summaryrefslogtreecommitdiffstats
path: root/dmaap-listener
diff options
context:
space:
mode:
authorJessica Wagantall <jwagantall@linuxfoundation.org>2020-12-01 11:52:01 -0800
committerJessica Wagantall <jwagantall@linuxfoundation.org>2020-12-01 11:52:01 -0800
commitff3eecb980bfdc8d43d2ed3a4c786d634fa6f4e2 (patch)
tree680db1c4f69f5c181b8f1fb7d7d8f46942783b3e /dmaap-listener
parent02b6c140f031c19cfcb791fd0142f03167db69b1 (diff)
Migrate sli-northbound repo
Migrate sli-northbound repo files into new directory "northbound". Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
Diffstat (limited to 'dmaap-listener')
-rwxr-xr-xdmaap-listener/.gitignore12
-rwxr-xr-xdmaap-listener/.sonar/checkstyle.xml1
-rwxr-xr-xdmaap-listener/.sonar/pmd.xml67
-rwxr-xr-xdmaap-listener/pom.xml150
-rw-r--r--dmaap-listener/src/assembly/assemble_zip.xml62
-rw-r--r--dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/A1AdapterPolicyDmaapConsumer.java108
-rw-r--r--dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/CMNotifyDmaapConsumer.java108
-rwxr-xr-xdmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/DmaapListener.java185
-rw-r--r--dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/DummyDmaapConsumer.java37
-rw-r--r--dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/InvalidMessageException.java37
-rwxr-xr-xdmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClient.java219
-rw-r--r--dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientJdk.java222
-rw-r--r--dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/OofPciPocDmaapConsumers.java564
-rw-r--r--dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncAaiDmaapConsumer.java280
-rw-r--r--dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDhcpEventConsumer.java130
-rw-r--r--dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDmaapConsumer.java34
-rw-r--r--dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDmaapConsumerImpl.java160
-rw-r--r--dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncFlatJsonDmaapConsumer.java170
-rw-r--r--dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncLcmDmaapConsumer.java93
-rw-r--r--dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncOdlConnection.java151
-rw-r--r--dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncRANSliceDmaapConsumer.java92
-rw-r--r--dmaap-listener/src/main/resources/anr-changes-from-policy-to-sdnr.map5
-rw-r--r--dmaap-listener/src/main/resources/anr-pci-changes-from-policy-to-sdnr.vt8
-rw-r--r--dmaap-listener/src/main/resources/edgeRouterStatusChange.map44
-rw-r--r--dmaap-listener/src/main/resources/esr-thirdparty-sdnc.map5
-rw-r--r--dmaap-listener/src/main/resources/generic-vnf.map5
-rw-r--r--dmaap-listener/src/main/resources/log4j2.xml26
-rw-r--r--dmaap-listener/src/main/resources/pci-changes-from-policy-to-sdnr.map5
-rw-r--r--dmaap-listener/src/main/resources/preferredRoute.txt1
-rw-r--r--dmaap-listener/src/main/resources/pserver.map5
-rw-r--r--dmaap-listener/src/main/resources/template-esr-thirdparty-sdnc.vt100
-rw-r--r--dmaap-listener/src/main/resources/template-generic-vnf.vt11
-rw-r--r--dmaap-listener/src/main/resources/template-pserver.vt11
-rw-r--r--dmaap-listener/src/main/scripts/start-dmaap-listener.sh69
-rw-r--r--dmaap-listener/src/main/scripts/stop-dmaap-listener.sh52
-rw-r--r--dmaap-listener/src/site/apt/index.apt46
-rw-r--r--dmaap-listener/src/site/site.xml31
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientJdkTest.java100
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientTest.java97
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncFlatJsonDmaapConsumerTest.java41
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestA1AdapterPolicyDmaapConsumer.java136
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestCMNotifyDmaapConsumer.java140
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestDmaapListener.java52
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestDummyDmaapConsumer.java26
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestOofPciPocDmaapConsumers.java314
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncDhcpEventConsumer.java139
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncEsrDmaapReceiver.java140
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncJsonDmaapConsumer.java138
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncLcmDmaapConsumer.java166
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncOdlConnection.java26
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java186
-rw-r--r--dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncRANSliceDmaapConsumer.java166
-rw-r--r--dmaap-listener/src/test/resources/dblib.properties38
-rwxr-xr-xdmaap-listener/src/test/resources/dmaap-consumer-1.properties35
-rw-r--r--dmaap-listener/src/test/resources/dmaap-consumer-a1Adapter-policy-1.properties35
-rw-r--r--dmaap-listener/src/test/resources/dmaap-consumer-cMNotify-1.properties35
-rw-r--r--dmaap-listener/src/test/resources/dmaap-consumer-esrsysteminfo.properties34
-rw-r--r--dmaap-listener/src/test/resources/dmaap-consumer-generic-vnf.properties34
-rw-r--r--dmaap-listener/src/test/resources/dmaap-consumer-pserver.properties34
-rwxr-xr-xdmaap-listener/src/test/resources/dmaap-listener.preferredRoute.txt1
-rwxr-xr-xdmaap-listener/src/test/resources/dmaap-listener.properties1
61 files changed, 0 insertions, 5420 deletions
diff --git a/dmaap-listener/.gitignore b/dmaap-listener/.gitignore
deleted file mode 100755
index 1b8a6ba9d..000000000
--- a/dmaap-listener/.gitignore
+++ /dev/null
@@ -1,12 +0,0 @@
-org.eclipse.core.resources.prefs
-.classpath
-.project
-.settings
-.idea
-.externalToolBuilders
-maven-eclipse.xml
-*.class
-target/
-MANIFEST.MF
-.DS_STORE
-.metadata
diff --git a/dmaap-listener/.sonar/checkstyle.xml b/dmaap-listener/.sonar/checkstyle.xml
deleted file mode 100755
index 3fa231535..000000000
--- a/dmaap-listener/.sonar/checkstyle.xml
+++ /dev/null
@@ -1 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"><!-- Generated by Sonar --><module name="Checker"><module name="SuppressionCommentFilter"/><module name="TreeWalker"><module name="FileContentsHolder"/> <module name="ClassFanOutComplexity"><property name="severity" value="warning"/></module><module name="NestedForDepth"><property name="severity" value="warning"/><property name="max" value="1"/></module><module name="ClassDataAbstractionCoupling"><property name="severity" value="warning"/></module></module></module> \ No newline at end of file
diff --git a/dmaap-listener/.sonar/pmd.xml b/dmaap-listener/.sonar/pmd.xml
deleted file mode 100755
index 80343b3bd..000000000
--- a/dmaap-listener/.sonar/pmd.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ruleset>
- <rule ref="rulesets/java/naming.xml/BooleanGetMethodName">
- <priority>3</priority>
- </rule>
- <rule ref="rulesets/java/j2ee.xml/StaticEJBFieldShouldBeFinal">
- <priority>3</priority>
- </rule>
- <rule ref="rulesets/java/coupling.xml/CouplingBetweenObjects">
- <priority>3</priority>
- </rule>
- <rule ref="rulesets/java/codesize.xml/TooManyMethods">
- <priority>3</priority>
- </rule>
- <rule ref="rulesets/java/naming.xml/AvoidFieldNameMatchingTypeName">
- <priority>3</priority>
- </rule>
- <rule ref="rulesets/java/basic.xml/DoubleCheckedLocking">
- <priority>3</priority>
- </rule>
- <rule ref="rulesets/java/naming.xml/AvoidFieldNameMatchingMethodName">
- <priority>3</priority>
- </rule>
- <rule ref="rulesets/java/coupling.xml/ExcessiveImports">
- <priority>3</priority>
- </rule>
- <rule ref="rulesets/java/basic.xml/OverrideBothEqualsAndHashcode">
- <priority>2</priority>
- </rule>
- <rule ref="rulesets/java/naming.xml/ShortMethodName">
- <priority>3</priority>
- </rule>
- <rule ref="rulesets/java/basic.xml/BooleanInstantiation">
- <priority>3</priority>
- </rule>
- <rule ref="rulesets/java/codesize.xml/TooManyFields">
- <priority>3</priority>
- </rule>
- <rule ref="rulesets/java/controversial.xml/AvoidUsingNativeCode">
- <priority>3</priority>
- </rule>
- <rule ref="rulesets/java/optimizations.xml/UseStringBufferForStringAppends">
- <priority>3</priority>
- </rule>
- <rule ref="rulesets/java/coupling.xml/LooseCoupling">
- <priority>3</priority>
- </rule>
- <rule ref="rulesets/java/design.xml/NonThreadSafeSingleton">
- <priority>3</priority>
- </rule>
- <rule ref="rulesets/java/j2ee.xml/DoNotUseThreads">
- <priority>3</priority>
- </rule>
- <rule ref="rulesets/java/sunsecure.xml/ArrayIsStoredDirectly">
- <priority>5</priority>
- </rule>
- <rule ref="rulesets/java/sunsecure.xml/MethodReturnsInternalArray">
- <priority>2</priority>
- </rule>
- <rule ref="rulesets/java/design.xml/AssignmentToNonFinalStatic">
- <priority>3</priority>
- </rule>
- <rule ref="rulesets/java/strictexception.xml/AvoidCatchingGenericException">
- <priority>3</priority>
- </rule>
-</ruleset>
-
diff --git a/dmaap-listener/pom.xml b/dmaap-listener/pom.xml
deleted file mode 100755
index 65e43886c..000000000
--- a/dmaap-listener/pom.xml
+++ /dev/null
@@ -1,150 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>standalone-parent</artifactId>
- <version>2.1.0</version>
- </parent>
-
- <groupId>org.onap.ccsdk.sli.northbound</groupId>
- <artifactId>dmaap-listener</artifactId>
- <version>1.1.1-SNAPSHOT</version>
- <packaging>jar</packaging>
-
- <name>ccsdk-sli-northbound :: dmaap-listener</name>
- <description>DMAAP Listener</description>
-
- <properties>
- <skip.SWM>true</skip.SWM>
- <dmaap.listener.base>/opt/app/dmaap-listener</dmaap.listener.base>
-
- <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
- <build.number>${maven.build.timestamp}</build.number>
- <SWM_VERSION>${project.version}-${build.number}</SWM_VERSION>
-
- <ccsdk.sli.core.version>1.1.0</ccsdk.sli.core.version>
- <ccsdk.sli.northbound.version>${project.version}</ccsdk.sli.northbound.version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-core-artifacts</artifactId>
- <version>${ccsdk.sli.core.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
- <!-- dmaapClient needs this version of this jar -->
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>2.1</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
- <dependencies>
-
- <dependency>
- <groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId>
- <artifactId>dmaapClient</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity-engine-core</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>ch.vorburger.mariaDB4j</groupId>
- <artifactId>mariaDB4j</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>dblib-provider</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
-
- <!-- ================================================== -->
- <!-- Set the JDK compiler version. -->
- <!-- ================================================== -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.5.1</version>
- <inherited>true</inherited>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.6</version>
- <configuration>
- <archive>
- <manifest>
- <addClasspath>true</addClasspath>
- <mainClass>org.onap.ccsdk.sli.northbound.dmaapclient.DmaapListener</mainClass>
- </manifest>
- </archive>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.6</version>
- <executions>
- <execution>
- <id>create-zip</id>
- <goals>
- <goal>single</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <attach>true</attach>
- <finalName>${project.artifactId}.${project.version}</finalName>
- <attach>true</attach>
- <descriptors>
- <descriptor>src/assembly/assemble_zip.xml</descriptor>
- </descriptors>
- <appendAssemblyId>false</appendAssemblyId>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- </plugins>
- </build>
-</project>
diff --git a/dmaap-listener/src/assembly/assemble_zip.xml b/dmaap-listener/src/assembly/assemble_zip.xml
deleted file mode 100644
index 632172d77..000000000
--- a/dmaap-listener/src/assembly/assemble_zip.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- openECOMP : SDN-C
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights
- reserved.
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- -->
-
-<!-- Defines how we build the .zip file which is our distribution. -->
-
-<assembly
- xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
- <id>assemble_zip</id>
- <formats>
- <format>zip</format>
- </formats>
-
- <includeBaseDirectory>false</includeBaseDirectory>
-
- <fileSets>
- <fileSet>
- <directory>src/main/scripts</directory>
- <outputDirectory>bin</outputDirectory>
- </fileSet>
- <fileSet>
- <directory>target</directory>
- <outputDirectory>lib</outputDirectory>
- <includes>
- <include>*.jar</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>src/main/resources</directory>
- <outputDirectory>lib</outputDirectory>
- <includes>
- <include>*.properties</include>
- <include>*.map</include>
- <include>*.vt</include>
- </includes>
- </fileSet>
- </fileSets>
- <dependencySets>
- <dependencySet>
- <outputDirectory>lib</outputDirectory>
- <useProjectArtifact>true</useProjectArtifact>
- <scope>runtime</scope>
- </dependencySet>
- </dependencySets>
-</assembly>
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/A1AdapterPolicyDmaapConsumer.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/A1AdapterPolicyDmaapConsumer.java
deleted file mode 100644
index dd59f5868..000000000
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/A1AdapterPolicyDmaapConsumer.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * Modifications Copyright © 2019 IBM.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class A1AdapterPolicyDmaapConsumer extends SdncDmaapConsumerImpl {
-
- private static final Logger LOG = LoggerFactory.getLogger(A1AdapterPolicyDmaapConsumer.class);
-
- private static final String BODY = "body";
- private static final String RPC = "rpc-name";
- private static final String INPUT = "input";
- private static final String PAYLOAD = "Payload";
-
-
- @Override
- public void processMsg(String msg) throws InvalidMessageException {
-
- if (msg == null) {
- throw new InvalidMessageException("Null A1-ADAPTER-DMAAP message");
- }
-
- ObjectMapper oMapper = new ObjectMapper();
- JsonNode a1AdapterRootNode;
- try {
- a1AdapterRootNode = oMapper.readTree(msg);
- } catch (Exception e) {
- throw new InvalidMessageException("Cannot parse A1-ADAPTER-DMAAP json input", e);
- }
-
- JsonNode bodyNode = a1AdapterRootNode.get(BODY);
- if(bodyNode == null) {
- LOG.warn("Missing body in A1-ADAPTER-DMAAP message");
- return;
- }
-
- JsonNode input = bodyNode.get(INPUT);
- if(input == null) {
- LOG.info("Missing input node.");
- return;
- }
-
- JsonNode payloadNode = input.get(PAYLOAD);
- if(payloadNode == null) {
- LOG.info("Missing payload node.");
- return;
- }
-
- String rpcMsgbody;
- try {
- ObjectMapper mapper = new ObjectMapper();
- rpcMsgbody = mapper.writeValueAsString(payloadNode);
-
- } catch (Exception e) {
- LOG.error("Unable to parse payload in A1-ADAPTER-DMAAP message", e);
- return;
- }
-
- JsonNode rpcNode = a1AdapterRootNode.get(RPC);
- if(rpcNode == null) {
- LOG.warn("Missing node in A1-ADAPTER-DMAAP message- " + RPC);
- return;
- }
- String rpc = rpcNode.textValue();
- String sdncEndpoint = "A1-ADAPTER-API:" + rpc;
-
- try {
- String odlUrlBase = getProperty("sdnc.odl.url-base");
- String odlUser = getProperty("sdnc.odl.user");
- String odlPassword = getProperty("sdnc.odl.password");
- LOG.info("POST A1-ADAPTER-API Request " + rpcMsgbody);
- if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) {
- SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + "/" + sdncEndpoint, odlUser, odlPassword);
-
- conn.send("POST", "application/json", rpcMsgbody);
- } else {
- LOG.warn("Unable to POST A1-ADAPTER-API message. SDNC URL not available. body:\n" + rpcMsgbody);
- }
- } catch (Exception e) {
- LOG.error("Unable to process message", e);
- }
- }
-}
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/CMNotifyDmaapConsumer.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/CMNotifyDmaapConsumer.java
deleted file mode 100644
index fa14fbb24..000000000
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/CMNotifyDmaapConsumer.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * Modifications Copyright © 2019 IBM.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.json.JSONObject;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CMNotifyDmaapConsumer extends SdncDmaapConsumerImpl {
-
- private static final Logger LOG = LoggerFactory.getLogger(CMNotifyDmaapConsumer.class);
-
- private static final String BODY = "body";
- private static final String RPC = "rpc-name";
- private static final String INPUT = "input";
- private static final String PAYLOAD = "Payload";
-
- @Override
- public void processMsg(String msg) throws InvalidMessageException {
-
- if (msg == null) {
- throw new InvalidMessageException("Null CMNotify-DMAAP message");
- }
-
- ObjectMapper oMapper = new ObjectMapper();
- JsonNode CMNotifyRootNode;
- try {
- CMNotifyRootNode = oMapper.readTree(msg);
- } catch (Exception e) {
- throw new InvalidMessageException("Cannot parse CMNotify-DMAAP json input", e);
- }
-
- JsonNode bodyNode = CMNotifyRootNode.get(BODY);
- if(bodyNode == null) {
- LOG.warn("Missing body in CMNotify-DMAAP message");
- return;
- }
-
- JsonNode input = bodyNode.get(INPUT);
- if(input == null) {
- LOG.info("Missing input node.");
- return;
- }
-
- JsonNode payloadNode = input.get(PAYLOAD);
- if(payloadNode == null) {
- LOG.info("Missing payload node.");
- return;
- }
-
- String rpcMsgbody;
- try {
- ObjectMapper mapper = new ObjectMapper();
- rpcMsgbody = "{\"input\":" + mapper.writeValueAsString(payloadNode) + "}";
-
- } catch (Exception e) {
- LOG.error("Unable to parse payload in CMNotify-DMAAP message", e);
- return;
- }
-
- JsonNode rpcNode = CMNotifyRootNode.get(RPC);
- if(rpcNode == null) {
- LOG.warn("Missing node in CMNotify-DMAAP message- " + RPC);
- return;
- }
- String rpc = rpcNode.textValue();
- String sdncEndpoint = "CM-NOTIFY-API:" + rpc;
-
- try {
- String odlUrlBase = getProperty("sdnc.odl.url-base");
- String odlUser = getProperty("sdnc.odl.user");
- String odlPassword = getProperty("sdnc.odl.password");
- LOG.info("POST CM-NOTIFY-API Request " + rpcMsgbody);
- if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) {
- SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + "/" + sdncEndpoint, odlUser, odlPassword);
-
- conn.send("POST", "application/json", rpcMsgbody);
- } else {
- LOG.warn("Unable to POST CM-NOTIFY-API message. SDNC URL not available. body:\n" + rpcMsgbody);
- }
- } catch (Exception e) {
- LOG.error("Unable to process message", e);
- }
- }
-}
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/DmaapListener.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/DmaapListener.java
deleted file mode 100755
index 18c00d563..000000000
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/DmaapListener.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DmaapListener {
-
- private static final String DMAAP_LISTENER_PROPERTIES = "dmaap-listener.properties";
- private static final String DMAAP_LISTENER_PROPERTIES_DIR = "/opt/onap/ccsdk/data/properties";
- private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR";
- private static final Logger LOG = LoggerFactory.getLogger(DmaapListener.class);
-
- public static void main(String[] args) {
-
- Properties properties = new Properties();
- String propFileName = DMAAP_LISTENER_PROPERTIES;
- String propPath = null;
- String propDir = System.getProperty(SDNC_CONFIG_DIR);
- if(propDir == null) {
- propDir = System.getenv(SDNC_CONFIG_DIR);
- LOG.debug(SDNC_CONFIG_DIR + " read from environment variable with value " + propDir);
- }
- List<SdncDmaapConsumer> consumers = new LinkedList<>();
-
- if (args.length > 0) {
- propFileName = args[0];
- }
-
- if (propDir == null) {
- propDir = DMAAP_LISTENER_PROPERTIES_DIR;
- }
-
- if (!propFileName.startsWith("/")) {
- propPath = propDir + "/" + propFileName;
- }
-
- if (propPath != null) {
- properties = loadProperties(propPath, properties);
-
- String subscriptionStr = properties.getProperty("subscriptions");
-
- boolean threadsRunning = false;
-
- LOG.debug("Dmaap subscriptions : " + subscriptionStr);
-
- if (subscriptionStr != null) {
- threadsRunning = handleSubscriptions(subscriptionStr, propDir, properties, consumers);
- }
-
- while (threadsRunning) {
- threadsRunning = updateThreadState(consumers);
- if (!threadsRunning) {
- break;
- }
-
- try {
- Thread.sleep(10000);
- } catch (InterruptedException e) {
- LOG.error(e.getLocalizedMessage(), e);
- }
- }
-
- LOG.info("No listener threads running - exiting");
- }
- }
-
- private static boolean updateThreadState(List<SdncDmaapConsumer> consumers) {
- boolean threadsRunning = false;
- for (SdncDmaapConsumer consumer : consumers) {
- if (consumer.isRunning()) {
- threadsRunning = true;
- }
- }
- return threadsRunning;
- }
-
- static Properties loadProperties(String propPath, Properties properties) {
- File propFile = new File(propPath);
-
- if (!propFile.canRead()) {
- LOG.error("Cannot read properties file " + propPath);
- System.exit(1);
- }
-
- try (FileInputStream in = new FileInputStream(propFile)) {
- properties.load(in);
- } catch (Exception e) {
- LOG.error("Caught exception loading properties from " + propPath, e);
- System.exit(1);
- }
- return properties;
- }
-
- static boolean handleSubscriptions(String subscriptionStr, String propDir, Properties properties,
- List<SdncDmaapConsumer> consumers) {
- String[] subscriptions = subscriptionStr.split(";");
-
- for (String subscription1 : subscriptions) {
- String[] subscription = subscription1.split(":");
- String consumerClassName = subscription[0];
- String propertyPath = subscription[1];
-
- LOG.debug(String.format("Handling subscription [%s,%s]", consumerClassName, propertyPath));
-
- if (propertyPath == null) {
- LOG.error(String.format("Invalid subscription (%s) property file missing", subscription1));
- continue;
- }
-
- if (!propertyPath.startsWith("/")) {
- propertyPath = propDir + "/" + propertyPath;
- }
-
- Class<?> consumerClass = null;
-
- try {
- consumerClass = Class.forName(consumerClassName);
- } catch (Exception e) {
- LOG.error("Could not find DMaap consumer class {}", consumerClassName, e);
- }
-
- if (consumerClass != null) {
- handleConsumerClass(consumerClass, consumerClassName, propertyPath,
- properties, consumers);
- }
- }
- return !consumers.isEmpty();
- }
-
- private static boolean handleConsumerClass(Class<?> consumerClass, String consumerClassName, String propertyPath,
- Properties properties, List<SdncDmaapConsumer> consumers) {
-
- SdncDmaapConsumer consumer = null;
-
- try {
- consumer = (SdncDmaapConsumer) consumerClass.newInstance();
- } catch (Exception e) {
- LOG.error("Could not create consumer from class " + consumerClassName, e);
- }
-
- if (consumer != null) {
- LOG.debug(String.format("Initializing consumer %s(%s)", consumerClassName, propertyPath));
- consumer.init(properties, propertyPath);
-
- if (consumer.isReady()) {
- Thread consumerThread = new Thread(consumer);
- consumerThread.start();
- consumers.add(consumer);
-
- LOG.info(String.format("Started consumer thread (%s : %s)", consumerClassName,
- propertyPath));
- return true;
- } else {
- LOG.debug(String.format("Consumer %s is not ready", consumerClassName));
- }
- }
- return false;
- }
-}
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/DummyDmaapConsumer.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/DummyDmaapConsumer.java
deleted file mode 100644
index 57fcd8809..000000000
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/DummyDmaapConsumer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DummyDmaapConsumer extends SdncDmaapConsumerImpl {
-
- private static final Logger LOG = LoggerFactory
- .getLogger(DummyDmaapConsumer.class);
-
- @Override
- public void processMsg(String msg) {
- LOG.info("Consumed message: \n"+msg);
- }
-
-}
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/InvalidMessageException.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/InvalidMessageException.java
deleted file mode 100644
index cab8b901c..000000000
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/InvalidMessageException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-public class InvalidMessageException extends Exception {
-
- public InvalidMessageException() {
- super();
- }
-
- public InvalidMessageException(String msg) {
- super(msg);
- }
-
- public InvalidMessageException(String msg, Throwable t) {
- super(msg, t);
- }
-}
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClient.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClient.java
deleted file mode 100755
index 2a9e0b145..000000000
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClient.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URLEncoder;
-import java.nio.charset.StandardCharsets;
-import java.util.Base64;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Invocation;
-import javax.ws.rs.client.Invocation.Builder;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/*
- * jax-rs based client to build message router consumers
- */
-public class MessageRouterHttpClient implements SdncDmaapConsumer {
- private static final Logger Log = LoggerFactory.getLogger(MessageRouterHttpClient.class);
-
- protected Boolean isReady = false;
- protected Boolean isRunning = false;
- protected Client client;
- protected URI uri;
- protected Invocation getMessages;
- protected Integer fetchPause;
- protected Properties properties;
- protected final String DEFAULT_CONNECT_TIMEOUT_SECONDS = "30";
- protected final String DEFAULT_READ_TIMEOUT_MINUTES = "3";
- protected final String DEFAULT_TIMEOUT_QUERY_PARAM_VALUE = "15000";
- protected final String DEFAULT_LIMIT = null;
- protected final String DEFAULT_FETCH_PAUSE = "5000";
-
- public MessageRouterHttpClient() {
-
- }
-
- @Override
- public void run() {
- if (isReady) {
- isRunning = true;
- while (isRunning) {
- try {
- Response response = getMessages.invoke();
- Log.info("GET " + uri + " returned http status " + response.getStatus());
- String entity = response.readEntity(String.class);
- if (response.getStatus() < 300) {
- if (entity.contains("{")) {
- // Get rid of opening ["
- entity = entity.substring(2);
- // Get rid of closing "]
- entity = entity.substring(0, entity.length() - 2);
- // This replacement effectively un-escapes the JSON
- for (String message : entity.split("\",\"")) {
- try {
- processMsg(message.replace("\\\"", "\""));
- } catch (InvalidMessageException e) {
- Log.error("Message could not be processed", e);
- }
- }
- } else {
- if (entity.length() < 1) {
- Log.info("GET was successful, but the server returned an empty message body.");
- } else {
- Log.info(
- "GET was successful, but entity is not valid JSON. Message body will be logged, but not processed");
- Log.info(entity);
- }
- }
- } else {
- Log.info("GET failed, message body will be logged, but not processed.");
- Log.info(entity);
- }
- } catch (Exception e) {
- Log.error("GET " + uri + " failed.", e);
- } finally {
- Log.info("Pausing " + fetchPause + " milliseconds before fetching from " + uri + " again.");
- try {
- Thread.sleep(fetchPause);
- } catch (InterruptedException e) {
- Log.error("Could not sleep thread", e);
- Thread.currentThread().interrupt();
- }
- }
- }
- }
- }
-
- @Override
- public void init(Properties baseProperties, String consumerPropertiesPath) {
- try {
- baseProperties.load(new FileInputStream(new File(consumerPropertiesPath)));
- processProperties(baseProperties);
- } catch (FileNotFoundException e) {
- Log.error("FileNotFoundException while reading consumer properties", e);
- } catch (IOException e) {
- Log.error("IOException while reading consumer properties", e);
- }
- }
-
- protected void processProperties(Properties properties) {
- this.properties = properties;
- String username = properties.getProperty("username");
- String password = properties.getProperty("password");
- String topic = properties.getProperty("topic");
- String group = properties.getProperty("group");
- String host = properties.getProperty("host");
- String id = properties.getProperty("id");
-
- String filter = properties.getProperty("filter");
- if (filter != null) {
- if (filter.length() > 0) {
- try {
- filter = URLEncoder.encode(filter, StandardCharsets.UTF_8.name());
- } catch (UnsupportedEncodingException e) {
- Log.error("Filter could not be encoded, setting to null", e);
- filter = null;
- }
- } else {
- filter = null;
- }
- }
-
- String limitString = properties.getProperty("limit", DEFAULT_LIMIT);
- Integer limit = null;
- if (limitString != null && limitString.length() > 0) {
- limit = Integer.valueOf(limitString);
- }
-
- Integer timeoutQueryParamValue =
- Integer.valueOf(properties.getProperty("timeout", DEFAULT_TIMEOUT_QUERY_PARAM_VALUE));
- Integer connectTimeoutSeconds = Integer
- .valueOf(properties.getProperty("connectTimeoutSeconds", DEFAULT_CONNECT_TIMEOUT_SECONDS));
- Integer readTimeoutMinutes =
- Integer.valueOf(properties.getProperty("readTimeoutMinutes", DEFAULT_READ_TIMEOUT_MINUTES));
- this.client = getClient(connectTimeoutSeconds, readTimeoutMinutes);
- this.uri = buildUri(topic, group, id, host, timeoutQueryParamValue, limit, filter);
- Builder builder = client.target(uri).request("application/json");
- if (username != null && password != null && username.length() > 0 && password.length() > 0) {
- String authorizationString = buildAuthorizationString(username, password);
- builder.header("Authorization", authorizationString);
- }
-
- this.getMessages = builder.buildGet();
- this.fetchPause = Integer.valueOf(properties.getProperty("fetchPause",DEFAULT_FETCH_PAUSE));
- this.isReady = true;
- }
-
- @Override
- public void processMsg(String msg) throws InvalidMessageException {
- System.out.println(msg);
- }
-
- @Override
- public boolean isReady() {
- return isReady;
- }
-
- @Override
- public boolean isRunning() {
- return isRunning;
- }
-
- protected String buildAuthorizationString(String userName, String password) {
- String basicAuthString = userName + ":" + password;
- basicAuthString = Base64.getEncoder().encodeToString(basicAuthString.getBytes());
- return "Basic " + basicAuthString;
- }
-
- protected Client getClient(Integer connectTimeoutSeconds, Integer readTimeoutMinutes) {
- ClientBuilder clientBuilder = ClientBuilder.newBuilder();
- clientBuilder.connectTimeout(connectTimeoutSeconds, TimeUnit.SECONDS);
- clientBuilder.readTimeout(readTimeoutMinutes, TimeUnit.MINUTES);
- return clientBuilder.build();
- }
-
- protected URI buildUri(String topic, String consumerGroup, String consumerId, String host, Integer timeout,
- Integer limit, String filter) {
- UriBuilder builder = UriBuilder.fromPath("http://" + host + "/events/{topic}/{consumerGroup}/{consumderId}");
- builder.queryParam("timeout", timeout);
- if (limit != null) {
- builder.queryParam("limit", limit);
- }
- if (filter != null) {
- builder.queryParam("filter", filter);
- }
- return builder.build(topic, consumerGroup, consumerId);
- }
-
-}
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientJdk.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientJdk.java
deleted file mode 100644
index a6744045d..000000000
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientJdk.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.nio.charset.StandardCharsets;
-import java.util.Base64;
-import java.util.Properties;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/*
- * java.net based client to build message router consumers
- */
-public class MessageRouterHttpClientJdk implements SdncDmaapConsumer {
- private static final Logger Log = LoggerFactory.getLogger(MessageRouterHttpClientJdk.class);
-
- protected Boolean isReady = false;
- protected Boolean isRunning = false;
- protected URL url;
- protected Integer fetchPause;
- protected Properties properties;
- protected final String DEFAULT_CONNECT_TIMEOUT = "30000";
- protected final String DEFAULT_READ_TIMEOUT = "180000";
- protected final String DEFAULT_TIMEOUT_QUERY_PARAM_VALUE = "15000";
- protected final String DEFAULT_LIMIT = null;
- protected final String DEFAULT_FETCH_PAUSE = "5000";
-
- private String authorizationString;
- protected Integer connectTimeout;
- protected Integer readTimeout;
- protected String topic;
-
- public MessageRouterHttpClientJdk() {}
-
- @Override
- public void run() {
- if (isReady) {
- isRunning = true;
- while (isRunning) {
- HttpURLConnection httpUrlConnection = null;
- try {
- httpUrlConnection = buildHttpURLConnection();
- httpUrlConnection.connect();
- int status = httpUrlConnection.getResponseCode();
- Log.info("GET " + url + " returned http status " + status);
- if (status < 300) {
- BufferedReader br =
- new BufferedReader(new InputStreamReader(httpUrlConnection.getInputStream()));
- StringBuilder sb = new StringBuilder();
- String line;
- while ((line = br.readLine()) != null) {
- sb.append(line + "\n");
- }
- br.close();
- String responseBody = sb.toString();
- if (responseBody.contains("{")) {
- // Get rid of opening [" entity =
- responseBody = responseBody.substring(2);
- // Get rid of closing "]
- responseBody = responseBody.substring(0, responseBody.length() - 2);
- // Split the json array into individual elements to process
- for (String message : responseBody.split("\",\"")) {
- // unescape the json
- message = message.replace("\\\"", "\"");
- // Topic names cannot contain periods
- processMsg(message);
- }
- } else {
- Log.info("Entity doesn't appear to contain JSON elements, logging body");
- Log.info(responseBody);
- }
- }
- } catch (Exception e) {
- Log.error("GET " + url + " failed.", e);
- } finally {
- if (httpUrlConnection != null) {
- httpUrlConnection.disconnect();
- }
- Log.info("Pausing " + fetchPause + " milliseconds before fetching from " + url + " again.");
- try {
- Thread.sleep(fetchPause);
- } catch (InterruptedException e) {
- Log.error("Could not sleep thread", e);
- Thread.currentThread().interrupt();
- }
- }
- }
- }
- }
-
- @Override
- public void init(Properties baseProperties, String consumerPropertiesPath) {
- try {
- baseProperties.load(new FileInputStream(new File(consumerPropertiesPath)));
- processProperties(baseProperties);
- } catch (FileNotFoundException e) {
- Log.error("FileNotFoundException while reading consumer properties", e);
- } catch (IOException e) {
- Log.error("IOException while reading consumer properties", e);
- }
- }
-
- protected void processProperties(Properties properties) throws MalformedURLException {
- this.properties = properties;
- String username = properties.getProperty("username");
- String password = properties.getProperty("password");
- topic = properties.getProperty("topic");
- String group = properties.getProperty("group");
- String host = properties.getProperty("host");
- String id = properties.getProperty("id");
-
- String filter = properties.getProperty("filter");
- if (filter != null) {
- if (filter.length() > 0) {
- try {
- filter = URLEncoder.encode(filter, StandardCharsets.UTF_8.name());
- } catch (UnsupportedEncodingException e) {
- Log.error("Couldn't encode filter string", e);
- }
- } else {
- filter = null;
- }
- }
-
- String limitString = properties.getProperty("limit", DEFAULT_LIMIT);
- Integer limit = null;
- if (limitString != null && limitString.length() > 0) {
- limit = Integer.valueOf(limitString);
- }
-
- Integer timeoutQueryParamValue =
- Integer.valueOf(properties.getProperty("timeout", DEFAULT_TIMEOUT_QUERY_PARAM_VALUE));
- connectTimeout = Integer.valueOf(properties.getProperty("connectTimeoutSeconds", DEFAULT_CONNECT_TIMEOUT));
- readTimeout = Integer.valueOf(properties.getProperty("readTimeoutMinutes", DEFAULT_READ_TIMEOUT));
- if (username != null && password != null && username.length() > 0 && password.length() > 0) {
- authorizationString = buildAuthorizationString(username, password);
- }
- String urlString = buildlUrlString(topic, group, id, host, timeoutQueryParamValue, limit, filter);
- this.url = new URL(urlString);
- this.fetchPause = Integer.valueOf(properties.getProperty("fetchPause", DEFAULT_FETCH_PAUSE));
- this.isReady = true;
- }
-
- public void processMsg(String msg) {
- Log.info(msg);
- }
-
- protected String buildAuthorizationString(String userName, String password) {
- String basicAuthString = userName + ":" + password;
- basicAuthString = Base64.getEncoder().encodeToString(basicAuthString.getBytes());
- return "Basic " + basicAuthString;
- }
-
- protected String buildlUrlString(String topic, String consumerGroup, String consumerId, String host,
- Integer timeout, Integer limit, String filter) {
- StringBuilder sb = new StringBuilder();
- sb.append("http://" + host + "/events/" + topic + "/" + consumerGroup + "/" + consumerId);
- sb.append("?timeout=" + timeout);
-
- if (limit != null) {
- sb.append("&limit=" + limit);
- }
- if (filter != null) {
- sb.append("&filter=" + filter);
- }
- return sb.toString();
- }
-
- @Override
- public boolean isReady() {
- return isReady;
- }
-
- @Override
- public boolean isRunning() {
- return isRunning;
- }
-
- protected HttpURLConnection buildHttpURLConnection() throws IOException {
- HttpURLConnection httpUrlConnection = (HttpURLConnection) url.openConnection();
- if (authorizationString != null) {
- httpUrlConnection.setRequestProperty("Authorization", authorizationString);
- }
- httpUrlConnection.setRequestMethod("GET");
- httpUrlConnection.setRequestProperty("Accept", "application/json");
- httpUrlConnection.setUseCaches(false);
- httpUrlConnection.setConnectTimeout(connectTimeout);
- httpUrlConnection.setReadTimeout(readTimeout);
- return httpUrlConnection;
- }
-
-}
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/OofPciPocDmaapConsumers.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/OofPciPocDmaapConsumers.java
deleted file mode 100644
index 9ff6fd616..000000000
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/OofPciPocDmaapConsumers.java
+++ /dev/null
@@ -1,564 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.time.Instant;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.VelocityEngine;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class OofPciPocDmaapConsumers extends SdncDmaapConsumerImpl {
-
- private static final Logger LOG = LoggerFactory.getLogger(OofPciPocDmaapConsumers.class);
- private static final String SDNC_ENDPOINT = "SDNC.endpoint";
- private static final String TEMPLATE = "SDNC.template";
- private static final String DMAAPLISTENERROOT = "DMAAPLISTENERROOT";
- private static final String UTF_8 = "UTF-8";
-
- private static final String PARAMETER_NAME = "parameter-name";
- private static final String STRING_VALUE = "string-value";
- private static final String PHYSICAL_CELL_ID_INPUT_FAP_SERVICE = "configuration-phy-cell-id-input.fap-service";
- private static final String EVENT_HEADER = "event-header";
- private static final String ACTION = "Action";
- private static final String CONFIGURATIONS = "Configurations";
- private static final String MODIFY_CONFIG = "ModifyConfig";
- private static final String DATA = "data";
- private static final String FAP_SERVICE = "FAPService";
-
- private static final String PAYLOAD = "Payload";
- private static final String PCI_CHANGES_MAP_FILE_NAME = "pci-changes-from-policy-to-sdnr";
- private static final String SLI_PARAMETERS = "sli_parameters";
- private static final String RPC_NAME = "rpc-name";
- private static final String BODY = "body";
- private static final String INPUT = "input";
- private static final String COMMON_HEADER = "CommonHeader";
- private static final String TIME_STAMP = "TimeStamp";
- private static final String REQUEST_ID = "RequestID";
- private static final String SUB_REQUEST_ID = "SubRequestID";
-
- private static final String TIME_STAMP_FOR_SLI = "timeStamp";
- private static final String REQUEST_ID_FOR_SLI = "requestID";
- private static final String SUB_REQUEST_ID_FOR_SLI = "subRequestID";
-
- private static final String CONFIGURATION_PHY_CELL_ID_INPUT = "configuration-phy-cell-id-input.";
-
- private static final String EMPTY = "";
- private static final String ESCAPE_SEQUENCE_QUOTES = "\"";
-
- private static final String GENERIC_NEIGHBOR_CONFIGURATION_INPUT = "generic-neighbor-configuration-input.";
- private static final String GENERIC_NEIGHBOR_CONFIGURATION_INPUT_NEIGHBOR_LIST_IN_USE = GENERIC_NEIGHBOR_CONFIGURATION_INPUT.concat("neighbor-list-in-use");
- private static final String MODIFY_CONFIG_ANR = "ModifyConfigANR";
- private static final String ANR_CHANGES_MAP_FILE_NAME = "anr-changes-from-policy-to-sdnr";
-
- private String rootDir;
-
- protected VelocityEngine velocityEngine;
-
- public OofPciPocDmaapConsumers() {
- velocityEngine = new VelocityEngine();
- Properties props = new Properties();
- rootDir = System.getenv(DMAAPLISTENERROOT);
-
- if ((rootDir == null) || (rootDir.length() == 0)) {
- rootDir = "/opt/onap/sdnc/dmaap-listener/lib/";
- }
- else {
- rootDir = rootDir + "/lib/";
- }
-
- props.put("file.resource.loader.path", rootDir);
- velocityEngine.init(props);
- }
-
- /*
- * for testing purposes
- */
- OofPciPocDmaapConsumers(Properties props) {
- velocityEngine = new VelocityEngine();
- velocityEngine.init(props);
- }
-
- protected String publish(String templatePath, String jsonString, JsonNode configurationsOrDataNode, boolean invokePciChangesPublish, boolean invokeAnrChangesPublish) throws IOException, InvalidMessageException
- {
- if (invokePciChangesPublish){
- return publishPciChangesFromPolicyToSDNR(templatePath, configurationsOrDataNode, jsonString);
- } else if (invokeAnrChangesPublish){
- return publishANRChangesFromPolicyToSDNR(templatePath, configurationsOrDataNode, jsonString);
- } else {
- return publishFullMessage(templatePath, jsonString);
- }
- }
-
- private String publishFullMessage(String templatePath, String jsonString) throws IOException
- {
- JSONObject jsonObj = new JSONObject(jsonString);
- VelocityContext context = new VelocityContext();
- for(Object key : jsonObj.keySet())
- {
- 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());
-
- ObjectMapper oMapper = new ObjectMapper();
-
- String rpcMsgbody = oMapper.writeValueAsString(jsonString);
- context.put("full_message", rpcMsgbody);
-
- Writer writer = new StringWriter();
- velocityEngine.mergeTemplate(templatePath, UTF_8, context, writer);
- writer.flush();
-
- return writer.toString();
- }
-
- private String publishANRChangesFromPolicyToSDNR(String templatePath, JsonNode dataNode, String msg) throws IOException, InvalidMessageException
- {
- VelocityContext context = new VelocityContext();
-
- String RPC_NAME_KEY_IN_VT = "rpc_name";
- String RPC_NAME_VALUE_IN_VT = "generic-neighbor-configuration";
-
- String CELL_CONFIG = "CellConfig";
- String ALIAS_LABEL = "alias";
- String LTE = "LTE";
- String RAN = "RAN";
- String LTE_CELL = "LTECell";
- String NEIGHBOR_LIST_IN_USE = "NeighborListInUse";
-
- JSONObject numberOfEntries = new JSONObject();
- JSONObject alias = new JSONObject();
- JSONArray sliParametersArray = new JSONArray();
-
- ObjectMapper oMapper = new ObjectMapper();
-
- JsonNode dmaapMessageRootNode;
- try {
- dmaapMessageRootNode = oMapper.readTree(msg);
- } catch (Exception e) {
- throw new InvalidMessageException("Cannot parse json object", e);
- }
-
- JsonNode commonHeader = dmaapMessageRootNode.get(BODY).get(INPUT).get(COMMON_HEADER);
-
- JsonNode timeStamp = commonHeader.get(TIME_STAMP);
-
- JsonNode requestID = commonHeader.get(REQUEST_ID);
-
- JsonNode subRequestID = commonHeader.get(SUB_REQUEST_ID);
-
- sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT+TIME_STAMP_FOR_SLI).put(STRING_VALUE,timeStamp));
-
- sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT+REQUEST_ID_FOR_SLI).put(STRING_VALUE,requestID));
-
- sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT+SUB_REQUEST_ID_FOR_SLI).put(STRING_VALUE,subRequestID));
-
- String aliasValue = dataNode.get(DATA).get(FAP_SERVICE).get(ALIAS_LABEL).textValue();
-
- JsonNode nbrListInUse = dataNode.get(DATA).get(FAP_SERVICE).get(CELL_CONFIG).get(LTE).get(RAN).get(NEIGHBOR_LIST_IN_USE).get(LTE_CELL);
-
- int entryCount = 0;
-
- if(nbrListInUse.isArray()) {
- for(JsonNode lteCell:nbrListInUse) {
- sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT_NEIGHBOR_LIST_IN_USE+"["+entryCount+"]."+"plmnid")
- .put(STRING_VALUE, lteCell.get("PLMNID").toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY)));
- sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT_NEIGHBOR_LIST_IN_USE+"["+entryCount+"]."+"cid")
- .put(STRING_VALUE, lteCell.get("CID").toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY)));
- sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT_NEIGHBOR_LIST_IN_USE+"["+entryCount+"]."+"phy-cell-id")
- .put(STRING_VALUE, lteCell.get("PhyCellID").toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY)));
- sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT_NEIGHBOR_LIST_IN_USE+"["+entryCount+"]."+"pnf-name")
- .put(STRING_VALUE, lteCell.get("PNFName").toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY)));
- sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT_NEIGHBOR_LIST_IN_USE+"["+entryCount+"]."+"blacklisted")
- .put(STRING_VALUE, lteCell.get("Blacklisted").toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY)));
-
- entryCount++;
- }
-
- alias.put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT+ALIAS_LABEL);
- alias.put(STRING_VALUE, aliasValue);
-
- numberOfEntries.put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT+"lte-cell-number-of-entries");
- numberOfEntries.put(STRING_VALUE, entryCount);
-
- sliParametersArray.put(alias);
- sliParametersArray.put(numberOfEntries);
-
- context.put(SLI_PARAMETERS, sliParametersArray);
-
- context.put(RPC_NAME_KEY_IN_VT, RPC_NAME_VALUE_IN_VT);
-
- Writer writer = new StringWriter();
- velocityEngine.mergeTemplate(templatePath, UTF_8, context, writer);
- writer.flush();
-
- return writer.toString();
-
- }else {
- throw new InvalidMessageException("nbrListInUse is not of Type Array. Could not read neighbor list elements");
- }
-
- }
-
- private String publishPciChangesFromPolicyToSDNR(String templatePath, JsonNode configurationsJsonNode, String msg) throws IOException, InvalidMessageException
- {
- String RPC_NAME_KEY_IN_VT = "rpc_name";
- String RPC_NAME_VALUE_IN_VT = "configuration-phy-cell-id";
- String ALIAS = "alias";
- String X0005b9Lte = "X0005b9Lte";
-
- VelocityContext context = new VelocityContext();
-
- JSONObject numberOfEntries = new JSONObject();
- JSONArray sliParametersArray = new JSONArray();
-
- JsonNode configurations = configurationsJsonNode.get(CONFIGURATIONS);
-
- ObjectMapper oMapper = new ObjectMapper();
-
- JsonNode dmaapMessageRootNode;
- try {
- dmaapMessageRootNode = oMapper.readTree(msg);
- } catch (Exception e) {
- throw new InvalidMessageException("Cannot parse json object", e);
- }
-
- JsonNode commonHeader = dmaapMessageRootNode.get(BODY).get(INPUT).get(COMMON_HEADER);
-
- JsonNode timeStamp = commonHeader.get(TIME_STAMP);
-
- JsonNode requestID = commonHeader.get(REQUEST_ID);
-
- JsonNode subRequestID = commonHeader.get(SUB_REQUEST_ID);
-
- sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, CONFIGURATION_PHY_CELL_ID_INPUT+TIME_STAMP_FOR_SLI).put(STRING_VALUE,timeStamp));
-
- sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, CONFIGURATION_PHY_CELL_ID_INPUT+REQUEST_ID_FOR_SLI).put(STRING_VALUE,requestID));
-
- sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, CONFIGURATION_PHY_CELL_ID_INPUT+SUB_REQUEST_ID_FOR_SLI).put(STRING_VALUE,subRequestID));
-
- int entryCount = 0;
-
- if(configurations.isArray()) {
- for(JsonNode dataNode:configurations) {
- sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, PHYSICAL_CELL_ID_INPUT_FAP_SERVICE+"["+entryCount+"]."+ALIAS)
- .put(STRING_VALUE, dataNode.get(DATA).get(FAP_SERVICE).get(ALIAS).toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY)));
- sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, PHYSICAL_CELL_ID_INPUT_FAP_SERVICE+"["+entryCount+"]."+"cid")
- .put(STRING_VALUE, dataNode.get(DATA).get(FAP_SERVICE).get("CellConfig").get("LTE").get("RAN").get("Common").get("CellIdentity").toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY)));
- sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, PHYSICAL_CELL_ID_INPUT_FAP_SERVICE+"["+entryCount+"]."+"phy-cell-id-in-use")
- .put(STRING_VALUE, dataNode.get(DATA).get(FAP_SERVICE).get(X0005b9Lte).get("phyCellIdInUse").toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY)));
- sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, PHYSICAL_CELL_ID_INPUT_FAP_SERVICE+"["+entryCount+"]."+"pnf-name")
- .put(STRING_VALUE, dataNode.get(DATA).get(FAP_SERVICE).get(X0005b9Lte).get("pnfName").toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY)));
- entryCount++;
- }
-
- numberOfEntries.put(PARAMETER_NAME, PHYSICAL_CELL_ID_INPUT_FAP_SERVICE+"-number-of-entries");
- numberOfEntries.put(STRING_VALUE, entryCount);
-
- sliParametersArray.put(numberOfEntries);
-
- context.put(SLI_PARAMETERS, sliParametersArray);
-
- context.put(RPC_NAME_KEY_IN_VT, RPC_NAME_VALUE_IN_VT);
-
- Writer writer = new StringWriter();
- velocityEngine.mergeTemplate(templatePath, UTF_8, context, writer);
- writer.flush();
-
- return writer.toString();
-
- }else {
- throw new InvalidMessageException("Configurations is not of Type Array. Could not read configuration changes");
- }
-
- }
-
- @Override
- public void processMsg(String msg) throws InvalidMessageException {
-
- if (msg == null) {
- throw new InvalidMessageException("Null message");
- }
-
- ObjectMapper oMapper = new ObjectMapper();
- JsonNode dmaapMessageRootNode;
- try {
- dmaapMessageRootNode = oMapper.readTree(msg);
- } catch (Exception e) {
- throw new InvalidMessageException("Cannot parse json object", e);
- }
-
-
- JsonNode rpcnameNode = dmaapMessageRootNode.get(RPC_NAME);
- if(rpcnameNode == null) {
- LOG.info("Unable to identify the respective consumer to invoke. Please verify the dmaap message..");
- return;
- }
-
- String rpcname = rpcnameNode.textValue();
-
- if(!MODIFY_CONFIG.toLowerCase().equals(rpcname) && !MODIFY_CONFIG_ANR.toLowerCase().equals(rpcname)) {
- LOG.info("Unknown rpc name {}", rpcname);
- return;
- }
-
- if(MODIFY_CONFIG.toLowerCase().equals(rpcname)) {
- invokePCIChangesConsumer(dmaapMessageRootNode, oMapper, msg);
- return;
- }
-
- if(MODIFY_CONFIG_ANR.toLowerCase().equals(rpcname)) {
- invokeANRChangesConsumer(dmaapMessageRootNode, oMapper, msg);
- return;
- }
-
- }
-
- private void invokeANRChangesConsumer(JsonNode dmaapMessageRootNode, ObjectMapper oMapper,
- String msg) throws InvalidMessageException {
- JsonNode body = dmaapMessageRootNode.get(BODY);
- if(body == null) {
- LOG.info("Missing body node.");
- return;
- }
-
- JsonNode input = body.get(INPUT);
- if(input == null) {
- LOG.info("Missing input node.");
- return;
- }
-
- JsonNode action = input.get(ACTION);
- if(action == null) {
- LOG.info("Missing action node.");
- return;
- }
-
- if(!MODIFY_CONFIG_ANR.equals(action.textValue())) {
- LOG.info("Unknown Action {}", action);
- return;
- }
-
- JsonNode payload = input.get(PAYLOAD);
- if(payload == null) {
- LOG.info("Missing payload node.");
- return;
- }
-
- String payloadText = payload.asText();
-
- if(!payloadText.contains(CONFIGURATIONS)) {
- LOG.info("Missing configurations node.");
- return;
- }
-
- JsonNode configurationsJsonNode;
- try {
- configurationsJsonNode = oMapper.readTree(payloadText);
- } catch (Exception e) {
- throw new InvalidMessageException("Cannot parse payload value", e);
- }
-
- String mapFilename = rootDir + ANR_CHANGES_MAP_FILE_NAME + ".map";
- Map<String, String> fieldMap = loadMap(mapFilename);
- if (fieldMap == null) {
- return;
- }
-
- if (!fieldMap.containsKey(SDNC_ENDPOINT)) {
- return;
- }
- String sdncEndpoint = fieldMap.get(SDNC_ENDPOINT);
-
- if (!fieldMap.containsKey(TEMPLATE)) {
- throw new InvalidMessageException("No SDNC template known for message ");
- }
- String templateName = fieldMap.get(TEMPLATE);
-
- JsonNode configurations = configurationsJsonNode.get(CONFIGURATIONS);
-
- if(configurations.isArray()) {
- for(JsonNode dataNode:configurations) {
- if(dataNode.get(DATA).get(FAP_SERVICE) == null) {
- LOG.info("Could not make a rpc call. Missing fapService node for dataNode element::", dataNode.textValue());
- }else {
- buildAndInvokeANRChangesRPC(sdncEndpoint, templateName,msg, dataNode);
- }
- }
- }else {
- throw new InvalidMessageException("Configurations is not of Type Array. Could not read configuration changes");
- }
- }
-
- private void invokePCIChangesConsumer(JsonNode dmaapMessageRootNode, ObjectMapper oMapper,
- String msg) throws InvalidMessageException {
- JsonNode body = dmaapMessageRootNode.get(BODY);
- if(body == null) {
- LOG.info("Missing body node.");
- return;
- }
-
- JsonNode input = body.get(INPUT);
- if(input == null) {
- LOG.info("Missing input node.");
- return;
- }
-
- JsonNode action = input.get(ACTION);
- if(action == null) {
- LOG.info("Missing action node.");
- return;
- }
-
-
- if(!MODIFY_CONFIG.equals(action.textValue())) {
- LOG.info("Unknown Action {}", action);
- return;
- }
-
- JsonNode payload = input.get(PAYLOAD);
- if(payload == null) {
- LOG.info("Missing payload node.");
- return;
- }
-
- String configurations = payload.asText();
-
- if(!configurations.contains(CONFIGURATIONS)) {
- LOG.info("Missing configurations node.");
- return;
- }
-
- JsonNode configurationsJsonNode;
- try {
- configurationsJsonNode = oMapper.readTree(configurations);
- } catch (Exception e) {
- throw new InvalidMessageException("Cannot parse payload value", e);
- }
-
- String mapFilename = rootDir + PCI_CHANGES_MAP_FILE_NAME + ".map";
- Map<String, String> fieldMap = loadMap(mapFilename);
- if (fieldMap == null) {
- return;
- }
-
- if (!fieldMap.containsKey(SDNC_ENDPOINT)) {
- return;
- }
- String sdncEndpoint = fieldMap.get(SDNC_ENDPOINT);
-
- if (!fieldMap.containsKey(TEMPLATE)) {
- throw new InvalidMessageException("No SDNC template known for message ");
- }
- String templateName = fieldMap.get(TEMPLATE);
-
- buildAndInvokePCIChangesRPC(sdncEndpoint, templateName, msg, configurationsJsonNode);
- }
-
- private void buildAndInvokePCIChangesRPC(String sdncEndpoint, String templateName, String msg, JsonNode configurationsOrDataNode) {
- try {
- String rpcMsgbody = publish(templateName, msg, configurationsOrDataNode, true, false);
- String odlUrlBase = getProperty("sdnc.odl.url-base");
- String odlUser = getProperty("sdnc.odl.user");
- String odlPassword = getProperty("sdnc.odl.password");
-
- if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) {
- SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + "/" + sdncEndpoint, odlUser, odlPassword);
-
- conn.send("POST", "application/json", rpcMsgbody);
- } else {
- LOG.info("POST message body would be:\n" + rpcMsgbody);
- }
- } catch (Exception e) {
- LOG.error("Unable to process message", e);
- }
- }
-
- private void buildAndInvokeANRChangesRPC(String sdncEndpoint, String templateName, String msg, JsonNode configurationsOrDataNode) {
- try {
- String rpcMsgbody = publish(templateName, msg, configurationsOrDataNode, false, true);
- String odlUrlBase = getProperty("sdnc.odl.url-base");
- String odlUser = getProperty("sdnc.odl.user");
- String odlPassword = getProperty("sdnc.odl.password");
-
- if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) {
- SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + "/" + sdncEndpoint, odlUser, odlPassword);
-
- conn.send("POST", "application/json", rpcMsgbody);
- } else {
- LOG.info("POST message body would be:\n" + rpcMsgbody);
- }
- } catch (Exception e) {
- LOG.error("Unable to process message", e);
- }
- }
-
- private Map<String, String> loadMap(String mapFilename) {
- File mapFile = new File(mapFilename);
-
- if (!mapFile.canRead()) {
- LOG.error(String.format("Cannot read map file (%s)", mapFilename));
- return null;
- }
-
- Map<String, String> results = new HashMap<>();
- try (BufferedReader mapReader = new BufferedReader(new FileReader(mapFile))) {
-
- String curLine;
-
- while ((curLine = mapReader.readLine()) != null) {
- curLine = curLine.trim();
-
- if ((curLine.length() > 0) && (!curLine.startsWith("#")) && curLine.contains("=>")) {
- String[] entry = curLine.split("=>");
- if (entry.length == 2) {
- results.put(entry[0].trim(), entry[1].trim());
- }
- }
- }
- mapReader.close();
- } catch (Exception e) {
- LOG.error("Caught exception reading map " + mapFilename, e);
- return null;
- }
-
- return results;
- }
-
-}
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
deleted file mode 100644
index f35e6f1e3..000000000
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncAaiDmaapConsumer.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * Modifications Copyright © 2018 IBM.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.time.Instant;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.VelocityEngine;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class SdncAaiDmaapConsumer extends SdncDmaapConsumerImpl {
-
- private static final Logger LOG = LoggerFactory.getLogger(SdncAaiDmaapConsumer.class);
- private static final String SDNC_ENDPOINT = "SDNC.endpoint";
- private static final String TEMPLATE = "SDNC.template";
- private static final String DMAAPLISTENERROOT = "DMAAPLISTENERROOT";
-
- private static final String ESR_SYSTEM_INFO = "esr-system-info";
- private static final String RELATIONSHIP_LIST = "relationship-list";
- private static final String ESR_SYSTEM_INFO_LIST = "esr-system-info-list";
- private static final String AAI_EVENT = "AAI-EVENT";
-
- private static final String EVENT_TYPE = "event-type";
- private static final String ENTITY = "entity";
- private static final String ENTITY_TYPE = "entity-type";
- private static final String EVENT_HEADER = "event-header";
-
- private String rootDir;
-
- protected VelocityEngine velocityEngine;
-
- public SdncAaiDmaapConsumer() {
- velocityEngine = new VelocityEngine();
- Properties props = new Properties();
- rootDir = System.getenv(DMAAPLISTENERROOT);
-
- if ((rootDir == null) || (rootDir.length() == 0)) {
- rootDir = "/opt/onap/sdnc/dmaap-listener/lib/";
- }
- else {
- rootDir = rootDir + "/lib/";
- }
-
- props.put("file.resource.loader.path", rootDir);
- velocityEngine.init(props);
- }
-
- /*
- * for testing purposes
- */
- SdncAaiDmaapConsumer(Properties props) {
- velocityEngine = new VelocityEngine();
- velocityEngine.init(props);
- }
-
- protected String publish(String templatePath, String jsonString) throws IOException
- {
- if (templatePath.contains("esr-thirdparty-sdnc")){
- return publishEsrThirdPartySdnc(templatePath, jsonString);
- } else {
- return publishFullMessage(templatePath, jsonString);
- }
- }
-
- private String publishFullMessage(String templatePath, String jsonString) throws IOException
- {
- JSONObject jsonObj = new JSONObject(jsonString);
- VelocityContext context = new VelocityContext();
- for(Object key : jsonObj.keySet())
- {
- 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());
-
- ObjectMapper oMapper = new ObjectMapper();
-
- String rpcMsgbody = oMapper.writeValueAsString(jsonString);
- context.put("full_message", rpcMsgbody);
-
- Writer writer = new StringWriter();
- velocityEngine.mergeTemplate(templatePath, "UTF-8", context, writer);
- writer.flush();
-
- return writer.toString();
- }
-
- private String publishEsrThirdPartySdnc(String templatePath, String jsonString) throws IOException
- {
- JSONObject jsonObj = new JSONObject(jsonString);
- VelocityContext context = new VelocityContext();
-
- JSONObject eventHeader = jsonObj.getJSONObject(EVENT_HEADER);
- for(Object key : eventHeader.keySet())
- {
- if (!("action").equals(key)) {
- context.put(((String)key).replaceAll("-", ""), eventHeader.get((String)key));
- } else {
- String action = (String) eventHeader.get((String) key);
- if (("create").equalsIgnoreCase(action)) {
- context.put((String)key,"Update");
- } else if (("delete").equalsIgnoreCase(action)) {
- context.put((String) key, "Delete");
- } else {
- throw new IOException("Action type not supported " + action);
- }
- }
- }
-
- JSONObject entityObj = jsonObj.getJSONObject(ENTITY);
- for(Object key : entityObj.keySet())
- {
- switch((String)key)
- {
- case ESR_SYSTEM_INFO_LIST :
- JSONArray esrSystemInfo = entityObj.getJSONObject((String)key)
- .getJSONArray(ESR_SYSTEM_INFO);
-
- for (int i = 0; i < esrSystemInfo.length(); i++) {
- JSONObject objects = esrSystemInfo.getJSONObject(i);
-
- for (Object name : objects.keySet()) {
- context.put(((String)name).replaceAll("-", ""),
- objects.get((String)name).toString());
- }
- }
- break;
-
- case RELATIONSHIP_LIST :
- //convertion not required for relationship
- break;
-
- default :
- context.put(((String)key).replaceAll("-", ""),
- entityObj.get((String)key).toString());
- break;
- }
- }
-
- Writer writer = new StringWriter();
- velocityEngine.mergeTemplate(templatePath, "UTF-8", context, writer);
- writer.flush();
-
- return writer.toString();
- }
-
- @Override
- public void processMsg(String msg) throws InvalidMessageException {
-
- if (msg == null) {
- throw new InvalidMessageException("Null message");
- }
-
- ObjectMapper oMapper = new ObjectMapper();
- JsonNode aaiRootNode;
- try {
- aaiRootNode = oMapper.readTree(msg);
- } catch (Exception e) {
- throw new InvalidMessageException("Cannot parse json object", e);
- }
-
- JsonNode eventHeaderNode = aaiRootNode.get(EVENT_HEADER);
- if(eventHeaderNode == null) {
- LOG.info("Missing Event Header node.");
- return;
- }
- JsonNode eventTypeNode = eventHeaderNode.get(EVENT_TYPE);
- String eventType = eventTypeNode.textValue();
-
- if(!AAI_EVENT.equals(eventType)) {
- LOG.info("Unknown Event Type {}", eventType);
- return;
- }
-
- JsonNode entityTypeNode = eventHeaderNode.get(ENTITY_TYPE);
- String entityType = entityTypeNode.textValue();
-
- String mapFilename = rootDir + entityType + ".map";
- Map<String, String> fieldMap = loadMap(mapFilename);
- if (fieldMap == null) {
- return;
- }
-
- if (!fieldMap.containsKey(SDNC_ENDPOINT)) {
- return;
- }
- String sdncEndpoint = fieldMap.get(SDNC_ENDPOINT);
-
- if (!fieldMap.containsKey(TEMPLATE)) {
- throw new InvalidMessageException("No SDNC template known for message " + entityType);
- }
- String templateName = fieldMap.get(TEMPLATE);
-
- try {
- String rpcMsgbody = publish(templateName, msg);
- String odlUrlBase = getProperty("sdnc.odl.url-base");
- String odlUser = getProperty("sdnc.odl.user");
- String odlPassword = getProperty("sdnc.odl.password");
-
- if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) {
- SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + "/" + sdncEndpoint, odlUser, odlPassword);
-
- conn.send("POST", "application/json", rpcMsgbody);
- } else {
- LOG.info("POST message body would be:\n" + rpcMsgbody);
- }
- } catch (Exception e) {
- LOG.error("Unable to process message", e);
- }
- }
-
- private Map<String, String> loadMap(String mapFilename) {
- File mapFile = new File(mapFilename);
-
- if (!mapFile.canRead()) {
- LOG.error(String.format("Cannot read map file (%s)", mapFilename));
- return null;
- }
-
- Map<String, String> results = new HashMap<>();
- try (BufferedReader mapReader = new BufferedReader(new FileReader(mapFile))) {
-
- String curLine;
-
- while ((curLine = mapReader.readLine()) != null) {
- curLine = curLine.trim();
-
- if ((curLine.length() > 0) && (!curLine.startsWith("#")) && curLine.contains("=>")) {
- String[] entry = curLine.split("=>");
- if (entry.length == 2) {
- results.put(entry[0].trim(), entry[1].trim());
- }
- }
- }
- mapReader.close();
- } catch (Exception e) {
- LOG.error("Caught exception reading map " + mapFilename, e);
- return null;
- }
-
- return results;
- }
-
-}
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDhcpEventConsumer.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDhcpEventConsumer.java
deleted file mode 100644
index 7b68ceb63..000000000
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDhcpEventConsumer.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.Properties;
-import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class SdncDhcpEventConsumer extends SdncDmaapConsumerImpl {
- private static final Logger LOG = LoggerFactory.getLogger(SdncDhcpEventConsumer.class);
-
- private static final String MAC_ADDR_TAG = "macaddr";
- private static final String MSG_NAME_TAG = "msg_name";
- private static final String IP_ADDR_TAG = "yiaddr";
-
- private static DBResourceManager jdbcDataSource = null;
- private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR";
-
- private class MissingDhcpAttributeException extends InvalidMessageException {
-
- public MissingDhcpAttributeException(String fieldName) {
- super("Invalid DHCP event - missing " + fieldName + " attribute");
- }
- }
-
- private static void setJdbcDataSource() throws IOException {
-
- String propPath;
- String propDir = System.getenv(SDNC_CONFIG_DIR);
- if (propDir == null) {
- propDir = "/opt/onap/sdnc/data/properties";
- }
- propPath = propDir + "/dblib.properties";
- File propFile = new File(propPath);
-
- if (!propFile.exists()) {
-
- throw new FileNotFoundException("Missing configuration properties file : " + propFile);
- }
-
- Properties props = new Properties();
- props.load(new FileInputStream(propFile));
-
- setJdbcDataSource(new DBResourceManager(props));
-
- }
-
- static void setJdbcDataSource(DBResourceManager dbMgr) {
-
- jdbcDataSource = dbMgr;
-
- if (jdbcDataSource.isActive()) {
- LOG.warn("DBLIB: JDBC DataSource has been initialized.");
- } else {
- LOG.warn("DBLIB: JDBC DataSource did not initialize successfully.");
- }
- }
-
- @Override
- public void processMsg(String msg) throws InvalidMessageException {
- if (msg == null) {
- throw new InvalidMessageException("Null message");
- }
-
- ObjectMapper oMapper = new ObjectMapper();
-
- JsonNode dhcpRootNode;
- String msgName;
- String macAddr;
- String ipAddr;
-
- try {
- dhcpRootNode = oMapper.readTree(msg);
-
- } catch (IOException e) {
- throw new InvalidMessageException("Cannot parse json object", e);
- }
-
- JsonNode msgNameNode = dhcpRootNode.get(MSG_NAME_TAG);
- if (msgNameNode != null) {
- msgName = msgNameNode.textValue();
-
- } else {
- throw new MissingDhcpAttributeException(MSG_NAME_TAG);
- }
-
- JsonNode macAddrNode = dhcpRootNode.get(MAC_ADDR_TAG);
- if (macAddrNode != null) {
- macAddr = macAddrNode.textValue();
-
- } else {
- throw new MissingDhcpAttributeException(MAC_ADDR_TAG);
- }
-
- JsonNode ipAddrNode = dhcpRootNode.get(IP_ADDR_TAG);
- if (ipAddrNode != null) {
- ipAddr = ipAddrNode.textValue();
-
- } else {
- throw new MissingDhcpAttributeException(IP_ADDR_TAG);
- }
-
- LOG.debug("Got DHCP event : msg name {}; mac addr {}; ip addr {}", msgName, macAddr, ipAddr);
-
- if (jdbcDataSource == null) {
- try {
- setJdbcDataSource();
- } catch (IOException e) {
- LOG.error("Could not create JDBC connection", e);
- return;
- }
- }
-
- try {
-
- jdbcDataSource.writeData("INSERT INTO DHCP_MAP(mac_addr, ip_addr) VALUES('" + macAddr + "','" + ipAddr + "') ON DUPLICATE KEY UPDATE ip_addr = '"+ipAddr+"'", null, null);
-
- } catch (SQLException e) {
- LOG.error("Could not insert DHCP event data into the database ", e);
- }
-
- }
-
-}
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDmaapConsumer.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDmaapConsumer.java
deleted file mode 100644
index 3fc769d35..000000000
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDmaapConsumer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import java.util.Properties;
-
-public abstract interface SdncDmaapConsumer extends Runnable {
- public abstract void init(Properties baseProperties, String consumerPropertiesPath);
-
- public abstract void processMsg(String msg) throws InvalidMessageException;
-
- public abstract boolean isReady();
-
- public abstract boolean isRunning();
-}
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDmaapConsumerImpl.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDmaapConsumerImpl.java
deleted file mode 100644
index ee8bb4d6e..000000000
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDmaapConsumerImpl.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * Modifications Copyright © 2018 IBM.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.Properties;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRConsumer;
-import com.att.nsa.mr.client.response.MRConsumerResponse;
-
-public abstract class SdncDmaapConsumerImpl implements SdncDmaapConsumer {
-
- private static final Logger LOG = LoggerFactory
- .getLogger(SdncDmaapConsumer.class);
-
- private final String name = this.getClass().getSimpleName();
- private Properties properties = null;
- private MRConsumer consumer = null;
- private MRConsumerResponse consumerResponse = null;
- private boolean running = false;
- private boolean ready = false;
- private int fetchPause = 5000; // Default pause between fetch - 5 seconds
- private int timeout = 15000; // Default timeout - 15 seconds
-
- public SdncDmaapConsumerImpl() {
-
- }
-
- public SdncDmaapConsumerImpl(Properties properties, String propertiesPath) {
- init(properties, propertiesPath);
- }
-
- public boolean isReady() {
- return ready;
- }
-
- public boolean isRunning() {
- return running;
- }
-
- public String getProperty(String name) {
- return properties.getProperty(name, "");
- }
-
- public void init(Properties properties, String propertiesPath) {
-
- try (FileInputStream in = new FileInputStream(new File(propertiesPath))) {
-
- LOG.debug("propertiesPath: " + propertiesPath);
- this.properties = (Properties) properties.clone();
- this.properties.load(in);
-
-
- String timeoutStr = this.properties.getProperty("timeout");
- LOG.debug("timeoutStr: " + timeoutStr);
-
- if ((timeoutStr != null) && (timeoutStr.length() > 0)) {
- timeout = parseTimeOutValue(timeoutStr);
- }
-
- String fetchPauseStr = this.properties.getProperty("fetchPause");
- LOG.debug("fetchPause(Str): " + fetchPauseStr);
- if ((fetchPauseStr != null) && (fetchPauseStr.length() > 0)) {
- fetchPause = parseFetchPause(fetchPauseStr);
- }
- LOG.debug("fetchPause: " + fetchPause);
-
-
- this.consumer = MRClientFactory.createConsumer(propertiesPath);
- ready = true;
- } catch (Exception e) {
- LOG.error("Error initializing DMaaP consumer from file " + propertiesPath, e);
- }
- }
-
- private int parseTimeOutValue(String timeoutStr) {
- try {
- return Integer.parseInt(timeoutStr);
- } catch (NumberFormatException e) {
- LOG.error("Non-numeric value specified for timeout (" + timeoutStr + ")");
- }
- return timeout;
- }
-
- private int parseFetchPause(String fetchPauseStr) {
- try {
- return Integer.parseInt(fetchPauseStr);
- } catch (NumberFormatException e) {
- LOG.error("Non-numeric value specified for fetchPause (" + fetchPauseStr + ")");
- }
- return fetchPause;
- }
-
-
- @Override
- public void run() {
- if (ready) {
-
- running = true;
-
- while (running) {
-
- try {
- boolean noData = true;
- consumerResponse = consumer.fetchWithReturnConsumerResponse(timeout, -1);
- for (String msg : consumerResponse.getActualMessages()) {
- noData = false;
- LOG.info(name + " received ActualMessage from DMaaP:\n"+msg);
- processMsg(msg);
- }
-
- if (noData) {
- LOG.info(name + " received ResponseCode: " + consumerResponse.getResponseCode());
- LOG.info(name + " received ResponseMessage: " + consumerResponse.getResponseMessage());
- pauseThread();
- }
- } catch (Exception e) {
- LOG.error("Caught exception reading from DMaaP", e);
- running = false;
- }
-
-
- }
- }
- }
-
- private void pauseThread() throws InterruptedException {
- if (fetchPause > 0) {
- LOG.info(String.format("No data received from fetch. Pausing %d ms before retry", fetchPause));
- Thread.sleep(fetchPause);
- } else {
- LOG.info("No data received from fetch. No fetch pause specified - retrying immediately");
- }
- }
-
- public abstract void processMsg(String msg) throws InvalidMessageException;
-}
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncFlatJsonDmaapConsumer.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncFlatJsonDmaapConsumer.java
deleted file mode 100644
index 6c90c7199..000000000
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncFlatJsonDmaapConsumer.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-
-public class SdncFlatJsonDmaapConsumer extends SdncDmaapConsumerImpl {
-
- private static final Logger LOG = LoggerFactory.getLogger(SdncFlatJsonDmaapConsumer.class);
-
- private static final String DMAAPLISTENERROOT = "DMAAPLISTENERROOT";
- private static final String SDNC_ENDPOINT = "SDNC.endpoint";
-
- @Override
- public void processMsg(String msg) throws InvalidMessageException {
-
- processMsg(msg, null);
- }
-
- public void processMsg(String msg, String mapDirName) throws InvalidMessageException {
-
- if (msg == null) {
- throw new InvalidMessageException("Null message");
- }
-
- ObjectMapper oMapper = new ObjectMapper();
- JsonNode instarRootNode;
- ObjectNode sdncRootNode;
-
- String instarMsgName = null;
-
- try {
- instarRootNode = oMapper.readTree(msg);
- } catch (Exception e) {
- throw new InvalidMessageException("Cannot parse json object", e);
- }
-
- Iterator<Map.Entry<String, JsonNode>> instarFields = instarRootNode.fields();
-
- while (instarFields.hasNext()) {
- Map.Entry<String, JsonNode> entry = instarFields.next();
-
- instarMsgName = entry.getKey();
- instarRootNode = entry.getValue();
- break;
- }
-
- Map<String, String> fieldMap = loadMap(instarMsgName, mapDirName);
-
- if (fieldMap == null) {
- throw new InvalidMessageException("Unable to process message - cannot load field mappings");
- }
-
- if (!fieldMap.containsKey(SDNC_ENDPOINT)) {
- throw new InvalidMessageException("No SDNC endpoint known for message " + instarMsgName);
- }
-
- String sdncEndpoint = fieldMap.get(SDNC_ENDPOINT);
-
- sdncRootNode = oMapper.createObjectNode();
- ObjectNode inputNode = oMapper.createObjectNode();
-
- for (Map.Entry<String, String> entry : fieldMap.entrySet()) {
-
- if (!SDNC_ENDPOINT.equals(entry.getKey())) {
- JsonNode curNode = instarRootNode.get(entry.getKey());
- if (curNode != null) {
- String fromValue = curNode.textValue();
-
- inputNode.put(entry.getValue(), fromValue);
- }
- }
- }
- sdncRootNode.put("input", inputNode);
-
- try {
- String rpcMsgbody = oMapper.writeValueAsString(sdncRootNode);
- String odlUrlBase = getProperty("sdnc.odl.url-base");
- String odlUser = getProperty("sdnc.odl.user");
- String odlPassword = getProperty("sdnc.odl.password");
-
- if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) {
- SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + sdncEndpoint, odlUser, odlPassword);
-
- conn.send("POST", "application/json", rpcMsgbody);
- } else {
- LOG.info("POST message body would be:\n" + rpcMsgbody);
- }
- } catch (Exception e) {
- LOG.error("Unable to process message", e);
- }
- }
-
- private Map<String, String> loadMap(String msgType, String mapDirName) {
- Map<String, String> results = new HashMap<>();
-
- String dirName = mapDirName;
-
- if (mapDirName == null) {
- String rootdir = System.getenv(DMAAPLISTENERROOT);
-
- if ((rootdir == null) || (rootdir.length() == 0)) {
- rootdir = "/opt/app/dmaap-listener";
- }
-
- dirName = rootdir + "/lib";
- }
-
- String mapFilename = dirName + "/" + msgType + ".map";
-
- File mapFile = new File(mapFilename);
-
- if (!mapFile.canRead()) {
- LOG.error(String.format("Cannot read map file (%s)", mapFilename));
- return null;
- }
-
- try (BufferedReader mapReader = new BufferedReader(new FileReader(mapFile))) {
-
- String curLine;
-
- while ((curLine = mapReader.readLine()) != null) {
- curLine = curLine.trim();
-
- if ((curLine.length() > 0) && (!curLine.startsWith("#")) && curLine.contains("=>")) {
- String[] entry = curLine.split("=>");
- if (entry.length == 2) {
- results.put(entry[0].trim(), entry[1].trim());
- }
- }
- }
- mapReader.close();
- } catch (Exception e) {
- LOG.error("Caught exception reading map " + mapFilename, e);
- return null;
- }
-
- return results;
- }
-}
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncLcmDmaapConsumer.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncLcmDmaapConsumer.java
deleted file mode 100644
index f2153789f..000000000
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncLcmDmaapConsumer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * Modifications Copyright © 2018 IBM.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SdncLcmDmaapConsumer extends SdncDmaapConsumerImpl {
-
- private static final Logger LOG = LoggerFactory.getLogger(SdncLcmDmaapConsumer.class);
-
- private static final String BODY = "body";
- private static final String RPC = "rpc-name";
-
- @Override
- public void processMsg(String msg) throws InvalidMessageException {
-
- if (msg == null) {
- throw new InvalidMessageException("Null LCM message");
- }
-
- ObjectMapper oMapper = new ObjectMapper();
- JsonNode lcmRootNode;
- try {
- lcmRootNode = oMapper.readTree(msg);
- } catch (Exception e) {
- throw new InvalidMessageException("Cannot parse LCM json input", e);
- }
-
- JsonNode bodyNode = lcmRootNode.get(BODY);
- if(bodyNode == null) {
- LOG.warn("Missing body in LCM message");
- return;
- }
- String rpcMsgbody;
- try {
- ObjectMapper mapper = new ObjectMapper();
- rpcMsgbody = mapper.writeValueAsString(bodyNode);
-
- } catch (Exception e) {
- LOG.error("Unable to parse body in LCM message", e);
- return;
- }
-
- JsonNode rpcNode = lcmRootNode.get(RPC);
- if(rpcNode == null) {
- LOG.warn("Missing node in LCM message- " + RPC);
- return;
- }
- String rpc = rpcNode.textValue();
- String sdncEndpoint = "LCM:" + rpc;
-
- try {
- String odlUrlBase = getProperty("sdnc.odl.url-base");
- String odlUser = getProperty("sdnc.odl.user");
- String odlPassword = getProperty("sdnc.odl.password");
- LOG.info("POST LCM Request " + rpcMsgbody);
- if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) {
- SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + "/" + sdncEndpoint, odlUser, odlPassword);
-
- conn.send("POST", "application/json", rpcMsgbody);
- } else {
- LOG.warn("Unable to POST LCM message. SDNC URL not available. body:\n" + rpcMsgbody);
- }
- } catch (Exception e) {
- LOG.error("Unable to process message", e);
- }
- }
-}
-
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncOdlConnection.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncOdlConnection.java
deleted file mode 100644
index 6eeef9b48..000000000
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncOdlConnection.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import java.io.BufferedReader;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.Authenticator;
-import java.net.HttpURLConnection;
-import java.net.PasswordAuthentication;
-import java.net.URL;
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLSession;
-import org.apache.commons.codec.binary.Base64;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class SdncOdlConnection {
-
- private static final Logger LOG = LoggerFactory
- .getLogger(SdncOdlConnection.class);
-
- private HttpURLConnection httpConn = null;
-
- private String url = null;
- private String user = null;
- private String password = null;
-
- private class SdncAuthenticator extends Authenticator {
-
- private String user;
- private String passwd;
-
- SdncAuthenticator(String user, String passwd) {
- this.user = user;
- this.passwd = passwd;
- }
-
- @Override
- protected PasswordAuthentication getPasswordAuthentication() {
- return new PasswordAuthentication(user, passwd.toCharArray());
- }
- }
-
- private SdncOdlConnection() {
-
- }
-
- private SdncOdlConnection(String url, String user, String password) {
- this.url = url;
- this.user = user;
- this.password = password;
-
- try {
- URL sdncUrl = new URL(url);
- Authenticator.setDefault(new SdncAuthenticator(user, password));
-
- this.httpConn = (HttpURLConnection) sdncUrl.openConnection();
- } catch (Exception e) {
- LOG.error("Unable to create http connection", e);
- }
- }
-
- public static SdncOdlConnection newInstance(String url, String user, String password) {
- return new SdncOdlConnection(url, user, password);
- }
-
-
- public String send(String method, String contentType, String msg) throws IOException {
-
- LOG.info(String.format("Sending REST %s to %s", method, url));
- LOG.info(String.format("Message body:%n%s", msg));
- String authStr = user + ":" + password;
- String encodedAuthStr = new String(Base64.encodeBase64(authStr.getBytes()));
-
- httpConn.addRequestProperty("Authentication", "Basic " + encodedAuthStr);
-
- httpConn.setRequestMethod(method);
- httpConn.setRequestProperty("Content-Type", contentType);
- httpConn.setRequestProperty("Accept", contentType);
-
- httpConn.setDoInput(true);
- httpConn.setDoOutput(true);
- httpConn.setUseCaches(false);
-
- if (httpConn instanceof HttpsURLConnection) {
- HostnameVerifier hostnameVerifier = new HostnameVerifier() {
- @Override
- public boolean verify(String hostname, SSLSession session) {
- return true;
- }
- };
- ((HttpsURLConnection) httpConn).setHostnameVerifier(hostnameVerifier);
- }
-
- // Write message
- httpConn.setRequestProperty("Content-Length", Integer.toString(msg.length()));
- DataOutputStream outStr = new DataOutputStream(httpConn.getOutputStream());
- outStr.write(msg.getBytes());
- outStr.close();
-
- // Read response
- BufferedReader respRdr;
-
- LOG.info("Response: " + httpConn.getResponseCode() + " " + httpConn.getResponseMessage());
-
- if (httpConn.getResponseCode() < 300) {
-
- respRdr = new BufferedReader(new InputStreamReader(httpConn.getInputStream()));
- } else {
- respRdr = new BufferedReader(new InputStreamReader(httpConn.getErrorStream()));
- }
-
- StringBuilder respBuff = new StringBuilder();
-
- String respLn;
-
- while ((respLn = respRdr.readLine()) != null) {
- respBuff.append(respLn).append("\n");
- }
- respRdr.close();
-
- String respString = respBuff.toString();
-
- LOG.info(String.format("Response body :%n%s", respString));
-
- return respString;
- }
-}
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncRANSliceDmaapConsumer.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncRANSliceDmaapConsumer.java
deleted file mode 100644
index f1749f99b..000000000
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncRANSliceDmaapConsumer.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * Modifications Copyright © 2018 IBM.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SdncRANSliceDmaapConsumer extends SdncDmaapConsumerImpl {
-
- private static final Logger LOG = LoggerFactory.getLogger(SdncRANSliceDmaapConsumer.class);
-
- private static final String BODY = "body";
- private static final String RPC = "rpc-name";
-
- @Override
- public void processMsg(String msg) throws InvalidMessageException {
-
- if (msg == null) {
- throw new InvalidMessageException("Null RANSlice message");
- }
-
- ObjectMapper oMapper = new ObjectMapper();
- JsonNode ranSliceRootNode;
- try {
- ranSliceRootNode = oMapper.readTree(msg);
- } catch (Exception e) {
- throw new InvalidMessageException("Cannot parse RANSlice json input", e);
- }
-
- JsonNode bodyNode = ranSliceRootNode.get(BODY);
- if(bodyNode == null) {
- LOG.warn("Missing body in RANSlice message");
- return;
- }
- String rpcMsgbody;
- try {
- ObjectMapper mapper = new ObjectMapper();
- rpcMsgbody = mapper.writeValueAsString(bodyNode);
-
- } catch (Exception e) {
- LOG.error("Unable to parse body in RANSlice message", e);
- return;
- }
-
- JsonNode rpcNode = ranSliceRootNode.get(RPC);
- if(rpcNode == null) {
- LOG.warn("Missing node in RANSlice message- " + RPC);
- return;
- }
- String rpc = rpcNode.textValue();
- String sdncEndpoint = "ran-slice-api:" + rpc;
-
- try {
- String odlUrlBase = getProperty("sdnc.odl.url-base");
- String odlUser = getProperty("sdnc.odl.user");
- String odlPassword = getProperty("sdnc.odl.password");
- LOG.info("POST RANSlice Request " + rpcMsgbody);
- if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) {
- SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + "/" + sdncEndpoint, odlUser, odlPassword);
-
- conn.send("POST", "application/json", rpcMsgbody);
- } else {
- LOG.warn("Unable to POST RANSlice message. SDNC URL not available. body:\n" + rpcMsgbody);
- }
- } catch (Exception e) {
- LOG.error("Unable to process message", e);
- }
- }
-}
diff --git a/dmaap-listener/src/main/resources/anr-changes-from-policy-to-sdnr.map b/dmaap-listener/src/main/resources/anr-changes-from-policy-to-sdnr.map
deleted file mode 100644
index 5cd2b8371..000000000
--- a/dmaap-listener/src/main/resources/anr-changes-from-policy-to-sdnr.map
+++ /dev/null
@@ -1,5 +0,0 @@
-# SDN-C URL
-SDNC.endpoint => SLI-API:execute-graph
-
-# Field mapping
-SDNC.template => anr-pci-changes-from-policy-to-sdnr.vt
diff --git a/dmaap-listener/src/main/resources/anr-pci-changes-from-policy-to-sdnr.vt b/dmaap-listener/src/main/resources/anr-pci-changes-from-policy-to-sdnr.vt
deleted file mode 100644
index 1ded88dc7..000000000
--- a/dmaap-listener/src/main/resources/anr-pci-changes-from-policy-to-sdnr.vt
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "input": {
- "module-name": "oofpcipoc-api",
- "rpc-name": "$rpc_name",
- "mode": "sync",
- "sli-parameter": $sli_parameters
- }
-}
diff --git a/dmaap-listener/src/main/resources/edgeRouterStatusChange.map b/dmaap-listener/src/main/resources/edgeRouterStatusChange.map
deleted file mode 100644
index fa5ff0784..000000000
--- a/dmaap-listener/src/main/resources/edgeRouterStatusChange.map
+++ /dev/null
@@ -1,44 +0,0 @@
-# SDN-C URL
-SDNC.endpoint => FLOWRED-API:process-edge-router-status-change
-
-# Field mapping
-equip_id => equip_id
-ptnii_equip_name => equip-name
-equip_type.equip_type => equip-type
-ip_addr => loopback0
-router_prov_status => prov-status
-country.region => region
-country_abbr => country
-equip_name_code => equip-name-code
-as_number => as-number
-loopback1 => loopback1
-loopback2 => loopback2
-loopback3 => loopback3
-loopback40 => loopback40
-loopback65535 => loopback65535
-inms_list => inms-list
-encrypted_access_flag => encrypted-access-flag
-sw_name => sw-name
-nmipaddr => nm-addr
-function_code => function-code
-
-EquipmentId => equip-id
-PTNIIEquipmentName => equip-name
-EquipmentType => equip-type
-Loopback0 => loopback0
-RouterStatus => prov-status
-Region => region
-CountryAbbreviation => country
-EquipmentNameCode => equip-name-code
-ASNumber => as-number
-SoftwareName => sw-name
-NetworkManagementIPAddress => nm-addr
-FunctionCode => function-code
-Loopback1 => loopback1
-Loopback2 => loopback2
-Loopback3 => loopback3
-Loopback40 => loopback40
-Loopback65535 => loopback65535
-InmsList => inms-list
-EncryptedAccessFlag => encrypted-access-flag
-
diff --git a/dmaap-listener/src/main/resources/esr-thirdparty-sdnc.map b/dmaap-listener/src/main/resources/esr-thirdparty-sdnc.map
deleted file mode 100644
index 603645ebe..000000000
--- a/dmaap-listener/src/main/resources/esr-thirdparty-sdnc.map
+++ /dev/null
@@ -1,5 +0,0 @@
-# SDN-C URL
-SDNC.endpoint => DataChange:data-change-notification
-
-# Field mapping
-SDNC.template => template-esr-thirdparty-sdnc.vt
diff --git a/dmaap-listener/src/main/resources/generic-vnf.map b/dmaap-listener/src/main/resources/generic-vnf.map
deleted file mode 100644
index bc375eb28..000000000
--- a/dmaap-listener/src/main/resources/generic-vnf.map
+++ /dev/null
@@ -1,5 +0,0 @@
-# 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/log4j2.xml b/dmaap-listener/src/main/resources/log4j2.xml
deleted file mode 100644
index 01ee93714..000000000
--- a/dmaap-listener/src/main/resources/log4j2.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<Configuration status="debug">
- <Properties>
- <Property name="logDir">$${env:LOGDIR:-logs}</Property>
- </Properties>
- <Appenders>
- <RollingFile name="LOGFILE" fileName="${logDir}/dmaap-listener.log"
- filePattern="${logDir}/dmaap-listener-%i.log">
- <PatternLayout pattern="%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n" />
- <Policies>
- <SizeBasedTriggeringPolicy size="10 MB" />
- </Policies>
- <DefaultRolloverStrategy max="10"/>
- </RollingFile>
- <Console name="CONSOLE" target="SYSTEM_OUT">
- <PatternLayout pattern="%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n" />
- </Console>
- </Appenders>
- <Loggers>
- <Root level="debug">
- <AppenderRef ref="LOGFILE"/>
- <AppenderRef ref="CONSOLE"/>
- </Root>
- </Loggers>
-</Configuration> \ No newline at end of file
diff --git a/dmaap-listener/src/main/resources/pci-changes-from-policy-to-sdnr.map b/dmaap-listener/src/main/resources/pci-changes-from-policy-to-sdnr.map
deleted file mode 100644
index 5cd2b8371..000000000
--- a/dmaap-listener/src/main/resources/pci-changes-from-policy-to-sdnr.map
+++ /dev/null
@@ -1,5 +0,0 @@
-# SDN-C URL
-SDNC.endpoint => SLI-API:execute-graph
-
-# Field mapping
-SDNC.template => anr-pci-changes-from-policy-to-sdnr.vt
diff --git a/dmaap-listener/src/main/resources/preferredRoute.txt b/dmaap-listener/src/main/resources/preferredRoute.txt
deleted file mode 100644
index 662b0aa7d..000000000
--- a/dmaap-listener/src/main/resources/preferredRoute.txt
+++ /dev/null
@@ -1 +0,0 @@
-preferredRouteKey=MR1 \ No newline at end of file
diff --git a/dmaap-listener/src/main/resources/pserver.map b/dmaap-listener/src/main/resources/pserver.map
deleted file mode 100644
index 8b3e463e7..000000000
--- a/dmaap-listener/src/main/resources/pserver.map
+++ /dev/null
@@ -1,5 +0,0 @@
-# SDN-C URL
-SDNC.endpoint => config-selfservice-api:notification-callback
-
-# Field mapping
-SDNC.template => template-pserver.vt
diff --git a/dmaap-listener/src/main/resources/template-esr-thirdparty-sdnc.vt b/dmaap-listener/src/main/resources/template-esr-thirdparty-sdnc.vt
deleted file mode 100644
index 225fce026..000000000
--- a/dmaap-listener/src/main/resources/template-esr-thirdparty-sdnc.vt
+++ /dev/null
@@ -1,100 +0,0 @@
-{
- "DataChange:input": {
- "DataChange:aai-node-type": "$entitytype",
- "DataChange:selflink": "$entitylink",
- "DataChange:aai-event-id": "$id",
- "DataChange:aai-event-trigger": "$action",
- "DataChange:key-data": [{
- "DataChange:key-name": "thirdparty-sdnc-id",
- "DataChange:key-value": "$thirdpartysdncid"
- },
- {
- "DataChange:key-name": "resource-version",
- "DataChange:key-value": "$resourceversion"
- },
- {
- "DataChange:key-name": "location",
- "DataChange:key-value": "$location"
- },
- {
- "DataChange:key-name": "product-name",
- "DataChange:key-value": "$productname"
- },
- {
- "DataChange:key-name": "esr-system-info-id",
- "DataChange:key-value": "$esrsysteminfoid"
- },
- {
- "DataChange:key-name": "system-type",
- "DataChange:key-value": "$systemtype"
- },
- {
- "DataChange:key-name": "service-url",
- "DataChange:key-value": "$serviceurl"
- },
- {
- "DataChange:key-name": "ssl-cacert",
- "DataChange:key-value": "$sslcacert"
- },
- {
- "DataChange:key-name": "type",
- "DataChange:key-value": "$type"
- },
- {
- "DataChange:key-name": "ssl-insecure",
- "DataChange:key-value": "$sslinsecure"
- },
- {
- "DataChange:key-name": "system-status",
- "DataChange:key-value": "$systemstatus"
- },
- {
- "DataChange:key-name": "version",
- "DataChange:key-value": "$version"
- },
- {
- "DataChange:key-name": "passive",
- "DataChange:key-value": "$passive"
- },
- {
- "DataChange:key-name": "password",
- "DataChange:key-value": "$password"
- },
- {
- "DataChange:key-name": "protocol",
- "DataChange:key-value": "$protocol"
- },
- {
- "DataChange:key-name": "ip-address",
- "DataChange:key-value": "$ipaddress"
- },
- {
- "DataChange:key-name": "cloud-domain",
- "DataChange:key-value": "$clouddomain"
- },
- {
- "DataChange:key-name": "user-name",
- "DataChange:key-value": "$username"
- },
- {
- "DataChange:key-name": "system-name",
- "DataChange:key-value": "$systemname"
- },
- {
- "DataChange:key-name": "port",
- "DataChange:key-value": "$port"
- },
- {
- "DataChange:key-name": "vendor",
- "DataChange:key-value": "$vendor"
- },
- {
- "DataChange:key-name": "remote-path",
- "DataChange:key-value": "$remotepath"
- },
- {
- "DataChange:key-name": "default-tenant",
- "DataChange:key-value": "$defaulttenant"
- }]
- }
-}
diff --git a/dmaap-listener/src/main/resources/template-generic-vnf.vt b/dmaap-listener/src/main/resources/template-generic-vnf.vt
deleted file mode 100644
index d57c9a0a4..000000000
--- a/dmaap-listener/src/main/resources/template-generic-vnf.vt
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "input": {
- "common-header": {
- "request-id": "$req_id",
- "timestamp": "$curr_time",
- "originator-id": "AAI",
- "api-ver": "2.00"
- },
- "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
deleted file mode 100644
index d57c9a0a4..000000000
--- a/dmaap-listener/src/main/resources/template-pserver.vt
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "input": {
- "common-header": {
- "request-id": "$req_id",
- "timestamp": "$curr_time",
- "originator-id": "AAI",
- "api-ver": "2.00"
- },
- "payload": $full_message
- }
-} \ No newline at end of file
diff --git a/dmaap-listener/src/main/scripts/start-dmaap-listener.sh b/dmaap-listener/src/main/scripts/start-dmaap-listener.sh
deleted file mode 100644
index f767d3cd1..000000000
--- a/dmaap-listener/src/main/scripts/start-dmaap-listener.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/bash
-
-###
-# ============LICENSE_START=======================================================
-# openECOMP : SDN-C
-# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights
-# reserved.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ============LICENSE_END=========================================================
-###
-
-PROPERTY_DIR=${PROPERTY_DIR:-/opt/onap/ccsdk/data/properties}
-
-LISTENER=dmaap-listener
-
-
-
-PIDFILE=/tmp/.${LISTENER}-pid
-UEBLISTENERROOT=${UEBLISTENERROOT:-/opt/onap/dmaap-listener}
-JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-8-oracle}
-JAVA_OPTS=${JAVA_OPTS:--Dhttps.protocols=TLSv1.1,TLSv1.2}
-JAVA=${JAVA:-${JAVA_HOME}/bin/java}
-
-# Redirect output from script to $LISTENER.out
-exec >> ${UEBLISTENERROOT}/logs/$LISTENER.out
-exec 2>&1
-
-if [ -f $PIDFILE ]
-then
- pid=$(cat $PIDFILE)
- if [ "$pid" != "" ]
- then
- if kill -0 $pid
- then
- echo "$LISTENER already running"
- exit 0
- fi
- fi
-fi
-
-if [ ! -d ${UEBLISTENERROOT}/logs ]
-then
- mkdir ${UEBLISTENERROOT}/logs
-fi
-
-for file in ${UEBLISTENERROOT}/lib/*.jar
-do
- LISTENERCLASSPATH=$LISTENERCLASSPATH:$file
-done
-
-${JAVA} ${JAVA_OPTS} -Dlog4j.configuration=file:${UEBLISTENERROOT}/lib/log4j.properties -cp ${LISTENERCLASSPATH} org.onap.ccsdk.sli.northbound.dmaapclient.DmaapListener &
-
-
-echo $! > $PIDFILE
-
-echo "$LISTENER started!"
-exit 0
diff --git a/dmaap-listener/src/main/scripts/stop-dmaap-listener.sh b/dmaap-listener/src/main/scripts/stop-dmaap-listener.sh
deleted file mode 100644
index ab242044f..000000000
--- a/dmaap-listener/src/main/scripts/stop-dmaap-listener.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/bash
-
-###
-# ============LICENSE_START=======================================================
-# openECOMP : SDN-C
-# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights
-# reserved.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ============LICENSE_END=========================================================
-###
-
-PROPERTY_DIR=${PROPERTY_DIR:-/opt/onap/ccsdk/data/properties}
-
-LISTENER=dmaap-listener
-
-
-PIDFILE=/tmp/.${LISTENER}-pid
-UEBLISTENERROOT=${UEBLISTENERROOT:-/opt/onap/dmaap-listener}
-
-if [ -f $PIDFILE ]
-then
- pid=$(cat $PIDFILE)
- if [ "$pid" != "" ]
- then
- if kill -0 $pid
- then
- echo "Stopping $LISTENER"
- kill $pid && rm $PIDFILE
- exit 0
- else
- echo "$LISTENER not running"
- exit 1
- fi
- else
- echo "$LISTENER not running"
- exit 1
- fi
-fi
-
-
diff --git a/dmaap-listener/src/site/apt/index.apt b/dmaap-listener/src/site/apt/index.apt
deleted file mode 100644
index 370ddd4db..000000000
--- a/dmaap-listener/src/site/apt/index.apt
+++ /dev/null
@@ -1,46 +0,0 @@
-~~~
-~~ ============LICENSE_START=======================================================
-~~ openECOMP : SDN-C
-~~ ================================================================================
-~~ Copyright (C) 2017 AT&T Intellectual Property. All rights
-~~ reserved.
-~~ ================================================================================
-~~ Licensed under the Apache License, Version 2.0 (the "License");
-~~ you may not use this file except in compliance with the License.
-~~ You may obtain a copy of the License at
-~~
-~~ http://www.apache.org/licenses/LICENSE-2.0
-~~
-~~ Unless required by applicable law or agreed to in writing, software
-~~ distributed under the License is distributed on an "AS IS" BASIS,
-~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-~~ See the License for the specific language governing permissions and
-~~ limitations under the License.
-~~ ============LICENSE_END=========================================================
-~~~
-
- ---
- UEB Listener
- ---
-
-
-UEB Listener
-
- The UEB Listener is a daemon that listens for notifications from SDC, posted to UEB (Universal Event Bus).
- On receipt of an event, the UEB listener downloads any artifacts posted and examines them to determine if
- the format (the outer XML tag) matches a supported format. If so, it posts the file to the ASDC-API REST
- API in order to update the SDN-C database.
-
-File Locations
-
- * Root directory : /opt/app/ueb-listener
-
- * Log files : /opt/app/ueb-listener/logs
-
- * Incoming files to be processed : /opt/app/ueb-listener/spool/asdc/incoming
-
- * Files already processed : /opt/app/ueb-listener/spool/asdc/archive
-
-
-
-
diff --git a/dmaap-listener/src/site/site.xml b/dmaap-listener/src/site/site.xml
deleted file mode 100644
index 6b97d925e..000000000
--- a/dmaap-listener/src/site/site.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ============LICENSE_START=======================================================
- openECOMP : SDN-C
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights
- reserved.
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- -->
-
-<project>
-
- <body>
- <menu ref="modules"/>
-
- <menu ref="reports"/>
-
- </body>
-</project>
diff --git a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientJdkTest.java b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientJdkTest.java
deleted file mode 100644
index 03f832801..000000000
--- a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientJdkTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Properties;
-import org.junit.Test;
-
-public class MessageRouterHttpClientJdkTest {
- public MessageRouterHttpClientJdk getClient() throws MalformedURLException {
- Properties properties = new Properties();
- properties.put("username", "my_user");
- properties.put("password", "my_password");
- properties.put("topic", "network_automation");
- properties.put("group", "message_processors");
- properties.put("host", "dmaap-server.com");
- properties.put("id", "machine_one");
- properties.put("fetchPause", "3000");
- MessageRouterHttpClientJdk client = new MessageRouterHttpClientJdk();
- client.processProperties(properties);
- return client;
- }
-
- @Test
- public void processMsg() throws InvalidMessageException, MalformedURLException {
- MessageRouterHttpClientJdk client = getClient();
- client.processMsg(null);
- }
-
- @Test
- public void isReady() throws InvalidMessageException, MalformedURLException {
- MessageRouterHttpClientJdk client = getClient();
- assertEquals(true, client.isReady());
- }
-
- @Test
- public void isRunning() throws InvalidMessageException, MalformedURLException {
- MessageRouterHttpClientJdk client = getClient();
- assertEquals(false, client.isRunning());
- }
-
- @Test
- public void buidUrl() throws InvalidMessageException, MalformedURLException {
- MessageRouterHttpClientJdk client = getClient();
- assertEquals(new URL(
- "http://dmaap-server.com/events/network_automation/message_processors/machine_one?timeout=15000"),
- client.url);
- }
-
- @Test
- public void buidUrlWithFilter() throws InvalidMessageException, MalformedURLException {
- Properties properties = new Properties();
- properties.put("username", "my_user");
- properties.put("password", "my_password");
- properties.put("topic", "network_automation");
- properties.put("group", "message_processors");
- properties.put("host", "dmaap-server.com");
- properties.put("id", "machine_one");
- properties.put("filter", "{\"class\":\"Contains\",\"string\":\"hello\",\"value\":\"world\"}");
- properties.put("fetchPause", "3000");
- MessageRouterHttpClientJdk client = new MessageRouterHttpClientJdk();
- client.processProperties(properties);
- assertEquals(new URL(
- "http://dmaap-server.com/events/network_automation/message_processors/machine_one?timeout=15000&filter=%7B%22class%22%3A%22Contains%22%2C%22string%22%3A%22hello%22%2C%22value%22%3A%22world%22%7D"),
- client.url);
- }
-
- @Test
- public void buildAuthorizationString() throws InvalidMessageException, MalformedURLException {
- MessageRouterHttpClientJdk client = getClient();
- String authString = client.buildAuthorizationString("Hello", "World");
- assertEquals("Basic SGVsbG86V29ybGQ=", authString);
- }
-
- @Test
- public void clientFromProperties() throws InvalidMessageException, MalformedURLException {
- MessageRouterHttpClientJdk client = new MessageRouterHttpClientJdk();
- Properties props = new Properties();
- client.init(props, "src/test/resources/dmaap-consumer-1.properties");
- assertEquals(new URL(
- "http://localhost:3904/events/ccsdk-topic/ccsdk-unittest/ccsdk_unittest?timeout=15000&limit=1000"),
- client.url);
- }
-
- @Test
- public void buildHttpURLConnection() throws InvalidMessageException, IOException {
- MessageRouterHttpClientJdk client = getClient();
- HttpURLConnection connection = client.buildHttpURLConnection();
- assertEquals("GET", connection.getRequestMethod());
- assertTrue(connection.getRequestProperties().get("Accept").contains("application/json"));
- assertEquals(false, connection.getUseCaches());
- Integer defaultConnectTimeout = Integer.valueOf(client.DEFAULT_CONNECT_TIMEOUT);
- Integer defaultReadTimeout = Integer.valueOf(client.DEFAULT_READ_TIMEOUT);
- assertEquals(defaultConnectTimeout.intValue(), connection.getConnectTimeout());
- assertEquals(defaultReadTimeout.intValue(), connection.getReadTimeout());
- }
-}
diff --git a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientTest.java b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientTest.java
deleted file mode 100644
index 7567e2a9e..000000000
--- a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import static org.junit.Assert.assertEquals;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Properties;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import org.junit.Test;
-
-public class MessageRouterHttpClientTest {
-
- class MockMessageRouterHttpClient extends MessageRouterHttpClient {
- protected Client getClient(Integer connectTimeoutSeconds, Integer readTimeoutMinutes) {
- ClientBuilder clientBuilder = ClientBuilder.newBuilder();
- return clientBuilder.build();
- }
- }
-
- public MessageRouterHttpClient getClient() {
- Properties properties = new Properties();
- properties.put("username", "my_user");
- properties.put("password", "my_password");
- properties.put("topic", "network_automation");
- properties.put("group", "message_processors");
- properties.put("host", "dmaap-server.com");
- properties.put("id", "machine_one");
- properties.put("fetch", "machine_one");
-
- MockMessageRouterHttpClient client = new MockMessageRouterHttpClient();
- client.processProperties(properties);
- return client;
- }
-
- @Test
- public void processMsg() throws InvalidMessageException, MalformedURLException {
- MessageRouterHttpClient client = getClient();
- client.processMsg(null);
- }
-
- @Test
- public void isReady() throws InvalidMessageException, MalformedURLException {
- MessageRouterHttpClient client = getClient();
- assertEquals(true, client.isReady());
- }
-
- @Test
- public void isRunning() throws InvalidMessageException, MalformedURLException {
- MessageRouterHttpClient client = getClient();
- assertEquals(false, client.isRunning());
- }
-
- @Test
- public void buidUrl() throws InvalidMessageException, MalformedURLException, URISyntaxException {
- MessageRouterHttpClient client = getClient();
- assertEquals(new URI(
- "http://dmaap-server.com/events/network_automation/message_processors/machine_one?timeout=15000"),
- client.uri);
- }
-
- @Test
- public void buidUrlWithFilter() throws InvalidMessageException, MalformedURLException, URISyntaxException {
- Properties properties = new Properties();
- properties.put("username", "my_user");
- properties.put("password", "my_password");
- properties.put("topic", "network_automation");
- properties.put("group", "message_processors");
- properties.put("host", "dmaap-server.com");
- properties.put("id", "machine_one");
- properties.put("filter", "{\"class\":\"Contains\",\"string\":\"hello\",\"value\":\"world\"}");
- properties.put("fetchPause", "3000");
- MessageRouterHttpClient client = new MockMessageRouterHttpClient();
- client.processProperties(properties);
- assertEquals(new URI(
- "http://dmaap-server.com/events/network_automation/message_processors/machine_one?timeout=15000&filter=%7B%22class%22%3A%22Contains%22%2C%22string%22%3A%22hello%22%2C%22value%22%3A%22world%22%7D"),
- client.uri);
- }
-
- @Test
- public void buildAuthorizationString() throws InvalidMessageException, MalformedURLException {
- MessageRouterHttpClient client = getClient();
- String authString = client.buildAuthorizationString("Hello", "World");
- assertEquals("Basic SGVsbG86V29ybGQ=", authString);
- }
-
- @Test
- public void clientFromProperties() throws InvalidMessageException, MalformedURLException, URISyntaxException {
- MessageRouterHttpClient client = new MockMessageRouterHttpClient();
- Properties props = new Properties();
- client.init(props, "src/test/resources/dmaap-consumer-1.properties");
- assertEquals(new URI(
- "http://localhost:3904/events/ccsdk-topic/ccsdk-unittest/ccsdk_unittest?timeout=15000&limit=1000"),
- client.uri);
- }
-
-}
diff --git a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncFlatJsonDmaapConsumerTest.java b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncFlatJsonDmaapConsumerTest.java
deleted file mode 100644
index d1aee634d..000000000
--- a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncFlatJsonDmaapConsumerTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import static org.junit.Assert.*;
-
-
-import java.io.File;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class SdncFlatJsonDmaapConsumerTest {
-
- private static final String DMAAP_LISTENER_PROPERTIES = "dmaap-listener.properties";
- private static final String DMAAP_LISTENER_PROPERTIES_DIR = "src/test/resources";
-
- SdncFlatJsonDmaapConsumer consumer;
-
- @Before
- public void setUp() throws Exception {
- consumer = new SdncFlatJsonDmaapConsumer();
- }
-
- @Test(expected = InvalidMessageException.class)
- public void testProcessMsgString_NullInvalidMessageException() throws InvalidMessageException {
- // expected = InvalidMessageException: Null message
- consumer.processMsg(null);
- }
-
- @Test(expected = InvalidMessageException.class)
- public void testProcessMsgString_UnformatedMessageInvalidMessageException() throws InvalidMessageException {
- // expected = InvalidMessageException: Cannot parse json object
- consumer.processMsg("TESTING", null);
- }
-
- @Test(expected = InvalidMessageException.class)
- public void testing()throws InvalidMessageException {
- // Expected = InvalidMessageException: Unable to process message - cannot load field mappings
- String msg = "{\"test\":\"string\"}";
- consumer.processMsg(msg, null);
- }
-} \ No newline at end of file
diff --git a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestA1AdapterPolicyDmaapConsumer.java b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestA1AdapterPolicyDmaapConsumer.java
deleted file mode 100644
index 8b7044f69..000000000
--- a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestA1AdapterPolicyDmaapConsumer.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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 TestA1AdapterPolicyDmaapConsumer {
- private static final String a1AdapterInput = "{\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\": \"getHealthCheck\",\n" +
- " \"Payload\": {\n" +
- " \"near-rt-ric-id\": \"near-RT-ric1\",\n" +
- " \"policy-type-id\": \"20000\",\n" +
- " \"description\": \"parameters to control policy \",\n" +
- " \"name\": \"admission_control_policy\",\n" +
- " \"policy-type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"version\": \"1.0\",\n" +
- " \"rpc-name\": \"getHealthCheck\",\n" +
- " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" +
- " \"type\": \"request\"\n" +
- " }\n" +
- "}";
-
- @Test
- public void test() throws Exception {
- Properties props = new Properties();
-
- A1AdapterPolicyDmaapConsumer consumer = new A1AdapterPolicyDmaapConsumer();
- InputStream propStr = TestA1AdapterPolicyDmaapConsumer.class.getResourceAsStream("/dmaap-consumer-a1Adapter-policy-1.properties");
- props.load(propStr);
- consumer.init(props, "src/test/resources/dmaap-consumer-1.properties");
- consumer.processMsg(a1AdapterInput);
- }
-
- @Test(expected = InvalidMessageException.class)
- public void testProcessMsgNullMessage() throws Exception {
- A1AdapterPolicyDmaapConsumer consumer = new A1AdapterPolicyDmaapConsumer();
- consumer.processMsg(null);
- }
-
- @Test
- public void testProcessMsgMissingBody() throws Exception {
- String msg = "{\n" +
- " \"body1\": {\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\": \"getHealthCheck\",\n" +
- " \"Payload\": {\n" +
- " \"near-rt-ric-id\": \"near-RT-ric1\",\n" +
- " \"policy-type-id\": \"20000\",\n" +
- " \"description\": \"parameters to control policy \",\n" +
- " \"name\": \"admission_control_policy\",\n" +
- " \"policy-type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"version\": \"1.0\",\n" +
- " \"rpc-name\": \"getHealthCheck\",\n" +
- " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" +
- " \"type\": \"request\"\n" +
- " }\n" +
- "}";
-
- A1AdapterPolicyDmaapConsumer consumer = new A1AdapterPolicyDmaapConsumer();
- 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\": \"getHealthCheck\",\n" +
- " \"Payload\": {\n" +
- " \"near-rt-ric-id\": \"near-RT-ric1\",\n" +
- " \"policy-type-id\": \"20000\",\n" +
- " \"description\": \"parameters to control policy \",\n" +
- " \"name\": \"admission_control_policy\",\n" +
- " \"policy-type\": \"object\"\n" +
- " }\n" +
- " },\n" +
- " \"version\": \"1.0\",\n" +
- " \"rpc-name1\": \"getHealthCheck\",\n" +
- " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" +
- " \"type\": \"request\"\n" +
- " }\n" +
- "}";
-
- A1AdapterPolicyDmaapConsumer consumer = new A1AdapterPolicyDmaapConsumer();
- consumer.processMsg(msg);
- }
-
-}
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
deleted file mode 100644
index 122a6d40b..000000000
--- a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestCMNotifyDmaapConsumer.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestDmaapListener.java b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestDmaapListener.java
deleted file mode 100644
index 943ef0204..000000000
--- a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestDmaapListener.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import static org.junit.Assert.*;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TestDmaapListener {
-
- private static final String DMAAP_LISTENER_PROPERTIES = "dmaap-listener.properties";
- private static final String DMAAP_LISTENER_PROPERTIES_DIR = "src/test/resources";
-
- private static final Logger LOG = LoggerFactory.getLogger(TestDmaapListener.class);
-
- @Before
- public void setUp() throws Exception {
- }
-
- @Test
- public void test() {
- Properties properties = new Properties();
- String propFileName = DMAAP_LISTENER_PROPERTIES;
- String propPath = null;
- String propDir = DMAAP_LISTENER_PROPERTIES_DIR;
-
- List<SdncDmaapConsumer> consumers = new LinkedList<>();
-
-
- propPath = propDir + "/" + propFileName;
-
- if (propPath != null) {
- properties = DmaapListener.loadProperties(propPath, properties);
-
- String subscriptionStr = properties.getProperty("subscriptions");
-
- boolean threadsRunning = false;
-
- LOG.debug("Dmaap subscriptions : " + subscriptionStr);
-
- if (subscriptionStr != null) {
- threadsRunning = DmaapListener.handleSubscriptions(subscriptionStr, propDir, properties, consumers);
- }
- }
- }
-
-}
diff --git a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestDummyDmaapConsumer.java b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestDummyDmaapConsumer.java
deleted file mode 100644
index 47330c622..000000000
--- a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestDummyDmaapConsumer.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class TestDummyDmaapConsumer {
- private static final String DMAAP_LISTENER_PROPERTIES = "dmaap-listener.properties";
- private static final String DMAAP_LISTENER_PROPERTIES_DIR = "src/test/resources";
-
- DummyDmaapConsumer consumer = new DummyDmaapConsumer();
-
- @Test
- public void testProcessMsg(){
- consumer.processMsg(null);
- }
-
-}
diff --git a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestOofPciPocDmaapConsumers.java b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestOofPciPocDmaapConsumers.java
deleted file mode 100644
index cd2ea6eb0..000000000
--- a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestOofPciPocDmaapConsumers.java
+++ /dev/null
@@ -1,314 +0,0 @@
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-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 TestOofPciPocDmaapConsumers {
-
- private static final String pciChangesFromPolicyToSDNRInput = "{\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\": \"ModifyConfig\",\n" +
- " \"Payload\": \"{\\\"Configurations\\\":[{\\\"data\\\":{\\\"FAPService\\\":{\\\"alias\\\":\\\"Chn0330\\\",\\\"X0005b9Lte\\\":{\\\"phyCellIdInUse\\\":6,\\\"pnfName\\\":\\\"ncserver23\\\"},\\\"CellConfig\\\":{\\\"LTE\\\":{\\\"RAN\\\":{\\\"Common\\\":{\\\"CellIdentity\\\":\\\"Chn0330\\\"}}}}}}},{\\\"data\\\":{\\\"FAPService\\\":{\\\"alias\\\":\\\"Chn0331\\\",\\\"X0005b9Lte\\\":{\\\"phyCellIdInUse\\\":7,\\\"pnfName\\\":\\\"ncserver23\\\"},\\\"CellConfig\\\":{\\\"LTE\\\":{\\\"RAN\\\":{\\\"Common\\\":{\\\"CellIdentity\\\":\\\"Chn0331\\\"}}}}}}}]}\"\n" +
- " }\n" +
- " },\n" +
- " \"version\": \"1.0\",\n" +
- " \"rpc-name\": \"modifyconfig\",\n" +
- " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" +
- " \"type\": \"request\"\n" +
- "}";
-
- private static final String anrChangesFromPolicyToSDNRInput = "{\n" +
- " \"body\": {\n" +
- " \"input\": {\n" +
- " \"CommonHeader\": {\n" +
- " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" +
- " \"APIVer\": \"1.0\",\n" +
- " \"RequestID\": \"722ee65a-8afd-48df-bf57-c152ae45bacc\",\n" +
- " \"SubRequestID\": \"1\",\n" +
- " \"RequestTrack\": {},\n" +
- " \"Flags\": {}\n" +
- " },\n" +
- "\"Action\": \"ModifyConfigANR\",\n" +
- " \"Payload\": \"{ \\\"Configurations\\\":[ { \\\"data\\\":{ \\\"FAPService\\\":{ \\\"alias\\\":\\\"Cell1\\\", \\\"CellConfig\\\":{ \\\"LTE\\\":{ \\\"RAN\\\":{ \\\"Common\\\":{ \\\"CellIdentity\\\":\\\"1\\\" }, \\\"NeighborListInUse\\\" : { \\\"LTECellNumberOfEntries\\\" : \\\"1\\\" , \\\"LTECell\\\" : [{ \\\"PLMNID\\\" :\\\"plmnid1\\\", \\\"CID\\\":\\\"Chn0001\\\", \\\"PhyCellID\\\":\\\"3\\\", \\\"PNFName\\\":\\\"ncserver01\\\", \\\"Blacklisted\\\":\\\"false\\\"}] } } } } } } } ] }\"\n" +
- " }\n" +
- " },\n" +
- " \"version\": \"1.0\",\n" +
- " \"rpc-name\": \"modifyconfiganr\",\n" +
- " \"correlation-id\": \"722ee65a-8afd-48df-bf57-c152ae45bacc-1\",\n" +
- " \"type\": \"request\"\n" +
- "}\n" +
- "";
-
- @Before
- public void setUp() throws Exception {
- }
-
- /* ---------- PCI Changes DMAAP messages test cases ------------------- */
-
- @Test
- public void testPCIChangesDmaapRPCMessageBodyResponse() throws Exception {
- Properties props = new Properties();
-
- ObjectMapper oMapper = new ObjectMapper();
- JsonNode pciChangesRootNode = oMapper.readTree(pciChangesFromPolicyToSDNRInput);
- JsonNode body = pciChangesRootNode.get("body");
- JsonNode input = body.get("input");
- JsonNode payload = input.get("Payload");
- String payloadText = payload.asText();
- JsonNode configurationsJsonNode = oMapper.readTree(payloadText);
-
- String rpcMsgbody = new OofPciPocDmaapConsumers(props).publish("src/main/resources/anr-pci-changes-from-policy-to-sdnr.vt", pciChangesFromPolicyToSDNRInput,configurationsJsonNode, true, false);
-
- JsonNode rootNode;
- try {
- rootNode = oMapper.readTree(rpcMsgbody);
- } catch (Exception e) {
- throw new InvalidMessageException("Cannot parse json object", e);
- }
-
- assertTrue(rootNode.get("input").get("module-name") != null);
- assertTrue(rootNode.get("input").get("rpc-name") != null);
- assertTrue(rootNode.get("input").get("mode") != null);
- assertTrue(rootNode.get("input").get("sli-parameter") != null);
-
- }
-
- @Test(expected = InvalidMessageException.class)
- public void testPCIChangesDmaapProcessMsgNullMessage() throws Exception {
- OofPciPocDmaapConsumers consumer = new OofPciPocDmaapConsumers();
- consumer.processMsg(null);
- }
-
- @Test(expected = InvalidMessageException.class)
- public void testPCIChangesDmaapProcessMsgInvalidMessage() throws Exception {
- OofPciPocDmaapConsumers consumer = new OofPciPocDmaapConsumers();
- consumer.processMsg("test");
- }
-
- @Test
- public void testPCIChangesDmaapProcessMsgMissingActionHeader() throws Exception {
- OofPciPocDmaapConsumers consumer = new OofPciPocDmaapConsumers();
- consumer.processMsg("{\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" +
- " \"RenamedAction\": \"ModifyConfig\",\n" +
- " \"Payload\": {\n" +
- " \"Configurations \": {\n" +
- " \"data \": {\n" +
- " \"FAPService \": {\n" +
- " \"alias\": \"Chn0330\",\n" +
- " \"X0005b9Lte\": {\n" +
- " \"phyCellIdInUse\": 6,\n" +
- " \"pnfName\": \"ncserver23\"\n" +
- " },\n" +
- " \"CellConfig\": {\n" +
- " \"LTE\": {\n" +
- " \"RAN\": {\n" +
- " \"Common\": {\n" +
- " \"CellIdentity\": \"Chn0330\"\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "\n" +
- " }\n" +
- " }\n" +
- " },\n" +
- " \"version\": \"1.0\",\n" +
- " \"rpc-name\": \"modifyconfig\",\n" +
- " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" +
- " \"type\": \"request\"\n" +
- "}");
- }
-
- @Test
- public void testPCIChangesDmaapProcessMsgInvalidPayloadConfigurations() 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\": \"ModifyConfig\",\n" +
- " \"Payload\": {\n" +
- " \"Configurations \": {\n" +
- " \"data \": {\n" +
- " \"FAPService \": {\n" +
- " \"alias\": \"Chn0330\",\n" +
- " \"X0005b9Lte\": {\n" +
- " \"phyCellIdInUse\": 6,\n" +
- " \"pnfName\": \"ncserver23\"\n" +
- " },\n" +
- " \"CellConfig\": {\n" +
- " \"LTE\": {\n" +
- " \"RAN\": {\n" +
- " \"Common\": {\n" +
- " \"CellIdentity\": \"Chn0330\"\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "\n" +
- " }\n" +
- " }\n" +
- " },\n" +
- " \"version\": \"1.0\",\n" +
- " \"rpc-name\": \"modifyconfig\",\n" +
- " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" +
- " \"type\": \"request\"\n" +
- "}";
-
- try {
- OofPciPocDmaapConsumers consumer = new OofPciPocDmaapConsumers();
- consumer.processMsg(msg);
-
- } catch (final InvalidMessageException e) {
- final String errorMsg = "Configurations is not of Type Array. Could not read configuration changes";
- assertEquals(errorMsg, e.getMessage());
- }
- }
-
- /* ---------- PCI Changes DMAAP messages test cases ------------------- */
-
- /* ---------- ANR Changes DMAAP messages test cases ------------------- */
-
- @Test
- public void testANRChangesDmaapRPCMessageBodyResponse() throws Exception {
- Properties props = new Properties();
-
- ObjectMapper oMapper = new ObjectMapper();
- JsonNode anrChangesRootNode = oMapper.readTree(anrChangesFromPolicyToSDNRInput);
- JsonNode body = anrChangesRootNode.get("body");
- JsonNode input = body.get("input");
- JsonNode payload = input.get("Payload");
- String payloadText = payload.asText();
- JsonNode configurationsJsonNode = oMapper.readTree(payloadText);
- JsonNode configurations = configurationsJsonNode.get("Configurations");
-
- for(JsonNode dataNode:configurations) {
- String rpcMsgbody = new OofPciPocDmaapConsumers(props).publish("src/main/resources/anr-pci-changes-from-policy-to-sdnr.vt", anrChangesFromPolicyToSDNRInput,dataNode, false, true);
-
- JsonNode rootNode;
- try {
- rootNode = oMapper.readTree(rpcMsgbody);
- } catch (Exception e) {
- throw new InvalidMessageException("Cannot parse json object", e);
- }
-
- assertTrue(rootNode.get("input").get("module-name") != null);
- assertTrue(rootNode.get("input").get("rpc-name") != null);
- assertTrue(rootNode.get("input").get("mode") != null);
- assertTrue(rootNode.get("input").get("sli-parameter") != null);
- }
- }
-
- @Test(expected = InvalidMessageException.class)
- public void testANRChangesDmaapProcessMsgNullMessage() throws Exception {
- OofPciPocDmaapConsumers consumer = new OofPciPocDmaapConsumers();
- consumer.processMsg(null);
- }
-
- @Test(expected = InvalidMessageException.class)
- public void testANRChangesDmaapProcessMsgInvalidMessage() throws Exception {
- OofPciPocDmaapConsumers consumer = new OofPciPocDmaapConsumers();
- consumer.processMsg("test");
- }
-
- @Test
- public void testANRChangesDmaapProcessMsgMissingActionHeader() throws Exception {
- OofPciPocDmaapConsumers consumer = new OofPciPocDmaapConsumers();
- consumer.processMsg("{\n" +
- " \"body\": {\n" +
- " \"input\": {\n" +
- " \"CommonHeader\": {\n" +
- " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" +
- " \"APIVer\": \"1.0\",\n" +
- " \"RequestID\": \"722ee65a-8afd-48df-bf57-c152ae45bacc\",\n" +
- " \"SubRequestID\": \"1\",\n" +
- " \"RequestTrack\": {},\n" +
- " \"Flags\": {}\n" +
- " },\n" +
- "\"NoAction\": \"ModifyConfigANR\",\n" +
- " \"Payload\": \"{ \\\"Configurations\\\":[ { \\\"data\\\":{ \\\"FAPService\\\":{ \\\"alias\\\":\\\"Cell1\\\", \\\"CellConfig\\\":{ \\\"LTE\\\":{ \\\"RAN\\\":{ \\\"Common\\\":{ \\\"CellIdentity\\\":\\\"1\\\" }, \\\"NeighborListInUse\\\" : { \\\"LTECellNumberOfEntries\\\" : \\\"1\\\" , \\\"LTECell\\\" : [{ \\\"PLMNID\\\" :\\\"plmnid1\\\", \\\"CID\\\":\\\"Chn0001\\\", \\\"PhyCellID\\\":\\\"3\\\", \\\"PNFName\\\":\\\"ncserver01\\\", \\\"Blacklisted\\\":\\\"false\\\"}] } } } } } } } ] }\"\n" +
- " }\n" +
- " },\n" +
- " \"version\": \"1.0\",\n" +
- " \"rpc-name\": \"modifyconfiganr\",\n" +
- " \"correlation-id\": \"722ee65a-8afd-48df-bf57-c152ae45bacc-1\",\n" +
- " \"type\": \"request\"\n" +
- "}\n" +
- "");
- }
-
- @Test
- public void testANRChangesDmaapProcessMsgInvalidPayloadConfigurations() throws Exception {
- String msg = "{\n" +
- " \"body\": {\n" +
- " \"input\": {\n" +
- " \"CommonHeader\": {\n" +
- " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" +
- " \"APIVer\": \"1.0\",\n" +
- " \"RequestID\": \"722ee65a-8afd-48df-bf57-c152ae45bacc\",\n" +
- " \"SubRequestID\": \"1\",\n" +
- " \"RequestTrack\": {},\n" +
- " \"Flags\": {}\n" +
- " },\n" +
- "\"Action\": \"ModifyConfigANR\",\n" +
- " \"Payload\": \"{ \\\"Configurations\\\":{ { \\\"data\\\":{ \\\"FAPService\\\":{ \\\"alias\\\":\\\"Cell1\\\", \\\"CellConfig\\\":{ \\\"LTE\\\":{ \\\"RAN\\\":{ \\\"Common\\\":{ \\\"CellIdentity\\\":\\\"1\\\" }, \\\"NeighborListInUse\\\" : { \\\"LTECellNumberOfEntries\\\" : \\\"1\\\" , \\\"LTECell\\\" : [{ \\\"PLMNID\\\" :\\\"plmnid1\\\", \\\"CID\\\":\\\"Chn0001\\\", \\\"PhyCellID\\\":\\\"3\\\", \\\"PNFName\\\":\\\"ncserver01\\\", \\\"Blacklisted\\\":\\\"false\\\"}} } } } } } } } ] }\"\n" +
- " }\n" +
- " },\n" +
- " \"version\": \"1.0\",\n" +
- " \"rpc-name\": \"modifyconfiganr\",\n" +
- " \"correlation-id\": \"722ee65a-8afd-48df-bf57-c152ae45bacc-1\",\n" +
- " \"type\": \"request\"\n" +
- "}\n" +
- "";
-
- try {
- OofPciPocDmaapConsumers consumer = new OofPciPocDmaapConsumers();
- consumer.processMsg(msg);
-
- } catch (final InvalidMessageException e) {
- final String errorMsg = "Cannot parse payload value";
- assertEquals(errorMsg, e.getMessage());
- }
- }
-
- /* ---------- ANR Changes DMAAP messages test cases ------------------- */
-}
diff --git a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncDhcpEventConsumer.java b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncDhcpEventConsumer.java
deleted file mode 100644
index 04f098ade..000000000
--- a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncDhcpEventConsumer.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/**
- *
- */
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import static org.junit.Assert.*;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.sql.SQLException;
-import java.util.Properties;
-
-import javax.sql.rowset.CachedRowSet;
-
-import org.junit.After;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import ch.vorburger.mariadb4j.DB;
-import ch.vorburger.mariadb4j.DBConfigurationBuilder;
-
-/**
- * @author dt5972
- *
- */
-public class TestSdncDhcpEventConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(TestSdncDhcpEventConsumer.class);
-
-
- private static final String DHCP_MAP_TABLE = "CREATE TABLE `DHCP_MAP` (\n" +
- " mac_addr varchar(80) NOT NULL,\n" +
- " ip_addr varchar(80),\n" +
- " PRIMARY KEY(`mac_addr`)\n" +
- ")";
-
-
-
- private static final String VALID_DHCP_EVENT = "{\"msg_name\":\"DHCPACK\"," +
- "\"macaddr\":\"fa:16:3e:8f:ea:68\"," +
- "\"yiaddr\":\"10.3.0.2\"}";
- private static final String SECOND_DHCP_EVENT = "{\"msg_name\":\"DHCPACK\"," +
- "\"macaddr\":\"fa:16:3e:8f:ea:68\"," +
- "\"yiaddr\":\"10.3.0.3\"}";
- private static final String MISSING_MSG_NAME_DHCP_EVENT = "{\"macaddr\":\"fa:16:3e:8f:ea:68\"," +
- "\"yiaddr\":\"10.3.0.2\"}";
- private static final String MISSING_MAC_ADDR_DHCP_EVENT = "{\"msg_name\":\"DHCPACK\"," +
- "\"yiaddr\":\"10.3.0.2\"}";
- private static final String MISSING_IP_ADDR_DHCP_EVENT = "{\"msg_name\":\"DHCPACK\"," +
- "\"macaddr\":\"fa:16:3e:8f:ea:68\"}";
-
- private static final String GET_DHCP_MAPPING = "SELECT * FROM DHCP_MAP WHERE mac_addr = 'fa:16:3e:8f:ea:68'";
-
-
- private static DBResourceManager dblibSvc;
- private static DB db;
-
- private static SdncDhcpEventConsumer consumer;
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
-
- LOG.debug("Setting up DHCP event testing");
-
- InputStream propStr = TestSdncDhcpEventConsumer.class.getResourceAsStream("/dblib.properties");
-
- Properties props = new Properties();
-
- props.load(propStr);
-
-
- // Start MariaDB4j database
-
- LOG.debug("Starting MariaDB instance");
- DBConfigurationBuilder config = DBConfigurationBuilder.newBuilder();
- config.setPort(0); // 0 => autom. detect free port
- db = DB.newEmbeddedDB(config.build());
- db.start();
-
-
- // Override jdbc URL and database name
- props.setProperty("org.onap.ccsdk.sli.jdbc.database", "test");
- props.setProperty("org.onap.ccsdk.sli.jdbc.url", config.getURL("test"));
-
-
- // Create dblib connection
-
- LOG.debug("Getting DBResourceManager instance");
- dblibSvc = new DBResourceManager(props);
-
- // Create DHCP_MAP table
- dblibSvc.writeData(DHCP_MAP_TABLE, null, null);
-
- consumer = new SdncDhcpEventConsumer();
- consumer.setJdbcDataSource(dblibSvc);
- LOG.debug("Setup complete");
-
- }
-
-
- @Test
- public void testValid() throws InvalidMessageException, SQLException {
- consumer.processMsg(VALID_DHCP_EVENT);
- consumer.processMsg(SECOND_DHCP_EVENT);
-
- CachedRowSet results = dblibSvc.getData(GET_DHCP_MAPPING, null, null);
-
- if (!results.next()) {
- fail("Test query ["+GET_DHCP_MAPPING+"] returned no data");
- } else {
- String ipAddr = results.getString("ip_addr");
- if (!"10.3.0.3".equals(ipAddr)) {
- fail("Expecting ipAddr to be 10.3.0.3, but was "+ipAddr);
- }
- }
-
- }
-
- @Test (expected = InvalidMessageException.class)
- public void testMissingMsgName() throws InvalidMessageException {
- consumer.processMsg(MISSING_MSG_NAME_DHCP_EVENT);
- }
-
- @Test (expected = InvalidMessageException.class)
- public void testMissingMacAddress() throws InvalidMessageException {
- consumer.processMsg(MISSING_MAC_ADDR_DHCP_EVENT);
- }
-
- @Test (expected = InvalidMessageException.class)
- public void testMissingIpAddress() throws InvalidMessageException {
- consumer.processMsg(MISSING_IP_ADDR_DHCP_EVENT);
- }
-}
diff --git a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncEsrDmaapReceiver.java b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncEsrDmaapReceiver.java
deleted file mode 100644
index 623c96426..000000000
--- a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncEsrDmaapReceiver.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - CCSDK
- * ================================================================================
- * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import org.apache.commons.io.FileUtils;
-import org.junit.Test;
-
-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;
-
-public class TestSdncEsrDmaapReceiver {
- static String aaiInput = "{\"cambria.partition\":\"AAI\",\n" +
- " \"event-header\":\n" +
- " {\n" +
- " \"severity\":\"NORMAL\",\n" +
- " \"entity-type\":\"esr-thirdparty-sdnc\",\n" +
- " \"top-entity-type\":\"esr-thirdparty-sdnc\",\n" +
- " \"entity-link\":\"aai/v11/external-system/esr-thirdparty-sdnc-list/esr-thirdparty-sdnc/IP-WAN-Controller-1\",\n" +
- " \"event-type\":\"AAI-EVENT\",\n" +
- " \"domain\":\"dev\",\n" +
- " \"action\":\"UPDATE\",\n" +
- " \"sequence-number\":\"0\",\n" +
- " \"id\":\"bf4df797-759a-4684-a63c-393b7d40ed55\",\n" +
- " \"source-name\":\"postman\",\n" +
- " \"version\":\"v11\",\n" +
- " \"timestamp\":\"20180104-09:57:58:721\"\n" +
- " },\n" +
- " \"entity\":\n" +
- " {\n" +
- " \"thirdparty-sdnc-id\":\"IP-WAN-Controller-1\",\n" +
- " \"relationship-list\":\n" +
- " {\n" +
- " \"relationship\":\n" +
- " [\n" +
- " {\n" +
- " \"related-to\":\"pnf\",\n" +
- " \"relationship-data\":\n" +
- " [\n" +
- " {\n" +
- " \"relationship-value\":\"a8098c1a-f86e-11da-bd1a-00112444be1e\",\n" +
- " \"relationship-key\":\"pnf.pnf-name\"\n" +
- " }\n" +
- " ],\n" +
- " \"related-link\":\"aai/v11/network/pnfs/pnf/a8098c1a-f86e-11da-bd1a-00112444be1e\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"resource-version\":\"1515059878654\",\n" +
- " \"location\":\"Core\",\n" +
- " \"product-name\":\"AC-WAN\",\n" +
- " \"esr-system-info-list\":\n" +
- " {\"esr-system-info\":\n" +
- " [\n" +
- " {\n" +
- " \"esr-system-info-id\":\"IP-WAN-Controller-ESR-1\",\n" +
- " \"system-type\":\"example-system-type-val-12078\",\n" +
- " \"service-url\":\"https://182.2.61.24:18002\",\n" +
- " \"ssl-cacert\":\"example-ssl-cacert-val-20589\",\n" +
- " \"type\":\"WAN\",\n" +
- " \"ssl-insecure\":true,\n" +
- " \"system-status\":\"example-system-status-val-23435\",\n" +
- " \"version\":\"V3R1\",\n" +
- " \"passive\":true,\n" +
- " \"password\":\"Admin@12345\",\n" +
- " \"protocol\":\"RESTCONF\",\n" +
- " \"ip-address\":\"182.2.61.24\",\n" +
- " \"cloud-domain\":\"example-cloud-domain-val-76077\",\n" +
- " \"user-name\":\"admin\",\n" +
- " \"system-name\":\"IP-WAN-Controller\",\n" +
- " \"port\":\"18002\",\n" +
- " \"vendor\":\"IP-WAN\",\n" +
- " \"resource-version\":\"1515059878666\",\n" +
- " \"remote-path\":\"example-remotepath-val-5833\",\n" +
- " \"default-tenant\":\"example-default-tenant-val-71148\"\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " }\n" +
- " }";
-
- @Test
- public void testProcessMsgInvalidEventType() throws Exception {
- String DMAAPLISTENERROOT = "DMAAPLISTENERROOT";
- File directory = new File("lib");
-
- if (! directory.exists()){
- directory.mkdir();
- }
-
- File source = new File("src/main/resources");
- File dest = new File("lib/");
- try {
- FileUtils.copyDirectory(source, dest);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- try {
- Map<String, String> env = System.getenv();
- Class<?> cl = env.getClass();
- Field field = cl.getDeclaredField("m");
- field.setAccessible(true);
- Map<String, String> writableEnv = (Map<String, String>) field.get(env);
- writableEnv.put(DMAAPLISTENERROOT, ".");
- } catch (Exception e) {
- throw new IllegalStateException("Failed to set environment variable", e);
- }
- Properties props = new Properties();
- InputStream propStr = TestSdncEsrDmaapReceiver.class.getResourceAsStream("/dmaap-consumer-esrsysteminfo.properties");
-
- props.load(propStr);
-
- SdncAaiDmaapConsumer consumer = new SdncAaiDmaapConsumer();
-
- consumer.init(props, "src/test/resources/dmaap-consumer-esrsysteminfo.properties");
- consumer.processMsg(aaiInput);
- }
-}
diff --git a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncJsonDmaapConsumer.java b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncJsonDmaapConsumer.java
deleted file mode 100644
index 620098cb7..000000000
--- a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncJsonDmaapConsumer.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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 org.junit.Test;
-
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.InputStream;
-import java.lang.reflect.Field;
-
-import java.util.Map;
-import java.util.Properties;
-
-public class TestSdncJsonDmaapConsumer {
- private static final String DMAAP_LISTENER_PROPERTIES = "dmaap-listener.properties";
- private static final String DMAAP_LISTENER_PROPERTIES_DIR = "src/test/resources";
-
- @Test(expected = InvalidMessageException.class)
- public void testProcessMsg_shouldThrowException() throws Exception {
- SdncFlatJsonDmaapConsumer consumer = new SdncFlatJsonDmaapConsumer();
- consumer.processMsg(null);
- }
-
- @Test
- public void testProcessMsgFieldMap() throws Exception {
- SdncFlatJsonDmaapConsumer consumer = new SdncFlatJsonDmaapConsumer();
-
- String DMAAPLISTENERROOT = "DMAAPLISTENERROOT";
- File directory = new File("lib");
-
- if (! directory.exists()){
- directory.mkdir();
- }
-
- File file = new File("lib" + "/" + "input.map");
- try{
- FileWriter fw = new FileWriter(file.getAbsoluteFile());
- BufferedWriter bw = new BufferedWriter(fw);
- bw.write("SDNC.endpoint=>http://localhost:8282/restconf/operations");
- bw.close();
- }
- catch (Exception e){
- e.printStackTrace();
- }
-
- try {
- Map<String, String> env = System.getenv();
- Class<?> cl = env.getClass();
- Field field = cl.getDeclaredField("m");
- field.setAccessible(true);
- Map<String, String> writableEnv = (Map<String, String>) field.get(env);
- writableEnv.put(DMAAPLISTENERROOT, ".");
- } catch (Exception e) {
- throw new IllegalStateException("Failed to set environment variable", e);
- }
-
- String msg = "{\n" +
- " \"input\" : { \n" +
- " }\n" +
- "}";
-
- InputStream propStr = TestSdncJsonDmaapConsumer.class.getResourceAsStream("/dmaap-consumer-pserver.properties");
- Properties props = new Properties();
-
- props.load(propStr);
-
- consumer.init(props, "src/test/resources/dmaap-consumer-pserver.properties");
- consumer.processMsg(msg);
- }
-
- @Test(expected = InvalidMessageException.class)
- public void testProcessMsgFieldMapNoSdncEndPoint() throws Exception {
- SdncFlatJsonDmaapConsumer consumer = new SdncFlatJsonDmaapConsumer();
-
- String DMAAPLISTENERROOT = "DMAAPLISTENERROOT";
- File directory = new File("lib");
-
- if (! directory.exists()){
- directory.mkdir();
- }
-
- File file = new File("lib" + "/" + "input.map");
- try{
- FileWriter fw = new FileWriter(file.getAbsoluteFile());
- BufferedWriter bw = new BufferedWriter(fw);
- bw.write("SDNC");
- bw.close();
- }
- catch (Exception e){
- e.printStackTrace();
- }
-
- try {
- Map<String, String> env = System.getenv();
- Class<?> cl = env.getClass();
- Field field = cl.getDeclaredField("m");
- field.setAccessible(true);
- Map<String, String> writableEnv = (Map<String, String>) field.get(env);
- writableEnv.put(DMAAPLISTENERROOT, ".");
- } catch (Exception e) {
- throw new IllegalStateException("Failed to set environment variable", e);
- }
-
- String msg = "{\n" +
- " \"input\" : { \n" +
- " }\n" +
- "}";
-
- InputStream propStr = TestSdncJsonDmaapConsumer.class.getResourceAsStream("/dmaap-consumer-pserver.properties");
- Properties props = new Properties();
-
- props.load(propStr);
-
- consumer.init(props, "src/test/resources/dmaap-consumer-pserver.properties");
- consumer.processMsg(msg);
- }
-
- @Test(expected = InvalidMessageException.class)
- public void testProcessMsgFieldMapNoFieldMap() throws Exception {
- SdncFlatJsonDmaapConsumer consumer = new SdncFlatJsonDmaapConsumer();
-
- String msg = "{\n" +
- " \"input\" : { \n" +
- " }\n" +
- "}";
-
- consumer.processMsg(msg);
- }
-}
diff --git a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncLcmDmaapConsumer.java b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncLcmDmaapConsumer.java
deleted file mode 100644
index 4073b5542..000000000
--- a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncLcmDmaapConsumer.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * 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 TestSdncLcmDmaapConsumer {
- private static final String lcmInput =
- "{\r\n" +
- " \"version\": \"lcm-dmaap.version\",\r\n" +
- " \"cambria.partition\": \"SDNC\",\r\n" +
- " \"correlation-id\": \"lcm-dmaap.correlation-id\",\r\n" +
- " \"rpc-name\": \"upgrade-software\",\r\n" +
- " \"type\": \"lcm-dmaap.type\",\r\n" +
- " \"body\": {\r\n" +
- " \"input\": {\r\n" +
- " \"common-header\": {\r\n" +
- " \"api-ver\": \"lcm-dmaap.api-ver\",\r\n" +
- " \"flags\": {\r\n" +
- " \"ttl\": \"lcm-dmaap.flags.mode\",\r\n" +
- " \"force\": \"lcm-dmaap.flags.force\",\r\n" +
- " \"mode\": \"lcm-dmaap.flags.mode\"\r\n" +
- " },\r\n" +
- " \"originator-id\": \"lcm-dmaap.originator-id\",\r\n" +
- " \"request-id\": \"lcm-dmaap.request-id\",\r\n" +
- " \"sub-request-id\": \"lcm-dmaap.sub-request-id\",\r\n" +
- " \"timestamp\": \"lcm-dmaap.timestamp\"\r\n" +
- " },\r\n" +
- " \"payload\": \"lcm-dmaap.payload\"\r\n" +
- " }\r\n" +
- " }\r\n" +
- "}";
-
-
- @Test
- public void test() throws Exception {
- Properties props = new Properties();
-
- SdncLcmDmaapConsumer consumer = new SdncLcmDmaapConsumer();
- InputStream propStr = TestSdncLcmDmaapConsumer.class.getResourceAsStream("/dmaap-consumer-1.properties");
- props.load(propStr);
- consumer.init(props, "src/test/resources/dmaap-consumer-1.properties");
- consumer.processMsg(lcmInput);
- }
-
- @Test(expected = InvalidMessageException.class)
- public void testProcessMsgNullMessage() throws Exception {
- SdncLcmDmaapConsumer consumer = new SdncLcmDmaapConsumer();
- consumer.processMsg(null);
- }
-
- @Test
- public void testProcessMsgMissingBody() throws Exception {
- String msg = "{\r\n" +
- " \"version\": \"lcm-dmaap.version\",\r\n" +
- " \"cambria.partition\": \"SDNC\",\r\n" +
- " \"correlation-id\": \"lcm-dmaap.correlation-id\",\r\n" +
- " \"rpc-name\": \"upgrade-software\",\r\n" +
- " \"type\": \"lcm-dmaap.type\",\r\n" +
- " \"body1\": {\r\n" +
- " \"input\": {\r\n" +
- " \"common-header\": {\r\n" +
- " \"api-ver\": \"lcm-dmaap.api-ver\",\r\n" +
- " \"flags\": {\r\n" +
- " \"ttl\": \"lcm-dmaap.flags.mode\",\r\n" +
- " \"force\": \"lcm-dmaap.flags.force\",\r\n" +
- " \"mode\": \"lcm-dmaap.flags.mode\"\r\n" +
- " },\r\n" +
- " \"originator-id\": \"lcm-dmaap.originator-id\",\r\n" +
- " \"request-id\": \"lcm-dmaap.request-id\",\r\n" +
- " \"sub-request-id\": \"lcm-dmaap.sub-request-id\",\r\n" +
- " \"timestamp\": \"lcm-dmaap.timestamp\"\r\n" +
- " },\r\n" +
- " \"payload\": \"lcm-dmaap.payload\"\r\n" +
- " }\r\n" +
- " }\r\n" +
- "}";
-
- SdncLcmDmaapConsumer consumer = new SdncLcmDmaapConsumer();
- consumer.processMsg(msg);
- }
-
- @Test
- public void testProcessMsgInvalidRPC() throws Exception {
- String msg = "{\r\n" +
- " \"version\": \"lcm-dmaap.version\",\r\n" +
- " \"cambria.partition\": \"SDNC\",\r\n" +
- " \"correlation-id\": \"lcm-dmaap.correlation-id\",\r\n" +
- " \"rpc-name1\": \"upgrade-software\",\r\n" +
- " \"type\": \"lcm-dmaap.type\",\r\n" +
- " \"body\": {\r\n" +
- " \"input\": {\r\n" +
- " \"common-header\": {\r\n" +
- " \"api-ver\": \"lcm-dmaap.api-ver\",\r\n" +
- " \"flags\": {\r\n" +
- " \"ttl\": \"lcm-dmaap.flags.mode\",\r\n" +
- " \"force\": \"lcm-dmaap.flags.force\",\r\n" +
- " \"mode\": \"lcm-dmaap.flags.mode\"\r\n" +
- " },\r\n" +
- " \"originator-id\": \"lcm-dmaap.originator-id\",\r\n" +
- " \"request-id\": \"lcm-dmaap.request-id\",\r\n" +
- " \"sub-request-id\": \"lcm-dmaap.sub-request-id\",\r\n" +
- " \"timestamp\": \"lcm-dmaap.timestamp\"\r\n" +
- " },\r\n" +
- " \"payload\": \"lcm-dmaap.payload\"\r\n" +
- " }\r\n" +
- " }\r\n" +
- "}";
-
- SdncLcmDmaapConsumer consumer = new SdncLcmDmaapConsumer();
- consumer.processMsg(msg);
- }
-
- @Test
- public void testProcessMsgInvalidPartition() throws Exception {
- String msg = "{\r\n" +
- " \"version\": \"lcm-dmaap.version\",\r\n" +
- " \"cambria.partition\": \"BAD\",\r\n" +
- " \"correlation-id\": \"lcm-dmaap.correlation-id\",\r\n" +
- " \"rpc-name\": \"upgrade-software\",\r\n" +
- " \"type\": \"lcm-dmaap.type\",\r\n" +
- " \"body\": {\r\n" +
- " \"input\": {\r\n" +
- " \"common-header\": {\r\n" +
- " \"api-ver\": \"lcm-dmaap.api-ver\",\r\n" +
- " \"flags\": {\r\n" +
- " \"ttl\": \"lcm-dmaap.flags.mode\",\r\n" +
- " \"force\": \"lcm-dmaap.flags.force\",\r\n" +
- " \"mode\": \"lcm-dmaap.flags.mode\"\r\n" +
- " },\r\n" +
- " \"originator-id\": \"lcm-dmaap.originator-id\",\r\n" +
- " \"request-id\": \"lcm-dmaap.request-id\",\r\n" +
- " \"sub-request-id\": \"lcm-dmaap.sub-request-id\",\r\n" +
- " \"timestamp\": \"lcm-dmaap.timestamp\"\r\n" +
- " },\r\n" +
- " \"payload\": \"lcm-dmaap.payload\"\r\n" +
- " }\r\n" +
- " }\r\n" +
- "}";
-
-
- SdncLcmDmaapConsumer consumer = new SdncLcmDmaapConsumer();
- consumer.processMsg(msg);
- }
-}
diff --git a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncOdlConnection.java b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncOdlConnection.java
deleted file mode 100644
index db24a4545..000000000
--- a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncOdlConnection.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.onap.ccsdk.sli.northbound.dmaapclient;
-
-import org.junit.Test;
-
-import java.io.IOException;
-import java.net.ConnectException;
-
-public class TestSdncOdlConnection {
-
- @Test
- public void test() {
-
- try {
- SdncOdlConnection sdncOdlConnection = SdncOdlConnection.newInstance("https://127.0.0.1:8447/aai/v11/network/pnfs/pnf/a8098c1a-f86e-11da-bd1a-00112444be1e", "", "");
- sdncOdlConnection.send("PUT", "application/json", "{\n" +
- " \"input\" : { \n" +
- " }\n" +
- "}");
- } catch (ConnectException e) {
- //Connection exception
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
-}
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
deleted file mode 100644
index 11201265d..000000000
--- a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * 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 TestSdncPserverDmaapReceiver {
- private static final String aaiInput = "{\r\n" +
- " \"cambria.partition\": \"AAI\",\r\n" +
- " \"event-header\": {\r\n" +
- " \"severity\": \"NORMAL\",\r\n" +
- " \"entity-type\": \"pserver\",\r\n" +
- " \"top-entity-type\": \"pserver\",\r\n" +
- " \"entity-link\": \"https://aai.com:8443/aai/v11/cloud-infrastructure/pservers/pserver/a3d3d3d3/\",\r\n" +
- " \"event-type\": \"AAI-EVENT\",\r\n" +
- " \"domain\": \"e2e\",\r\n" +
- " \"action\": \"UPDATE\",\r\n" +
- " \"sequence-number\": \"0\",\r\n" +
- " \"id\": \"20170415000111-1234\",\r\n" +
- " \"source-name\": \"testclient\",\r\n" +
- " \"version\": \"v11\",\r\n" +
- " \"timestamp\": \"20170415-00:01:11:979\"\r\n" +
- " },\r\n" +
- " \"entity\": {\r\n" +
- " \"hostname\": \"host1\",\r\n" +
- " \"ptnii-equip-name\": \"lat111\",\r\n" +
- " \"equip-type\": \"server\",\r\n" +
- " \"equip-vendor\": \"HP\",\r\n" +
- " \"equip-model\": \"model1\",\r\n" +
- " \"fqdn\": \"l.global.net\",\r\n" +
- " \"ipv4-oam-address\": \"12.12.12.12\",\r\n" +
- " \"in-maint\": false,\r\n" +
- " \"resource-version\": \"11111111111\",\r\n" +
- " \"purpose\": \"Gamma\",\r\n" +
- " \"relationship-list\": {\r\n" +
- " \"relationship\": [\r\n" +
- " {\r\n" +
- " \"related-to\": \"complex\",\r\n" +
- " \"relationship-data\": [\r\n" +
- " {\r\n" +
- " \"relationship-value\": \"L1L2L3\",\r\n" +
- " \"relationship-key\": \"complex.physical-location-id\"\r\n" +
- " }\r\n" +
- " ],\r\n" +
- " \"related-link\": \"https://aai.com:8443/aai/v11/cloud-infrastructure/complexes/complex/cmpl1\"\r\n" +
- " }\r\n" +
- " ]\r\n" +
- " },\r\n" +
- " \"p-interfaces\": {\r\n" +
- " \"p-interface\": []\r\n" +
- " },\r\n" +
- " \"lag-interfaces\": {\r\n" +
- " \"lag-interface\": []\r\n" +
- " }\r\n" +
- " }\r\n" +
- "}";
-
- @Before
- public void setUp() throws Exception {
- }
-
- @Test
- public void test() throws Exception {
- 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(aaiRootNode.get("input").get("payload") != null);
- assertTrue(aaiRootNode.get("input").get("common-header") != null);
-
- }
-
- @Test
- public void testProcessMsgFieldMap() throws Exception {
-
-
- String DMAAPLISTENERROOT = "DMAAPLISTENERROOT";
- File directory = new File("lib");
-
- if (! directory.exists()){
- directory.mkdir();
- }
-
- File source = new File("src/main/resources");
- File dest = new File("lib/");
- try {
- FileUtils.copyDirectory(source, dest);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- try {
- Map<String, String> env = System.getenv();
- Class<?> cl = env.getClass();
- Field field = cl.getDeclaredField("m");
- field.setAccessible(true);
- Map<String, String> writableEnv = (Map<String, String>) field.get(env);
- writableEnv.put(DMAAPLISTENERROOT, ".");
- } catch (Exception e) {
- throw new IllegalStateException("Failed to set environment variable", e);
- }
- Properties props = new Properties();
-
- SdncAaiDmaapConsumer consumer = new SdncAaiDmaapConsumer();
-
- InputStream propStr = TestSdncPserverDmaapReceiver.class.getResourceAsStream("/dmaap-consumer-pserver.properties");
-
-
- props.load(propStr);
-
- consumer.init(props, "src/test/resources/dmaap-consumer-pserver.properties");
- consumer.processMsg(aaiInput);
- }
-
- @Test(expected = InvalidMessageException.class)
- public void testProcessMsgNullMessage() throws Exception {
- Properties props = new Properties();
-
- SdncAaiDmaapConsumer consumer = new SdncAaiDmaapConsumer();
- consumer.processMsg(null);
- }
-
- @Test(expected = InvalidMessageException.class)
- public void testProcessMsgInvalidMessage() throws Exception {
- Properties props = new Properties();
-
- SdncAaiDmaapConsumer consumer = new SdncAaiDmaapConsumer();
- consumer.processMsg("test");
- }
-
- @Test
- public void testProcessMsgMissingEventHeader() throws Exception {
- Properties props = new Properties();
-
- SdncAaiDmaapConsumer consumer = new SdncAaiDmaapConsumer();
- consumer.processMsg("{\n" +
- " \"input\" : { \n" +
- " }\n" +
- "}");
- }
-
- @Test
- public void testProcessMsgInvalidEventType() throws Exception {
- Properties props = new Properties();
-
- String msg = "{\"cambria.partition\": \"AAI\",\r\n" +
- " \"event-header\": {\"event-type\": \"TEST-EVENT\"}}";
-
- SdncAaiDmaapConsumer consumer = new SdncAaiDmaapConsumer();
- consumer.processMsg(msg);
- }
-
-
-
-
-
-}
diff --git a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncRANSliceDmaapConsumer.java b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncRANSliceDmaapConsumer.java
deleted file mode 100644
index 50c427ec1..000000000
--- a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncRANSliceDmaapConsumer.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * 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 TestSdncRANSliceDmaapConsumer {
- private static final String ranSliceInput =
- "{\r\n" +
- " \"version\": \"ranSlice-dmaap.version\",\r\n" +
- " \"cambria.partition\": \"SDNC\",\r\n" +
- " \"correlation-id\": \"ranSlice-dmaap.correlation-id\",\r\n" +
- " \"rpc-name\": \"upgrade-software\",\r\n" +
- " \"type\": \"ranSlice-dmaap.type\",\r\n" +
- " \"body\": {\r\n" +
- " \"input\": {\r\n" +
- " \"common-header\": {\r\n" +
- " \"api-ver\": \"ranSlice-dmaap.api-ver\",\r\n" +
- " \"flags\": {\r\n" +
- " \"ttl\": \"ranSlice-dmaap.flags.mode\",\r\n" +
- " \"force\": \"ranSlice-dmaap.flags.force\",\r\n" +
- " \"mode\": \"ranSlice-dmaap.flags.mode\"\r\n" +
- " },\r\n" +
- " \"originator-id\": \"ranSlice-dmaap.originator-id\",\r\n" +
- " \"request-id\": \"ranSlice-dmaap.request-id\",\r\n" +
- " \"sub-request-id\": \"ranSlice-dmaap.sub-request-id\",\r\n" +
- " \"timestamp\": \"ranSlice-dmaap.timestamp\"\r\n" +
- " },\r\n" +
- " \"payload\": \"ranSlice-dmaap.payload\"\r\n" +
- " }\r\n" +
- " }\r\n" +
- "}";
-
-
- @Test
- public void test() throws Exception {
- Properties props = new Properties();
-
- SdncRANSliceDmaapConsumer consumer = new SdncRANSliceDmaapConsumer();
- InputStream propStr = TestSdncRANSliceDmaapConsumer.class.getResourceAsStream("/dmaap-consumer-1.properties");
- props.load(propStr);
- consumer.init(props, "src/test/resources/dmaap-consumer-1.properties");
- consumer.processMsg(ranSliceInput);
- }
-
- @Test(expected = InvalidMessageException.class)
- public void testProcessMsgNullMessage() throws Exception {
- SdncRANSliceDmaapConsumer consumer = new SdncRANSliceDmaapConsumer();
- consumer.processMsg(null);
- }
-
- @Test
- public void testProcessMsgMissingBody() throws Exception {
- String msg = "{\r\n" +
- " \"version\": \"ranSlice-dmaap.version\",\r\n" +
- " \"cambria.partition\": \"SDNC\",\r\n" +
- " \"correlation-id\": \"ranSlice-dmaap.correlation-id\",\r\n" +
- " \"rpc-name\": \"upgrade-software\",\r\n" +
- " \"type\": \"ranSlice-dmaap.type\",\r\n" +
- " \"body1\": {\r\n" +
- " \"input\": {\r\n" +
- " \"common-header\": {\r\n" +
- " \"api-ver\": \"ranSlice-dmaap.api-ver\",\r\n" +
- " \"flags\": {\r\n" +
- " \"ttl\": \"ranSlice-dmaap.flags.mode\",\r\n" +
- " \"force\": \"ranSlice-dmaap.flags.force\",\r\n" +
- " \"mode\": \"ranSlice-dmaap.flags.mode\"\r\n" +
- " },\r\n" +
- " \"originator-id\": \"ranSlice-dmaap.originator-id\",\r\n" +
- " \"request-id\": \"ranSlice-dmaap.request-id\",\r\n" +
- " \"sub-request-id\": \"ranSlice-dmaap.sub-request-id\",\r\n" +
- " \"timestamp\": \"ranSlice-dmaap.timestamp\"\r\n" +
- " },\r\n" +
- " \"payload\": \"ranSlice-dmaap.payload\"\r\n" +
- " }\r\n" +
- " }\r\n" +
- "}";
-
- SdncRANSliceDmaapConsumer consumer = new SdncRANSliceDmaapConsumer();
- consumer.processMsg(msg);
- }
-
- @Test
- public void testProcessMsgInvalidRPC() throws Exception {
- String msg = "{\r\n" +
- " \"version\": \"ranSlice-dmaap.version\",\r\n" +
- " \"cambria.partition\": \"SDNC\",\r\n" +
- " \"correlation-id\": \"ranSlice-dmaap.correlation-id\",\r\n" +
- " \"rpc-name1\": \"upgrade-software\",\r\n" +
- " \"type\": \"ranSlice-dmaap.type\",\r\n" +
- " \"body\": {\r\n" +
- " \"input\": {\r\n" +
- " \"common-header\": {\r\n" +
- " \"api-ver\": \"ranSlice-dmaap.api-ver\",\r\n" +
- " \"flags\": {\r\n" +
- " \"ttl\": \"ranSlice-dmaap.flags.mode\",\r\n" +
- " \"force\": \"ranSlice-dmaap.flags.force\",\r\n" +
- " \"mode\": \"ranSlice-dmaap.flags.mode\"\r\n" +
- " },\r\n" +
- " \"originator-id\": \"ranSlice-dmaap.originator-id\",\r\n" +
- " \"request-id\": \"ranSlice-dmaap.request-id\",\r\n" +
- " \"sub-request-id\": \"ranSlice-dmaap.sub-request-id\",\r\n" +
- " \"timestamp\": \"ranSlice-dmaap.timestamp\"\r\n" +
- " },\r\n" +
- " \"payload\": \"ranSlice-dmaap.payload\"\r\n" +
- " }\r\n" +
- " }\r\n" +
- "}";
-
- SdncRANSliceDmaapConsumer consumer = new SdncRANSliceDmaapConsumer();
- consumer.processMsg(msg);
- }
-
- @Test
- public void testProcessMsgInvalidPartition() throws Exception {
- String msg = "{\r\n" +
- " \"version\": \"ranSlice-dmaap.version\",\r\n" +
- " \"cambria.partition\": \"BAD\",\r\n" +
- " \"correlation-id\": \"ranSlice-dmaap.correlation-id\",\r\n" +
- " \"rpc-name\": \"upgrade-software\",\r\n" +
- " \"type\": \"ranSlice-dmaap.type\",\r\n" +
- " \"body\": {\r\n" +
- " \"input\": {\r\n" +
- " \"common-header\": {\r\n" +
- " \"api-ver\": \"ranSlice-dmaap.api-ver\",\r\n" +
- " \"flags\": {\r\n" +
- " \"ttl\": \"ranSlice-dmaap.flags.mode\",\r\n" +
- " \"force\": \"ranSlice-dmaap.flags.force\",\r\n" +
- " \"mode\": \"ranSlice-dmaap.flags.mode\"\r\n" +
- " },\r\n" +
- " \"originator-id\": \"ranSlice-dmaap.originator-id\",\r\n" +
- " \"request-id\": \"ranSlice-dmaap.request-id\",\r\n" +
- " \"sub-request-id\": \"ranSlice-dmaap.sub-request-id\",\r\n" +
- " \"timestamp\": \"ranSlice-dmaap.timestamp\"\r\n" +
- " },\r\n" +
- " \"payload\": \"ranSlice-dmaap.payload\"\r\n" +
- " }\r\n" +
- " }\r\n" +
- "}";
-
-
- SdncRANSliceDmaapConsumer consumer = new SdncRANSliceDmaapConsumer();
- consumer.processMsg(msg);
- }
-}
diff --git a/dmaap-listener/src/test/resources/dblib.properties b/dmaap-listener/src/test/resources/dblib.properties
deleted file mode 100644
index 9506ac8d1..000000000
--- a/dmaap-listener/src/test/resources/dblib.properties
+++ /dev/null
@@ -1,38 +0,0 @@
-###
-# ============LICENSE_START=======================================================
-# openECOMP : SDN-C
-# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights
-# reserved.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ============LICENSE_END=========================================================
-###
-
-# dblib.properrties
-org.onap.ccsdk.sli.dbtype=jdbc
-
-org.onap.ccsdk.sli.jdbc.hosts=sdnctldb01
-org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://dbhost:3306/sdnctl
-org.onap.ccsdk.sli.jdbc.driver=org.mariadb.jdbc.Driver
-org.onap.ccsdk.sli.jdbc.database=sdnctl
-org.onap.ccsdk.sli.jdbc.user=sdnctl
-org.onap.ccsdk.sli.jdbc.password=gamma
-org.onap.ccsdk.sli.jdbc.connection.name=sdnctldb01
-org.onap.ccsdk.sli.jdbc.connection.timeout=50
-org.onap.ccsdk.sli.jdbc.request.timeout=100
-org.onap.ccsdk.sli.jdbc.limit.init=10
-org.onap.ccsdk.sli.jdbc.limit.min=10
-org.onap.ccsdk.sli.jdbc.limit.max=20
-org.onap.dblib.connection.recovery=false
-
diff --git a/dmaap-listener/src/test/resources/dmaap-consumer-1.properties b/dmaap-listener/src/test/resources/dmaap-consumer-1.properties
deleted file mode 100755
index ae83ef8c2..000000000
--- a/dmaap-listener/src/test/resources/dmaap-consumer-1.properties
+++ /dev/null
@@ -1,35 +0,0 @@
-TransportType=HTTPAAF
-Latitude =40.397443
-Longitude =-74.135602
-Version =1.0
-ServiceName =localhost/events
-Environment =DEV
-Partner =
-SubContextPath =/
-Protocol =http
-MethodType =GET
-username =test
-password =test
-contenttype =application/json
-authKey=ABC123
-authDate=2016-05-10T13:13:50-0700
-host=localhost:3904
-topic=ccsdk-topic
-group=ccsdk-unittest
-id=ccsdk_unittest
-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=src/test/resources/dmaap-listener.preferredRoute.txt
-sdnc.odl.user=admin
-sdnc.odl.password=admin
-sdnc.odl.url-base=http://localhost:8282/restconf/operations
-
diff --git a/dmaap-listener/src/test/resources/dmaap-consumer-a1Adapter-policy-1.properties b/dmaap-listener/src/test/resources/dmaap-consumer-a1Adapter-policy-1.properties
deleted file mode 100644
index edb7c453e..000000000
--- a/dmaap-listener/src/test/resources/dmaap-consumer-a1Adapter-policy-1.properties
+++ /dev/null
@@ -1,35 +0,0 @@
-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=A1-P
-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
diff --git a/dmaap-listener/src/test/resources/dmaap-consumer-cMNotify-1.properties b/dmaap-listener/src/test/resources/dmaap-consumer-cMNotify-1.properties
deleted file mode 100644
index aae34a26f..000000000
--- a/dmaap-listener/src/test/resources/dmaap-consumer-cMNotify-1.properties
+++ /dev/null
@@ -1,35 +0,0 @@
-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
diff --git a/dmaap-listener/src/test/resources/dmaap-consumer-esrsysteminfo.properties b/dmaap-listener/src/test/resources/dmaap-consumer-esrsysteminfo.properties
deleted file mode 100644
index 9f5cfe71f..000000000
--- a/dmaap-listener/src/test/resources/dmaap-consumer-esrsysteminfo.properties
+++ /dev/null
@@ -1,34 +0,0 @@
-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=pserver
-id=1
-timeout=20000
-limit=10000
-filter={"class":"Equals","field":"event-header.entity-type","value":"pserver"}
-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-generic-vnf.properties b/dmaap-listener/src/test/resources/dmaap-consumer-generic-vnf.properties
deleted file mode 100644
index 710a7c7c9..000000000
--- a/dmaap-listener/src/test/resources/dmaap-consumer-generic-vnf.properties
+++ /dev/null
@@ -1,34 +0,0 @@
-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
deleted file mode 100644
index 9f5cfe71f..000000000
--- a/dmaap-listener/src/test/resources/dmaap-consumer-pserver.properties
+++ /dev/null
@@ -1,34 +0,0 @@
-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=pserver
-id=1
-timeout=20000
-limit=10000
-filter={"class":"Equals","field":"event-header.entity-type","value":"pserver"}
-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-listener.preferredRoute.txt b/dmaap-listener/src/test/resources/dmaap-listener.preferredRoute.txt
deleted file mode 100755
index 88705f73b..000000000
--- a/dmaap-listener/src/test/resources/dmaap-listener.preferredRoute.txt
+++ /dev/null
@@ -1 +0,0 @@
-preferredRouteKey=ABC123 \ No newline at end of file
diff --git a/dmaap-listener/src/test/resources/dmaap-listener.properties b/dmaap-listener/src/test/resources/dmaap-listener.properties
deleted file mode 100755
index defef0b43..000000000
--- a/dmaap-listener/src/test/resources/dmaap-listener.properties
+++ /dev/null
@@ -1 +0,0 @@
-subscriptions=org.onap.ccsdk.sli.northbound.dmaapclient.DummyDmaapConsumer:dmaap-consumer-1.properties;org.onap.ccsdk.sli.northbound.dmaapclient.SdncAaiDmaapConsumer:dmaap-consumer-esrsysteminfo.properties \ No newline at end of file