aboutsummaryrefslogtreecommitdiffstats
path: root/dmaap-listener
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2017-08-30 10:28:08 -0400
committerDan Timoney <dtimoney@att.com>2017-08-30 10:29:57 -0400
commit0bce413218560b0f5df834581f22841eb0bc7074 (patch)
treed8a3f2cb22dcc33fb353714096509f584ffb1463 /dmaap-listener
parent356b29817974cf09ed15088fef172e033e940047 (diff)
Prune migrated components from sdnc/northbound
Prune components that were migrated from sdnc/northbound to ccsdk by removing code and replacing with a README.md that redirects the reader to the appropriate CCSDK repo Change-Id: I317b1d0093a1dd4647feaf6b852826a2230f4879 Issue-ID: SDNC-59 Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'dmaap-listener')
-rw-r--r--dmaap-listener/README.md3
-rwxr-xr-xdmaap-listener/pom.xml120
-rw-r--r--dmaap-listener/src/assembly/assemble_zip.xml61
-rw-r--r--dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DmaapListener.java165
-rw-r--r--dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DummyDmaapConsumer.java37
-rw-r--r--dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/InvalidMessageException.java37
-rw-r--r--dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncDmaapConsumer.java146
-rw-r--r--dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncFlatJsonDmaapConsumer.java196
-rw-r--r--dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncOdlConnection.java159
-rw-r--r--dmaap-listener/src/main/resources/edgeRouterStatusChange.map23
-rw-r--r--dmaap-listener/src/main/resources/log4j.properties37
-rw-r--r--dmaap-listener/src/main/resources/preferredRoute.txt1
-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
16 files changed, 3 insertions, 1180 deletions
diff --git a/dmaap-listener/README.md b/dmaap-listener/README.md
new file mode 100644
index 00000000..ed067b1a
--- /dev/null
+++ b/dmaap-listener/README.md
@@ -0,0 +1,3 @@
+DMAAP-LISTENER MOVED TO CCSDK!
+
+The code for dmaap-listener moved to the ccsdk/sli/northbound repository
diff --git a/dmaap-listener/pom.xml b/dmaap-listener/pom.xml
deleted file mode 100755
index c4c6656a..00000000
--- a/dmaap-listener/pom.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<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>
- <groupId>org.openecomp.sdnc.northbound</groupId>
- <packaging>jar</packaging>
- <artifactId>dmaap-listener</artifactId>
- <version>1.1.2-SNAPSHOT</version>
-
- <name>DMAAP Listener</name>
- <description>DMAAP Listener</description>
- <parent>
- <groupId>org.openecomp.sdnc.northbound</groupId>
- <artifactId>sdnc-northbound</artifactId>
- <version>1.1.2-SNAPSHOT</version>
- </parent>
- <properties>
- <sdc.client.version>1.1.7-SNAPSHOT</sdc.client.version>
- <fasterxml.jackson.version>2.9.0.pr1</fasterxml.jackson.version>
- <skip.SWM>true</skip.SWM>
- <dmaap.listener.base>/opt/app/dmaap-listener</dmaap.listener.base>
- <dmaap.listener.version>0.2.12</dmaap.listener.version>
- <maven.build.timestamp.format>yyMMdd-HHmmss</maven.build.timestamp.format>
- <build.number>${maven.build.timestamp}</build.number>
- <SWM_VERSION>${project.version}-${build.number}</SWM_VERSION>
- </properties>
-
- <dependencies>
-
- <dependency>
- <groupId>com.att.nsa</groupId>
- <artifactId>dmaapClient</artifactId>
- <version>${dmaap.listener.version}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.10</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.6.1</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.17</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>${fasterxml.jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>${fasterxml.jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>${fasterxml.jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdnc.core</groupId>
- <artifactId>dblib-provider</artifactId>
- <version>${sdnctl.dblib.version}</version>
- </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.7</source>
- <target>1.7</target>
- </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 e8adf4b3..00000000
--- a/dmaap-listener/src/assembly/assemble_zip.xml
+++ /dev/null
@@ -1,61 +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>
- </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/openecomp/sdnc/dmaapclient/DmaapListener.java b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DmaapListener.java
deleted file mode 100644
index 74a752b9..00000000
--- a/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DmaapListener.java
+++ /dev/null
@@ -1,165 +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.openecomp.sdnc.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 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;
-
- if (args.length > 0) {
- propFileName = args[0];
- }
-
- String propPath = null;
- String propDir = System.getenv(SDNC_CONFIG_DIR);
-
- List<SdncDmaapConsumer> consumers = new LinkedList();
-
- if (propDir == null) {
-
- propDir = "/opt/sdnc/data/properties";
- }
-
- if (!propFileName.startsWith("/")) {
- propPath = propDir + "/" + propFileName;
- }
-
- File propFile = new File(propPath);
-
- if (!propFile.canRead()) {
- LOG.error("Cannot read properties file "+propPath);
- System.exit(1);
- }
-
- try {
- properties.load(new FileInputStream(propFile));
- } catch (Exception e) {
- LOG.error("Caught exception loading properties from "+propPath, e);
- System.exit(1);
- }
-
- String subscriptionStr = properties.getProperty("subscriptions");
-
- boolean threadsRunning = false;
-
- LOG.debug("Dmaap subscriptions : "+subscriptionStr);
-
- if (subscriptionStr != null) {
- String[] subscriptions = subscriptionStr.split(";");
-
- for (int i = 0; i < subscriptions.length; i++) {
- String[] subscription = subscriptions[i].split(":");
- String consumerClassName = subscription[0];
- String propertyPath = subscription[1];
-
- LOG.debug("Handling subscription [" + consumerClassName + "," + propertyPath + "]");
-
- if (propertyPath == null) {
- LOG.error("Invalid subscription (" + subscriptions[i] + ") property file missing");
- 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);
- }
-
- if (consumerClass != null) {
-
- 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("Initializing consumer " + consumerClassName + "(" + propertyPath + ")");
- consumer.init(properties, propertyPath);
-
- if (consumer.isReady()) {
- Thread consumerThread = new Thread(consumer);
- consumerThread.start();
- consumers.add(consumer);
- threadsRunning = true;
- LOG.info("Started consumer thread (" + consumerClassName + " : " + propertyPath + ")");
- } else {
- LOG.debug("Consumer " + consumerClassName + " is not ready");
- }
- }
-
- }
-
- }
- }
-
- while (threadsRunning) {
-
- threadsRunning = false;
- for (SdncDmaapConsumer consumer : consumers) {
- if (consumer.isRunning()) {
- threadsRunning = true;
- }
- }
-
- if (!threadsRunning) {
- break;
- }
-
- try {
- Thread.sleep(10000);
- } catch (InterruptedException e) {
-
- }
- }
-
- LOG.info("No listener threads running - exitting");
-
- }
-}
diff --git a/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DummyDmaapConsumer.java b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DummyDmaapConsumer.java
deleted file mode 100644
index 42708b61..00000000
--- a/dmaap-listener/src/main/java/org/openecomp/sdnc/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.openecomp.sdnc.dmaapclient;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DummyDmaapConsumer extends SdncDmaapConsumer {
-
- 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/openecomp/sdnc/dmaapclient/InvalidMessageException.java b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/InvalidMessageException.java
deleted file mode 100644
index 5a7859fe..00000000
--- a/dmaap-listener/src/main/java/org/openecomp/sdnc/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.openecomp.sdnc.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/openecomp/sdnc/dmaapclient/SdncDmaapConsumer.java b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncDmaapConsumer.java
deleted file mode 100644
index 1472671d..00000000
--- a/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncDmaapConsumer.java
+++ /dev/null
@@ -1,146 +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.openecomp.sdnc.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 SdncDmaapConsumer implements Runnable {
-
- private static final Logger LOG = LoggerFactory
- .getLogger(SdncDmaapConsumer.class);
-
- private String propertiesPath = "";
- private Properties properties = null;
- MRConsumer consumer = null;
- MRConsumerResponse consumerResponse = null;
- boolean running = false;
- boolean ready = false;
- int fetchPause = 5000; // Default pause between fetchs - 5 seconds
-
- public boolean isReady() {
- return ready;
- }
-
- int timeout = 15000; // Default timeout - 15 seconds
-
- public boolean isRunning() {
- return running;
- }
-
- public SdncDmaapConsumer() {
-
- }
-
- public SdncDmaapConsumer(Properties properties, String propertiesPath) {
- init(properties, propertiesPath);
- }
-
- public String getProperty(String name) {
- return(properties.getProperty(name, ""));
- }
-
- public void init(Properties properties, String propertiesPath) {
-
- this.propertiesPath = propertiesPath;
-
- try {
-
- this.properties = (Properties) properties.clone();
-
- this.properties.load(new FileInputStream(new File(propertiesPath)));
-
- String timeoutStr = properties.getProperty("timeout");
-
- if ((timeoutStr != null) && (timeoutStr.length() > 0)) {
- try {
- timeout = Integer.parseInt(timeoutStr);
- } catch (NumberFormatException e) {
- LOG.error("Non-numeric value specified for timeout ("+timeoutStr+")");
- }
- }
-
- String fetchPauseStr = properties.getProperty("fetchPause");
- if ((fetchPauseStr != null) && (fetchPauseStr.length() > 0)) {
- try {
- fetchPause = Integer.parseInt(fetchPauseStr);
- } catch (NumberFormatException e) {
- LOG.error("Non-numeric valud specified for fetchPause ("+fetchPauseStr+")");
- }
- }
-
- this.consumer = MRClientFactory.createConsumer(propertiesPath);
- ready = true;
- } catch (Exception e) {
- LOG.error("Error initializing DMaaP consumer from file "+propertiesPath, e);
- }
- }
-
-
- @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("Received message from DMaaP:\n"+msg);
- processMsg(msg);
- }
-
- if (noData) {
- if (fetchPause > 0) {
-
- LOG.info("No data received from fetch. Pausing "+fetchPause+" ms before retry");
- Thread.sleep(fetchPause);
- } else {
-
- LOG.info("No data received from fetch. No fetch pause specified - retrying immediately");
- }
- }
- } catch (Exception e) {
- LOG.error("Caught exception reading from DMaaP", e);
- running = false;
- }
-
-
- }
- }
-
- }
-
- abstract public void processMsg(String msg) throws InvalidMessageException;
-}
diff --git a/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncFlatJsonDmaapConsumer.java b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncFlatJsonDmaapConsumer.java
deleted file mode 100644
index b6277455..00000000
--- a/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncFlatJsonDmaapConsumer.java
+++ /dev/null
@@ -1,196 +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.openecomp.sdnc.dmaapclient;
-
-import java.io.BufferedReader;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileReader;
-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 java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-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;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-
-public class SdncFlatJsonDmaapConsumer extends SdncDmaapConsumer {
-
- 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 = null;
- ObjectNode sdncRootNode = null;
-
- 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 (String fromField : fieldMap.keySet()) {
-
- if (!SDNC_ENDPOINT.equals(fromField)) {
- JsonNode curNode = instarRootNode.get(fromField);
- if (curNode != null) {
- String fromValue = curNode.textValue();
-
- inputNode.put(fieldMap.get(fromField), 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) {
-
- }
-
- }
-
- private Map<String,String> loadMap(String msgType, String mapDirName) {
- Map<String, String> results = new HashMap<String, String>();
-
-
- if (mapDirName == null) {
- String rootdir = System.getenv(DMAAPLISTENERROOT);
-
- if ((rootdir == null) || (rootdir.length() == 0)) {
- rootdir = "/opt/app/dmaap-listener";
- }
-
- mapDirName = rootdir + "/lib";
-
- }
-
- String mapFilename = mapDirName + "/" + msgType + ".map";
-
- File mapFile = new File(mapFilename);
-
- if (!mapFile.canRead()) {
- LOG.error("Cannot read map file ("+mapFilename+")");
- return(null);
- }
-
- try {
- BufferedReader mapReader = new BufferedReader(new FileReader(mapFile));
-
- String curLine = null;
-
- while ((curLine = mapReader.readLine()) != null) {
- curLine = curLine.trim();
-
- if ((curLine.length() > 0) && (!curLine.startsWith("#"))) {
-
- if (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/openecomp/sdnc/dmaapclient/SdncOdlConnection.java b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncOdlConnection.java
deleted file mode 100644
index 55a35970..00000000
--- a/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncOdlConnection.java
+++ /dev/null
@@ -1,159 +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.openecomp.sdnc.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.ProtocolException;
-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) throws IOException
- {
- return (new SdncOdlConnection(url, user, password));
- }
-
-
-
- public String send(String method, String contentType, String msg) throws IOException {
-
- LOG.info("Sending REST " + method + " to " + url);
- LOG.info("Message body:\n" + 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", "" + 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()));
- }
-
- StringBuffer respBuff = new StringBuffer();
-
- String respLn;
-
- while ((respLn = respRdr.readLine()) != null) {
- respBuff.append(respLn + "\n");
- }
- respRdr.close();
-
- String respString = respBuff.toString();
-
- LOG.info("Response body :\n" + respString);
-
- return (respString);
-
- }
-
-
-}
diff --git a/dmaap-listener/src/main/resources/edgeRouterStatusChange.map b/dmaap-listener/src/main/resources/edgeRouterStatusChange.map
deleted file mode 100644
index 57644bbd..00000000
--- a/dmaap-listener/src/main/resources/edgeRouterStatusChange.map
+++ /dev/null
@@ -1,23 +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 \ No newline at end of file
diff --git a/dmaap-listener/src/main/resources/log4j.properties b/dmaap-listener/src/main/resources/log4j.properties
deleted file mode 100644
index 5219f977..00000000
--- a/dmaap-listener/src/main/resources/log4j.properties
+++ /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=========================================================
-###
-
-log4j.rootLogger=DEBUG,CONSOLE,LOGFILE
-
-# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.Threshold=ERROR
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n
-
-# LOGFILE is set to be a File appender using a PatternLayout.
-log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender
-log4j.appender.LOGFILE.File=/opt/app/dmaap-listener/logs/dmaap-listener.log
-log4j.appender.LOGFILE.Append=true
-log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
-log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n
-log4j.appender.LOGFILE.MaxFileSize=10MB
-log4j.appender.LOGFILE.MaxBackupIndex=10
diff --git a/dmaap-listener/src/main/resources/preferredRoute.txt b/dmaap-listener/src/main/resources/preferredRoute.txt
deleted file mode 100644
index 662b0aa7..00000000
--- 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/scripts/start-dmaap-listener.sh b/dmaap-listener/src/main/scripts/start-dmaap-listener.sh
deleted file mode 100644
index 3890df26..00000000
--- 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/sdnc/data/properties}
-
-LISTENER=dmaap-listener
-
-
-
-PIDFILE=/tmp/.${LISTENER}-pid
-UEBLISTENERROOT=${UEBLISTENERROOT:-/opt/app/dmaap-listener}
-JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-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.openecomp.sdnc.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 26f3db13..00000000
--- 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/sdnc/data/properties}
-
-LISTENER=dmaap-listener
-
-
-PIDFILE=/tmp/.${LISTENER}-pid
-UEBLISTENERROOT=${UEBLISTENERROOT:-/opt/app/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 db584bfd..00000000
--- 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 f940e237..00000000
--- 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>