aboutsummaryrefslogtreecommitdiffstats
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
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>
-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 4b695fce..0e12dfa2 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 c8a6b78e..d57c9a0a 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 c8a6b78e..d57c9a0a 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 ec01df53..11201265 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