From 60d5ee0c6d4cc32d6181c29ee55a67575669a0cd Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Fri, 21 Apr 2017 17:36:30 -0400 Subject: [SDNC-5] Split listeners Split dmaap-listener and ueb-listener to separate artifacts Change-Id: I7b1d5b15c8ef850ace75d4da451143ba4062b817 Signed-off-by: Dan Timoney --- .gitreview | 2 +- asdcApi/installer/pom.xml | 2 - .../src/assembly/assemble_installer_zip.xml | 1 - .../src/assembly/assemble_mvnrepo_zip.xml | 1 - dataChange/installer/pom.xml | 2 - .../src/assembly/assemble_installer_zip.xml | 1 - .../src/assembly/assemble_mvnrepo_zip.xml | 1 - dmaap-listener/.gitignore | 12 + dmaap-listener/.sonar/checkstyle.xml | 1 + dmaap-listener/.sonar/pmd.xml | 67 +++ dmaap-listener/pom.xml | 113 +++++ dmaap-listener/src/assembly/assemble_zip.xml | 59 +++ .../openecomp/sdnc/dmaapclient/DmaapListener.java | 165 +++++++ .../sdnc/dmaapclient/DummyDmaapConsumer.java | 37 ++ .../sdnc/dmaapclient/InvalidMessageException.java | 37 ++ .../sdnc/dmaapclient/SdncDmaapConsumer.java | 146 ++++++ .../dmaapclient/SdncFlatJsonDmaapConsumer.java | 196 ++++++++ .../sdnc/dmaapclient/SdncOdlConnection.java | 159 ++++++ .../src/main/resources/edgeRouterStatusChange.map | 23 + dmaap-listener/src/main/resources/log4j.properties | 37 ++ .../src/main/resources/preferredRoute.txt | 1 + .../src/main/scripts/start-dmaap-listener.sh | 69 +++ .../src/main/scripts/stop-dmaap-listener.sh | 52 ++ dmaap-listener/src/site/apt/index.apt | 46 ++ dmaap-listener/src/site/site.xml | 31 ++ pom.xml | 15 +- ueb-listener/pom.xml | 35 +- ueb-listener/src/assembly/assemble_zip.xml | 4 +- .../org/openecomp/sdnc/uebclient/SdncARModel.java | 53 ++ .../openecomp/sdnc/uebclient/SdncArtifactMap.java | 134 +++++ .../openecomp/sdnc/uebclient/SdncBaseModel.java | 297 ++++++++++++ .../openecomp/sdnc/uebclient/SdncNodeModel.java | 145 ++++++ .../sdnc/uebclient/SdncOdlConnection.java | 159 ++++++ .../openecomp/sdnc/uebclient/SdncServiceModel.java | 98 ++++ .../openecomp/sdnc/uebclient/SdncUebCallback.java | 538 ++++++++++++++++----- .../openecomp/sdnc/uebclient/SdncUebClient.java | 2 +- .../sdnc/uebclient/SdncUebConfiguration.java | 22 +- .../org/openecomp/sdnc/uebclient/SdncVFCModel.java | 69 +++ .../org/openecomp/sdnc/uebclient/SdncVFModel.java | 56 +++ .../sdnc/uebclient/SdncVFModuleModel.java | 45 ++ ueb-listener/src/main/resources/log4j.properties | 4 +- .../src/main/scripts/start-ueb-listener.sh | 68 +++ ueb-listener/src/main/scripts/stop-ueb-listener.sh | 56 +++ ueb-listener/src/site/apt/index.apt | 2 +- ueb-listener/src/site/site.xml | 2 +- vnfapi/features/src/main/resources/features.xml | 2 +- vnfapi/installer/pom.xml | 2 - .../src/assembly/assemble_installer_zip.xml | 3 +- .../src/assembly/assemble_mvnrepo_zip.xml | 3 +- .../src/main/resources/scripts/install-feature.sh | 2 +- vnfapi/model/src/main/yang/VNF-API.yang | 11 + .../impl/rev140523/VnfapiProviderModule.java | 2 +- .../rev140523/VnfapiProviderModuleFactory.java | 2 +- .../sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java | 2 +- .../java/org/openecomp/sdnc/vnfapi/VnfSdnUtil.java | 2 +- .../org/openecomp/sdnc/vnfapi/vnfapiProvider.java | 42 +- .../src/main/resources/initial/vnfapi-provider.xml | 2 +- .../openecomp/sdnc/vnfapi/TestPropertyList.java | 2 +- .../src/test/resources/proplist.properties | 2 +- .../src/test/resources/simplelogger.properties | 2 +- vnftools/installer/pom.xml | 2 - .../src/assembly/assemble_installer_zip.xml | 1 - .../src/assembly/assemble_mvnrepo_zip.xml | 1 - 63 files changed, 2970 insertions(+), 180 deletions(-) create mode 100755 dmaap-listener/.gitignore create mode 100755 dmaap-listener/.sonar/checkstyle.xml create mode 100755 dmaap-listener/.sonar/pmd.xml create mode 100755 dmaap-listener/pom.xml create mode 100644 dmaap-listener/src/assembly/assemble_zip.xml create mode 100644 dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DmaapListener.java create mode 100644 dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DummyDmaapConsumer.java create mode 100644 dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/InvalidMessageException.java create mode 100644 dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncDmaapConsumer.java create mode 100644 dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncFlatJsonDmaapConsumer.java create mode 100644 dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncOdlConnection.java create mode 100644 dmaap-listener/src/main/resources/edgeRouterStatusChange.map create mode 100644 dmaap-listener/src/main/resources/log4j.properties create mode 100644 dmaap-listener/src/main/resources/preferredRoute.txt create mode 100644 dmaap-listener/src/main/scripts/start-dmaap-listener.sh create mode 100644 dmaap-listener/src/main/scripts/stop-dmaap-listener.sh create mode 100644 dmaap-listener/src/site/apt/index.apt create mode 100644 dmaap-listener/src/site/site.xml create mode 100644 ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncARModel.java create mode 100644 ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncArtifactMap.java create mode 100644 ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncBaseModel.java create mode 100644 ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncNodeModel.java create mode 100644 ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncOdlConnection.java create mode 100644 ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncServiceModel.java create mode 100644 ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFCModel.java create mode 100644 ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFModel.java create mode 100644 ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFModuleModel.java create mode 100644 ueb-listener/src/main/scripts/start-ueb-listener.sh create mode 100644 ueb-listener/src/main/scripts/stop-ueb-listener.sh diff --git a/.gitreview b/.gitreview index de68d2ee..ac3bf486 100644 --- a/.gitreview +++ b/.gitreview @@ -1,4 +1,4 @@ [gerrit] -host=gerrit.onap.org +host=gerrit.openecomp.org port=29418 project=sdnc/northbound.git diff --git a/asdcApi/installer/pom.xml b/asdcApi/installer/pom.xml index 764c8665..f5c3771d 100755 --- a/asdcApi/installer/pom.xml +++ b/asdcApi/installer/pom.xml @@ -60,7 +60,6 @@ src/assembly/assemble_mvnrepo_zip.xml - false @@ -75,7 +74,6 @@ src/assembly/assemble_installer_zip.xml - false diff --git a/asdcApi/installer/src/assembly/assemble_installer_zip.xml b/asdcApi/installer/src/assembly/assemble_installer_zip.xml index 85e2e1e8..728afca5 100644 --- a/asdcApi/installer/src/assembly/assemble_installer_zip.xml +++ b/asdcApi/installer/src/assembly/assemble_installer_zip.xml @@ -25,7 +25,6 @@ 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"> - bin zip diff --git a/asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml b/asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml index 73afa1c1..b4d2d61a 100644 --- a/asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml +++ b/asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -25,7 +25,6 @@ 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"> - bin zip diff --git a/dataChange/installer/pom.xml b/dataChange/installer/pom.xml index 0eeea7aa..7ab32092 100755 --- a/dataChange/installer/pom.xml +++ b/dataChange/installer/pom.xml @@ -60,7 +60,6 @@ src/assembly/assemble_mvnrepo_zip.xml - false @@ -75,7 +74,6 @@ src/assembly/assemble_installer_zip.xml - false diff --git a/dataChange/installer/src/assembly/assemble_installer_zip.xml b/dataChange/installer/src/assembly/assemble_installer_zip.xml index 85e2e1e8..728afca5 100644 --- a/dataChange/installer/src/assembly/assemble_installer_zip.xml +++ b/dataChange/installer/src/assembly/assemble_installer_zip.xml @@ -25,7 +25,6 @@ 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"> - bin zip diff --git a/dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml b/dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml index 73afa1c1..b4d2d61a 100644 --- a/dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml +++ b/dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -25,7 +25,6 @@ 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"> - bin zip diff --git a/dmaap-listener/.gitignore b/dmaap-listener/.gitignore new file mode 100755 index 00000000..1b8a6ba9 --- /dev/null +++ b/dmaap-listener/.gitignore @@ -0,0 +1,12 @@ +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 new file mode 100755 index 00000000..3fa23153 --- /dev/null +++ b/dmaap-listener/.sonar/checkstyle.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/dmaap-listener/.sonar/pmd.xml b/dmaap-listener/.sonar/pmd.xml new file mode 100755 index 00000000..80343b3b --- /dev/null +++ b/dmaap-listener/.sonar/pmd.xml @@ -0,0 +1,67 @@ + + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 2 + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 5 + + + 2 + + + 3 + + + 3 + + + diff --git a/dmaap-listener/pom.xml b/dmaap-listener/pom.xml new file mode 100755 index 00000000..a46d7ca4 --- /dev/null +++ b/dmaap-listener/pom.xml @@ -0,0 +1,113 @@ + + 4.0.0 + org.openecomp.sdnc.northbound + jar + dmaap-listener + 1.1.0-SNAPSHOT + + DMAAP Listener + DMAAP Listener + + org.openecomp.sdnc.northbound + sdnc-northbound + 1.1.0-SNAPSHOT + + + 1.1.7-SNAPSHOT + 2.9.0.pr1 + true + /opt/app/dmaap-listener + 0.2.12 + yyMMdd-HHmmss + ${maven.build.timestamp} + ${project.version}-${build.number} + + + + + + com.att.nsa + dmaapClient + ${dmaap.listener.version} + + + org.slf4j + slf4j-api + 1.7.10 + + + org.slf4j + slf4j-log4j12 + 1.6.1 + compile + + + log4j + log4j + 1.2.17 + + + com.fasterxml.jackson.core + jackson-core + ${fasterxml.jackson.version} + + + com.fasterxml.jackson.core + jackson-databind + ${fasterxml.jackson.version} + + + junit + junit + ${junit.version} + test + + + org.openecomp.sdnc.core + dblib-provider + 1.1.0-SNAPSHOT + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.5.1 + true + + 1.7 + 1.7 + + + + + + maven-assembly-plugin + + + create-zip + + single + + package + + true + ${project.artifactId}.${project.version} + true + + src/assembly/assemble_zip.xml + + + + + + + + + + diff --git a/dmaap-listener/src/assembly/assemble_zip.xml b/dmaap-listener/src/assembly/assemble_zip.xml new file mode 100644 index 00000000..b8c44c77 --- /dev/null +++ b/dmaap-listener/src/assembly/assemble_zip.xml @@ -0,0 +1,59 @@ + + + + + + + zip + + + false + + + + src/main/scripts + bin + + + target + lib + + *.jar + + + + src/main/resources + lib + + *.properties + + + + + + lib + true + runtime + + + 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 new file mode 100644 index 00000000..bfc342c8 --- /dev/null +++ b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DmaapListener.java @@ -0,0 +1,165 @@ +/*- + * ============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 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 new file mode 100644 index 00000000..b948d4a7 --- /dev/null +++ b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DummyDmaapConsumer.java @@ -0,0 +1,37 @@ +/*- + * ============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 new file mode 100644 index 00000000..cff4edbf --- /dev/null +++ b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/InvalidMessageException.java @@ -0,0 +1,37 @@ +/*- + * ============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 new file mode 100644 index 00000000..42ae1a21 --- /dev/null +++ b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncDmaapConsumer.java @@ -0,0 +1,146 @@ +/*- + * ============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 new file mode 100644 index 00000000..1cc5d149 --- /dev/null +++ b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncFlatJsonDmaapConsumer.java @@ -0,0 +1,196 @@ +/*- + * ============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 UEBLISTENERROOT = "UEBLISTENERROOT"; + 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> instarFields = instarRootNode.fields(); + + while (instarFields.hasNext()) { + Map.Entry entry = instarFields.next(); + + instarMsgName = entry.getKey(); + instarRootNode = entry.getValue(); + break; + } + + Map 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 loadMap(String msgType, String mapDirName) { + Map results = new HashMap(); + + + if (mapDirName == null) { + String rootdir = System.getenv(UEBLISTENERROOT); + + if ((rootdir == null) || (rootdir.length() == 0)) { + rootdir = "/opt/app/ueb-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 new file mode 100644 index 00000000..94596e60 --- /dev/null +++ b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncOdlConnection.java @@ -0,0 +1,159 @@ +/*- + * ============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 new file mode 100644 index 00000000..57644bbd --- /dev/null +++ b/dmaap-listener/src/main/resources/edgeRouterStatusChange.map @@ -0,0 +1,23 @@ +# 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 new file mode 100644 index 00000000..b6960a7d --- /dev/null +++ b/dmaap-listener/src/main/resources/log4j.properties @@ -0,0 +1,37 @@ +### +# ============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 new file mode 100644 index 00000000..662b0aa7 --- /dev/null +++ b/dmaap-listener/src/main/resources/preferredRoute.txt @@ -0,0 +1 @@ +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 new file mode 100644 index 00000000..cee16fc3 --- /dev/null +++ b/dmaap-listener/src/main/scripts/start-dmaap-listener.sh @@ -0,0 +1,69 @@ +#!/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} com.att.sdnctl.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 new file mode 100644 index 00000000..0193f15e --- /dev/null +++ b/dmaap-listener/src/main/scripts/stop-dmaap-listener.sh @@ -0,0 +1,52 @@ +#!/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 new file mode 100644 index 00000000..19ff8bdb --- /dev/null +++ b/dmaap-listener/src/site/apt/index.apt @@ -0,0 +1,46 @@ +~~~ +~~ ============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 new file mode 100644 index 00000000..4118c7b6 --- /dev/null +++ b/dmaap-listener/src/site/site.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index f642ab0c..c3485977 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.openecomp.sdnc.core root - 1.1.1-SNAPSHOT + 1.1.0 4.0.0 @@ -14,13 +14,13 @@ sdnc-northbound SDN-C Northbound APIs - https://wiki.onap.org + https://wiki.openecomp.org The SDN-C Northbound APIs repo contains code for northbound API adaptors, typically MD-SAL applications JIRA - https://jira.onap.org/ + https://jira.openecomp.org/ @@ -33,13 +33,13 @@ Jenkins - https://jenkins.onap.org/ + https://jenkins.openecomp.org/ - ecomp-site - dav:https://${openecomp.nexus.host}/content/sites/site/org/onap/sdnc/${project.artifactId}/${project.version} + sdnc-javadoc + dav:https://${openecomp.nexus.host}:${openecomp.nexus.port}/repository/sdn-c-javadoc/${project.artifactId}/${project.version} @@ -109,7 +109,8 @@ asdcApi dataChange - + dmaap-listener + ueb-listener vnfapi vnftools diff --git a/ueb-listener/pom.xml b/ueb-listener/pom.xml index 91ef89fa..48c47a84 100755 --- a/ueb-listener/pom.xml +++ b/ueb-listener/pom.xml @@ -1,19 +1,20 @@ 4.0.0 - org.openecomp.sdnc.northbound + org.openecomp.sdnc.northbound jar ueb-listener - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT UEB Listener UEB Listener org.openecomp.sdnc.northbound sdnc-northbound - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT - 1.1.0 + 1.1.7-SNAPSHOT + 2.9.0.pr1 true /opt/app/ueb-listener yyMMdd-HHmmss @@ -24,12 +25,11 @@ - org.openecomp.sdc + org.openecomp.sdc.sdc-distribution-client sdc-distribution-client ${sdc.client.version} compile - org.slf4j slf4j-api @@ -47,9 +47,25 @@ 1.2.17 - commons-codec - commons-codec - ${commons.codec.version} + com.fasterxml.jackson.core + jackson-core + ${fasterxml.jackson.version} + + + com.fasterxml.jackson.core + jackson-databind + ${fasterxml.jackson.version} + + + junit + junit + ${junit.version} + test + + + org.openecomp.sdnc.core + dblib-provider + 1.1.0-SNAPSHOT @@ -99,7 +115,6 @@ src/assembly/assemble_zip.xml - false diff --git a/ueb-listener/src/assembly/assemble_zip.xml b/ueb-listener/src/assembly/assemble_zip.xml index 48aafa57..29e3b414 100644 --- a/ueb-listener/src/assembly/assemble_zip.xml +++ b/ueb-listener/src/assembly/assemble_zip.xml @@ -3,7 +3,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 AT&T Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -25,7 +25,6 @@ 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"> - bin zip @@ -49,6 +48,7 @@ lib *.xslt + *.properties diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncARModel.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncARModel.java new file mode 100644 index 00000000..0bb7a852 --- /dev/null +++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncARModel.java @@ -0,0 +1,53 @@ +/*- + * ============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.uebclient; + +import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; +import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames; +import org.openecomp.sdc.toscaparser.api.Metadata; +import org.openecomp.sdc.toscaparser.api.NodeTemplate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncARModel extends SdncBaseModel { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncARModel.class); + + public SdncARModel(ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate) { + + super(sdcCsarHelper, nodeTemplate); + + // extract metadata + Metadata metadata = nodeTemplate.getMetadata(); + addParameter("type", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_TYPE)); + + // extract properties + //addParameter("role", extractValue (sdcCsarHelper, nodeTemplate, SdcPropertyNames.PROPERTY_NAME_ROLE)); + //addParameter("type", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_TYPE)); - wrong location, get from metadata + addParameter("ecomp_generated_naming", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VFCNAMING_ECOMPGENERATEDNAMING)); + addParameter("naming_policy", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VFCNAMING_NAMINGPOLICY)); + //addParameter("depending_service", extractValue (sdcCsarHelper, nodeTemplate, SdcPropertyNames.PROPERTY_NAME_DEPENDINGSERVICE)); + //addParameter("service_dependency", extractValue (sdcCsarHelper, nodeTemplate, SdcPropertyNames.PROPERTY_NAME_SERVICEDEPENDENCY)); + } + +} diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncArtifactMap.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncArtifactMap.java new file mode 100644 index 00000000..5b004185 --- /dev/null +++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncArtifactMap.java @@ -0,0 +1,134 @@ +/*- + * ============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.uebclient; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncArtifactMap { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncArtifactMap.class); + + public class SdncArtifactType { + private String tag; + private String artifactType; + private String rpc; + private int pass; + + public String getTag() { + return tag; + } + public String getArtifactType() { + return artifactType; + } + public String getRpc() { + return rpc; + } + + public int getPass() { + return pass; + } + + public String getRpcUrl(String base) { + return(base+rpc); + } + + private SdncArtifactType(String tag, String rpc, String pass) { + this.tag = tag; + this.rpc = rpc; + try { + this.pass = Integer.parseInt(pass); + } catch (Exception e) { + LOG.error("Invalid pass value for artifact map entry ("+tag+","+rpc+","+pass+")"); + } + } + } + + + + private Map mapItems = new HashMap(); + + private int NumPasses = 1; + + public int getNumPasses() { + return NumPasses; + } + + public void load(String fileName) { + + File mapFile = new File(fileName); + + if (mapFile.exists() && mapFile.canRead()) { + + BufferedReader rdr = null; + try { + + rdr = new BufferedReader(new FileReader(mapFile)); + + for (String ln ; (ln = rdr.readLine()) != null ; ) { + String[] lnFields = ln.split(","); + if (lnFields.length == 3) { + SdncArtifactType entry = new SdncArtifactType(lnFields[0], lnFields[1], lnFields[2]); + mapItems.put(entry.getTag(), entry); + if (entry.getPass() + 1 > NumPasses ) { + NumPasses = entry.getPass() + 1; + } + } + } + + + } catch (Exception e) { + LOG.error("Caught exception reading artifact map", e); + return; + } finally { + if (rdr != null) { + try { + rdr.close(); + } catch (IOException e) { + + } + } + } + } + } + + public SdncArtifactType getMapping(String tag) { + if (mapItems.containsKey(tag)) { + return(mapItems.get(tag)); + } else { + return(null); + } + } + + public static SdncArtifactMap getInstance() { + return new SdncArtifactMap(); + } + +} diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncBaseModel.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncBaseModel.java new file mode 100644 index 00000000..6eb9dcc5 --- /dev/null +++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncBaseModel.java @@ -0,0 +1,297 @@ +/*- + * ============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.uebclient; + +import java.util.HashMap; +import java.util.Map; + +import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; +import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames; +import org.openecomp.sdc.toscaparser.api.Group; +import org.openecomp.sdc.toscaparser.api.Metadata; +import org.openecomp.sdc.toscaparser.api.NodeTemplate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncBaseModel { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncBaseModel.class); + + protected String customizationUUID = null; + protected String invariantUUID = null; + protected String model_yaml = null; + protected String version = null; + + protected Map params = null; + protected ISdcCsarHelper sdcCsarHelper = null; + + public SdncBaseModel() { + + } + + public SdncBaseModel(ISdcCsarHelper sdcCsarHelper, Metadata metadata) { + + params = new HashMap(); + this.sdcCsarHelper = sdcCsarHelper; + + // extract service metadata + invariantUUID = extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID); + addParameter("invariant_uuid",invariantUUID); + addParameter("version",extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_VERSION)); + addParameter("name",extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_NAME)); + addParameter("description",extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + addParameter("type",extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_TYPE)); + addParameter("category",extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_CATEGORY)); + } + + public SdncBaseModel(ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate) { + + params = new HashMap(); + this.sdcCsarHelper = sdcCsarHelper; + + // extract nodeTemplate metadata + Metadata metadata = nodeTemplate.getMetadata(); + customizationUUID = extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); + addParameter("invariant_uuid", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + addParameter("uuid", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_UUID)); + addParameter("version", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VERSION)); + } + + public SdncBaseModel(ISdcCsarHelper sdcCsarHelper, Group group) { + + params = new HashMap(); + this.sdcCsarHelper = sdcCsarHelper; + + // extract group metadata + Metadata metadata = group.getMetadata(); + //customizationUUID = extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULECUSTOMIZATIONUUID); - returning null + customizationUUID = extractValue (metadata, "vfModuleModelCustomizationUUID"); + addParameter("invariant_uuid", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)); + addParameter("uuid", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)); + addParameter("version", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION)); + } + + protected void addParameter (String name, String value) { + if (value != null && !value.isEmpty()) { + params.put(name, "\"" + value + "\""); + } + } + + protected void addIntParameter (String name, String value) { + if (value != null && !value.isEmpty()) { + params.put(name, value); + } + } + + public static void addIntParameter (String name, String value, Map params) { + if (value != null && !value.isEmpty()) { + params.put(name, value); + } + } + + public static void addParameter (String name, String value, Map params) { + if (value != null && !value.isEmpty()) { + params.put(name, "\"" + value + "\""); + } + } + + protected String extractValue (Metadata metadata, String name) { + String value = sdcCsarHelper.getMetadataPropertyValue(metadata, name); + if (value != null) { + return value; + } else { + return ""; + } + } + + public static String extractValue (ISdcCsarHelper sdcCsarHelper, Metadata metadata, String name) { + String value = sdcCsarHelper.getMetadataPropertyValue(metadata, name); + if (value != null) { + return value; + } else { + return ""; + } + } + + protected String extractValue (NodeTemplate nodeTemplate, String name) { + String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, name); + if (value != null) { + return value; + } else { + return ""; + } + } + + public static String extractValue (ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate, String name) { + String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, name); + if (value != null) { + return value; + } else { + return ""; + } + } + + protected String extractBooleanValue (NodeTemplate nodeTemplate, String name) { + String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, name); + if (value != null && !value.isEmpty()) { + return value.contains("true") ? "Y" : "N"; + } else { + return ""; + } + } + + public static String extractBooleanValue (ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate, String name) { + String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, name); + if (value != null && !value.isEmpty()) { + return value.contains("true") ? "Y" : "N"; + } else { + return ""; + } + } + + protected String extractValue (Group group, String name) { + String value = sdcCsarHelper.getGroupPropertyLeafValue(group, name); + if (value != null) { + return value; + } else { + return ""; + } + } + + protected String extractBooleanValue (Group group, String name) { + String value = sdcCsarHelper.getGroupPropertyLeafValue(group, name); + if (value != null && !value.isEmpty()) { + return value.contains("true") ? "Y" : "N"; + } else { + return ""; + } + } + + protected String extractInputDefaultValue (String name) { + String value = sdcCsarHelper.getServiceInputLeafValueOfDefault(name); + if (value != null) { + return value; + } else { + return ""; + } + } + + protected String extractBooleanInputDefaultValue (String name) { + String value = sdcCsarHelper.getServiceInputLeafValueOfDefault(name); + if (value != null && !value.isEmpty()) { + return value.contains("true") ? "Y" : "N"; + } else { + return ""; + } + } + + public static String extractInputDefaultValue (ISdcCsarHelper sdcCsarHelper, String name) { + String value = sdcCsarHelper.getServiceInputLeafValueOfDefault(name); + if (value != null) { + return value; + } else { + return ""; + } + } + + public static String extractBooleanInputDefaultValue (ISdcCsarHelper sdcCsarHelper, String name) { + String value = sdcCsarHelper.getServiceInputLeafValueOfDefault(name); + if (value != null && !value.isEmpty()) { + return value.contains("true") ? "Y" : "N"; + } else { + return ""; + } + } + + public static String extractSubstitutionMappingTypeName (ISdcCsarHelper sdcCsarHelper) { + String value = sdcCsarHelper.getServiceSubstitutionMappingsTypeName(); + if (value != null) { + return value; + } else { + return ""; + } + } + + public String getCustomizationUUID() { + return ("\"" + customizationUUID + "\""); + } + public String getCustomizationUUIDNoQuotes() { + return (customizationUUID); + } + public void setCustomizationUUID(String customizationUUID) { + this.customizationUUID = customizationUUID; + } + + public String getSql(String tableName, String model_yaml) { + + StringBuilder sb = new StringBuilder(); + sb.append("INSERT into " + tableName + " (customization_uuid, model_yaml, "); + + int paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + sb.append(paramKey); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(") values (" + getCustomizationUUID() + ", \"" + model_yaml + "\", "); + + paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + String paramValue = params.get(paramKey); + sb.append(paramValue); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(");"); + return sb.toString(); + } + + public static String getSql(String tableName, String keyName, String keyValue, String model_yaml, Map params) { + + StringBuilder sb = new StringBuilder(); + sb.append("INSERT into " + tableName + " (" + keyName + ", "); + + int paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + sb.append(paramKey); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(") values (" + keyValue + ", "); + + paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + String paramValue = params.get(paramKey); + sb.append(paramValue); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(");"); + return sb.toString(); + } + +} diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncNodeModel.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncNodeModel.java new file mode 100644 index 00000000..b0fdc5e3 --- /dev/null +++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncNodeModel.java @@ -0,0 +1,145 @@ +/*- + * ============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.uebclient; + +import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; +import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames; +import org.openecomp.sdc.toscaparser.api.NodeTemplate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncNodeModel extends SdncBaseModel { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncNodeModel.class); + + private String serviceUUID = null; + private String ecompGeneratedNaming = null; + private String [] bindingUuids = null; + + // Using ASDC TOSCA Parser 17.07 + public SdncNodeModel(ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate) { + + super(sdcCsarHelper, nodeTemplate); + + // extract inputs + String ecompGeneratedNaming = extractBooleanInputDefaultValue(SdcPropertyNames.PROPERTY_NAME_SERVICENAMING_DEFAULT_ECOMPGENERATEDNAMING); + addParameter("ecomp_generated_naming",ecompGeneratedNaming); + addParameter("naming_policy", extractInputDefaultValue(SdcPropertyNames.PROPERTY_NAME_SERVICENAMING_DEFAULT_NAMINGPOLICY)); + + // extract properties + addParameter("network_type", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE)); + addParameter("network_role", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE)); + addParameter("network_scope", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)); + addParameter("network_technology", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY)); + + // extract properties - network_assignments + addParameter("is_shared_network", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_ISSHAREDNETWORK)); + addParameter("is_external_network", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_ISEXTERNALNETWORK)); + + // extract properties - network_assignments - ipv4_subnet_default_assignment + String useIpv4 = extractBooleanValue(nodeTemplate, "network_assignments#ipv4_subnet_default_assignment#use_ipv4"); + addParameter("use_ipv4", useIpv4); + addParameter("ipv4_dhcp_enabled", extractBooleanValue(nodeTemplate, "network_assignments#ipv4_subnet_default_assignment#dhcp_enabled")); + if (useIpv4.contains("Y")) { + addParameter("ipv4_ip_version", "ipv4"); + } + addParameter("ipv4_cidr_mask", extractValue(nodeTemplate, "network_assignments#ipv4_subnet_default_assignment#cidr_mask")); + addParameter("eipam_v4_address_plan", extractValue(nodeTemplate, "network_assignments#ipv4_subnet_default_assignment#ip_network_address_plan")); + + // extract properties - network_assignments - ipv6_subnet_default_assignment + String useIpv6 = extractBooleanValue(nodeTemplate, "network_assignments#ipv6_subnet_default_assignment#use_ipv6"); + addParameter("use_ipv6", useIpv6); + addParameter("ipv6_dhcp_enabled", extractBooleanValue(nodeTemplate, "network_assignments#ipv6_subnet_default_assignment#dhcp_enabled")); + if (useIpv6.contains("Y")) { + addParameter("ipv6_ip_version", "ipv6"); + } + addParameter("ipv6_cidr_mask", extractValue(nodeTemplate, "network_assignments#ipv6_subnet_default_assignment#cidr_mask")); + addParameter("eipam_v6_address_plan", extractValue(nodeTemplate, "network_assignments#ipv6_subnet_default_assignment#ip_network_address_plan")); + + // extract properties - provider_network + addParameter("is_provider_network", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK)); + addParameter("physical_network_name", extractValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_PHYSICALNETWORKNAME)); + + // extract properties - network_flows + addParameter("is_bound_to_vpn", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKFLOWS_ISBOUNDTOVPN)); + + // extract properties - network_flows - vpn_bindings + String vpnBindingString = extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKFLOWS_VPNBINDING); + bindingUuids = vpnBindingString.split(","); + +} + + public String getServiceUUID() { + return serviceUUID; + } + public void setServiceUUID(String serviceUUID) { + this.serviceUUID = serviceUUID; + } + + public String getEcompGeneratedNaming() { + return ecompGeneratedNaming; + } + public void setEcompGeneratedNaming(String ecompGeneratedNaming) { + this.ecompGeneratedNaming = ecompGeneratedNaming; + if (ecompGeneratedNaming != null && !ecompGeneratedNaming.isEmpty()) { + params.put("ecomp_generated_naming", "\"" + ecompGeneratedNaming + "\""); + } + } + + public String getSql(String model_yaml) { + + StringBuilder sb = new StringBuilder(); + sb.append("INSERT into NETWORK_MODEL (service_uuid, customization_uuid, model_yaml, "); + + int paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + sb.append(paramKey); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(") values (" + serviceUUID + ", " + getCustomizationUUID() + ", \"" + model_yaml + "\", "); + + paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + String paramValue = params.get(paramKey); + sb.append(paramValue); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(");"); + return sb.toString(); + } + + public String getVpnBindingsSql() { + + StringBuilder sb = new StringBuilder(); + for (int i=0; i < bindingUuids.length; i++) { + sb.append("INSERT into VPN_BINDINGS (network_customization_uuid, binding_uuid) values (" + getCustomizationUUID() + ", \"" + bindingUuids[i] + "\"); "); + } + + return sb.toString(); + } + +} diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncOdlConnection.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncOdlConnection.java new file mode 100644 index 00000000..a277def1 --- /dev/null +++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncOdlConnection.java @@ -0,0 +1,159 @@ +/*- + * ============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.uebclient; + +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/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncServiceModel.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncServiceModel.java new file mode 100644 index 00000000..7e95c8f6 --- /dev/null +++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncServiceModel.java @@ -0,0 +1,98 @@ +/*- + * ============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.uebclient; + +import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; +import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames; +import org.openecomp.sdc.toscaparser.api.Metadata; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncServiceModel extends SdncBaseModel { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncServiceModel.class); + + private String UUID = null; + private String serviceInstanceNamePrefix = null; + private String filename = null; + + public SdncServiceModel(ISdcCsarHelper sdcCsarHelper, Metadata metadata) { + + super(sdcCsarHelper, metadata); + + UUID = extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_UUID); + + // extract service topology template input data + addParameter("ecomp_naming",extractBooleanInputDefaultValue(SdcPropertyNames.PROPERTY_NAME_SERVICENAMING_DEFAULT_ECOMPGENERATEDNAMING)); + addParameter("naming_policy",extractInputDefaultValue(SdcPropertyNames.PROPERTY_NAME_SERVICENAMING_DEFAULT_NAMINGPOLICY)); + } + + public String getServiceUUID() { + return ("\"" + UUID + "\""); + } + public void setServiceUUID(String serviceUUID) { + this.UUID = serviceUUID; + } + public String getServiceInstanceNamePrefix() { + return serviceInstanceNamePrefix; + } + public void setServiceInstanceNamePrefix(String serviceInstanceNamePrefix) { + if (serviceInstanceNamePrefix != null && !serviceInstanceNamePrefix.isEmpty()) { + this.serviceInstanceNamePrefix = serviceInstanceNamePrefix; + params.put("service_instance_name_prefix", "\"" + serviceInstanceNamePrefix + "\""); + } + } + public String getFilename() { + return filename; + } + public void setFilename(String filename) { + this.filename = filename; + } + + public String getSql(String model_yaml) { + + StringBuilder sb = new StringBuilder(); + sb.append("INSERT into SERVICE_MODEL (service_uuid, model_yaml, filename, "); + + int paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + sb.append(paramKey); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(") values (" + getServiceUUID() + ", \"" + model_yaml + "\", \"" + filename + "\", "); + + paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + String paramValue = params.get(paramKey); + sb.append(paramValue); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(");"); + return sb.toString(); + } + +} diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebCallback.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebCallback.java index 3fa752bc..03933975 100644 --- a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebCallback.java +++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebCallback.java @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,12 @@ import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.DataOutputStream; import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; import java.net.Authenticator; import java.net.HttpURLConnection; @@ -37,14 +40,20 @@ import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; +import java.sql.ResultSet; +import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map; +import java.util.Properties; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLSession; +import javax.sql.rowset.CachedRowSet; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Source; @@ -56,6 +65,7 @@ import javax.xml.xpath.XPath; import javax.xml.xpath.XPathFactory; import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang3.tuple.Pair; import org.openecomp.sdc.api.IDistributionClient; import org.openecomp.sdc.api.consumer.IDistributionStatusMessage; import org.openecomp.sdc.api.consumer.INotificationCallback; @@ -64,60 +74,33 @@ import org.openecomp.sdc.api.notification.INotificationData; import org.openecomp.sdc.api.notification.IResourceInstance; import org.openecomp.sdc.api.results.IDistributionClientDownloadResult; import org.openecomp.sdc.api.results.IDistributionClientResult; +import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; +import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException; +import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames; +import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory; +import org.openecomp.sdc.toscaparser.api.Group; +import org.openecomp.sdc.toscaparser.api.Metadata; +import org.openecomp.sdc.toscaparser.api.NodeTemplate; import org.openecomp.sdc.utils.ArtifactTypeEnum; import org.openecomp.sdc.utils.DistributionActionResultEnum; import org.openecomp.sdc.utils.DistributionStatusEnum; +import org.openecomp.sdnc.sli.resource.dblib.DBResourceManager; +import org.openecomp.sdnc.uebclient.SdncArtifactMap.SdncArtifactType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.yaml.snakeyaml.Yaml; +import org.yaml.snakeyaml.constructor.Constructor; public class SdncUebCallback implements INotificationCallback { private static final Logger LOG = LoggerFactory .getLogger(SdncUebCallback.class); - private static final int NUM_PASSES = 2; + private static DBResourceManager jdbcDataSource = null; + private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR"; - private enum SdncArtifactType { - VF_LICENSE_MODEL("vf-license-model", "vf-license-model-update",0), - UNKNOWN("","",0); - - - private String tag; - private String rpcName; - private int pass; - - public int getPass() { - return pass; - } - - private SdncArtifactType(String tag, String rpcName, int pass) { - this.tag = tag; - this.rpcName = rpcName; - this.pass = pass; - } - - public String getTag() { - return tag; - } - - public String getRpcUrl(String base) { - return base+rpcName; - } - - public static SdncArtifactType fromTag(String tag) { - if (tag != null) { - for (SdncArtifactType artifact: SdncArtifactType.values()) { - if (artifact.getTag().equalsIgnoreCase(tag)) { - return artifact; - } - } - } - - return UNKNOWN; - } - } private class SdncAuthenticator extends Authenticator { @@ -176,6 +159,8 @@ public class SdncUebCallback implements INotificationCallback { public DeployableArtifact(SdncArtifactType type, String svcName, String resourceName, IArtifactInfo artifactInfo, File file) { this.type = type; this.artifactInfo = artifactInfo; + this.svcName = svcName; + this.resourceName = resourceName; this.artifactName = artifactInfo.getArtifactName(); this.artifactVersion = artifactInfo.getArtifactVersion(); this.file = file; @@ -185,6 +170,8 @@ public class SdncUebCallback implements INotificationCallback { public DeployableArtifact(SdncArtifactType type, String svcName, String resourceName, String artifactName, String artifactVersion, File file) { this.type = type; this.artifactInfo = null; + this.svcName = svcName; + this.resourceName = resourceName; this.artifactName = artifactName; this.artifactVersion = artifactVersion; this.file = file; @@ -207,24 +194,57 @@ public class SdncUebCallback implements INotificationCallback { private final IDistributionClient client; private final SdncUebConfiguration config; - private final LinkedList deployList[]; + private LinkedList deployList[]; + private static void setJdbcDataSource() throws IOException { + + String propPath = null; + String propDir = System.getenv(SDNC_CONFIG_DIR); + if (propDir == null) { + + propDir = "/opt/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)); + + try { + jdbcDataSource = DBResourceManager.create(props); + } catch(Throwable exc) { + LOG.error("", exc); + } + + if(((DBResourceManager)jdbcDataSource).isActive()){ + LOG.warn( "DBLIB: JDBC DataSource has been initialized."); + } else { + LOG.warn( "DBLIB: JDBC DataSource did not initialize successfully."); + } + } + + private static void loadArtifactMap() { + + } public SdncUebCallback(IDistributionClient client, SdncUebConfiguration config) { this.client = client; this.config = config; - this.deployList = new LinkedList[NUM_PASSES]; - for (int i = 0 ; i < NUM_PASSES ; i++) { - this.deployList[i] = new LinkedList<>(); - } } @Override public void activateCallback(INotificationData data) { LOG.info("Received notification : ("+data.getDistributionID()+","+data.getServiceName()+","+data.getServiceVersion()+ - ","+data.getServiceDescription()); + ","+data.getServiceDescription() + ")"); String incomingDirName = config.getIncomingDir(); String archiveDirName = config.getArchiveDir(); @@ -260,7 +280,7 @@ public class SdncUebCallback implements INotificationCallback { LOG.info("Received artifact " + curArtifact.getArtifactName()); - handleArtifact(data, data.getServiceName(), null, curArtifact, incomingDir, archiveDir); + handleArtifact(data, data.getServiceName(), null, null, curArtifact, incomingDir, archiveDir); } } @@ -287,7 +307,7 @@ public class SdncUebCallback implements INotificationCallback { LOG.info("Received artifact " + curArtifact.getArtifactName()); - handleArtifact(data, data.getServiceName(), curResource.getResourceName(), curArtifact, incomingDir, archiveDir); + handleArtifact(data, data.getServiceName(), curResource.getResourceName(), curResource.getResourceType(), curArtifact, incomingDir, archiveDir); } } } @@ -330,8 +350,14 @@ public class SdncUebCallback implements INotificationCallback { } // Deploy scheduled deployments + int numPasses = config.getMaxPasses(); + + deployList = new LinkedList[numPasses]; - for (int pass = 0 ; pass < NUM_PASSES ; pass++) { + for (int i = 0 ; i < numPasses ; i++) { + deployList[i] = new LinkedList(); + } + for (int pass = 0 ; pass < config.getMaxPasses() ; pass++) { if (deployList[pass] != null) { while (! deployList[pass].isEmpty()) { @@ -350,7 +376,7 @@ public class SdncUebCallback implements INotificationCallback { IArtifactInfo artifactInfo = artifact.getArtifactInfo(); - if (artifactInfo != null && data != null) { + if ((artifactInfo != null) && (data != null)) { IDistributionClientResult deploymentStatus; deploymentStatus = client.sendDeploymentStatus(buildStatusMessage( client, data, artifactInfo, @@ -362,13 +388,26 @@ public class SdncUebCallback implements INotificationCallback { } } - private void handleArtifact(INotificationData data, String svcName, String resourceName, IArtifactInfo artifact, File incomingDir, File archiveDir) { + private void handleArtifact(INotificationData data, String svcName, String resourceName, String resourceType, IArtifactInfo artifact, File incomingDir, File archiveDir) { // Download Artifact IDistributionClientDownloadResult downloadResult = client .download(artifact); - String payload = new String(downloadResult.getArtifactPayload()); + if (downloadResult == null) { + + handleFailedDownload(data, artifact); + return; + } + + byte[] payloadBytes = downloadResult.getArtifactPayload(); + + if (payloadBytes == null) { + handleFailedDownload(data, artifact); + return; + } + + String payload = new String(payloadBytes); File spoolFile = new File(incomingDir.getAbsolutePath() + "/" + artifact.getArtifactName()); @@ -385,7 +424,7 @@ public class SdncUebCallback implements INotificationCallback { } - if (writeSucceeded && downloadResult.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS) { + if (writeSucceeded && (downloadResult.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS)) { handleSuccessfulDownload(data, svcName, resourceName, artifact, spoolFile, archiveDir); @@ -406,7 +445,7 @@ public class SdncUebCallback implements INotificationCallback { private void handleSuccessfulDownload(INotificationData data, String svcName, String resourceName, IArtifactInfo artifact, File spoolFile, File archiveDir) { - if (data != null && artifact != null) { + if ((data != null) && (artifact != null)) { // Send Download Status IDistributionClientResult sendDownloadStatus = client .sendDownloadStatus(buildStatusMessage(client, data, artifact, DistributionStatusEnum.DOWNLOAD_OK)); @@ -415,11 +454,19 @@ public class SdncUebCallback implements INotificationCallback { // If an override file exists, read that instead of the file we just downloaded ArtifactTypeEnum artifactEnum = ArtifactTypeEnum.YANG_XML; + boolean toscaYamlType = false; if (artifact != null) { - artifact.getArtifactType(); + String artifactTypeString = artifact.getArtifactType(); + if (artifactTypeString.contains("TOSCA_TEMPLATE")) { + toscaYamlType = true; + } + } else { + if (spoolFile.toString().contains(".yml") || spoolFile.toString().contains(".csar")) { + toscaYamlType = true; + } } String overrideFileName = config.getOverrideFile(); - if (overrideFileName != null && overrideFileName.length() > 0) { + if ((overrideFileName != null) && (overrideFileName.length() > 0)) { File overrideFile = new File(overrideFileName); if (overrideFile.exists()) { @@ -429,13 +476,30 @@ public class SdncUebCallback implements INotificationCallback { } + if (toscaYamlType == true) { + processToscaYaml (data, svcName, resourceName, artifact, spoolFile, archiveDir); + + try { + Path source = spoolFile.toPath(); + Path targetDir = archiveDir.toPath(); + + Files.move(source, targetDir.resolve(source.getFileName()), StandardCopyOption.REPLACE_EXISTING); + } catch (IOException e) { + LOG.warn("Could not move "+spoolFile.getAbsolutePath()+" to "+archiveDir.getAbsolutePath(), e); + } + + return; + } + // Process spool file Document spoolDoc = null; File transformedFile = null; // Apply XSLTs and get Doc object try { + if (!spoolFile.isDirectory()) { transformedFile = applyXslts(spoolFile); + } } catch (Exception e) { LOG.error("Caught exception trying to parse XML file", e); } @@ -467,7 +531,7 @@ public class SdncUebCallback implements INotificationCallback { SdncArtifactType artifactType = analyzeFileType(artifactEnum, spoolFile, spoolDoc); - if (artifactType != SdncArtifactType.UNKNOWN) { + if (artifactType != null) { scheduleDeployment(artifactType, svcName, resourceName, artifact, spoolFile.getName(), transformedFile); @@ -489,11 +553,285 @@ public class SdncUebCallback implements INotificationCallback { } + private void processToscaYaml(INotificationData data, String svcName, String resourceName, + IArtifactInfo artifact, File spoolFile, File archiveDir) { + + // Use ASDC Dist Client 1.1.5 with TOSCA parsing APIs to extract relevant TOSCA model data + + // TOSCA data extraction flow 1707: + // Use ASDC dist-client to get yaml string - not yet available + String model_yaml = null; + LOG.info("Process TOSCA YAML file: "+spoolFile.toString()); + + SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance(); + ISdcCsarHelper sdcCsarHelper = null; + try { + sdcCsarHelper = factory.getSdcCsarHelper(spoolFile.getAbsolutePath()); + } catch (SdcToscaParserException e) { + LOG.error("Could not create SDC TOSCA Parser ", e); + factory.close(); + return; + } + + // Ingest Service Data - 1707 + Metadata serviceMetadata = sdcCsarHelper.getServiceMetadata(); + SdncServiceModel serviceModel = new SdncServiceModel(sdcCsarHelper, serviceMetadata); + serviceModel.setFilename(spoolFile.toString().substring(spoolFile.toString().lastIndexOf("/")+1)); // will be csar file name + serviceModel.setServiceInstanceNamePrefix(SdncBaseModel.extractSubstitutionMappingTypeName(sdcCsarHelper).substring(SdncBaseModel.extractSubstitutionMappingTypeName(sdcCsarHelper).lastIndexOf(".")+1)); + + try { + cleanUpExistingToscaServiceData(serviceModel.getServiceUUID()); + LOG.info("Call insertToscaData for SERVICE_MODEL serviceUUID = " + serviceModel.getServiceUUID()); + insertToscaData(serviceModel.getSql(model_yaml)); + } catch (IOException e) { + LOG.error("Could not insert Tosca YAML data into the SERVICE_MODEL table ", e); + factory.close(); + return; + } + + // Ingest Network (VL) Data - 1707 + //List vlNodeTemplatesList = sdcCsarHelper.getServiceNodeTemplatesByType("VL"); + List vlNodeTemplatesList = sdcCsarHelper.getServiceVlList(); + + for (NodeTemplate nodeTemplate : vlNodeTemplatesList) { + SdncNodeModel nodeModel = new SdncNodeModel (sdcCsarHelper, nodeTemplate); + nodeModel.setServiceUUID(serviceModel.getServiceUUID()); + nodeModel.setEcompGeneratedNaming(SdncBaseModel.extractBooleanInputDefaultValue(sdcCsarHelper, SdcPropertyNames.PROPERTY_NAME_SERVICENAMING_DEFAULT_ECOMPGENERATEDNAMING));//service_naming#default#ecomp_generated_naming + + try { + cleanUpExistingToscaData("NETWORK_MODEL", "customization_uuid", nodeModel.getCustomizationUUID()); + cleanUpExistingToscaData("VPN_BINDINGS", "network_customization_uuid", nodeModel.getCustomizationUUID()); + LOG.info("Call insertToscaData for NETWORK_MODEL customizationUUID = " + nodeModel.getCustomizationUUID()); + // using ASDC dist-client use method for get yaml string + insertToscaData(nodeModel.getSql(model_yaml)); + insertToscaData(nodeModel.getVpnBindingsSql()); + } catch (IOException e) { + LOG.error("Could not insert Tosca YAML data into the NETWORK_MODEL table ", e); + } + } + + // Ingest Allotted Resource Data - 1707 + List arNodeTemplatesList = sdcCsarHelper.getAllottedResources(); + + for (NodeTemplate nodeTemplate : arNodeTemplatesList) { + SdncARModel nodeModel = new SdncARModel (sdcCsarHelper, nodeTemplate); + + try { + cleanUpExistingToscaData("ALLOTTED_RESOURCE_MODEL", "customization_uuid", nodeModel.getCustomizationUUID()); + LOG.info("Call insertToscaData for ALLOTTED_RESOURCE_MODEL customizationUUID = " + nodeModel.getCustomizationUUID()); + // using ASDC dist-client use method for get yaml string + insertToscaData(nodeModel.getSql("ALLOTTED_RESOURCE_MODEL", model_yaml)); + } catch (IOException e) { + LOG.error("Could not insert Tosca YAML data into the NETWORK_MODEL table ", e); + } + } + + // Ingest Network (VF) Data - 1707 + //List nodeTemplatesList = sdcCsarHelper.getServiceNodeTemplatesByType("VF"); + List vfNodeTemplatesList = sdcCsarHelper.getServiceVfList(); + + for (NodeTemplate nodeTemplate : vfNodeTemplatesList) { + SdncVFModel vfNodeModel = new SdncVFModel (sdcCsarHelper, nodeTemplate); + + try { + cleanUpExistingToscaData("VF_MODEL", "customization_uuid", vfNodeModel.getCustomizationUUID()) ; + LOG.info("Call insertToscaData for VF_MODEL customizationUUID = " + vfNodeModel.getCustomizationUUID()); + insertToscaData(vfNodeModel.getSql("VF_MODEL", model_yaml)); + } catch (IOException e) { + LOG.error("Could not insert Tosca YAML data into the VF_MODEL table ", e); + } + + // For each VF, insert VF_MODULE_MODEL data + List vfModules = sdcCsarHelper.getVfModulesByVf(vfNodeModel.getCustomizationUUIDNoQuotes()); + for (Group group : vfModules){ + SdncVFModuleModel vfModuleModel = new SdncVFModuleModel(sdcCsarHelper, group); + + try { + cleanUpExistingToscaData("VF_MODULE_MODEL", "customization_uuid", vfModuleModel.getCustomizationUUID()); + LOG.info("Call insertToscaData for VF_MODULE_MODEL customizationUUID = " + vfModuleModel.getCustomizationUUID()); + insertToscaData(vfModuleModel.getSql("VF_MODULE_MODEL", model_yaml)); + } catch (IOException e) { + LOG.error("Could not insert Tosca YAML data into the VF_MODULE_MODEL table ", e); + } + + // For each VF Module, get the VFC list, insert VF_MODULE_TO_VFC_MAPPING data + // List groupMembers = sdcCsarHelper.getMembersOfGroup(group); - old version + // For each vfcNode (group member) in the groupMembers list, extract vm_type and vm_count. + // Insert vf_module.customizationUUID, vfcNode.customizationUUID and vm_type and vm_count into VF_MODULE_TO_VFC_MAPPING + List groupMembers = sdcCsarHelper.getMembersOfVfModule(nodeTemplate, group); // not yet available + for (NodeTemplate vfcNode : groupMembers){ + SdncVFCModel vfcModel = new SdncVFCModel(sdcCsarHelper, vfcNode); + + try { + cleanUpExistingToscaData("VF_MODULE_TO_VFC_MAPPING", "vf_module_customization_uuid", vfModuleModel.getCustomizationUUID()); + LOG.info("Call insertToscaData for VF_MODULE_TO_VFC_MAPPING customizationUUID = " + vfModuleModel.getCustomizationUUID()); + insertToscaData("insert into VF_MODULE_TO_VFC_MAPPING (vf_module_customization_uuid, vfc_customization_uuid, vm_type, vm_count) values (" + + vfModuleModel.getCustomizationUUID() + ", " + vfcModel.getCustomizationUUID() + ", \"" + vfcModel.getVmType() + "\", \"" + vfcModel.getVmCount() + "\")"); + } catch (IOException e) { + LOG.error("Could not insert Tosca YAML data into the VF_MODULE_TO_VFC_MAPPING table ", e); + } + + } + + } + + // For each VF, insert VFC_MODEL data + List vfcNodes = sdcCsarHelper.getVfcListByVf(vfNodeModel.getCustomizationUUIDNoQuotes()); + for (NodeTemplate vfcNode : vfcNodes){ + SdncVFCModel vfcModel = new SdncVFCModel(sdcCsarHelper, vfcNode); + + try { + cleanUpExistingToscaData("VFC_MODEL", "customization_uuid", vfcModel.getCustomizationUUID()); + LOG.info("Call insertToscaData for VFC_MODEL customizationUUID = " + vfcModel.getCustomizationUUID()); + insertToscaData(vfcModel.getSql("VFC_MODEL", model_yaml)); + } catch (IOException e) { + LOG.error("Could not insert Tosca YAML data into the VFC_MODEL table ", e); + } + + } + + // For each VF, insert VF_TO_NETWORK_ROLE_MAPPING data + List cpNodes = sdcCsarHelper.getCpListByVf(vfNodeModel.getCustomizationUUIDNoQuotes()); + for (NodeTemplate cpNode : cpNodes){ + + // Insert into VF_TO_NETWORK_ROLE_MAPPING vf_customization_uuid and network_role + String cpNetworkRole = sdcCsarHelper.getNodeTemplatePropertyLeafValue(cpNode, "network_role_tag"); + + try { + cleanUpExistingToscaData("VF_TO_NETWORK_ROLE_MAPPING", "vf_customization_uuid", vfNodeModel.getCustomizationUUID()); + LOG.info("Call insertToscaData for VF_TO_NETWORK_ROLE_MAPPING vfCustomizationUUID = " + vfNodeModel.getCustomizationUUID()); + insertToscaData("insert into VF_TO_NETWORK_ROLE_MAPPING (vf_customization_uuid, network_role) values (" + + vfNodeModel.getCustomizationUUID() + ", \"" + cpNetworkRole + "\")"); + } catch (IOException e) { + LOG.error("Could not insert Tosca YAML data into the VF_TO_NETWORK_ROLE_MAPPING table ", e); + } + + // Insert VFC_TO_NETWORK_ROLE_MAPPING data + Map mappingParams = new HashMap(); + //String cpNetworkRoleTag = "\"" + sdcCsarHelper.getNodeTemplatePropertyLeafValue(cpNode, SdcPropertyNames.PROPERTY_NAME_NETWORKROLETAG) + "\""; + // extract network_role, network_role_tag and virtual_binding from this cpNode + SdncBaseModel.addParameter("network_role", SdncBaseModel.extractValue(sdcCsarHelper, cpNode, "network_role"), mappingParams); + SdncBaseModel.addParameter("network_role_tag", SdncBaseModel.extractValue(sdcCsarHelper, cpNode, "network_role_tag"), mappingParams); + String virtualBinding = "\"" + SdncBaseModel.extractValue(sdcCsarHelper, cpNode, "requirements#virtualBinding") + "\""; + + // get list of cpNodes and vfcNodes with matching virtualBinding + List> matchList = sdcCsarHelper.getNodeTemplatePairsByReqName(sdcCsarHelper.getCpListByVf(vfNodeModel.getCustomizationUUIDNoQuotes()), sdcCsarHelper.getVfcListByVf(vfNodeModel.getCustomizationUUIDNoQuotes()), virtualBinding); + for (Pair match : matchList) { // should be 1 match? + + // extract values from the left "CP" Node + SdncBaseModel.addParameter("ipv4_use_dhcp", SdncBaseModel.extractBooleanValue(sdcCsarHelper, match.getLeft(), SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_IPV4SUBNETDEFAULTASSIGNMENTS_DHCPENABLED), mappingParams); + //SdncBaseModel.addParameter("ipv4_ip_version", SdncBaseModel.extractValue(sdcCsarHelper, match.getLeft(), SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_IPV4SUBNETDEFAULTASSIGNMENTS_IPVERSION), mappingParams); + SdncBaseModel.addParameter("ipv4_ip_version", "dummy_ipv4_vers", mappingParams); + SdncBaseModel.addParameter("ipv6_use_dhcp", SdncBaseModel.extractBooleanValue(sdcCsarHelper, match.getLeft(), SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_IPV6SUBNETDEFAULTASSIGNMENTS_DHCPENABLED), mappingParams); + //SdncBaseModel.addParameter("ipv6_ip_version", SdncBaseModel.extractValue(sdcCsarHelper, match.getLeft(), SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_IPV6SUBNETDEFAULTASSIGNMENTS_IPVERSION), mappingParams); + SdncBaseModel.addParameter("ipv6_ip_version", "dummy_ipv6_vers", mappingParams); + //String extcp_subnetpool_id = "\"" + SdncBaseModel.extractValue(sdcCsarHelper, match.getLeft(), SdcPropertyNames.PROPERTY_NAME_SUBNETPOOLID) + "\""; // need path to subnetpoolid + + // extract values from the right "VFC" Node + String vfcCustomizationUuid = "\"" + SdncBaseModel.extractValue(sdcCsarHelper, match.getRight().getMetadata(), "customization_uuid") + "\""; + SdncBaseModel.addParameter("vm_type", SdncBaseModel.extractValue(sdcCsarHelper, match.getRight(), SdcPropertyNames.PROPERTY_NAME_VMTYPE), mappingParams); + SdncBaseModel.addIntParameter("ipv4_count", SdncBaseModel.extractValue(sdcCsarHelper, match.getRight(), SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_IPV4SUBNETDEFAULTASSIGNMENTS_MINSUBNETSCOUNT), mappingParams); + SdncBaseModel.addIntParameter("ipv6_count", SdncBaseModel.extractValue(sdcCsarHelper, match.getRight(), SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_IPV6SUBNETDEFAULTASSIGNMENTS_MINSUBNETSCOUNT), mappingParams); + + try { + cleanUpExistingToscaData("VFC_TO_NETWORK_ROLE_MAPPING", "vfc_customization_uuid", vfcCustomizationUuid); + LOG.info("Call insertToscaData for VFC_TO_NETWORK_ROLE_MAPPING vfcCustomizationUUID = " + vfcCustomizationUuid); + insertToscaData(SdncBaseModel.getSql("VFC_TO_NETWORK_ROLE_MAPPING", "vfc_customization_uuid", vfcCustomizationUuid, "", mappingParams)); + } catch (IOException e) { + LOG.error("Could not insert Tosca YAML data into the VFC_TO_NETWORK_ROLE_MAPPING table ", e); + } + + } + + } // CP loop + + } // VF loop + + // Close ASDC TOSCA Parser factory - we are done processing this distribution + factory.close(); + + if ((artifact != null) && (data != null)) { + LOG.info("Update to SDN-C succeeded"); + IDistributionClientResult deploymentStatus; + deploymentStatus = client.sendDeploymentStatus(buildStatusMessage( + client, data, artifact, + DistributionStatusEnum.DEPLOY_OK)); + } + + } + + private void cleanUpExistingToscaData(String tableName, String keyName, String keyValue) throws IOException + { + + if (jdbcDataSource == null) { + setJdbcDataSource(); + } + try { + int rowCount = 0; + CachedRowSet data = jdbcDataSource.getData("SELECT * from " + tableName + " where " + keyName + " = " + keyValue + ";", null, ""); + while(data.next()) { + rowCount ++; + } + if (rowCount != 0) { + LOG.info("cleanUpExistingToscaData: " + keyValue); + jdbcDataSource.writeData("DELETE from " + tableName + " where " + keyName + " = " + keyValue + ";", null, null); + } + + } catch (SQLException e) { + LOG.error("Could not clean up existing " + tableName + " for " + keyValue, e); + } + + } + + + private void cleanUpExistingToscaServiceData(String serviceUUID) throws IOException + { + + if (jdbcDataSource == null) { + setJdbcDataSource(); + } + try { + int rowCount = 0; + CachedRowSet data = jdbcDataSource.getData("SELECT * from SERVICE_MODEL where service_uuid = " + serviceUUID + ";", null, ""); + while(data.next()) { + rowCount ++; + } + if (rowCount != 0) { + LOG.info("cleanUpExistingToscaData: " + serviceUUID); + jdbcDataSource.writeData("DELETE from NETWORK_MODEL where service_uuid = " + serviceUUID + ";", null, null); + jdbcDataSource.writeData("DELETE from SERVICE_MODEL where service_uuid = " + serviceUUID + ";", null, null); + } + + } catch (SQLException e) { + LOG.error("Could not clean up existing NETWORK_MODEL and SERVICE_MODEL for service_UUID " + serviceUUID, e); + } + + } + + + private void insertToscaData(String toscaDataString) throws IOException + { + LOG.debug("insertToscaData: " + toscaDataString); + + if (jdbcDataSource == null) { + setJdbcDataSource(); + } + try { + + jdbcDataSource.writeData(toscaDataString, null, null); + + } catch (SQLException e) { + LOG.error("Could not insert Tosca YAML data into the database ", e); + } + + } + + private SdncArtifactType analyzeFileType(ArtifactTypeEnum artifactType, File spoolFile, Document spoolDoc) { if (artifactType != ArtifactTypeEnum.YANG_XML) { LOG.error("Unexpected artifact type - expecting YANG_XML, got "+artifactType); - return SdncArtifactType.UNKNOWN; + return (null); } // Examine outer tag @@ -511,21 +849,22 @@ public class SdncUebCallback implements INotificationCallback { } if (rootName != null) { - SdncArtifactType retValue = SdncArtifactType.fromTag(rootName); + SdncArtifactType mapEntry = config.getMapping(rootName); - if (retValue == SdncArtifactType.UNKNOWN) { + + if (mapEntry == null) { LOG.error("Unexpected file contents - root tag is "+rootName); } - return retValue; + return(mapEntry); } else { LOG.error("Cannot get root tag from file"); - return SdncArtifactType.UNKNOWN; + return(null); } } catch (Exception e) { LOG.error("Could not parse YANG_XML file "+spoolFile.getName(), e); - return SdncArtifactType.UNKNOWN; + return(null); } } @@ -562,7 +901,7 @@ public class SdncUebCallback implements INotificationCallback { String namespace = config.getAsdcApiNamespace(); - if (namespace == null || namespace.length() == 0) { + if ((namespace == null) || (namespace.length() == 0)) { namespace="com:att:sdnctl:asdcapi"; } @@ -602,7 +941,7 @@ public class SdncUebCallback implements INotificationCallback { } catch (Exception e) { LOG.error("Could not process spool file "+artifact.getFile().getName(), e); - return DistributionStatusEnum.DEPLOY_ERROR; + return(DistributionStatusEnum.DEPLOY_ERROR); } msgBuffer.append("\n"); @@ -646,7 +985,7 @@ public class SdncUebCallback implements INotificationCallback { - return deployResult; + return(deployResult); } @@ -709,74 +1048,29 @@ public class SdncUebCallback implements INotificationCallback { conn.setDoOutput(true); conn.setUseCaches(false); - return conn; + return(conn); } private Document postRestXml(String urlString, byte[] msgBytes) { Document response = null; - LOG.info("Sending REST POST to "+urlString); - LOG.info("Message body:\n"+new String(msgBytes)); - try { - HttpURLConnection conn = getRestXmlConnection(urlString, "POST"); - - if (conn instanceof HttpsURLConnection) { - HostnameVerifier hostnameVerifier = new HostnameVerifier() { - @Override - public boolean verify(String hostname, SSLSession session) { - return true; - } - }; - ((HttpsURLConnection)conn).setHostnameVerifier(hostnameVerifier); - } - - // Write message - conn.setRequestProperty("Content-Length", ""+msgBytes.length); - DataOutputStream outStr = new DataOutputStream(conn.getOutputStream()); - outStr.write(msgBytes); - outStr.close(); + SdncOdlConnection odlConn = SdncOdlConnection.newInstance(urlString, config.getSdncUser(), config.getSdncPasswd()); - - // Read response - BufferedReader respRdr; - - LOG.info("Response: "+conn.getResponseCode()+" "+conn.getResponseMessage()); - - - if (conn.getResponseCode() < 300) { - - respRdr = new BufferedReader(new InputStreamReader(conn.getInputStream())); - } else { - respRdr = new BufferedReader(new InputStreamReader(conn.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); + String sdncResp = odlConn.send("POST", "application/xml", new String(msgBytes)); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); - response = db.parse(new ByteArrayInputStream(respString.getBytes())); - + response = db.parse(new ByteArrayInputStream(sdncResp.getBytes())); } catch (Exception e) { - - LOG.error("Caught exception in postRestXml", e); + LOG.error("Caught exception posting to ODL tier", e); } - return response; + return(response); + } private File applyXslts(File srcFile) { @@ -789,7 +1083,7 @@ public class SdncUebCallback implements INotificationCallback { String xsltPathList = config.getXsltPathList(); - if (xsltPathList == null || xsltPathList.length() == 0) { + if ((xsltPathList == null) || (xsltPathList.length() == 0)) { outFile = inFile; } else { @@ -820,7 +1114,7 @@ public class SdncUebCallback implements INotificationCallback { // After transformations, parse transformed XML - return outFile; + return(outFile); } private String escapeFilename(String str) { @@ -833,7 +1127,7 @@ public class SdncUebCallback implements INotificationCallback { } } - return retval.toString(); + return(retval.toString()); } diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebClient.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebClient.java index dd6c5148..bf4446fd 100644 --- a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebClient.java +++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebClient.java @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebConfiguration.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebConfiguration.java index b7d9b983..6abc6f62 100644 --- a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebConfiguration.java +++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebConfiguration.java @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,6 +55,8 @@ public class SdncUebConfiguration implements IConfiguration{ private String asdcApiBaseUrl = null; private String asdcApiNamespace = null; + private SdncArtifactMap artifactMap = SdncArtifactMap.getInstance(); + public String getAsdcApiNamespace() { return asdcApiNamespace; } @@ -172,6 +174,10 @@ public class SdncUebConfiguration implements IConfiguration{ xsltPathList = props.getProperty("org.openecomp.sdnc.uebclient.xslt-path-list"); + String artifactMapFile = props.getProperty("org.openecomp.sdnc.uebclient.artifact-map"); + if (artifactMapFile != null) { + artifactMap.load(artifactMapFile); + } } @@ -256,5 +262,19 @@ public class SdncUebConfiguration implements IConfiguration{ return archiveDir; } + public int getMaxPasses() { + return(artifactMap.getNumPasses()); + } + + public SdncArtifactMap.SdncArtifactType getMapping(String tag) { + return(artifactMap.getMapping(tag)); + } + + @Override + public boolean isFilterInEmptyResources() { + // TODO Auto-generated method stub + return false; + } + } diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFCModel.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFCModel.java new file mode 100644 index 00000000..cf47fb5c --- /dev/null +++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFCModel.java @@ -0,0 +1,69 @@ +/*- + * ============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.uebclient; + +import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; +import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames; +import org.openecomp.sdc.toscaparser.api.NodeTemplate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncVFCModel extends SdncBaseModel { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncVFCModel.class); + + private String vmType = null; + private String vmCount = null; + + public SdncVFCModel(ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate) { + + super(sdcCsarHelper, nodeTemplate); + + // extract properties + vmType = extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VMTYPE); + //vmCount = extractValue (sdcCsarHelper, nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VMCOUNT); - need path to vm_count + vmCount = "1"; + addParameter("vm_type", vmType); + addParameter("vm_type_tag", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VMTYPETAG)); + addParameter("ecomp_generated_naming", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VFCNAMING_ECOMPGENERATEDNAMING)); + addParameter("naming_policy", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VFCNAMING_NAMINGPOLICY)); + addParameter("nfc_naming_code", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFCCODE)); + } + + public String getVmType() { + return vmType; + } + + public void setVmType(String vmType) { + this.vmType = vmType; + } + + public String getVmCount() { + return vmCount; + } + + public void setVmCount(String vmCount) { + this.vmCount = vmCount; + } + +} diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFModel.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFModel.java new file mode 100644 index 00000000..8793cf8c --- /dev/null +++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFModel.java @@ -0,0 +1,56 @@ +/*- + * ============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.uebclient; + +import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; +import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames; +import org.openecomp.sdc.toscaparser.api.Metadata; +import org.openecomp.sdc.toscaparser.api.NodeTemplate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncVFModel extends SdncBaseModel { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncVFModel.class); + + public SdncVFModel(ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate) { + + super(sdcCsarHelper, nodeTemplate); + + // extract metadata + Metadata metadata = nodeTemplate.getMetadata(); + addParameter("name", extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_NAME)); + addParameter("vendor", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_RESOURCEVENDOR)); + addParameter("vendor_version", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_RESOURCEVENDORRELEASE)); + + // extract properties + addParameter("ecomp_generated_naming", extractBooleanValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VNFECOMPNAMING_ECOMPGENERATEDNAMING)); + addParameter("naming_policy", extractValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VNFECOMPNAMING_NAMINGPOLICY)); + addParameter("nf_type", extractValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE)); + addParameter("nf_role", extractValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE)); + addParameter("nf_code", extractValue( nodeTemplate, "nf_naming_code")); + addParameter("nf_function", extractValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); + addParameter("avail_zone_max_count", extractValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONEMAXCOUNT)); + } + +} diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFModuleModel.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFModuleModel.java new file mode 100644 index 00000000..20165a1b --- /dev/null +++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFModuleModel.java @@ -0,0 +1,45 @@ +/*- + * ============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.uebclient; + +import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; +import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames; +import org.openecomp.sdc.toscaparser.api.Group; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncVFModuleModel extends SdncBaseModel { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncVFModuleModel.class); + + public SdncVFModuleModel(ISdcCsarHelper sdcCsarHelper, Group group) { + + super(sdcCsarHelper, group); + + // extract properties + addParameter("vf_module_type", extractValue(group, SdcPropertyNames.PROPERTY_NAME_VFMODULETYPE)); + addIntParameter("availability_zone_count", extractValue(group, SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT)); + addParameter("ecomp_generated_vm_assignments", extractBooleanValue(group, SdcPropertyNames.PROPERTY_NAME_ECOMPGENERATEDVMASSIGNMENTS)); + } + +} diff --git a/ueb-listener/src/main/resources/log4j.properties b/ueb-listener/src/main/resources/log4j.properties index 274f2d45..dbfe6949 100644 --- a/ueb-listener/src/main/resources/log4j.properties +++ b/ueb-listener/src/main/resources/log4j.properties @@ -3,7 +3,7 @@ # openECOMP : SDN-C # ================================================================================ # Copyright (C) 2017 AT&T Intellectual Property. All rights -# reserved. +# reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ # ============LICENSE_END========================================================= ### -log4j.rootCategory=INFO,CONSOLE,LOGFILE +log4j.rootLogger=DEBUG,CONSOLE,LOGFILE # CONSOLE is set to be a ConsoleAppender using a PatternLayout. log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender diff --git a/ueb-listener/src/main/scripts/start-ueb-listener.sh b/ueb-listener/src/main/scripts/start-ueb-listener.sh new file mode 100644 index 00000000..d59eea71 --- /dev/null +++ b/ueb-listener/src/main/scripts/start-ueb-listener.sh @@ -0,0 +1,68 @@ +#!/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=ueb-listener + +PIDFILE=/tmp/.${LISTENER}-pid +UEBLISTENERROOT=${UEBLISTENERROOT:-/opt/app/ueb-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} -jar ${UEBLISTENERROOT}/lib/ueb-listener*.jar -Dlog4j.configuration=file:${UEBLISTENERROOT}/lib/log4j.properties -cp ${LISTENERCLASSPATH} & + + +echo $! > $PIDFILE + +echo "$LISTENER started!" +exit 0 diff --git a/ueb-listener/src/main/scripts/stop-ueb-listener.sh b/ueb-listener/src/main/scripts/stop-ueb-listener.sh new file mode 100644 index 00000000..381266d9 --- /dev/null +++ b/ueb-listener/src/main/scripts/stop-ueb-listener.sh @@ -0,0 +1,56 @@ +#!/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} + +if [ -f ${PROPERTY_DIR}/dmaap-listener.properties ] +then + LISTENER=dmaap-listener +else + LISTENER=ueb-listener +fi + +PIDFILE=/tmp/.${LISTENER}-pid +UEBLISTENERROOT=${UEBLISTENERROOT:-/opt/app/ueb-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/ueb-listener/src/site/apt/index.apt b/ueb-listener/src/site/apt/index.apt index fb2cb293..19ff8bdb 100644 --- a/ueb-listener/src/site/apt/index.apt +++ b/ueb-listener/src/site/apt/index.apt @@ -3,7 +3,7 @@ ~~ openECOMP : SDN-C ~~ ================================================================================ ~~ Copyright (C) 2017 AT&T Intellectual Property. All rights -~~ reserved. +~~ reserved. ~~ ================================================================================ ~~ Licensed under the Apache License, Version 2.0 (the "License"); ~~ you may not use this file except in compliance with the License. diff --git a/ueb-listener/src/site/site.xml b/ueb-listener/src/site/site.xml index 1d4e73ff..4118c7b6 100644 --- a/ueb-listener/src/site/site.xml +++ b/ueb-listener/src/site/site.xml @@ -4,7 +4,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 AT&T Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vnfapi/features/src/main/resources/features.xml b/vnfapi/features/src/main/resources/features.xml index 2758a482..813459de 100644 --- a/vnfapi/features/src/main/resources/features.xml +++ b/vnfapi/features/src/main/resources/features.xml @@ -4,7 +4,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 AT&T Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vnfapi/installer/pom.xml b/vnfapi/installer/pom.xml index ee681132..88b38e93 100755 --- a/vnfapi/installer/pom.xml +++ b/vnfapi/installer/pom.xml @@ -60,7 +60,6 @@ src/assembly/assemble_mvnrepo_zip.xml - false @@ -75,7 +74,6 @@ src/assembly/assemble_installer_zip.xml - false diff --git a/vnfapi/installer/src/assembly/assemble_installer_zip.xml b/vnfapi/installer/src/assembly/assemble_installer_zip.xml index f8bf5a26..c7fb0c16 100644 --- a/vnfapi/installer/src/assembly/assemble_installer_zip.xml +++ b/vnfapi/installer/src/assembly/assemble_installer_zip.xml @@ -3,7 +3,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 AT&T Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,7 +23,6 @@ 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"> - bin zip diff --git a/vnfapi/installer/src/assembly/assemble_mvnrepo_zip.xml b/vnfapi/installer/src/assembly/assemble_mvnrepo_zip.xml index c2b3ecc0..b37b3f19 100644 --- a/vnfapi/installer/src/assembly/assemble_mvnrepo_zip.xml +++ b/vnfapi/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -3,7 +3,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 AT&T Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,7 +23,6 @@ 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"> - bin zip diff --git a/vnfapi/installer/src/main/resources/scripts/install-feature.sh b/vnfapi/installer/src/main/resources/scripts/install-feature.sh index 93236c5b..6e8620e1 100644 --- a/vnfapi/installer/src/main/resources/scripts/install-feature.sh +++ b/vnfapi/installer/src/main/resources/scripts/install-feature.sh @@ -5,7 +5,7 @@ # openECOMP : SDN-C # ================================================================================ # Copyright (C) 2017 AT&T Intellectual Property. All rights -# reserved. +# reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/vnfapi/model/src/main/yang/VNF-API.yang b/vnfapi/model/src/main/yang/VNF-API.yang index f61b3e78..83e3e4cd 100755 --- a/vnfapi/model/src/main/yang/VNF-API.yang +++ b/vnfapi/model/src/main/yang/VNF-API.yang @@ -122,6 +122,17 @@ module VNF-API { leaf vnf-request-version { type string; } + leaf model-customization-uuid { + type string; + description "customized resource, i.e. vf-module, for use within a given service"; + } + leaf use-preload { + type enumeration { + enum "Y"; + enum "N"; + } + description "orchestrate vf-module with full preload data or TOSCA lookup plus EIPAM automation"; + } leaf vnf-id { type string; description "vf-module-id"; diff --git a/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModule.java b/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModule.java index 56a1b186..4302a175 100644 --- a/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModule.java +++ b/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModule.java @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModuleFactory.java b/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModuleFactory.java index 2df2bfa9..4b07aabe 100644 --- a/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModuleFactory.java +++ b/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModuleFactory.java @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java index e15a9864..e356baa9 100644 --- a/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java +++ b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VnfSdnUtil.java b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VnfSdnUtil.java index 74359630..4a41aacd 100644 --- a/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VnfSdnUtil.java +++ b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VnfSdnUtil.java @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/vnfapiProvider.java b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/vnfapiProvider.java index 0d31c071..92ba08d0 100644 --- a/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/vnfapiProvider.java +++ b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/vnfapiProvider.java @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -797,7 +797,37 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL } } } + } + private void DeleteVnfList (final VnfList entry, LogicalDatastoreType storeType) throws IllegalStateException { + // Each entry will be identifiable by a unique key, we have to create that identifier + InstanceIdentifier.InstanceIdentifierBuilder vnfListIdBuilder = + InstanceIdentifier.builder(Vnfs.class) + .child(VnfList.class, entry.getKey()); + InstanceIdentifier path = vnfListIdBuilder.toInstance(); + + int tries = 2; + while (true) { + try { + WriteTransaction tx = dataBroker.newWriteOnlyTransaction(); + tx.delete(storeType, path); + tx.submit().checkedGet(); + log.debug("DataStore delete succeeded"); + break; + } catch (final TransactionCommitFailedException e) { + if (e instanceof OptimisticLockFailedException) { + if (--tries <= 0) { + log.debug("Got OptimisticLockFailedException on last try - failing "); + throw new IllegalStateException(e); + } + log.debug("Got OptimisticLockFailedException - trying again "); + } else { + log.debug("Delete DataStore failed"); + throw new IllegalStateException(e); + } + } + } + } //1610 vnf-instance private void SaveVnfInstanceList (final VnfInstanceList entry, boolean merge, LogicalDatastoreType storeType) throws IllegalStateException { @@ -1630,12 +1660,16 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) { // Only update operational tree on Delete or Activate - if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Delete) || - input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) - { + if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) { log.info("Updating OPERATIONAL tree."); SaveVnfList (vnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); } + else if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Delete) || + input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Rollback)) { + log.info("Delete OPERATIONAL tree."); + DeleteVnfList (vnfListBuilder.build(), LogicalDatastoreType.CONFIGURATION); + DeleteVnfList (vnfListBuilder.build(), LogicalDatastoreType.OPERATIONAL); + } } VnfInformationBuilder vnfInformationBuilder = new VnfInformationBuilder(); vnfInformationBuilder.setVnfId(siid); diff --git a/vnfapi/provider/src/main/resources/initial/vnfapi-provider.xml b/vnfapi/provider/src/main/resources/initial/vnfapi-provider.xml index eebba0c4..01f156d3 100644 --- a/vnfapi/provider/src/main/resources/initial/vnfapi-provider.xml +++ b/vnfapi/provider/src/main/resources/initial/vnfapi-provider.xml @@ -4,7 +4,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 AT&T Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vnfapi/provider/src/test/java/org/openecomp/sdnc/vnfapi/TestPropertyList.java b/vnfapi/provider/src/test/java/org/openecomp/sdnc/vnfapi/TestPropertyList.java index b131f834..320f30d3 100644 --- a/vnfapi/provider/src/test/java/org/openecomp/sdnc/vnfapi/TestPropertyList.java +++ b/vnfapi/provider/src/test/java/org/openecomp/sdnc/vnfapi/TestPropertyList.java @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vnfapi/provider/src/test/resources/proplist.properties b/vnfapi/provider/src/test/resources/proplist.properties index 203d5654..556de910 100644 --- a/vnfapi/provider/src/test/resources/proplist.properties +++ b/vnfapi/provider/src/test/resources/proplist.properties @@ -3,7 +3,7 @@ # openECOMP : SDN-C # ================================================================================ # Copyright (C) 2017 AT&T Intellectual Property. All rights -# reserved. +# reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/vnfapi/provider/src/test/resources/simplelogger.properties b/vnfapi/provider/src/test/resources/simplelogger.properties index 9b10afdb..96a105c0 100644 --- a/vnfapi/provider/src/test/resources/simplelogger.properties +++ b/vnfapi/provider/src/test/resources/simplelogger.properties @@ -3,7 +3,7 @@ # openECOMP : SDN-C # ================================================================================ # Copyright (C) 2017 AT&T Intellectual Property. All rights -# reserved. +# reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/vnftools/installer/pom.xml b/vnftools/installer/pom.xml index 796b1598..d08e3134 100755 --- a/vnftools/installer/pom.xml +++ b/vnftools/installer/pom.xml @@ -60,7 +60,6 @@ src/assembly/assemble_mvnrepo_zip.xml - false @@ -75,7 +74,6 @@ src/assembly/assemble_installer_zip.xml - false diff --git a/vnftools/installer/src/assembly/assemble_installer_zip.xml b/vnftools/installer/src/assembly/assemble_installer_zip.xml index 85e2e1e8..728afca5 100644 --- a/vnftools/installer/src/assembly/assemble_installer_zip.xml +++ b/vnftools/installer/src/assembly/assemble_installer_zip.xml @@ -25,7 +25,6 @@ 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"> - bin zip diff --git a/vnftools/installer/src/assembly/assemble_mvnrepo_zip.xml b/vnftools/installer/src/assembly/assemble_mvnrepo_zip.xml index bf7805f7..c14f8aed 100644 --- a/vnftools/installer/src/assembly/assemble_mvnrepo_zip.xml +++ b/vnftools/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -25,7 +25,6 @@ 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"> - bin zip -- cgit 1.2.3-korg