summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dt5972@att.com>2018-03-28 14:10:52 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-28 14:10:52 +0000
commit563f9cea833f0af27b101ba8f60fc14df84fb7fe (patch)
tree88f5f6f6f9a20729b03468222df4e949e6d341ce
parent448607990ac6b73d21f8d1b781e37ec798d7e29e (diff)
parentfa0fd7c1fe8dcb746cc8bdb9cc8d8e09ef10f7ad (diff)
Merge "Add Aai event listener"
-rw-r--r--dmaap-listener/src/main/resources/generic-vnf.map5
-rw-r--r--dmaap-listener/src/main/resources/template-generic-vnf.vt15
-rw-r--r--dmaap-listener/src/main/resources/template-pserver.vt4
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java20
-rw-r--r--dmaap-listener/src/test/resources/dmaap-consumer-generic-vnf.properties34
-rw-r--r--dmaap-listener/src/test/resources/dmaap-consumer-pserver.properties2
6 files changed, 76 insertions, 4 deletions
diff --git a/dmaap-listener/src/main/resources/generic-vnf.map b/dmaap-listener/src/main/resources/generic-vnf.map
new file mode 100644
index 00000000..bc375eb2
--- /dev/null
+++ b/dmaap-listener/src/main/resources/generic-vnf.map
@@ -0,0 +1,5 @@
+# SDN-C URL
+SDNC.endpoint => config-selfservice-api:notification-callback
+
+# Field mapping
+SDNC.template => template-generic-vnf.vt
diff --git a/dmaap-listener/src/main/resources/template-generic-vnf.vt b/dmaap-listener/src/main/resources/template-generic-vnf.vt
new file mode 100644
index 00000000..c8a6b78e
--- /dev/null
+++ b/dmaap-listener/src/main/resources/template-generic-vnf.vt
@@ -0,0 +1,15 @@
+{
+ "input": {
+ "common-header": {
+ "request-id": "$event-header.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 1df659e0..c8a6b78e 100644
--- a/dmaap-listener/src/main/resources/template-pserver.vt
+++ b/dmaap-listener/src/main/resources/template-pserver.vt
@@ -6,6 +6,10 @@
"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 db7cbd72..b9b20a6c 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,12 +9,16 @@
package org.onap.ccsdk.sli.northbound.dmaapclient;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
import java.util.Properties;
import org.junit.Before;
import org.junit.Test;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
public class TestSdncPserverDmaapReceiver {
private static final String aaiInput = "{\r\n" +
" \"cambria.partition\": \"AAI\",\r\n" +
@@ -75,10 +79,20 @@ public class TestSdncPserverDmaapReceiver {
Properties props = new Properties();
String rpcMsgbody = new SdncAaiDmaapConsumer(props).publish("src/main/resources/template-pserver.vt", aaiInput);
+
+ ObjectMapper oMapper = new ObjectMapper();
+ JsonNode aaiRootNode;
+ try {
+ aaiRootNode = oMapper.readTree(rpcMsgbody);
+ } catch (Exception e) {
+ throw new InvalidMessageException("Cannot parse json object", e);
+ }
- assertTrue(rpcMsgbody.indexOf("input") != -1);
- assertTrue(rpcMsgbody.indexOf("payload") != -1);
- assertTrue(rpcMsgbody.indexOf("common-header") != -1);
+ 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");
}
diff --git a/dmaap-listener/src/test/resources/dmaap-consumer-generic-vnf.properties b/dmaap-listener/src/test/resources/dmaap-consumer-generic-vnf.properties
new file mode 100644
index 00000000..710a7c7c
--- /dev/null
+++ b/dmaap-listener/src/test/resources/dmaap-consumer-generic-vnf.properties
@@ -0,0 +1,34 @@
+TransportType=DME2
+Latitude =47.778998
+Longitude =-122.182883
+Version =1.0
+ServiceName =dmaap-v1.dev.dmaap.dt.saat.acsi.att.com/events
+Environment =TEST
+Partner =
+SubContextPath =/
+Protocol =https
+MethodType =GET
+username =test
+password =test
+contenttype =application/json
+authKey=ABC123
+authDate=2016-05-10T13:13:50-0700
+host=localhost:3904
+topic=AAI-EVENT
+group=vnf
+id=1
+timeout=20000
+limit=10000
+filter={"class":"And","filters":[{"class":"Equals","field":"event-header.entity-type","value":"generic-vnf"},{"class":"Equals","field":"entity.vnf-type","value":"kvm-vpe"}]}
+AFT_DME2_EXCHANGE_REQUEST_HANDLERS=com.att.nsa.test.PreferredRouteRequestHandler
+AFT_DME2_EXCHANGE_REPLY_HANDLERS=com.att.nsa.test.PreferredRouteReplyHandler
+AFT_DME2_REQ_TRACE_ON=true
+AFT_ENVIRONMENT=AFTUAT
+AFT_DME2_EP_CONN_TIMEOUT=55000
+AFT_DME2_ROUNDTRIP_TIMEOUT_MS=240000
+AFT_DME2_EP_READ_TIMEOUT_MS=50000
+sessionstickinessrequired=NO
+DME2preferredRouterFilePath=src/test/resources/dmaap-listener.preferredRoute.txt
+sdnc.odl.user=admin
+sdnc.odl.password=admin
+sdnc.odl.url-base=http://localhost:8181/restconf/operations \ No newline at end of file
diff --git a/dmaap-listener/src/test/resources/dmaap-consumer-pserver.properties b/dmaap-listener/src/test/resources/dmaap-consumer-pserver.properties
index e3c4fdac..9f5cfe71 100644
--- a/dmaap-listener/src/test/resources/dmaap-consumer-pserver.properties
+++ b/dmaap-listener/src/test/resources/dmaap-consumer-pserver.properties
@@ -14,7 +14,7 @@ contenttype =application/json
authKey=ABC123
authDate=2016-05-10T13:13:50-0700
host=localhost:3904
-topic=ccsdk-topic
+topic=AAI-EVENT
group=pserver
id=1
timeout=20000