From d3dff0bc0832ea02f53bd952ea9c180f8df94580 Mon Sep 17 00:00:00 2001 From: Serban Popescu Date: Wed, 28 Mar 2018 16:43:24 +0000 Subject: 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 --- .../onap/ccsdk/sli/northbound/dmaapclient/SdncAaiDmaapConsumer.java | 5 ++++- dmaap-listener/src/main/resources/template-generic-vnf.vt | 6 +----- dmaap-listener/src/main/resources/template-pserver.vt | 6 +----- .../sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java | 3 --- 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 -- cgit 1.2.3-korg