summaryrefslogtreecommitdiffstats
path: root/dmaap-listener/src
diff options
context:
space:
mode:
authorSerban Popescu <sp5226@att.com>2018-03-28 16:43:24 +0000
committerSerban Popescu <sp5226@att.com>2018-03-28 16:43:24 +0000
commitd3dff0bc0832ea02f53bd952ea9c180f8df94580 (patch)
tree8ce71ed80dc2de17f410c265f5b134c466b8fc97 /dmaap-listener/src
parent7ee6690d42bdfbc1685b1ea1c40dc4015bd271e8 (diff)
Add Aai event listener
Add support for Aai and Pserver incoming messages from Dmaap Change-Id: Ie799cb57f5c00eed70c9f6fd30825f907962a094 Issue-ID: CCSDK-226 Signed-off-by: Serban Popescu <sp5226@att.com>
Diffstat (limited to 'dmaap-listener/src')
-rw-r--r--dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncAaiDmaapConsumer.java5
-rw-r--r--dmaap-listener/src/main/resources/template-generic-vnf.vt6
-rw-r--r--dmaap-listener/src/main/resources/template-pserver.vt6
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java3
4 files changed, 6 insertions, 14 deletions
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncAaiDmaapConsumer.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncAaiDmaapConsumer.java
index 4b695fcec..0e12dfa2e 100644
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncAaiDmaapConsumer.java
+++ b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncAaiDmaapConsumer.java
@@ -90,6 +90,9 @@ public class SdncAaiDmaapConsumer extends SdncDmaapConsumer {
{
context.put((String)key, jsonObj.get((String)key));
}
+
+ String id = jsonObj.getJSONObject(EVENT_HEADER).get("id").toString();
+ context.put("req_id", id);
context.put("curr_time", Instant.now());
@@ -159,7 +162,7 @@ public class SdncAaiDmaapConsumer extends SdncDmaapConsumer {
String odlPassword = getProperty("sdnc.odl.password");
if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) {
- SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + sdncEndpoint, odlUser, odlPassword);
+ SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + "/" + sdncEndpoint, odlUser, odlPassword);
conn.send("POST", "application/json", rpcMsgbody);
} else {
diff --git a/dmaap-listener/src/main/resources/template-generic-vnf.vt b/dmaap-listener/src/main/resources/template-generic-vnf.vt
index c8a6b78ea..d57c9a0a4 100644
--- a/dmaap-listener/src/main/resources/template-generic-vnf.vt
+++ b/dmaap-listener/src/main/resources/template-generic-vnf.vt
@@ -1,15 +1,11 @@
{
"input": {
"common-header": {
- "request-id": "$event-header.id",
+ "request-id": "$req_id",
"timestamp": "$curr_time",
"originator-id": "AAI",
"api-ver": "2.00"
},
- "action-identifiers": {
- "action-name": "dmaap-notification",
- "mode": "async"
- },
"payload": $full_message
}
} \ No newline at end of file
diff --git a/dmaap-listener/src/main/resources/template-pserver.vt b/dmaap-listener/src/main/resources/template-pserver.vt
index c8a6b78ea..d57c9a0a4 100644
--- a/dmaap-listener/src/main/resources/template-pserver.vt
+++ b/dmaap-listener/src/main/resources/template-pserver.vt
@@ -1,15 +1,11 @@
{
"input": {
"common-header": {
- "request-id": "$event-header.id",
+ "request-id": "$req_id",
"timestamp": "$curr_time",
"originator-id": "AAI",
"api-ver": "2.00"
},
- "action-identifiers": {
- "action-name": "dmaap-notification",
- "mode": "async"
- },
"payload": $full_message
}
} \ No newline at end of file
diff --git a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java
index ec01df534..11201265d 100644
--- a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java
+++ b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java
@@ -9,7 +9,6 @@
package org.onap.ccsdk.sli.northbound.dmaapclient;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
import java.io.File;
import java.io.IOException;
@@ -98,8 +97,6 @@ public class TestSdncPserverDmaapReceiver {
assertTrue(aaiRootNode.get("input").get("payload") != null);
assertTrue(aaiRootNode.get("input").get("common-header") != null);
- assertEquals(aaiRootNode.get("input").get("action-identifiers").get("action-name").textValue(), "dmaap-notification");
- assertEquals(aaiRootNode.get("input").get("action-identifiers").get("mode").textValue(), "async");
}
@Test