aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2017-10-02 13:18:14 +0000
committerGerrit Code Review <gerrit@onap.org>2017-10-02 13:18:14 +0000
commita045fb4177e072d061dcc1644985c5934e356037 (patch)
tree6c779024ff88bd34a3cf6ac2d414a107e4b23e74
parentd19e21da553d3539ca1403b3e0c4d586f0260309 (diff)
parentdacd4a5fb73644c3510251774a1f354a5d42ffd2 (diff)
Merge "HeatBridge integration with Orchestration, part 1"
-rw-r--r--adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java45
-rw-r--r--packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final6
-rw-r--r--packages/docker/src/main/docker/docker-files/heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whlbin0 -> 7382 bytes
3 files changed, 51 insertions, 0 deletions
diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
index c8c036d58a..cba378eab0 100644
--- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
@@ -22,10 +22,17 @@
package org.openecomp.mso.adapters.vnf;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import java.util.Arrays;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -540,6 +547,41 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
return string;
}
+ private boolean callHeatbridge(String heatStackId) {
+ String executionDir = "/usr/local/lib/python2.7/dist-packages/heatbridge";
+ String openstackIdentityUrl = "", username = "", password = "", tenant = "", region = "", owner = "";
+ long waitTimeMs = 10000l;
+ try {
+ String[] cmdarray = {"/usr/bin/python", "HeatBridgeMain.py", openstackIdentityUrl, username, password, tenant, region, owner, heatStackId};
+ String[] envp = null;
+ File dir = new File(executionDir);
+ LOGGER.debug("Calling HeatBridgeMain.py in " + dir + " with arguments " + Arrays.toString(cmdarray));
+ Runtime r = Runtime.getRuntime();
+ Process p = r.exec(cmdarray, envp, dir);
+ /*
+ BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String linein = stdout.readLine();
+ while (linein!=null) {
+ System.out.println(linein);
+ linein = stdout.readLine();
+ }
+ */
+ boolean wait = p.waitFor(waitTimeMs, TimeUnit.MILLISECONDS);
+
+ LOGGER.debug(" HeatBridgeMain.py returned " + wait + " with code " + p.exitValue());
+ return (wait && p.exitValue()==0);
+ } catch (IOException e) {
+ LOGGER.debug(" HeatBridgeMain.py failed with IO Exception! " + e);
+ return false;
+ } catch (InterruptedException e) {
+ LOGGER.debug(" HeatBridgeMain.py failed when interrupted! " + e);
+ return false;
+ } catch (RuntimeException e) {
+ LOGGER.debug(" HeatBridgeMain.py failed for unknown reasons!" + e);
+ return false;
+ }
+ }
+
private void sendMapToDebug(Map<String, Object> inputs, String optionalName) {
int i = 0;
StringBuilder sb = new StringBuilder(optionalName == null ? "\ninputs" : "\n" + optionalName);
@@ -731,6 +773,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
vfRollback.setIsBase(isBaseRequest);
vfRollback.setModelCustomizationUuid(mcu);
+ // Put data into A&AI through Heatstack
+ boolean heatStackCallSuccess = callHeatbridge(baseVfHeatStackId);
+
// First, look up to see if the VF already exists.
MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_VNF_ADAPTER, msoPropertiesFactory,cloudConfigFactory);
diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final b/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final
index 2e227bef0d..8238923139 100644
--- a/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final
+++ b/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final
@@ -81,6 +81,12 @@ COPY ./maven/artifacts/* $JBOSS_HOME/standalone/deployments/
RUN mkdir -p /etc/mso/config.d/ASDC && chown -R jboss:jboss /etc/mso/config.d/ASDC && chmod u+xrw /etc/mso/config.d/ASDC
+## Install heatbridge
+RUN apt-get install -y python && apt-get install -y python-pip && echo 'PIP Installed, doing upgrade' && pip install --upgrade pip
+RUN mkdir /opt/mso/heatbridge
+COPY heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl /opt/mso/heatbridge
+RUN pip install /opt/mso/heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl
+
### Open Ports
EXPOSE 8080
diff --git a/packages/docker/src/main/docker/docker-files/heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl b/packages/docker/src/main/docker/docker-files/heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl
new file mode 100644
index 0000000000..357a669c1a
--- /dev/null
+++ b/packages/docker/src/main/docker/docker-files/heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl
Binary files differ