summaryrefslogtreecommitdiffstats
path: root/dmaap-listener/src/test
diff options
context:
space:
mode:
authorSandeep Shah <sandeeplinux1068@gmail.com>2020-03-03 10:10:48 -0600
committerSandeep Shah <sandeeplinux1068@gmail.com>2020-03-03 10:10:48 -0600
commit66ce8b86e11159bc833a64685333f7676055e38d (patch)
treecd9e7d2fcecf8c478f20af41222758b9f74a330d /dmaap-listener/src/test
parentf0594b8f4684ddbb81e490c630e5a968abd2170f (diff)
DMAAP Listener for ORAN CMNotify VES events
DMAAP listener for VES events originating from ORAN. Will invoke RPC/DG for updating RuntimeDB Issue-ID: CCSDK-2133 Signed-off-by: SandeepLinux <Sandeep.Shah@ibm.com> Change-Id: Ia17a7b2da1c58f5624c1d331aac56ce566d097bf
Diffstat (limited to 'dmaap-listener/src/test')
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestCMNotifyDmaapConsumer.java140
-rw-r--r--dmaap-listener/src/test/resources/dmaap-consumer-cMNotify-1.properties35
2 files changed, 175 insertions, 0 deletions
diff --git a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestCMNotifyDmaapConsumer.java b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestCMNotifyDmaapConsumer.java
new file mode 100644
index 000000000..122a6d40b
--- /dev/null
+++ b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestCMNotifyDmaapConsumer.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
+ * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
+ * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
+ * Vestibulum commodo. Ut rhoncus gravida arcu.
+ */
+
+package org.onap.ccsdk.sli.northbound.dmaapclient;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.commons.io.FileUtils;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+
+public class TestCMNotifyDmaapConsumer {
+ private static final String cMNotifyInput = "{\n" +
+ " \"body\": {\n" +
+ " \"input\": {\n" +
+ " \"CommonHeader\": {\n" +
+ " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" +
+ " \"APIver\": \"1.0\",\n" +
+ " \"RequestID\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459\",\n" +
+ " \"SubRequestID\": \"1\",\n" +
+ " \"RequestTrack\": {},\n" +
+ " \"Flags\": {}\n },\n" +
+ " \"Action\": \"nbrlist-change-notification\",\n" +
+ " \"Payload\": {\n" +
+ " \"fap-service-number-of-entries-changed\": 1,\n" +
+ " \"fap-service\": [{ \"alias\": \n" +
+ " \"Chn0001\", \"cid\": \"Chn0001\", \"lte-cell-number-of-entries\": 1,\n" +
+ " \"lte-ran-neighbor-list-in-use-lte-cell-changed\": \n" +
+ " [{ \"plmnid\": \"ran-1\", \"cid\": \"Chn0002\", \"phy-cell-id\": 4,\n" +
+ " \"pnf-name\": \"ncserver1\",\n" +
+ " \"blacklisted\": false }] }] }\n" +
+ " }\n" +
+ " },\n" +
+ " \"version\": \"1.0\",\n" +
+ " \"rpc-name\": \"nbrlist-change-notification\",\n" +
+ " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" +
+ " \"type\": \"request\"\n" +
+ "}";
+
+
+ @Test
+ public void test() throws Exception {
+ Properties props = new Properties();
+
+ CMNotifyDmaapConsumer consumer = new CMNotifyDmaapConsumer();
+ InputStream propStr = TestCMNotifyDmaapConsumer.class.getResourceAsStream("/dmaap-consumer-cMNotify-1.properties");
+ props.load(propStr);
+ consumer.init(props, "src/test/resources/dmaap-consumer-1.properties");
+ consumer.processMsg(cMNotifyInput);
+ }
+
+ @Test(expected = InvalidMessageException.class)
+ public void testProcessMsgNullMessage() throws Exception {
+ CMNotifyDmaapConsumer consumer = new CMNotifyDmaapConsumer();
+ consumer.processMsg(null);
+ }
+
+ @Test
+ public void testProcessMsgMissingBody() throws Exception {
+ String msg = "{\n" +
+ " \"bodyTest\": {\n" +
+ " \"input\": {\n" +
+ " \"CommonHeader\": {\n" +
+ " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" +
+ " \"APIver\": \"1.0\",\n" +
+ " \"RequestID\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459\",\n" +
+ " \"SubRequestID\": \"1\",\n" +
+ " \"RequestTrack\": {},\n" +
+ " \"Flags\": {}\n },\n" +
+ " \"Action\": \"nbrlist-change-notification\",\n" +
+ " \"Payload\": {\n" +
+ " \"fap-service-number-of-entries-changed\": 1,\n" +
+ " \"fap-service\": [{ \"alias\": \n" +
+ " \"Chn0001\", \"cid\": \"Chn0001\", \"lte-cell-number-of-entries\": 1,\n" +
+ " \"lte-ran-neighbor-list-in-use-lte-cell-changed\": \n" +
+ " [{ \"plmnid\": \"ran-1\", \"cid\": \"Chn0002\", \"phy-cell-id\": 4,\n" +
+ " \"pnf-name\": \"ncserver1\",\n" +
+ " \"blacklisted\": false }] }] }\n" +
+ " }\n" +
+ " },\n" +
+ " \"version\": \"1.0\",\n" +
+ " \"rpc-name\": \"nbrlist-change-notification\",\n" +
+ " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" +
+ " \"type\": \"request\"\n" +
+ "}";
+ CMNotifyDmaapConsumer consumer = new CMNotifyDmaapConsumer();
+ consumer.processMsg(msg);
+ }
+
+ @Test
+ public void testProcessMsgInvalidRPC() throws Exception {
+ String msg = "{\n" +
+ " \"body\": {\n" +
+ " \"input\": {\n" +
+ " \"CommonHeader\": {\n" +
+ " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" +
+ " \"APIver\": \"1.0\",\n" +
+ " \"RequestID\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459\",\n" +
+ " \"SubRequestID\": \"1\",\n" +
+ " \"RequestTrack\": {},\n" +
+ " \"Flags\": {}\n },\n" +
+ " \"Action\": \"nbrlist-change-notification\",\n" +
+ " \"Payload\": {\n" +
+ " \"fap-service-number-of-entries-changed\": 1,\n" +
+ " \"fap-service\": [{ \"alias\": \n" +
+ " \"Chn0001\", \"cid\": \"Chn0001\", \"lte-cell-number-of-entries\": 1,\n" +
+ " \"lte-ran-neighbor-list-in-use-lte-cell-changed\": \n" +
+ " [{ \"plmnid\": \"ran-1\", \"cid\": \"Chn0002\", \"phy-cell-id\": 4,\n" +
+ " \"pnf-name\": \"ncserver1\",\n" +
+ " \"blacklisted\": false }] }] }\n" +
+ " }\n" +
+ " },\n" +
+ " \"version\": \"1.0\",\n" +
+ " \"rpc-nameTest\": \"nbrlist-change-notification\",\n" +
+ " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" +
+ " \"type\": \"request\"\n" +
+ "}";
+
+ CMNotifyDmaapConsumer consumer = new CMNotifyDmaapConsumer();
+ consumer.processMsg(msg);
+ }
+
+}
diff --git a/dmaap-listener/src/test/resources/dmaap-consumer-cMNotify-1.properties b/dmaap-listener/src/test/resources/dmaap-consumer-cMNotify-1.properties
new file mode 100644
index 000000000..aae34a26f
--- /dev/null
+++ b/dmaap-listener/src/test/resources/dmaap-consumer-cMNotify-1.properties
@@ -0,0 +1,35 @@
+TransportType=HTTPNOAUTH
+Latitude =50.000000
+Longitude =-100.000000
+Version =1.0
+ServiceName =message-router.onap:3904/events
+Environment =TEST
+Partner =
+routeOffer=MR1
+SubContextPath =/
+Protocol =http
+MethodType =GET
+username =admin
+password =admin
+contenttype =application/json
+authKey=fs20cKwalJ6ry4kX:7Hqm6BDZK47IKxGRkOPFk33qMYs=
+authDate=2019-04-09T04:28:40-05:00
+host=message-router.onap:3904
+topic=CM-NOTIFICATION
+group=users
+id=sdnc1
+timeout=15000
+limit=1000
+filter=
+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=15000
+AFT_DME2_ROUNDTRIP_TIMEOUT_MS=240000
+AFT_DME2_EP_READ_TIMEOUT_MS=50000
+sessionstickinessrequired=NO
+DME2preferredRouterFilePath=/opt/onap/sdnc/data/properties/dmaap-listener.preferredRoute.txt
+sdnc.odl.user=admin
+sdnc.odl.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
+sdnc.odl.url-base=http://sdnc.onap:8282/restconf/operations