Submitting APPC Requests via DMaaP
If testing requires requests be submitted via DMaaP curl can be used to submit the request:
Verify APPC is connecting to DMaaP
DMaaP queue read example
2017-11-08 00:38:09,445 | INFO | Appc-Listener-1 | HttpDmaapConsumerImpl | 365 - appc-dmaap-adapter-bundle - 1.1.0 | Got 0 messages from DMaaP
2017-11-08 00:38:09,445 | INFO | Appc-Listener-1 | EventHandlerImpl | 360 - appc-common - 1.1.0 | Read 0 messages from APPC-LCM-READ as APPC-EVENT-LISTENER-TEST/450.
2017-11-08 00:38:09,445 | INFO | Appc-Listener-1 | EventHandlerImpl | 360 - appc-common - 1.1.0 | Getting up to 10 incoming events
2017-11-08 00:38:09,445 | INFO | Appc-Listener-1 | HttpDmaapConsumerImpl | 365 - appc-dmaap-adapter-bundle - 1.1.0 | GET http://10.0.11.1:3904/events/APPC-LCM-READ/APPC-EVENT-LISTENER-TEST/450?timeout=60000&limit=10
Create the request (Sample below)
Sample Restart DMaaP Request
{
"version": "2.0",
"type": "request",
"correlation-id": "c09ac7d1-de62-0016-2000-e63701125557-201",
"cambria.partition": "APPC",
"rpc-name": "restart",
"body": {
"input": {
"common-header": {
"timestamp": "2017-11-07T19:50:04.244Z",
"api-ver": "2.00",
"originator-id": "APPC",
"request-id": "1",
"sub-request-id": "2",
"flags": {
"ttl": 36000
}
},
"action-identifiers": {
"service-instance-id": "",
"vnf-id": "APPC_Test_VM",
"vnfc-name": "VNFC_APPC_Test_VM",
"vserver-id": "http://10.0.14.1:80/api/multicloud-titanium_cloud/v0/pod25_RegionOne/compute/v2.1/cf142fb96ce24770946c0f7117c0aeb3/servers/60be808f-5d45-4a60-a578-9c0c6ee6be08"
},
"action": "Restart",
"payload": ""
}
}
}
Submit the request to DMaaP via curl
DMaaP request submitted via curl
# curl -X POST -v -H "Content-Type: application/json" -d @./APPC-Test-VNF-Restart.json http://10.0.11.1:3904/events/APPC-LCM-READ
Sample Output:
* Hostname was NOT found in DNS cache
* Trying 10.0.11.1...
* Connected to 10.0.11.1 (10.0.11.1) port 3904 (#0)
> POST /events/APPC-LCM-READ HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 10.0.11.1:3904
> Accept: */*
> Content-Type: application/json
> Content-Length: 729
>
* upload completely sent off: 729 out of 729 bytes
< HTTP/1.1 200 OK
< Date: Wed, 08 Nov 2017 00:50:39 GMT
< Content-Type: application/json
< Accept: */*
< breadcrumbId: ID-4560176304e4-54707-1508768450955-0-2609182
< User-Agent: curl/7.35.0
< X-CSI-Internal-WriteableRequest: true
< Content-Length: 41
* Server Jetty(9.2.z-SNAPSHOT) is not blacklisted
< Server: Jetty(9.2.z-SNAPSHOT)
<
{
"serverTimeMs": 0,
"count": 1
* Connection #0 to host 10.0.11.1 left intact
}
Sample log of DMaaP message being received
DMaaP request received
2017-11-08 00:50:34,161 | INFO | Appc-Listener-1 | HttpDmaapConsumerImpl | 365 - appc-dmaap-adapter-bundle - 1.1.0 | Got 1 messages from DMaaP
2017-11-08 00:50:34,162 | INFO | Appc-Listener-1 | EventHandlerImpl | 360 - appc-common - 1.1.0 | Read 1 messages from APPC-LCM-READ as APPC-EVENT-LISTENER-TEST/450.
2017-11-08 00:50:34,162 | INFO | Appc-Listener-1 | ListenerImpl | 360 - appc-common - 1.1.0 | Acknowledging Message: 1-2
2017-11-08 00:50:34,162 | INFO | Appc-Listener-1 | ListenerImpl | 360 - appc-common - 1.1.0 | Adding DMaaP message to pool queue [1-2]
2017-11-08 00:50:34,162 | INFO | Appc-Listener-1 | EventHandlerImpl | 360 - appc-common - 1.1.0 | Getting up to 10 incoming events
2017-11-08 00:50:34,162 | INFO | Appc-Listener-1 | HttpDmaapConsumerImpl | 365 - appc-dmaap-adapter-bundle - 1.1.0 | GET http://10.0.11.1:3904/events/APPC-LCM-READ/APPC-EVENT-LISTENER-TEST/450?timeout=60000&limit=10