Add Aai event listener 41/39741/1
authorSerban Popescu <sp5226@att.com>
Wed, 28 Mar 2018 16:43:24 +0000 (16:43 +0000)
committerSerban Popescu <sp5226@att.com>
Wed, 28 Mar 2018 16:43:24 +0000 (16:43 +0000)
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>
dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncAaiDmaapConsumer.java
dmaap-listener/src/main/resources/template-generic-vnf.vt
dmaap-listener/src/main/resources/template-pserver.vt
dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java

index 4b695fc..0e12dfa 100644 (file)
@@ -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 {
index c8a6b78..d57c9a0 100644 (file)
@@ -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
index c8a6b78..d57c9a0 100644 (file)
@@ -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
index ec01df5..1120126 100644 (file)
@@ -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