aboutsummaryrefslogtreecommitdiffstats
path: root/ncomp-docker-adaptor/src/main
diff options
context:
space:
mode:
authorlj1412 <lji@research.att.com>2017-02-14 15:11:24 +0000
committerlj1412 <lji@research.att.com>2017-02-14 15:11:26 +0000
commit9a98a583855c9665c7171ca2e44e311095cdaac1 (patch)
treeb9f784669b9d235bba8d9bf9354cd313ff051171 /ncomp-docker-adaptor/src/main
parent0453f7ce05dcb0affc9025c007db125128d0bf95 (diff)
Init ncomp.docker
Change-Id: Ic87bcf77cff63ef6cd3004fbff9a69f11930d684 Signed-off-by: lj1412 <lji@research.att.com>
Diffstat (limited to 'ncomp-docker-adaptor/src/main')
-rw-r--r--ncomp-docker-adaptor/src/main/etc/docker-mra-certs.jksbin0 -> 8925 bytes
-rw-r--r--ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/docker/adaptor/tools/Generator.java70
-rw-r--r--ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerAbstractClient.java191
-rw-r--r--ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorProvider.java63
-rw-r--r--ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerDockerHostProvider.java968
-rw-r--r--ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerHttpClient.java196
-rw-r--r--ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerHttpClientException.java31
-rw-r--r--ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestDockerInspect.java52
-rw-r--r--ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestDockerRun.java102
-rw-r--r--ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestDockerRunLinks.java102
-rw-r--r--ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestDockerStop.java52
-rw-r--r--ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestPolling.java52
-rw-r--r--ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiProvider.java78
-rw-r--r--ncomp-docker-adaptor/src/main/server/config/adaptor.properties7
-rw-r--r--ncomp-docker-adaptor/src/main/server/config/console.properties3
-rw-r--r--ncomp-docker-adaptor/src/main/server/config/gui.properties0
-rw-r--r--ncomp-docker-adaptor/src/main/server/config/log4j.properties24
-rw-r--r--ncomp-docker-adaptor/src/main/server/config/makefile9
-rw-r--r--ncomp-docker-adaptor/src/main/server/config/pw.sh.sh15
-rw-r--r--ncomp-docker-adaptor/src/main/server/scripts/console.groovy27
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/DockerAdaptor.yaml3
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/DockerHost.yaml168
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/GuiClientApi.yaml69
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptor.java65
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorClient.java65
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorConsole.java63
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorProviderTemplate.java63
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorServer.java110
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerFactory.java60
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHost.java378
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHostClient.java150
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHostConsole.java211
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHostProviderTemplate.java149
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApi.java217
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiClient.java102
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiConsole.java123
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiProviderTemplate.java78
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerModelFactory.java54
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApi.properties78
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApiMessageEnum.java47
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApiOperationEnum.java41
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptor.properties6
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptorMessageEnum.java35
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptorOperationEnum.java29
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHost.properties186
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHostMessageEnum.java65
-rw-r--r--ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHostOperationEnum.java59
47 files changed, 4716 insertions, 0 deletions
diff --git a/ncomp-docker-adaptor/src/main/etc/docker-mra-certs.jks b/ncomp-docker-adaptor/src/main/etc/docker-mra-certs.jks
new file mode 100644
index 0000000..e1f68fe
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/etc/docker-mra-certs.jks
Binary files differ
diff --git a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/docker/adaptor/tools/Generator.java b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/docker/adaptor/tools/Generator.java
new file mode 100644
index 0000000..09f3f3f
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/docker/adaptor/tools/Generator.java
@@ -0,0 +1,70 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.docker.adaptor.tools;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.openecomp.utils.YamlToJava;
+import org.openecomp.ncomp.sirius.manager.controllermodel.ControllerModel;
+import org.openecomp.ncomp.sirius.manager.controllermodel.ControllermodelFactory;
+import org.openecomp.ncomp.sirius.manager.generator.ControllerGenerator;
+import org.openecomp.ncomp.gwt.siriusportal.model.*;
+import org.openecomp.ncomp.sirius.manager.server.ServerPackage;
+import org.openecomp.ncomp.docker.DockerFactory;
+
+public class Generator {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ @SuppressWarnings("unused")
+ ServerPackage f = ServerPackage.eINSTANCE;
+ EObject o = DockerFactory.eINSTANCE.createDockerAdaptor();
+ EPackage p = o.eClass().getEPackage();
+ String dir = p.getNsURI().replaceAll(p.getNsPrefix() + '$', "") + "servers." + p.getNsPrefix();
+ dir = "src/main/sirius-gen/" + dir.replace('.', '/');
+ ControllerModel m = ControllermodelFactory.eINSTANCE.createControllerModel();
+ m.setTemplateDirectory("../../dcae-org.openecomp.ncomp.sirius.manager/ncomp-sirius-manager-generator/src/main/templates");
+ m.setPrefix("Docker");
+ m.setPluginName(p.getNsURI());
+ m.setName("Docker");
+ m.setTitle("Docker");
+ ControllerGenerator g = new ControllerGenerator(o, m);
+ EObject h = DockerFactory.eINSTANCE.createDockerHost();
+ g.addApi("host", h, m, false, true);
+ g.setEnableIRequestHandler(false);
+ g.setEnableISiriusPlugin(false);
+ EObject gui = ModelFactory.eINSTANCE.createGuiClientApi();
+ g.addObject("gui", gui, m);
+ g.generate(dir);
+ String pName = p.getNsURI().replaceAll(p.getNsPrefix()+'$',"") + "servers." + p.getNsPrefix() +".logging";
+// YamlToJava.convert("src/main/resources/DockerAdaptor.yaml", dir + "/logging", pName);
+ YamlToJava.convert("src/main/sirius-gen/DockerAdaptor.yaml", dir + "/logging", pName);
+ YamlToJava.convert("src/main/sirius-gen/DockerHost.yaml", dir + "/logging", pName);
+ String pName1 = p.getNsURI().replaceAll(p.getNsPrefix()+'$',"") + "servers." + p.getNsPrefix() +".gui.logging";
+ YamlToJava.convert("src/main/sirius-gen/GuiClientApi.yaml", dir + "/gui/logging", pName1);
+
+ }
+
+}
diff --git a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerAbstractClient.java b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerAbstractClient.java
new file mode 100644
index 0000000..30a5777
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerAbstractClient.java
@@ -0,0 +1,191 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker;
+
+import java.util.HashMap;
+import java.util.Properties;
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import org.openecomp.ncomp.utils.emf.EUtils;
+import org.openecomp.ncomp.sirius.manager.ManagementServer;
+
+public abstract class DockerAbstractClient {
+ public static final Logger logger = Logger.getLogger(DockerAbstractClient.class);
+ abstract public byte[] httpBinaryTransaction(String path, String method, HashMap<String, String> headers, JSONObject body, Long timeout);
+
+ public Properties props;
+ public String language;
+ public String namespace;
+ private static HashMap<EObject, DockerAbstractClient> map1 = new HashMap<EObject, DockerAbstractClient>();
+ private static HashMap<EObject, String> map2 = new HashMap<EObject, String>();
+
+ public void add(String uri, EObject o) {
+ map1.put(o, this);
+ map2.put(o, uri);
+ }
+
+ static DockerAbstractClient findClient(EObject o) {
+ return map1.get(o);
+ }
+
+ public JSONObject operationJson(EObject o, String name, Long timeout, JSONObject json) {
+ return operationPath2(map2.get(o), name, timeout, json);
+ }
+
+ public JSONObject operationPath2(String path, String name, Long timeout, JSONObject json) {
+ HashMap<String, String> headers = new HashMap<String, String>();
+ headers.put("action", name);
+ logger.debug("operation: " + name + "\n" + json.toString(2));
+ return httpJsonTransaction(path, "PUT", headers, json, timeout);
+ }
+ public JSONObject operationOdl(String path, Long timeout, JSONObject json) {
+ JSONObject json1 = new JSONObject();
+ json1.put("input", json);
+ logger.debug("ODL operation: " + path + "\n" + json1.toString(2));
+ return httpJsonTransaction(path, "POST", null, json1, timeout);
+ }
+
+ public Object operation2(String path, EObject o, String opName, Long timeout, Object[] params) {
+ EOperation op = EUtils.name2operation(o.eClass(), opName);
+ if (op == null)
+ throw new RuntimeException("no such operation: " + opName + " on " + o);
+ JSONObject res = operationPath2(path, opName, timeout, ManagementServer.params2json(op, params));
+ return ManagementServer.json2response(op, res);
+ }
+
+ public JSONObject operation(String resourcePath, String opName, Long timeout, JSONObject json) {
+ return operationPath2(resourcePath, opName, timeout, json);
+ }
+
+ public Object operation(String path, EObject o, String opName, Long timeout, Object... params) {
+ return operation2(path, o, opName, timeout, params);
+ }
+
+ public Object operation(EObject o, String opName, Long timeout, Object... params) {
+ return operation2(map2.get(o), o, opName, timeout, params);
+ }
+
+ public Object operationPath(String resourcePath, EClass c, String opName, Long timeout, Object... params) {
+ EOperation op = EUtils.name2operation(c, opName);
+ if (op == null) {
+ throw new RuntimeException("Unknown operation " + opName + " on Eclass " + c.getName());
+ }
+ JSONObject res;
+ JSONObject json1 = ManagementServer.params2json(op, params);
+ if (language != null && language.equals("restconf")) {
+ res = operationOdl("/restconf/operations/" + namespace + ":" + opName,timeout,json1);
+ }
+ else {
+ res = operationPath2(resourcePath, op.getName(), timeout, json1 );
+ }
+ return ManagementServer.json2response(op, res);
+ }
+
+ // abstract public void sendToDataRouter(String feedname, String fileId,
+ // JSONObject metadata, InputStream is);
+
+ // public void sendToDataRouter(String feedname, String fileId, JSONObject
+ // metadata, byte[] bytes) {
+ // ByteArrayInputStream in = new ByteArrayInputStream(bytes);
+ // sendToDataRouter(feedname, fileId, metadata, in);
+ // }
+
+ public void create(String resourcePath, String json) {
+ create(resourcePath, new JSONObject(json));
+ }
+
+ public void create(String resourcePath, JSONObject json) {
+ httpJsonTransaction(resourcePath, "POST", null, json, null);
+ }
+
+ public void update(String resourcePath, JSONObject json) {
+ httpJsonTransaction(resourcePath, "PUT", null, json, null);
+ }
+
+ public void delete(String resourcePath) {
+ httpJsonTransaction(resourcePath, "DELETE", null, new JSONObject(), null);
+ }
+
+ public JSONObject method(String resourcePath, String method, JSONObject json) {
+ return httpJsonTransaction(resourcePath, method, null, json, null);
+ }
+
+ public byte[] methodAsBinary(String resourcePath, String method, JSONObject json) {
+ return httpBinaryTransaction(resourcePath, method, null, json, null);
+ }
+
+ public String methodAsString(String resourcePath, String method, JSONObject json) {
+ return httpStringTransaction(resourcePath, method, null, json, null);
+ }
+
+ public JSONObject list(String resourcePath) {
+ if (language != null && language.equals("rest")) {
+ return httpJsonTransaction(resourcePath, "GET", null, new JSONObject(), null);
+ } else {
+ return list(resourcePath, 1);
+ }
+ }
+
+ public JSONObject listAll(String resourcePath) {
+ return httpJsonTransaction(resourcePath + "?match=regexp", "GET", null, new JSONObject(), null);
+ }
+
+ public JSONObject listReferences(String resourcePath, boolean recursive) {
+ return httpJsonTransaction(resourcePath + "?references=" + recursive, "GET", null, new JSONObject(), null);
+ }
+
+ public JSONObject list(String resourcePath, int levels) {
+ return httpJsonTransaction(resourcePath + "?levels=" + levels, "GET", null, new JSONObject(), null);
+ }
+
+ public JSONObject httpJsonTransaction(String path, String method, HashMap<String, String> headers, JSONObject body) {
+ return httpJsonTransaction(path, method, headers, body,null);
+ }
+
+ public JSONObject httpJsonTransaction(String path, String method, HashMap<String, String> headers, JSONObject body, Long timeout) {
+ String s = httpStringTransaction(path, method, headers, body, timeout);
+ if (s == null) return null;
+ if (s.startsWith("[")) {
+ JSONArray a = new JSONArray(s);
+ JSONObject json = new JSONObject();
+ json.put("$list", a);
+ return json;
+ } else {
+ logger.info("json returned <- " + "'" + s + "'");
+ JSONObject json = (!s.isEmpty()) ? new JSONObject(s) : new JSONObject();
+ return json;
+ }
+ }
+
+ public String httpStringTransaction(String path, String method, HashMap<String, String> headers, JSONObject body, Long timeout) {
+ byte[] b = httpBinaryTransaction(path, method, headers, body, timeout);
+ if (b == null) return null;
+ else return new String(b);
+ }
+
+}
diff --git a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorProvider.java b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorProvider.java
new file mode 100644
index 0000000..70ad116
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorProvider.java
@@ -0,0 +1,63 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker;
+
+
+
+
+
+import java.io.InputStream;
+
+import org.openecomp.ncomp.sirius.manager.IRequestHandler;
+import org.openecomp.ncomp.sirius.manager.ISiriusPlugin;
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+import org.openecomp.ncomp.sirius.function.FunctionUtils;
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.common.util.EList;
+import org.json.JSONObject;
+
+
+
+import org.openecomp.ncomp.sirius.manager.BasicAdaptorProvider;
+
+
+import org.openecomp.ncomp.docker.impl.DockerAdaptorImpl;
+import org.openecomp.ncomp.docker.DockerAdaptor;
+
+
+public class DockerDockerAdaptorProvider extends BasicAdaptorProvider {
+ private static final Logger logger = Logger.getLogger(DockerDockerAdaptorProvider.class);
+ DockerAdaptor o;
+
+ public DockerDockerAdaptorProvider(ISiriusServer controller, DockerAdaptor o) {
+ super(controller, o);
+ this.o = o;
+ }
+
+
+
+
+
+
+}
diff --git a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerDockerHostProvider.java b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerDockerHostProvider.java
new file mode 100644
index 0000000..d3888dc
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerDockerHostProvider.java
@@ -0,0 +1,968 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.text.ParseException;
+import java.net.URLEncoder;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.io.UnsupportedEncodingException;
+
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+import org.openecomp.ncomp.sirius.manager.ManagementServer;
+import org.openecomp.ncomp.sirius.manager.ManagementServerUtils;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.log4j.Logger;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import org.openecomp.ncomp.sirius.manager.BasicAdaptorProvider;
+import org.openecomp.ncomp.docker.ContainerOptions;
+import org.openecomp.ncomp.docker.ContainerCpuUsage;
+import org.openecomp.ncomp.docker.ContainerCpuStats;
+import org.openecomp.ncomp.docker.ContainerPortBindings;
+import org.openecomp.ncomp.docker.ContainerNetworkStats;
+import org.openecomp.ncomp.docker.ContainerMemoryStats;
+import org.openecomp.ncomp.docker.ContainerMemoryUsage;
+import org.openecomp.ncomp.docker.ContainerRestartPolicy;
+import org.openecomp.ncomp.docker.DockerContainer;
+import org.openecomp.ncomp.docker.DockerContainerStats;
+import org.openecomp.ncomp.docker.DockerFactory;
+import org.openecomp.ncomp.docker.DockerProcess;
+import org.openecomp.ncomp.docker.DockerHost;
+import org.openecomp.ncomp.docker.DockerImage;
+import org.openecomp.ncomp.docker.DockerNetwork;
+import org.openecomp.ncomp.docker.DockerPackage;
+
+import org.eclipse.emf.common.util.EList;
+
+class DockerDockerHostProvider extends BasicAdaptorProvider {
+
+ private static final Logger logger = Logger.getLogger(DockerDockerHostProvider.class);
+
+ DockerHost o;
+ DockerHttpClient client;
+ protected Date lastPoll;
+
+ //
+ // Docker endpoint types are --
+ // -> containers
+ // -> images
+ // -> networks
+ // -> misc
+ //
+ private static final String CONTAINERS = "/containers/";
+ private static final String IMAGES = "/images/";
+ private static final String NETWORKS = "/networks/";
+ private static final String MISC = "/misc/";
+
+ private static final String GET_METHOD = "GET";
+ private static final String POST_METHOD = "POST";
+ private static final String DELETE_METHOD = "DELETE";
+ private static final int PRETTY_PRINT = 4;
+ private static final int REPO = 0;
+ private static final int PORT = 1;
+ private static final int NAME = 2;
+ private static final int VER = 3;
+
+ private enum ContainerState {
+ CREATED, STOPPED, RUNNING, PAUSED, DELETED
+ }
+
+ private enum ContainerEvents {
+ CREATE, START, STOP, RESTART, PAUSE, UNPAUSE, KILL, DESTORY
+ }
+
+ private JSONObject encodeAuth(String json) {
+ String auth = Base64.encodeBase64String(json.getBytes());
+ return new JSONObject(auth);
+ }
+
+ public DockerDockerHostProvider(ISiriusServer controller, DockerHost o) {
+ super(controller, o);
+ this.o = o;
+ this.client = new DockerHttpClient("docker.properties","dockerHost");
+ }
+
+ @Override
+ public void start() {
+ if (o.isRemote()) return;
+ Thread t = new Thread("docker poller: " + o.getName()) {
+ @Override
+ public void run() {
+ while (true) {
+ try {
+ if (lastPoll == null
+ || lastPoll.getTime() + o.getPollingFrequency() < new Date()
+ .getTime())
+ o.poll();
+ Thread.sleep(5000); // sleep 5 seconds
+ } catch (Exception e) {
+ ManagementServerUtils.printStackTrace(e);
+ logger.fatal("openstackPoller Thread DIED: " + e);
+ try {
+ Thread.sleep(30000);
+ } catch (InterruptedException e1) {
+ }
+ }
+ }
+ };
+ };
+ t.start();
+ }
+
+ protected void poll() {
+ logger.info("XXXX poll");
+ lastPoll = new Date();
+ JSONObject json = callRemoteApi("/images/json", GET_METHOD);
+ logger.info("XXXX res:" + json.toString(2));
+ updateImages(json);
+ // containers
+ // if you only want to see running containers, set "all" to false
+ // this results in only running containers being shown
+ //
+ int ALL=1;
+ json = callRemoteApi("/containers/json?all=" + ALL, GET_METHOD);
+ logger.info("XXXX res:" + json.toString(2));
+ updateContainers(json);
+ // networks
+ json = callRemoteApi("/networks", GET_METHOD);
+ logger.info("XXXX res:" + json.toString(2));
+ updateNetworks(json);
+ updateContainerStats();
+
+ logger.info("XXXX " + ManagementServer.ecore2json(o, 100, null, true).toString(2));
+ }
+
+ /*
+ * json to provide with request to create a container from an image
+ */
+ private JSONObject mkContainerJson(String image) {
+
+ StringBuilder json = new StringBuilder();
+
+ json.append("{");
+ json.append("\"Hostname\":\"\",");
+ json.append("\"User\":\"\",");
+ json.append("\"Memory\":0,");
+ json.append("\"MemorySwam\":0,");
+ json.append("\"AttachStdin\":false,");
+ json.append("\"AttachStdout\":true,");
+ json.append("\"AttachStderr\":true,");
+ json.append("\"PortSpecs\":null,");
+ json.append("\"Privleged\":false,");
+ json.append("\"Tty\":false,");
+ json.append("\"OpenStdin\":false,");
+ json.append("\"StdinOnce\":false,");
+ json.append("\"Env\":null,");
+ json.append("\"Dns\":null,");
+ json.append("\"Image\":\"<image>\",");
+ json.append("\"Volumes\":null,");
+ json.append("\"VolumesFrom\":null,");
+ json.append("\"WorkingDir\":\"\",");
+ json.append("}");
+
+
+ return new JSONObject(json.toString().replace("<image>", image));
+ }
+
+ /*
+ * this is a composite of two separate API calls. the first call creates the
+ * container. the second call starts the created container
+ */
+ public void dockerRun(String image) {
+ dockerRunWithName(image, null);
+ }
+
+ public void dockerRunWithName(String image, String name) {
+ logger.debug("image <-" + image);
+ boolean chkEnv = false;
+
+ if (chkEnv) {
+ Map<String,String> env = System.getenv();
+ for(Map.Entry<String,String> entry : env.entrySet()) {
+ if (entry.getKey().toLowerCase().contains("proxy")) {
+ logger.debug(entry.getKey() + " = " + entry.getValue());
+ }
+ }
+ }
+
+ String api = "/containers/create";
+ if (name != null) {
+ api += "?name=" + name;
+ }
+
+ JSONObject jobj = mkContainerJson(image);
+
+ logger.info("container json <- " + jobj.toString(PRETTY_PRINT));
+
+ JSONObject json = callRemoteApi(api, POST_METHOD, jobj);
+
+ // 201 - no error
+ // 404 - no such container
+ // 406 - impossible to attach (container not running)
+ // 500 - server error
+
+ if (client.getResponseCode() == 201) {
+ String shortId = json.getString("Id").substring(0,11);
+ logger.info("Starting container <- " + shortId);
+ startContainer(shortId);
+ }
+
+ }
+
+ public void dockerRunWithOptions(String image, ContainerOptions opts) {
+
+ String api = "/containers/create";
+ String name = opts.getName();
+
+ if (name != null) {
+ api += "?name=" + name;
+ }
+
+ JSONObject jobj = mkContainerJson(image);
+ JSONObject options = new JSONObject();
+ JSONArray binds = new JSONArray();
+
+ for(String binding : opts.getVolumes()) {
+ binds.put(binding);
+ }
+
+ if (binds.length() > 0) {
+ options.put("Binds",binds);
+ }
+
+ JSONObject portBindings = new JSONObject();
+ JSONObject exposedPorts = new JSONObject();
+
+ for(ContainerPortBindings portMap : opts.getPortBindings()) {
+ String tag = Integer.toString(portMap.getContainerPort()) + "/" + portMap.getProtocol();
+ String val = Integer.toString(portMap.getVmPort());
+ JSONObject pair = new JSONObject().put("HostIp", "").put("HostPort", val);
+
+ if (portBindings.has(tag)) {
+ portBindings.accumulate(tag,pair);
+ } else {
+ portBindings.put(tag, new JSONArray().put(pair));
+ }
+ exposedPorts.put(tag, new JSONObject());
+ }
+
+ if (portBindings.length() > 0) {
+ options.put("PortBindings",portBindings);
+ }
+
+ // container links
+ if (!opts.getLinks().isEmpty()) {
+ JSONArray links = new JSONArray();
+ for(String fromLink : opts.getLinks()) {
+ String linkAlias = "";
+ String link = "";
+
+ if (fromLink.contains(":")) {
+ String[] ary = fromLink.split("\\:");
+ if (ary.length > 1) {
+ link = ary[0];
+ linkAlias = ary[1];
+ }
+ } else {
+ link = fromLink;
+ }
+
+ String fqLink = link + ":" + name + "/" + linkAlias;
+ links.put(fqLink);
+ }
+ options.put("Links", links);
+ }
+
+ // default behavior
+ opts.setPublishAllPorts(true);
+
+ if (opts.isPublishAllPorts()) {
+ options.put("PublishAllPorts", true);
+ }
+
+ // restart policy defaults
+ String policy = "always";
+ int retries = 0;
+
+ if (opts.getAutoRestart() != null && opts.getAutoRestart().getNm() != null) {
+ policy = opts.getAutoRestart().getNm();
+ }
+
+ if ("on-failure".equals(policy)) {
+ retries = opts.getAutoRestart().getMaxRetryCnt();
+ }
+
+ JSONObject restartPolicy = new JSONObject()
+ .put("Name", policy)
+ .put("MaximumRetryCount", retries);
+
+ options.put("RestartPolicy", restartPolicy);
+
+ if (options.length() > 0) {
+ jobj.put("HostConfig",options);
+ }
+
+ if (exposedPorts.length() > 0) {
+ jobj.put("ExposedPorts",exposedPorts);
+ }
+
+ JSONObject config = new JSONObject();
+
+ // add any runtime environment arguments
+ if (!opts.getEnv().isEmpty()) {
+ JSONArray rekv = new JSONArray();
+ for(String kv : opts.getEnv()) {
+ logger.debug("adding runtime argument " + kv);
+ rekv.put(kv);
+ }
+ jobj.put("Env", rekv);
+ }
+
+ opts.setSetContainerName(true);
+
+ if (opts.isSetContainerName()) {
+ try {
+ jobj.put("Hostname", InetAddress.getLocalHost().getHostName());
+ } catch(UnknownHostException e) {
+ logger.error("Unable to determine local hostname", e);
+ }
+ }
+
+ logger.info("container json <- " + jobj.toString(PRETTY_PRINT));
+
+ JSONObject json = callRemoteApi(api, POST_METHOD, jobj);
+
+ // 201 - no error
+ // 404 - no such container
+ // 406 - impossible to attach (container not running)
+ // 500 - server error
+
+ if (client.getResponseCode() == 201) {
+ String shortId = json.getString("Id").substring(0,11);
+ logger.info("Starting container <- " + shortId);
+ startContainer(shortId);
+ }
+
+
+ }
+
+ private void updateContainers(JSONObject json) {
+ JSONArray a = json.getJSONArray("$list");
+ o.getContainers().clear();
+ for (int i = 0; i < a.length(); i++) {
+ JSONObject j = a.getJSONObject(i);
+ decapitalize(j);
+ fixNull(j);
+ rename(j, "created", "dockerCreated");
+ fixMap(j, "hostConfig");
+ fixMap(j, "labels");
+ DockerContainer container = (DockerContainer) controller
+ .getServer().json2ecore(
+ DockerPackage.eINSTANCE.getDockerContainer(), j);
+ if (container.getNames().size()>0)
+ container.setName(container.getNames().get(0).replace("/", ""));
+ else container.setName(container.getId().substring(0, 10));
+
+ // get container process info
+ //containerProcesses(container.getId());
+// String name = container.getId();
+// String api = CONTAINERS + name + "/top?ps_args=aux";
+// JSONObject jo = callRemoteApi(api,GET_METHOD);
+// DockerProcess[] dp = setPtbl(jo);
+ // so how do we actually update the DockerProcess processes
+ // member of the container class?
+ // EList<DockerProcess> cp = container.getProcesses();
+ // cp = (EList<DockerProcess>)Arrays.asList(dp);
+
+ System.err.println("XXXX "
+ + ManagementServer.ecore2json(container, 100, null, true)
+ .toString(2));
+ o.getContainers().add(container);
+ }
+ }
+
+ private void updateImages(JSONObject json) {
+
+
+ JSONArray a = json.getJSONArray("$list");
+ o.getImages().clear();
+ for (int i = 0; i < a.length(); i++) {
+ JSONObject j = a.getJSONObject(i);
+ decapitalize(j);
+ fixNull(j);
+ rename(j, "created", "dockerCreated");
+ if (j.has("labels")) j.remove("labels");
+ System.err.println("XXXX " + j.toString());
+ DockerImage image = (DockerImage) controller.getServer()
+ .json2ecore(DockerPackage.eINSTANCE.getDockerImage(), j);
+ // System.err.println("XXXX " + ManagementServer.ecore2json(image,
+ // 100, null, true).toString(2));
+ if (image.getRepoTags().size() > 0)
+ image.setName(image.getRepoTags().get(0));
+ image.setName(image.getName().replace("/", "_"));
+ o.getImages().add(image);
+ }
+ }
+
+
+ /*
+ * should probably break this up into discrete pieces for
+ * cpu, memory, blkio, and network. but this is good enough for now.
+ * blkio stats not modeled - since i'm not certain what is actually
+ * being reported
+ */
+ private void updateContainerStats() {
+
+ for(DockerContainer c : o.getContainers()) {
+ if (c.getStatus().equals("exited")) continue;
+ if (c.getStatus().startsWith("Exited")) continue;
+ if (c.getStatus().startsWith("Created")) continue;
+ String nm = c.getName();
+ JSONObject j = containerStats(nm,false);
+ logger.info("container stats json <- " + j.toString(4));
+
+ DockerContainerStats cstats = DockerFactory.eINSTANCE.createDockerContainerStats();
+
+ /*
+ * network stats
+ */
+ JSONObject netwks = j.getJSONObject("networks");
+ for(String net : JSONObject.getNames(netwks)) {
+ JSONObject intf = netwks.getJSONObject(net);
+ System.err.println(net + " <- " + intf.toString(4));
+ ContainerNetworkStats cnet = DockerFactory.eINSTANCE.createContainerNetworkStats();
+ cnet.setIntf(net);
+ cnet.setRx_bytes(intf.getInt("rx_bytes"));
+ cnet.setRx_dropped(intf.getInt("rx_dropped"));
+ cnet.setRx_errors(intf.getInt("rx_errors"));
+ cnet.setRx_packets(intf.getInt("rx_packets"));
+ cnet.setTx_bytes(intf.getInt("tx_bytes"));
+ cnet.setTx_dropped(intf.getInt("tx_dropped"));
+ cnet.setTx_errors(intf.getInt("tx_errors"));
+ cnet.setTx_packets(intf.getInt("tx_packets"));
+
+ cstats.getNetworks().add(cnet);
+ }
+
+ /*
+ * memory usage
+ */
+ JSONObject mem = j.getJSONObject("memory_stats");
+ ContainerMemoryUsage memusg = DockerFactory.eINSTANCE.createContainerMemoryUsage();
+
+ memusg.setUsage(mem.getInt("usage"));
+ memusg.setMax_usage(mem.getInt("max_usage"));
+ memusg.setLimit(mem.getInt("limit"));
+ memusg.setFailcnt(mem.getInt("failcnt"));
+
+ /*
+ * memory stats
+ */
+ if (mem.has("stats") && isaJSONObject(mem.get("stats"))) {
+ JSONObject mstats = mem.getJSONObject("stats");
+
+ if (mstats != null) {
+ ContainerMemoryStats memstats = DockerFactory.eINSTANCE.createContainerMemoryStats();
+ memstats.setActive_anon(mstats.getInt("active_anon"));
+ memstats.setActive_file(mstats.getInt("active_file"));
+ memstats.setCache(mstats.getInt("cache"));
+ memstats.setHierarchical_memory_limit(mstats.getInt("hierarchical_memory_limit"));
+ memstats.setInactive_anon(mstats.getInt("inactive_anon"));
+ memstats.setInactive_file(mstats.getInt("inactive_file"));
+ memstats.setMapped_file(mstats.getInt("mapped_file"));
+ memstats.setPgfault(mstats.getInt("pgfault"));
+ memstats.setPgmajfault(mstats.getInt("pgmajfault"));
+ memstats.setPgpgin(mstats.getInt("pgpgin"));
+ memstats.setPgpgout(mstats.getInt("pgpgout"));
+ memstats.setRss(mstats.getInt("rss"));
+ memstats.setRss_huge(mstats.getInt("rss_huge"));
+// memstats.setUnevictable(mstats.getInt("unevicatable"));
+ memstats.setTotal_active_anon(mstats.getInt("total_active_anon"));
+ memstats.setTotal_active_file(mstats.getInt("total_active_file"));
+ memstats.setTotal_cache(mstats.getInt("total_cache"));
+ memstats.setTotal_inactive_anon(mstats.getInt("total_inactive_anon"));
+ memstats.setTotal_inactive_file(mstats.getInt("total_inactive_file"));
+ memstats.setTotal_mapped_file(mstats.getInt("total_mapped_file"));
+ memstats.setTotal_pgfault(mstats.getInt("total_pgfault"));
+ memstats.setTotal_pgmajfault(mstats.getInt("total_pgmajfault"));
+ memstats.setTotal_pgpgin(mstats.getInt("total_pgpgin"));
+ memstats.setTotal_pgpgout(mstats.getInt("total_pgpgout"));
+ memstats.setTotal_rss(mstats.getInt("total_rss"));
+ memstats.setTotal_rss_huge(mstats.getInt("total_rss_huge"));
+ memstats.setTotal_unevictable(mstats.getInt("total_unevictable"));
+ memstats.setTotal_writeback(mstats.getInt("total_writeback"));
+
+ memusg.setMemstats(memstats);
+ }
+ }
+
+ cstats.setMemory(memusg);
+
+ /*
+ * cpu stats
+ */
+ ContainerCpuStats ccpustats = DockerFactory.eINSTANCE.createContainerCpuStats();
+ ContainerCpuUsage ccpuusage = DockerFactory.eINSTANCE.createContainerCpuUsage();
+
+ JSONObject jcpuusage = j.getJSONObject("cpu_stats").getJSONObject("cpu_usage");
+
+ ccpuusage.setTotal_usage(jcpuusage.getLong("total_usage"));
+ ccpuusage.setUsage_in_usermode(jcpuusage.getLong("usage_in_kernelmode"));
+ ccpuusage.setUser_in_kernelmode(jcpuusage.getLong("usage_in_usermode"));
+
+ JSONArray ccpupcpu = jcpuusage.getJSONArray("percpu_usage");
+
+ for(int idx = 0; idx < ccpupcpu.length(); idx++) {
+ ccpuusage.getPercpu_usage().add(ccpupcpu.getLong(idx));
+ }
+
+ ccpustats.setCpu_usage(ccpuusage);
+ cstats.setCpu(ccpustats);
+
+ c.setStats(cstats);
+ }
+
+ }
+
+ private static final boolean isaJSONObject(Object v) {
+ if (v.getClass().equals(JSONObject.class)) {
+ return true;
+ }
+ return false;
+ }
+
+ private void updateNetworks(JSONObject json) {
+ JSONArray a = json.getJSONArray("$list");
+ o.getNetworks().clear();
+ for (int i = 0; i < a.length(); i++) {
+ JSONObject j = a.getJSONObject(i);
+ decapitalize(j);
+ fixNull(j);
+ rename(j, "created", "dockerCreated");
+ fixMap(j, "containers", "id");
+ fixMap(j, "options");
+ DockerNetwork network = (DockerNetwork) controller.getServer()
+ .json2ecore(DockerPackage.eINSTANCE.getDockerNetwork(), j);
+ // System.err.println("XXXX " + ManagementServer.ecore2json(network,
+ // 100, null, true).toString(2));
+ o.getNetworks().add(network);
+ }
+ }
+
+ // change JSONObject to a JSONArray with name,value objects
+ private void fixMap(JSONObject j, String key) {
+ JSONArray a = new JSONArray();
+ if (!j.has(key)) return;
+ JSONObject jjj = j.getJSONObject(key);
+ for (Iterator<String> i = jjj.keys(); i.hasNext();) {
+ String k = i.next();
+ Object v = jjj.get(k);
+ JSONObject jj = new JSONObject();
+ jj.put("name", k);
+ jj.put("value", v);
+ a.put(jj);
+ }
+ j.put(key, a);
+ }
+
+ // change JSONObject to a JSONArray with name,value objects
+ private void fixMap(JSONObject j, String key, String nameKey) {
+ JSONArray a = new JSONArray();
+ JSONObject jjj = j.getJSONObject(key);
+ for (Iterator<String> i = jjj.keys(); i.hasNext();) {
+ String k = i.next();
+ JSONObject v = jjj.getJSONObject(k);
+ v.put(nameKey, k);
+ a.put(v);
+ }
+ j.put(key, a);
+ }
+
+ private void fixNull(JSONObject j) {
+ for (Iterator<String> i = j.keys(); i.hasNext();) {
+ String k = i.next();
+ Object v = j.get(k);
+ // System.err.println("XXXX " + v.getClass().getName());
+ if (v.getClass().getName().equals("org.json.JSONObject$Null")) {
+ j.put(k, new JSONArray());
+ System.err.println("XXXX change null to empty array " + k);
+ }
+ }
+ }
+
+ private void decapitalize(JSONObject j) {
+ ArrayList<String> l = new ArrayList<String>();
+ for (Iterator<String> i = j.keys(); i.hasNext();) {
+ l.add(i.next());
+ }
+ for (String k : l) {
+ Object v = j.get(k);
+ if (v instanceof JSONObject) {
+ JSONObject jj = (JSONObject) v;
+ decapitalize(jj);
+ }
+ if (v instanceof JSONArray) {
+ JSONArray a = (JSONArray) v;
+ for (int i = 0; i < a.length(); i++) {
+ Object v1 = a.get(i);
+ if (v1 instanceof JSONObject) {
+ JSONObject jj = (JSONObject) v1;
+ decapitalize(jj);
+ }
+ }
+ }
+ rename(j, k, k.substring(0, 1).toLowerCase() + k.substring(1));
+ }
+
+ }
+
+ private void rename(JSONObject j, String k1, String k2) {
+ if (k1.equals(k2))
+ return;
+ if (j.has(k1)) {
+ j.put(k2, j.get(k1));
+ j.remove(k1);
+ }
+ }
+
+ // run through json.get("Processes") arrays
+ // and generate a DockerProcess object
+ // "USER","PID","%CPU","%MEM","VSZ","RSS","TTY","STAT","START","TIME","COMMAND"
+ private DockerProcess[] setPtbl(JSONObject json) {
+
+ if (!json.has("Proccesses")) {
+ return null;
+ }
+ JSONArray processes = json.getJSONArray("Processes");
+ int sz = processes.length();
+
+ DockerProcess[] dprocs = new DockerProcess[sz];
+
+ for (int i=0; i < processes.length(); i++) {
+ JSONArray proc = processes.getJSONArray(i);
+ logger.debug("proc <- " + proc.toString(PRETTY_PRINT));
+
+ DateFormat df = new SimpleDateFormat();
+
+ DockerProcess dp = DockerFactory.eINSTANCE.createDockerProcess();
+ dp.setUser(proc.getString(0));
+ dp.setPid(proc.getLong(1));
+ dp.setCpu(proc.getDouble(2));
+ dp.setMem(proc.getDouble(3));
+ dp.setVsz(proc.getLong(4));
+ dp.setRss(proc.getLong(5));
+ dp.setTty(proc.getString(6));
+ dp.setStat(proc.getString(7));
+ dp.setCommand(proc.getString(10));
+ // 9th field is a duration indicator. FIXME
+ dp.setTimeElapsed(0);
+
+ try {
+ dp.setStart(df.parse(proc.getString(8)));
+ }
+ catch(ParseException ep) {
+ logger.warn("Could not parse " + proc.getString(8) + " into a Date");
+ dp.setStart(null);
+ }
+ catch(NullPointerException e){
+ logger.warn("Could not parse " + proc.getString(8) + " into a Date");
+ dp.setStart(null);
+ }
+
+ dprocs[i] = dp;
+ }
+
+ return dprocs;
+ }
+
+ /*
+ * many remote docker api calls do not return a json message
+ * your only indication of operational success will be in the
+ * http client response code. the json object will be null in
+ * those cases
+ */
+ private JSONObject callRemoteApi(String api, String method) {
+ return callRemoteApi(api,method,null);
+ }
+
+ private JSONObject callRemoteApi(String api, String method, JSONObject context) {
+
+ HashMap<String, String> headers = new HashMap<String, String>();
+ JSONObject json = null;
+
+ // this will be prepended to the api string passed into the method
+ String url = client.getBaseAddress();
+
+ logger.info("api <- " + method + " " + url + api);
+
+ switch(method) {
+ case GET_METHOD :
+ json = client.httpJsonTransaction(api, method, headers, null, 5000L);
+ break;
+ case POST_METHOD :
+ if (context == null) {
+ client.httpBinaryTransaction(api, method, headers, context, 5000L);
+ } else {
+ json = client.httpJsonTransaction(api,method, headers, context, 5000L);
+ }
+ break;
+ case DELETE_METHOD :
+ json = client.httpJsonTransaction(api, method, headers, null, 5000L);
+ break;
+ }
+
+ logger.info("http response <- " + client.getResponseCode());
+
+ if (json != null) {
+ logger.debug("json <- " + json.toString(PRETTY_PRINT));
+ }
+
+ return json;
+ }
+
+ private JSONArray callRemoteApiStream(String api, String method, JSONObject aContext) {
+
+ HashMap<String, String> headers = new HashMap<String, String>();
+ byte[] bytes;
+ JSONObject context = aContext;
+ String func = "callRemoteApiStream";
+
+ // this will be prepended to the api string passed into the method
+ String url = client.getBaseAddress();
+
+ logger.info("api <- " + method + " " + url + api);
+
+ bytes = client.httpBinaryTransaction(api, method, headers, context, 5000L);
+ logger.info("http response <- " + client.getResponseCode());
+
+ JSONObject json = new JSONObject(bytes.toString());
+ JSONArray a = json.getJSONArray("$list");
+
+ return a;
+ }
+
+ //
+ // GET /containers/(id)/json
+ //
+ // return low level information about a container
+ //
+ // should it be void? this is returns
+ public void inspectContainer(String name) {
+
+ int size = 0; // 1 - true, 0 - false
+ String url = CONTAINERS + name + "/json?size=" + size;
+
+ JSONObject json = callRemoteApi(url,GET_METHOD);
+ logger.info("container " + name + " <- " + json.toString(PRETTY_PRINT));
+
+ // status codes:
+ // 200 - no error
+ // 404 - no such container
+ // 500 - server error
+ // process JSON
+ }
+
+ // GET /containers/(id)/top
+ // List processes running in a container
+ public void containerProcesses(String name) {
+
+ String api = CONTAINERS + name + "/top?ps_args=aux";
+ JSONObject json = callRemoteApi(api,GET_METHOD);
+ logger.info("container " + name + " <- " + json.toString(PRETTY_PRINT));
+ setPtbl(json);
+ }
+
+ // POST /containers/(id)/kill
+ public void killContainer(String name,String sigint) {
+
+ String url = CONTAINERS + name + "/kill?signal=" + sigint;
+ JSONObject json = callRemoteApi(url,POST_METHOD);
+
+ // status codes:
+ // 204 - no error
+ // 404 - no such container
+ // 500 - server err
+ // process JSON
+ }
+
+ // POST /containers/(id)/restart?t=seconds
+ public void restartContainer(String name, int seconds) {
+
+ String url = CONTAINERS + name + "/restart?seconds=" + seconds;
+ JSONObject json = callRemoteApi(url,POST_METHOD);
+ // status codes:
+ // 204 - no error
+ // 404 - no such container
+ // 500 - server err
+ // process JSON
+ }
+
+ // remove - remove volumes, force - kill & remove
+ public void removeContainer(String name, boolean remove, boolean force) {
+
+ int rm = (force) ? 1 : 0;
+ int vol = (remove) ? 1 : 0;
+
+ String url = CONTAINERS + name + "?force=" + rm + "&v=" + vol;
+
+ JSONObject json = callRemoteApi(url,DELETE_METHOD);
+
+ // status codes:
+ // 204 - no error
+ // 400 - bad parameter
+ // 404 - no such container
+ // 500 - server error
+ // process JSON
+ }
+
+ // POST /containers/(id)/pause
+ public void pauseContainer(String name) {
+
+ String url = CONTAINERS + name + "/pause";
+ JSONObject json = callRemoteApi(url,POST_METHOD);
+
+ // status codes:
+ // 204 - no error
+ // 404 - no such container
+ // 500 - server err
+ // process JSON
+ }
+
+ // POST /containers/(id)/unpause
+ public void unpauseContainer(String name) {
+
+ String url = CONTAINERS + name + "/unpause";
+ JSONObject json = callRemoteApi(url,POST_METHOD);
+
+ // status codes:
+ // 204 - no error
+ // 404 - no such container
+ // 500 - server err
+ // process JSON
+ }
+
+ // GET /containers/(id)/stats?stream
+ // stream - true or false, if false, poll once and exit
+ public JSONObject containerStats(String name, boolean stream) {
+
+ String url = CONTAINERS + name + "/stats?stream=" + stream;
+ JSONObject json = callRemoteApi(url,GET_METHOD);
+
+ return json;
+ }
+
+ // POST /containers/(id)/start
+ public void startContainer(String name) {
+
+ String url = CONTAINERS + name + "/start";
+ JSONObject json = callRemoteApi(url,POST_METHOD);
+ // status codes:
+ // 200 - no error
+ // 304 - container already started
+ // 404 - no such container
+ // 500 - server err
+ }
+
+ // POST /containers/(id)/stop?t=seconds
+ // t = seconds to wait before killing the container
+ public void stopContainer(String name, int seconds) {
+
+ String url = CONTAINERS + name + "/stop?t=" + seconds;
+ JSONObject json = callRemoteApi(url,POST_METHOD);
+ // status codes:
+ // 204 - no error
+ // 304 - container already stopped
+ // 404 - no such container
+ // 500 - server err
+ }
+
+ private List<String> getImageNameElements(String image) {
+
+ List<String> a = new ArrayList<>();
+ for(String z : image.split("\\/")) {
+ String[] iz = z.split(":");
+ for(int i = 0; i < iz.length; i++) {
+ a.add(iz[i]);
+ }
+ }
+ return a;
+ }
+
+ /*
+ * return the latest version nbr of a package
+ */
+ private String getLatest(String image) {
+
+ List<String> vers = new ArrayList<>();
+
+ for(DockerImage im : o.getImages()) {
+ List<String> elms = getImageNameElements(im.getName());
+
+ if (image.contains(elms.get(NAME))) {
+ EList<String> tags = im.getRepoTags();
+ for(int i = 0; i < tags.size(); i++) {
+ List<String> repoElm = getImageNameElements(tags.get(i));
+ vers.add(repoElm.get(VER));
+ }
+ }
+ }
+ Collections.sort(vers);
+
+ return vers.get(vers.size()-1);
+ }
+
+ /*
+ * Tag the most current version of an image as latest
+ */
+ public void tagImage(String image, String ver, boolean force) {
+
+ int f = (force) ? 1 : 0;
+
+ if (ver.isEmpty()) {
+ ver = "latest";
+ }
+
+ List<String> elms = getImageNameElements(image);
+ String repo = elms.get(REPO);
+
+ String url = IMAGES + "/" + image + "/tag" + "?repo=" + repo + "&tag=" + ver + "&force=" + f;
+
+ JSONObject json = callRemoteApi(url,POST_METHOD);
+ // status codes:
+ // 201 - no error
+ // 400 - bad parameter
+ // 404 - no such image
+ // 500 - server err
+ }
+}
diff --git a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerHttpClient.java b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerHttpClient.java
new file mode 100644
index 0000000..0b9d43a
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerHttpClient.java
@@ -0,0 +1,196 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker;
+
+import java.io.*;
+import java.util.*;
+import java.net.*;
+
+import org.apache.log4j.Logger;
+import org.json.JSONObject;
+import org.apache.commons.codec.binary.Base64;
+
+import org.openecomp.ncomp.utils.CryptoUtils;
+import org.openecomp.ncomp.utils.PropertyUtil;
+
+public class DockerHttpClient extends DockerAbstractClient {
+
+ public static final Logger logger = Logger.getLogger(DockerHttpClient.class);
+ String authorization;
+ String baseAddress;
+ private boolean debug = true;
+ private int responseCode;
+
+ public int getResponseCode() {
+ return this.responseCode;
+ }
+
+ private static void safeClose(final OutputStream out) {
+ if (out != null) {
+ try {
+ out.close();
+ } catch(IOException e) {
+ logger.error("Failed to close stream " + e);
+ }
+ }
+ }
+
+ private static void safeClose(final InputStream in) {
+ if (in != null) {
+ try {
+ in.close();
+ } catch(IOException e) {
+ logger.error("Failed to close stream " + e);
+ }
+ }
+ }
+
+ public DockerHttpClient(String fileName, String endpoint) {
+ this.responseCode = 0;
+ try {
+ props = PropertyUtil.getPropertiesFromClasspath(fileName);
+ setBaseAddress(props.getProperty(endpoint + ".endpoint"));
+ if (getBaseAddress() == null) {
+ logger.error("unable to determine baseAddress for endpoint: " + endpoint + " in " + fileName);
+ throw new RuntimeException("unable to determine baseAddress for endpoint: " + endpoint + " in "
+ + fileName);
+ }
+ //String user = props.getProperty(endpoint + ".user");
+ //String password = decryptPassword(props.getProperty(endpoint + ".password"));
+ debug = Boolean.parseBoolean(props.getProperty(endpoint + ".debug", "false"));
+ //authorization = "Basic " + Base64.encodeBase64String((user + ":" + password).getBytes());
+ //authorization = authorization.trim();
+ } catch (Exception e) {
+ logger.error("creating client failed: " + e.getMessage());
+ }
+ }
+
+ private String decryptPassword(String s) {
+ if (s.startsWith("rsa:")) {
+ s = CryptoUtils.decryptPrivate(CryptoUtils.getKey("config/server.private"), s.substring(4));
+ }
+ return s;
+ }
+
+
+ public byte[] httpBinaryTransaction(String path, String method, HashMap<String, String> headers, JSONObject body,
+ Long timeout) {
+
+ byte[] rawbody = null;
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ if ("DELETE".equals(method) || "GET".equals(method)) {
+ body = null;
+ }
+ if (body != null) {
+ rawbody = body.toString(2).getBytes();
+ if (rawbody.length == 0) {
+ rawbody = null;
+ }
+ }
+ String url = getBaseAddress() + path;
+ int tout = 60000;
+ if (timeout != null) {
+ // units? seconds or millis?
+ tout = (int) timeout.longValue();
+ }
+ try {
+ URL u = new URL(url);
+ HttpURLConnection uc = (HttpURLConnection) u.openConnection();
+ uc.setConnectTimeout(tout);
+ uc.setReadTimeout(tout);
+ if (headers == null)
+ headers = new HashMap<String, String>();
+
+ if (body != null) {
+ headers.put("Content-type", "application/json");
+ }
+ //headers.put("Authorization", authorization);
+ for (String n : headers.keySet()) {
+ uc.setRequestProperty(n, headers.get(n));
+ if (debug) {
+ System.err.println("HTTP REQUEST header: " + n + " " + headers.get(n));
+ }
+ }
+ uc.setRequestMethod(method);
+ if (debug)
+ System.err.println("HTTP REQUEST method: " + method + " " + uc.getRequestMethod());
+
+ if (rawbody != null && rawbody.length > 0) {
+ uc.setRequestProperty("Content-Length", Integer.toString(rawbody.length));
+ uc.setFixedLengthStreamingMode(rawbody.length);
+ uc.setDoOutput(true);
+ OutputStream os = uc.getOutputStream();
+ os.write(rawbody);
+ safeClose(os);
+ }
+ int rc = uc.getResponseCode();
+ this.responseCode = rc;
+ if (rc < 200 || rc >= 300) {
+ // do not throw an error - log the failure
+ //throw new DockerHttpClientException("HTTP Request Failed: URL: " + url + " code:" + rc + " msg:"
+ //+ uc.getResponseMessage());
+ logger.error("HTTP Request Failed. URL: " + url + " code: " + rc + " msg: " + uc.getResponseMessage());
+ throw new RuntimeException("Docker HTTP Request Failed. URL: " + url + " code: " + rc + " msg: " + uc.getResponseMessage());
+ }
+
+ //ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ int i;
+ InputStream is = uc.getInputStream();
+ byte[] buf = new byte[65536];
+ while ((i = is.read(buf)) > 0) {
+ baos.write(buf, 0, i);
+ }
+ safeClose(is);
+ //return baos.toByteArray();
+
+ } catch (RuntimeException re) {
+ throw re;
+ } catch (Exception e) {
+ logger.error("Exception <- " + e + " " + e.getMessage());
+ throw new RuntimeException("http error: " + e, e);
+ }
+ return baos.toByteArray();
+ }
+
+ public String getBaseAddress() {
+ return baseAddress;
+ }
+
+ public void setBaseAddress(String baseAddress) {
+ this.baseAddress = baseAddress;
+ }
+
+ public void setDebug(boolean debug) {
+ this.debug = debug;
+ }
+
+ public void httpBinaryTransaction(String path, String method, HashMap<String, String> headers, InputStream i, int j) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void httpJsonTransaction(String path, String method, HashMap<String, String> headers, InputStream i, int j) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerHttpClientException.java b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerHttpClientException.java
new file mode 100644
index 0000000..c9aa78e
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerHttpClientException.java
@@ -0,0 +1,31 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker;
+
+class DockerHttpClientException extends RuntimeException {
+ public DockerHttpClientException(String string) {
+ super(string);
+ }
+
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestDockerInspect.java b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestDockerInspect.java
new file mode 100644
index 0000000..2e81d9a
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestDockerInspect.java
@@ -0,0 +1,52 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker;
+
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+import org.openecomp.ncomp.sirius.manager.ManagementServer;
+
+public class TestDockerInspect implements ISiriusServer {
+
+ private ManagementServer server;
+
+ public static void main(String[] args) {
+ TestDockerInspect t = new TestDockerInspect();
+ String containerId = args[0];
+ t.dockerRun(containerId);
+ }
+
+ private void dockerRun(String container) {
+ server = new ManagementServer();
+ DockerDockerHost dockerd = new DockerDockerHost(this);
+ System.out.println("inspect container <- ");
+ dockerd.inspectContainer(container);
+
+ System.out.println("container processes <- ");
+ dockerd.containerProcesses(container);
+ }
+
+ @Override
+ public ManagementServer getServer() {
+ return server;
+ }
+
+}
diff --git a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestDockerRun.java b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestDockerRun.java
new file mode 100644
index 0000000..dcbe4a9
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestDockerRun.java
@@ -0,0 +1,102 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker;
+
+import org.openecomp.ncomp.docker.ContainerOptions;
+import org.openecomp.ncomp.docker.ContainerPortBindings;
+import org.openecomp.ncomp.docker.ContainerRestartPolicy;
+import org.openecomp.ncomp.docker.DockerFactory;
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+import org.openecomp.ncomp.sirius.manager.ManagementServer;
+
+import java.util.List;
+import java.util.ArrayList;
+
+public class TestDockerRun implements ISiriusServer {
+
+ private ManagementServer server;
+
+ public static void main(String[] args) {
+ TestDockerRun t = new TestDockerRun();
+ String dockerRegistry = "cdf-2.novalocal:7113";
+ String dockerImage = "dcae-controller-sdnlocal";
+ String dockerImageTag = "latest";
+ String image = dockerRegistry + "/" + dockerImage + ":" + dockerImageTag;
+
+ t.dockerRun(image);
+ }
+
+ private void dockerRun(String image) {
+ server = new ManagementServer();
+ DockerDockerHost dockerd = new DockerDockerHost(this);
+ boolean withOpts = true;
+
+ if (withOpts) {
+ ContainerOptions opts = DockerFactory.eINSTANCE.createContainerOptions();
+
+ // explicit port mapping
+ ContainerPortBindings portBinds = DockerFactory.eINSTANCE.createContainerPortBindings();
+ portBinds.setContainerPort(27001);
+ portBinds.setProtocol("tcp");
+ portBinds.setVmPort(27001);
+ opts.getPortBindings().add(portBinds);
+
+ // container name
+ opts.setName("kens_folly");
+
+ // vm to container volume mapping
+ opts.getVolumes().add("/var/log:/opt/app/logs");
+
+ // publish exposed ports to an ephemeral vm port
+ opts.setPublishAllPorts(true);
+
+ // set the containerName equal to the VM name
+ opts.setSetContainerName(true);;
+
+ // set restart policy
+ // if the docker engine is stopped and containers killed - this will
+ // instruct the docker engine to restart those containers when it
+ // is brought back up
+ ContainerRestartPolicy restartPolicy = DockerFactory.eINSTANCE.createContainerRestartPolicy();
+ restartPolicy.setNm("always");
+ restartPolicy.setMaxRetryCnt(0);
+ opts.setAutoRestart(restartPolicy);
+
+ // add some environment variables
+ List<String> rtEnv = new ArrayList<>();
+ rtEnv.add("FOO=bar");
+ rtEnv.add("BAR=baz");
+ rtEnv.add("BAz=foo");
+ opts.getEnv().addAll(rtEnv);
+
+ dockerd.dockerRunWithOptions(image, opts);
+ } else {
+ dockerd.dockerRunWithName(image, "kens_folly");
+ }
+ }
+
+ @Override
+ public ManagementServer getServer() {
+ return server;
+ }
+
+}
diff --git a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestDockerRunLinks.java b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestDockerRunLinks.java
new file mode 100644
index 0000000..0d92e90
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestDockerRunLinks.java
@@ -0,0 +1,102 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker;
+
+import org.openecomp.ncomp.docker.ContainerOptions;
+import org.openecomp.ncomp.docker.ContainerPortBindings;
+import org.openecomp.ncomp.docker.ContainerRestartPolicy;
+import org.openecomp.ncomp.docker.DockerFactory;
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+import org.openecomp.ncomp.sirius.manager.ManagementServer;
+
+public class TestDockerRunLinks implements ISiriusServer {
+
+ private ManagementServer server;
+
+ public static void main(String[] args) {
+
+ TestDockerRunLinks t = new TestDockerRunLinks();
+
+ String dockerRegistry = "cdf-2.novalocal:7113";
+ String dockerImage = "dcae-mysql";
+ String dockerImageTag = "5.7";
+ String image = dockerRegistry + "/" + dockerImage + ":" + dockerImageTag;
+
+ ContainerOptions opts = DockerFactory.eINSTANCE.createContainerOptions();
+
+ String containerName = dockerImage + "_kens_test";
+
+ // container name
+ opts.setName(containerName);
+
+ // vm to container volume mapping
+ opts.getVolumes().add("/var/log:/opt/app/logs");
+
+ // publish exposed ports to an ephemeral vm port
+ opts.setPublishAllPorts(true);
+
+ // set restart policy
+ // if the docker engine is stopped and containers killed - this will
+ // instruct the docker engine to restart those containers when it
+ // is brought back up
+ ContainerRestartPolicy restartPolicy = DockerFactory.eINSTANCE.createContainerRestartPolicy();
+ restartPolicy.setNm("always");
+ restartPolicy.setMaxRetryCnt(0);
+ opts.setAutoRestart(restartPolicy);
+
+ // mysql runtime arguments
+ // not really necessary because we set these in the Dockerfile
+ /*
+ opts.getEnv().add("MYSQL_USER=nmsadm");
+ opts.getEnv().add("MYSQL_PASSWORD=nmsadm");
+ opts.getEnv().add("MYSQL_DATABASE=ucsnmp");
+ opts.getEnv().add("MYSQL_ROOT_PASSWORD=dcae");
+ */
+
+ System.err.println("Starting first container " + opts.getName() + " ...");
+ t.dockerRun(image,opts);
+
+ // create container to link to the previous one
+ ContainerOptions linkOpts = DockerFactory.eINSTANCE.createContainerOptions();
+ String linkedImage = dockerRegistry + "/" + "dcae-controller-snmptrap" + ":" + "5.7";
+ linkOpts.getLinks().add(containerName + ":" + "mysql");
+ linkOpts.setName("dcae-controller-snmptrap" + "_kens_test");
+ linkOpts.setPublishAllPorts(true);
+
+ System.err.println("Starting second container " + opts.getName() + " ...");
+ t.dockerRun(linkedImage,linkOpts);
+
+ }
+
+ private void dockerRun(String image, ContainerOptions opts) {
+ server = new ManagementServer();
+ DockerDockerHost dockerd = new DockerDockerHost(this);
+
+ dockerd.dockerRunWithOptions(image, opts);
+ }
+
+ @Override
+ public ManagementServer getServer() {
+ return server;
+ }
+
+}
diff --git a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestDockerStop.java b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestDockerStop.java
new file mode 100644
index 0000000..eb9e88e
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestDockerStop.java
@@ -0,0 +1,52 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker;
+
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+import org.openecomp.ncomp.sirius.manager.ManagementServer;
+
+public class TestDockerStop implements ISiriusServer {
+
+ private ManagementServer server;
+
+ public static void main(String[] args)
+ throws InterruptedException {
+
+ TestDockerStop t = new TestDockerStop();
+ String containerNm = "kens_folly";
+ t.dockerStop(containerNm);
+ }
+
+ private void dockerStop(String container)
+ throws InterruptedException {
+ server = new ManagementServer();
+ DockerDockerHost dockerd = new DockerDockerHost(this);
+
+ dockerd.removeContainer(container,true,true);
+ }
+
+ @Override
+ public ManagementServer getServer() {
+ return server;
+ }
+
+}
diff --git a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestPolling.java b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestPolling.java
new file mode 100644
index 0000000..450a41f
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestPolling.java
@@ -0,0 +1,52 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker;
+
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+import org.openecomp.ncomp.sirius.manager.ManagementServer;
+
+/*
+ * the polled docker-engine is defined in docker.properties
+ * dockerHost.endpoint=https://host.domaon:port
+ *
+ */
+public class TestPolling implements ISiriusServer {
+
+ public static void main(String[] args) {
+ TestPolling t = new TestPolling();
+ t.poll();
+ }
+
+ private ManagementServer server;
+
+ private void poll() {
+ server = new ManagementServer();
+ DockerDockerHost h = new DockerDockerHost(this);
+ h.poll();
+ }
+
+ @Override
+ public ManagementServer getServer() {
+ return server;
+ }
+
+}
diff --git a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiProvider.java b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiProvider.java
new file mode 100644
index 0000000..884baf3
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiProvider.java
@@ -0,0 +1,78 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker.gui;
+
+
+
+
+
+import java.io.InputStream;
+
+import org.openecomp.ncomp.sirius.manager.IRequestHandler;
+import org.openecomp.ncomp.sirius.manager.ISiriusPlugin;
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+import org.openecomp.ncomp.sirius.function.FunctionUtils;
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.common.util.EList;
+import org.json.JSONObject;
+
+
+
+import org.openecomp.ncomp.sirius.gui.tools.*;
+
+
+import org.openecomp.ncomp.gwt.siriusportal.model.*;
+
+
+import org.openecomp.ncomp.sirius.manager.Subject;
+
+
+import org.openecomp.ncomp.sirius.manager.ManagementServer;
+
+
+import org.openecomp.ncomp.sirius.manager.server.AbstractManagementServer;
+
+
+import org.openecomp.ncomp.sirius.manager.BasicGuiClientApiProvider;
+
+
+import org.openecomp.ncomp.gwt.siriusportal.model.impl.GuiClientApiImpl;
+import org.openecomp.ncomp.gwt.siriusportal.model.GuiClientApi;
+
+
+public class DockerGuiClientApiProvider extends BasicGuiClientApiProvider {
+ private static final Logger logger = Logger.getLogger(DockerGuiClientApiProvider.class);
+ GuiClientApi o;
+
+ public DockerGuiClientApiProvider(ISiriusServer controller, GuiClientApi o) {
+ super(controller, o);
+ this.o = o;
+ }
+
+
+
+
+
+
+}
diff --git a/ncomp-docker-adaptor/src/main/server/config/adaptor.properties b/ncomp-docker-adaptor/src/main/server/config/adaptor.properties
new file mode 100644
index 0000000..4605389
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/server/config/adaptor.properties
@@ -0,0 +1,7 @@
+server.dir = data/resources
+metrics.dir = data/metrics
+properties.dir = data/properties
+server.port = PORT
+server.user.console = CONSOLE_PW
+server.user.gui = GUI_PW
+server.user.client = CLIENT_PW
diff --git a/ncomp-docker-adaptor/src/main/server/config/console.properties b/ncomp-docker-adaptor/src/main/server/config/console.properties
new file mode 100644
index 0000000..4b63607
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/server/config/console.properties
@@ -0,0 +1,3 @@
+localhost.endpoint=http://localhost:PORT
+localhost.user=console
+localhost.password=CONSOLE_PW
diff --git a/ncomp-docker-adaptor/src/main/server/config/gui.properties b/ncomp-docker-adaptor/src/main/server/config/gui.properties
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/server/config/gui.properties
diff --git a/ncomp-docker-adaptor/src/main/server/config/log4j.properties b/ncomp-docker-adaptor/src/main/server/config/log4j.properties
new file mode 100644
index 0000000..d048817
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/server/config/log4j.properties
@@ -0,0 +1,24 @@
+log4j.debug=0
+log4j.rootLogger=warn, file
+log4j.logger.org.openecomp.ncomp=info, file
+log4j.additivity.org.openecomp.ncomp=false
+log4j.logger.org.openecomp.ncomp.datarouter=warn, file
+log4j.additivity.org.openecomp.ncomp.datarouter=false
+log4j.logger.org.apache.http.headers=debug, file
+log4j.logger.org.apache.http.wire=debug, file
+
+## uploaded logger
+log4j.logger.org.openecomp.ncomp.sirius.manager.uploaded=info, uploaded
+log4j.additivity.org.openecomp.ncomp.sirius.manager.uploaded=false
+## request logging
+log4j.logger.org.openecomp.ncomp.sirius.manager.ManagementServer.requests=info, requests
+log4j.additivity.org.openecomp.ncomp.sirius.manager.ManagementServer.requests=false
+
+
+log4j.appender.file=org.apache.log4j.RollingFileAppender
+log4j.appender.file.File=c:/Users/km1785/logs/BBBB.log
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d %5p [%t] %m %C:%L%n
+log4j.appender.file.MaxFileSize=50MB
+log4j.appender.file.MaxBackupIndex=5
+
diff --git a/ncomp-docker-adaptor/src/main/server/config/makefile b/ncomp-docker-adaptor/src/main/server/config/makefile
new file mode 100644
index 0000000..717823e
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/server/config/makefile
@@ -0,0 +1,9 @@
+
+restart: stop start
+
+start:
+ M2_HOME=/home/ncomp/.m2 bin/BBBB-controller start
+stop:
+ bin/BBBB-controller stop
+console:
+ bin/BBBB-controller console
diff --git a/ncomp-docker-adaptor/src/main/server/config/pw.sh.sh b/ncomp-docker-adaptor/src/main/server/config/pw.sh.sh
new file mode 100644
index 0000000..cd022ae
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/server/config/pw.sh.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+### used to generate random passwords
+
+
+echo '#!/bin/bash'
+echo ""
+
+echo 'cat \'
+
+for i in CONSOLE GUI CLIENT
+do
+ echo ' |' sed s/${i}_PW/$(echo $i:$(date +%s) | sha256sum | base64 | head -c 20 ; echo)/ \\
+done
+ \ No newline at end of file
diff --git a/ncomp-docker-adaptor/src/main/server/scripts/console.groovy b/ncomp-docker-adaptor/src/main/server/scripts/console.groovy
new file mode 100644
index 0000000..4c186de
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/server/scripts/console.groovy
@@ -0,0 +1,27 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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============================================
+ */
+
+import org.openecomp.ncomp.servers.docker.DockerDockerAdaptorConsole
+import org.openecomp.ncomp.sirius.manager.console.Utils
+
+adaptor = new DockerDockerAdaptorConsole("console.properties","localhost")
+
+def p(x) { Utils.object2json(x).toString(2) }
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/DockerAdaptor.yaml b/ncomp-docker-adaptor/src/main/sirius-gen/DockerAdaptor.yaml
new file mode 100644
index 0000000..d728705
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/DockerAdaptor.yaml
@@ -0,0 +1,3 @@
+operations: {}
+messages:
+ dummy: {}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/DockerHost.yaml b/ncomp-docker-adaptor/src/main/sirius-gen/DockerHost.yaml
new file mode 100644
index 0000000..b86e0ef
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/DockerHost.yaml
@@ -0,0 +1,168 @@
+operations:
+ poll: {}
+ startContainer: {}
+ stopContainer: {}
+ restartContainer: {}
+ pauseContainer: {}
+ unpauseContainer: {}
+ removeContainer: {}
+ inspectContainer: {}
+ killContainer: {}
+ dockerRun: {}
+ dockerRunWithName: {}
+ dockerRunWithOptions: {}
+ containerStats: {}
+ containerProcesses: {}
+ pullImage: {}
+ REMOTE_poll:
+ decription: Remote call poll
+ REMOTE_startContainer:
+ decription: Remote call startContainer
+ REMOTE_stopContainer:
+ decription: Remote call stopContainer
+ REMOTE_restartContainer:
+ decription: Remote call restartContainer
+ REMOTE_pauseContainer:
+ decription: Remote call pauseContainer
+ REMOTE_unpauseContainer:
+ decription: Remote call unpauseContainer
+ REMOTE_removeContainer:
+ decription: Remote call removeContainer
+ REMOTE_inspectContainer:
+ decription: Remote call inspectContainer
+ REMOTE_killContainer:
+ decription: Remote call killContainer
+ REMOTE_dockerRun:
+ decription: Remote call dockerRun
+ REMOTE_dockerRunWithName:
+ decription: Remote call dockerRunWithName
+ REMOTE_dockerRunWithOptions:
+ decription: Remote call dockerRunWithOptions
+ REMOTE_containerStats:
+ decription: Remote call containerStats
+ REMOTE_containerProcesses:
+ decription: Remote call containerProcesses
+ REMOTE_pullImage:
+ decription: Remote call pullImage
+messages:
+ dummy: {}
+ poll:
+ errorCode: poll-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ startContainer:
+ errorCode: startContainer-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ stopContainer:
+ errorCode: stopContainer-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ restartContainer:
+ errorCode: restartContainer-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ pauseContainer:
+ errorCode: pauseContainer-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ unpauseContainer:
+ errorCode: unpauseContainer-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ removeContainer:
+ errorCode: removeContainer-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ inspectContainer:
+ errorCode: inspectContainer-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ killContainer:
+ errorCode: killContainer-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ dockerRun:
+ errorCode: dockerRun-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ dockerRunWithName:
+ errorCode: dockerRunWithName-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ dockerRunWithOptions:
+ errorCode: dockerRunWithOptions-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ containerStats:
+ errorCode: containerStats-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ containerProcesses:
+ errorCode: containerProcesses-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ pullImage:
+ errorCode: pullImage-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ REMOTE_poll:
+ errorCode: REMOTE-poll-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_startContainer:
+ errorCode: REMOTE-startContainer-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_stopContainer:
+ errorCode: REMOTE-stopContainer-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_restartContainer:
+ errorCode: REMOTE-restartContainer-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_pauseContainer:
+ errorCode: REMOTE-pauseContainer-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_unpauseContainer:
+ errorCode: REMOTE-unpauseContainer-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_removeContainer:
+ errorCode: REMOTE-removeContainer-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_inspectContainer:
+ errorCode: REMOTE-inspectContainer-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_killContainer:
+ errorCode: REMOTE-killContainer-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_dockerRun:
+ errorCode: REMOTE-dockerRun-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_dockerRunWithName:
+ errorCode: REMOTE-dockerRunWithName-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_dockerRunWithOptions:
+ errorCode: REMOTE-dockerRunWithOptions-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_containerStats:
+ errorCode: REMOTE-containerStats-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_containerProcesses:
+ errorCode: REMOTE-containerProcesses-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_pullImage:
+ errorCode: REMOTE-pullImage-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/GuiClientApi.yaml b/ncomp-docker-adaptor/src/main/sirius-gen/GuiClientApi.yaml
new file mode 100644
index 0000000..bf3d69d
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/GuiClientApi.yaml
@@ -0,0 +1,69 @@
+operations:
+ getTree: {}
+ getObject: {}
+ getTimeSerie: {}
+ getTable: {}
+ getHtml: {}
+ getGraph: {}
+ REMOTE_getTree:
+ decription: Remote call getTree
+ REMOTE_getObject:
+ decription: Remote call getObject
+ REMOTE_getTimeSerie:
+ decription: Remote call getTimeSerie
+ REMOTE_getTable:
+ decription: Remote call getTable
+ REMOTE_getHtml:
+ decription: Remote call getHtml
+ REMOTE_getGraph:
+ decription: Remote call getGraph
+messages:
+ dummy: {}
+ getTree:
+ errorCode: getTree-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ getObject:
+ errorCode: getObject-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ getTimeSerie:
+ errorCode: getTimeSerie-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ getTable:
+ errorCode: getTable-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ getHtml:
+ errorCode: getHtml-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ getGraph:
+ errorCode: getGraph-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ REMOTE_getTree:
+ errorCode: REMOTE-getTree-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_getObject:
+ errorCode: REMOTE-getObject-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_getTimeSerie:
+ errorCode: REMOTE-getTimeSerie-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_getTable:
+ errorCode: REMOTE-getTable-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_getHtml:
+ errorCode: REMOTE-getHtml-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_getGraph:
+ errorCode: REMOTE-getGraph-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptor.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptor.java
new file mode 100644
index 0000000..2cdc121
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptor.java
@@ -0,0 +1,65 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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============================================
+ */
+
+// Autogenerated
+// Do not edit. No need to extend this class.
+package org.openecomp.ncomp.servers.docker;
+
+import java.io.InputStream;
+import org.openecomp.ncomp.sirius.manager.IRequestHandler;
+import org.openecomp.ncomp.sirius.manager.ISiriusPlugin;
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+import org.openecomp.ncomp.sirius.function.FunctionUtils;
+import org.openecomp.ncomp.component.ApiRequestStatus;
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.common.util.EList;
+import org.json.JSONObject;
+import java.util.Date;
+
+
+
+import org.openecomp.ncomp.docker.impl.DockerAdaptorImpl;
+
+
+
+public class DockerDockerAdaptor extends DockerAdaptorImpl {
+ public static final Logger logger = Logger.getLogger(DockerDockerAdaptor.class);
+ DockerDockerAdaptorProvider controller;
+ ISiriusServer server;
+
+ public DockerDockerAdaptor(ISiriusServer server) {
+ this.server = server;
+ this.controller = new DockerDockerAdaptorProvider(server,this);
+ }
+
+
+
+
+
+
+ public static void ecoreSetup() {
+ DockerDockerAdaptorProvider.ecoreSetup();
+ }
+ public DockerDockerAdaptorProvider getSomfProvider() {
+ return controller;
+ }
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorClient.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorClient.java
new file mode 100644
index 0000000..e629eb5
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorClient.java
@@ -0,0 +1,65 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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============================================
+ */
+
+// Autogenerated
+// Do not edit. No need to extend this class.
+package org.openecomp.ncomp.servers.docker;
+
+import org.openecomp.ncomp.sirius.manager.AbstractClient;
+import org.openecomp.ncomp.sirius.manager.HighAvailabilityClient;
+import org.openecomp.ncomp.sirius.manager.GenericHttpClient;
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.openecomp.ncomp.docker.impl.DockerAdaptorImpl;
+import org.openecomp.ncomp.docker.DockerPackage;
+
+
+
+
+
+
+@SuppressWarnings("unchecked")
+public class DockerDockerAdaptorClient extends DockerAdaptorImpl {
+ public static final Logger logger = Logger.getLogger(DockerDockerAdaptorClient.class);
+ public AbstractClient client;
+
+ public DockerDockerAdaptorClient(String file, String name) {
+ DockerDockerAdaptor.ecoreSetup();
+ client = new GenericHttpClient(file,name);
+ client.add("/resources", this);
+ }
+
+ public DockerDockerAdaptorClient(String file, String name1, String name2) {
+ HighAvailabilityClient client1 = new HighAvailabilityClient(file,name1,name2);
+ client = client1.all; // requests should be forwarded to all.
+ client.add("/resources", this);
+ }
+
+ public DockerDockerAdaptorClient(AbstractClient c) {
+ client = c;
+ client.add("/resources", this);
+ }
+
+
+
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorConsole.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorConsole.java
new file mode 100644
index 0000000..b13b32d
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorConsole.java
@@ -0,0 +1,63 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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============================================
+ */
+
+// Autogenerated
+// Do not edit but extend this class as needed
+package org.openecomp.ncomp.servers.docker;
+
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.common.util.EList;
+
+import org.openecomp.ncomp.sirius.manager.console.Console;
+import org.openecomp.ncomp.sirius.manager.AbstractClient;
+import org.openecomp.ncomp.sirius.manager.ManagementServerError;
+
+
+
+import org.openecomp.ncomp.servers.docker.gui.DockerGuiClientApiConsole;
+
+
+public class DockerDockerAdaptorConsole extends Console {
+ public static final Logger logger = Logger.getLogger(DockerDockerAdaptorConsole.class);
+ protected DockerDockerAdaptorClient controller;
+
+
+ DockerDockerHostConsole host;
+ DockerGuiClientApiConsole gui;
+
+
+ public DockerDockerAdaptorConsole(String filename, String name) {
+ super(filename, name);
+ controller = new DockerDockerAdaptorClient(filename,name);
+ client = controller.client;
+
+ host = new DockerDockerHostConsole(filename,name);
+ gui = new DockerGuiClientApiConsole(filename,name);
+ }
+
+ public DockerDockerAdaptorConsole(AbstractClient c) {
+ controller = new DockerDockerAdaptorClient(c);
+ client = controller.client;
+ }
+
+
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorProviderTemplate.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorProviderTemplate.java
new file mode 100644
index 0000000..b43b087
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorProviderTemplate.java
@@ -0,0 +1,63 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker;
+
+
+
+
+
+import java.io.InputStream;
+
+import org.openecomp.ncomp.sirius.manager.IRequestHandler;
+import org.openecomp.ncomp.sirius.manager.ISiriusPlugin;
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+import org.openecomp.ncomp.sirius.function.FunctionUtils;
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.common.util.EList;
+import org.json.JSONObject;
+
+
+
+import org.openecomp.ncomp.sirius.manager.BasicAdaptorProvider;
+
+
+import org.openecomp.ncomp.docker.impl.DockerAdaptorImpl;
+import org.openecomp.ncomp.docker.DockerAdaptor;
+
+
+public class DockerDockerAdaptorProviderTemplate extends BasicAdaptorProvider {
+ private static final Logger logger = Logger.getLogger(DockerDockerAdaptorProviderTemplate.class);
+ DockerAdaptor o;
+
+ public DockerDockerAdaptorProviderTemplate(ISiriusServer controller, DockerAdaptor o) {
+ super(controller, o);
+ this.o = o;
+ }
+
+
+
+
+
+
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorServer.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorServer.java
new file mode 100644
index 0000000..b4e83fa
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorServer.java
@@ -0,0 +1,110 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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============================================
+ */
+
+// Autogenerated
+// Do not edit but extend this class as needed
+package org.openecomp.ncomp.servers.docker;
+
+import static org.openecomp.ncomp.utils.PropertyUtil.getPropertiesFromClasspath;
+
+import java.io.IOException;
+import java.util.Properties;
+import java.util.TimeZone;
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.ecore.EFactory;
+
+import org.openecomp.ncomp.sirius.manager.Jetty8Server;
+import org.openecomp.ncomp.sirius.manager.ManagementServer;
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+
+import org.openecomp.ncomp.docker.DockerAdaptor;
+
+
+import org.openecomp.ncomp.servers.docker.DockerDockerFactory;
+
+import org.openecomp.ncomp.servers.docker.gui.DockerModelFactory;
+
+
+
+
+
+public class DockerDockerAdaptorServer implements ISiriusServer {
+ public static final Logger logger = Logger.getLogger(DockerDockerAdaptorServer.class);
+ String serverPath;
+ ManagementServer server;
+ DockerDockerAdaptor controller;
+ String directory = "data";
+// LocationControllerApi api ;
+ Jetty8Server webServer;
+ DockerDockerFactory f = new DockerDockerFactory(this);
+
+ String hostPath;
+ ManagementServer hostServer;
+
+ String guiPath;
+ ManagementServer guiServer;
+
+
+ public DockerDockerAdaptorServer(String filename) throws IOException {
+ logger.warn("controller restarting");
+ DockerDockerAdaptor.ecoreSetup();
+ props = getPropertiesFromClasspath(filename);
+ serverPath = (String) props.get("server.dir");
+ server = new ManagementServer(f, "DockerAdaptor", serverPath, filename);
+ server.addFactory(f);
+
+ server.addRuntimeFactories(this);
+ server.start();
+ }
+ public void runWebserver() throws IOException {
+ controller = (DockerDockerAdaptor) server.find("/").o;
+ webServer = new Jetty8Server("docker.properties");
+ webServer.add("/resources",server);
+
+
+
+ EFactory guiFactory = new DockerModelFactory(this);
+ guiPath = serverPath + "/gui";
+ guiServer = new ManagementServer(guiFactory, "GuiClientApi", guiPath, "gui.properties");
+ guiServer.start();
+ webServer.add("/gui",guiServer);
+
+
+
+ logger.info("Joining webserver");
+ webServer.join();
+ }
+ static Properties props = null;
+ public static void main(String []args) throws IOException {
+ // ALWAYS USE GMT.
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+
+ DockerDockerAdaptorServer s = new DockerDockerAdaptorServer("docker.properties");
+ s.runWebserver();
+ }
+ public DockerAdaptor getController() {
+ return controller;
+ }
+ public ManagementServer getServer() {
+ return server;
+ }
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerFactory.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerFactory.java
new file mode 100644
index 0000000..e3d34b5
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerFactory.java
@@ -0,0 +1,60 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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============================================
+ */
+
+// Autogenerated
+// Do not edit. No need to extend this class.
+package org.openecomp.ncomp.servers.docker;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.apache.log4j.Logger;
+
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+
+import org.openecomp.ncomp.docker.DockerAdaptor;
+import org.openecomp.ncomp.docker.DockerPackage;
+import org.openecomp.ncomp.docker.impl.DockerFactoryImpl;
+
+
+
+
+import org.openecomp.ncomp.docker.DockerHost;
+
+public class DockerDockerFactory extends DockerFactoryImpl {
+ public static final Logger logger = Logger.getLogger(DockerDockerFactory.class);
+ ISiriusServer server = null;
+ @Override
+ public EPackage getEPackage() { return DockerPackage.eINSTANCE; }
+ public DockerDockerFactory(ISiriusServer server) {
+ this.server = server;
+ }
+ @Override
+ public DockerAdaptor createDockerAdaptor() {
+ return new DockerDockerAdaptor(server);
+ }
+
+
+ @Override
+ public DockerHost createDockerHost() {
+ return new DockerDockerHost(server);
+ }
+
+
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHost.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHost.java
new file mode 100644
index 0000000..d16b4ff
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHost.java
@@ -0,0 +1,378 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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============================================
+ */
+
+// Autogenerated
+// Do not edit. No need to extend this class.
+package org.openecomp.ncomp.servers.docker;
+
+import java.io.InputStream;
+import org.openecomp.ncomp.sirius.manager.IRequestHandler;
+import org.openecomp.ncomp.sirius.manager.ISiriusPlugin;
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+import org.openecomp.ncomp.sirius.function.FunctionUtils;
+import org.openecomp.ncomp.component.ApiRequestStatus;
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.common.util.EList;
+import org.json.JSONObject;
+import java.util.Date;
+
+
+
+import org.openecomp.ncomp.docker.impl.DockerHostImpl;
+
+
+
+public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin {
+ public static final Logger logger = Logger.getLogger(DockerDockerHost.class);
+ DockerDockerHostProvider controller;
+ ISiriusServer server;
+
+ public DockerDockerHost(ISiriusServer server) {
+ this.server = server;
+ this.controller = new DockerDockerHostProvider(server,this);
+ }
+
+ public void poll() {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "poll", ApiRequestStatus.START, duration_);
+ Date now_ = new Date();
+ try {
+ controller.poll();
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "poll", ApiRequestStatus.ERROR, duration_);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "poll", ApiRequestStatus.OKAY, duration_);
+
+ }
+
+ public void startContainer(java.lang.String name) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "startContainer", ApiRequestStatus.START, duration_,name);
+ Date now_ = new Date();
+ try {
+ controller.startContainer(name);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "startContainer", ApiRequestStatus.ERROR, duration_,name);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "startContainer", ApiRequestStatus.OKAY, duration_,name);
+
+ }
+
+ public void stopContainer(java.lang.String name, int seconds) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "stopContainer", ApiRequestStatus.START, duration_,name,seconds);
+ Date now_ = new Date();
+ try {
+ controller.stopContainer(name,seconds);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "stopContainer", ApiRequestStatus.ERROR, duration_,name,seconds);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "stopContainer", ApiRequestStatus.OKAY, duration_,name,seconds);
+
+ }
+
+ public void restartContainer(java.lang.String name, int seconds) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "restartContainer", ApiRequestStatus.START, duration_,name,seconds);
+ Date now_ = new Date();
+ try {
+ controller.restartContainer(name,seconds);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "restartContainer", ApiRequestStatus.ERROR, duration_,name,seconds);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "restartContainer", ApiRequestStatus.OKAY, duration_,name,seconds);
+
+ }
+
+ public void pauseContainer(java.lang.String name) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "pauseContainer", ApiRequestStatus.START, duration_,name);
+ Date now_ = new Date();
+ try {
+ controller.pauseContainer(name);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "pauseContainer", ApiRequestStatus.ERROR, duration_,name);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "pauseContainer", ApiRequestStatus.OKAY, duration_,name);
+
+ }
+
+ public void unpauseContainer(java.lang.String name) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "unpauseContainer", ApiRequestStatus.START, duration_,name);
+ Date now_ = new Date();
+ try {
+ controller.unpauseContainer(name);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "unpauseContainer", ApiRequestStatus.ERROR, duration_,name);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "unpauseContainer", ApiRequestStatus.OKAY, duration_,name);
+
+ }
+
+ public void removeContainer(java.lang.String name, boolean remove, boolean force) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "removeContainer", ApiRequestStatus.START, duration_,name,remove,force);
+ Date now_ = new Date();
+ try {
+ controller.removeContainer(name,remove,force);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "removeContainer", ApiRequestStatus.ERROR, duration_,name,remove,force);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "removeContainer", ApiRequestStatus.OKAY, duration_,name,remove,force);
+
+ }
+
+ public void inspectContainer(java.lang.String name) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "inspectContainer", ApiRequestStatus.START, duration_,name);
+ Date now_ = new Date();
+ try {
+ controller.inspectContainer(name);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "inspectContainer", ApiRequestStatus.ERROR, duration_,name);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "inspectContainer", ApiRequestStatus.OKAY, duration_,name);
+
+ }
+
+ public void killContainer(java.lang.String name, java.lang.String sigint) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "killContainer", ApiRequestStatus.START, duration_,name,sigint);
+ Date now_ = new Date();
+ try {
+ controller.killContainer(name,sigint);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "killContainer", ApiRequestStatus.ERROR, duration_,name,sigint);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "killContainer", ApiRequestStatus.OKAY, duration_,name,sigint);
+
+ }
+
+ public void dockerRun(java.lang.String image) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "dockerRun", ApiRequestStatus.START, duration_,image);
+ Date now_ = new Date();
+ try {
+ controller.dockerRun(image);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "dockerRun", ApiRequestStatus.ERROR, duration_,image);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "dockerRun", ApiRequestStatus.OKAY, duration_,image);
+
+ }
+
+ public void dockerRunWithName(java.lang.String image, java.lang.String name) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "dockerRunWithName", ApiRequestStatus.START, duration_,image,name);
+ Date now_ = new Date();
+ try {
+ controller.dockerRunWithName(image,name);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "dockerRunWithName", ApiRequestStatus.ERROR, duration_,image,name);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "dockerRunWithName", ApiRequestStatus.OKAY, duration_,image,name);
+
+ }
+
+ public void dockerRunWithOptions(java.lang.String image, org.openecomp.ncomp.docker.ContainerOptions opts) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "dockerRunWithOptions", ApiRequestStatus.START, duration_,image,opts);
+ Date now_ = new Date();
+ try {
+ controller.dockerRunWithOptions(image,opts);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "dockerRunWithOptions", ApiRequestStatus.ERROR, duration_,image,opts);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "dockerRunWithOptions", ApiRequestStatus.OKAY, duration_,image,opts);
+
+ }
+
+ public void containerStats(java.lang.String name, boolean stream) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "containerStats", ApiRequestStatus.START, duration_,name,stream);
+ Date now_ = new Date();
+ try {
+ controller.containerStats(name,stream);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "containerStats", ApiRequestStatus.ERROR, duration_,name,stream);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "containerStats", ApiRequestStatus.OKAY, duration_,name,stream);
+
+ }
+
+ public void containerProcesses(java.lang.String name) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "containerProcesses", ApiRequestStatus.START, duration_,name);
+ Date now_ = new Date();
+ try {
+ controller.containerProcesses(name);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "containerProcesses", ApiRequestStatus.ERROR, duration_,name);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "containerProcesses", ApiRequestStatus.OKAY, duration_,name);
+
+ }
+
+
+
+
+
+
+ @Override
+ public void start() {
+ controller.start();
+ }
+
+ public static void ecoreSetup() {
+ DockerDockerHostProvider.ecoreSetup();
+ }
+ public DockerDockerHostProvider getSomfProvider() {
+ return controller;
+ }
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHostClient.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHostClient.java
new file mode 100644
index 0000000..aa468c9
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHostClient.java
@@ -0,0 +1,150 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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============================================
+ */
+
+// Autogenerated
+// Do not edit. No need to extend this class.
+package org.openecomp.ncomp.servers.docker;
+
+import org.openecomp.ncomp.sirius.manager.AbstractClient;
+import org.openecomp.ncomp.sirius.manager.HighAvailabilityClient;
+import org.openecomp.ncomp.sirius.manager.GenericHttpClient;
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.openecomp.ncomp.docker.impl.DockerHostImpl;
+import org.openecomp.ncomp.docker.DockerPackage;
+
+
+import org.openecomp.ncomp.servers.docker.DockerDockerAdaptor;
+
+
+
+
+@SuppressWarnings("unchecked")
+public class DockerDockerHostClient extends DockerHostImpl {
+ public static final Logger logger = Logger.getLogger(DockerDockerHostClient.class);
+ public AbstractClient client;
+
+ public DockerDockerHostClient(String file, String name) {
+ DockerDockerAdaptor.ecoreSetup();
+ client = new GenericHttpClient(file,name);
+ client.add("/host", this);
+ }
+
+ public DockerDockerHostClient(String file, String name1, String name2) {
+ HighAvailabilityClient client1 = new HighAvailabilityClient(file,name1,name2);
+ client = client1.all; // requests should be forwarded to all.
+ client.add("/host", this);
+ }
+
+ public DockerDockerHostClient(AbstractClient c) {
+ client = c;
+ client.add("/resources", this);
+ }
+
+
+
+
+ public void poll(String path) {
+ EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo
+ client.operationPath(path, c, "poll", null);
+ }
+
+
+ public void startContainer(String path, java.lang.String name) {
+ EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo
+ client.operationPath(path, c, "startContainer", null, name);
+ }
+
+
+ public void stopContainer(String path, java.lang.String name, int seconds) {
+ EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo
+ client.operationPath(path, c, "stopContainer", null, name,seconds);
+ }
+
+
+ public void restartContainer(String path, java.lang.String name, int seconds) {
+ EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo
+ client.operationPath(path, c, "restartContainer", null, name,seconds);
+ }
+
+
+ public void pauseContainer(String path, java.lang.String name) {
+ EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo
+ client.operationPath(path, c, "pauseContainer", null, name);
+ }
+
+
+ public void unpauseContainer(String path, java.lang.String name) {
+ EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo
+ client.operationPath(path, c, "unpauseContainer", null, name);
+ }
+
+
+ public void removeContainer(String path, java.lang.String name, boolean remove, boolean force) {
+ EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo
+ client.operationPath(path, c, "removeContainer", null, name,remove,force);
+ }
+
+
+ public void inspectContainer(String path, java.lang.String name) {
+ EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo
+ client.operationPath(path, c, "inspectContainer", null, name);
+ }
+
+
+ public void killContainer(String path, java.lang.String name, java.lang.String sigint) {
+ EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo
+ client.operationPath(path, c, "killContainer", null, name,sigint);
+ }
+
+
+ public void dockerRun(String path, java.lang.String image) {
+ EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo
+ client.operationPath(path, c, "dockerRun", null, image);
+ }
+
+
+ public void dockerRunWithName(String path, java.lang.String image, java.lang.String name) {
+ EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo
+ client.operationPath(path, c, "dockerRunWithName", null, image,name);
+ }
+
+
+ public void dockerRunWithOptions(String path, java.lang.String image, org.openecomp.ncomp.docker.ContainerOptions opts) {
+ EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo
+ client.operationPath(path, c, "dockerRunWithOptions", null, image,opts);
+ }
+
+
+ public void containerStats(String path, java.lang.String name, boolean stream) {
+ EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo
+ client.operationPath(path, c, "containerStats", null, name,stream);
+ }
+
+
+ public void containerProcesses(String path, java.lang.String name) {
+ EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo
+ client.operationPath(path, c, "containerProcesses", null, name);
+ }
+
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHostConsole.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHostConsole.java
new file mode 100644
index 0000000..d140003
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHostConsole.java
@@ -0,0 +1,211 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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============================================
+ */
+
+// Autogenerated
+// Do not edit but extend this class as needed
+package org.openecomp.ncomp.servers.docker;
+
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.common.util.EList;
+
+import org.openecomp.ncomp.sirius.manager.console.Console;
+import org.openecomp.ncomp.sirius.manager.AbstractClient;
+import org.openecomp.ncomp.sirius.manager.ManagementServerError;
+
+
+
+
+public class DockerDockerHostConsole extends Console {
+ public static final Logger logger = Logger.getLogger(DockerDockerHostConsole.class);
+ protected DockerDockerHostClient controller;
+
+
+
+
+ public DockerDockerHostConsole(String filename, String name) {
+ super(filename, name);
+ controller = new DockerDockerHostClient(filename,name);
+ client = controller.client;
+
+ }
+
+ public DockerDockerHostConsole(AbstractClient c) {
+ controller = new DockerDockerHostClient(c);
+ client = controller.client;
+ }
+
+
+ public void poll(String path) {
+
+ try {
+ controller.poll(path);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void startContainer(String path, java.lang.String name) {
+
+ try {
+ controller.startContainer(path,name);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void stopContainer(String path, java.lang.String name, int seconds) {
+
+ try {
+ controller.stopContainer(path,name,seconds);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void restartContainer(String path, java.lang.String name, int seconds) {
+
+ try {
+ controller.restartContainer(path,name,seconds);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void pauseContainer(String path, java.lang.String name) {
+
+ try {
+ controller.pauseContainer(path,name);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void unpauseContainer(String path, java.lang.String name) {
+
+ try {
+ controller.unpauseContainer(path,name);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void removeContainer(String path, java.lang.String name, boolean remove, boolean force) {
+
+ try {
+ controller.removeContainer(path,name,remove,force);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void inspectContainer(String path, java.lang.String name) {
+
+ try {
+ controller.inspectContainer(path,name);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void killContainer(String path, java.lang.String name, java.lang.String sigint) {
+
+ try {
+ controller.killContainer(path,name,sigint);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void dockerRun(String path, java.lang.String image) {
+
+ try {
+ controller.dockerRun(path,image);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void dockerRunWithName(String path, java.lang.String image, java.lang.String name) {
+
+ try {
+ controller.dockerRunWithName(path,image,name);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void dockerRunWithOptions(String path, java.lang.String image, org.openecomp.ncomp.docker.ContainerOptions opts) {
+
+ try {
+ controller.dockerRunWithOptions(path,image,opts);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void containerStats(String path, java.lang.String name, boolean stream) {
+
+ try {
+ controller.containerStats(path,name,stream);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void containerProcesses(String path, java.lang.String name) {
+
+ try {
+ controller.containerProcesses(path,name);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHostProviderTemplate.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHostProviderTemplate.java
new file mode 100644
index 0000000..23f84dd
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHostProviderTemplate.java
@@ -0,0 +1,149 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker;
+
+
+
+
+
+import java.io.InputStream;
+
+import org.openecomp.ncomp.sirius.manager.IRequestHandler;
+import org.openecomp.ncomp.sirius.manager.ISiriusPlugin;
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+import org.openecomp.ncomp.sirius.function.FunctionUtils;
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.common.util.EList;
+import org.json.JSONObject;
+
+
+
+import org.openecomp.ncomp.sirius.manager.BasicAdaptorProvider;
+
+
+import org.openecomp.ncomp.docker.impl.DockerHostImpl;
+import org.openecomp.ncomp.docker.DockerHost;
+
+
+public class DockerDockerHostProviderTemplate extends BasicAdaptorProvider {
+ private static final Logger logger = Logger.getLogger(DockerDockerHostProviderTemplate.class);
+ DockerHost o;
+
+ public DockerDockerHostProviderTemplate(ISiriusServer controller, DockerHost o) {
+ super(controller, o);
+ this.o = o;
+ }
+
+ public void poll() {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void startContainer(java.lang.String name) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void stopContainer(java.lang.String name, int seconds) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void restartContainer(java.lang.String name, int seconds) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void pauseContainer(java.lang.String name) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void unpauseContainer(java.lang.String name) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeContainer(java.lang.String name, boolean remove, boolean force) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void inspectContainer(java.lang.String name) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void killContainer(java.lang.String name, java.lang.String sigint) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void dockerRun(java.lang.String image) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void dockerRunWithName(java.lang.String image, java.lang.String name) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void dockerRunWithOptions(java.lang.String image, org.openecomp.ncomp.docker.ContainerOptions opts) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void containerStats(java.lang.String name, boolean stream) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void containerProcesses(java.lang.String name) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+
+
+
+
+
+
+
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApi.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApi.java
new file mode 100644
index 0000000..95966f5
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApi.java
@@ -0,0 +1,217 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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============================================
+ */
+
+// Autogenerated
+// Do not edit. No need to extend this class.
+package org.openecomp.ncomp.servers.docker.gui;
+
+import java.io.InputStream;
+import org.openecomp.ncomp.sirius.manager.IRequestHandler;
+import org.openecomp.ncomp.sirius.manager.ISiriusPlugin;
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+import org.openecomp.ncomp.sirius.function.FunctionUtils;
+import org.openecomp.ncomp.component.ApiRequestStatus;
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.common.util.EList;
+import org.json.JSONObject;
+import java.util.Date;
+
+
+
+
+import org.openecomp.ncomp.sirius.gui.tools.*;
+
+
+
+import org.openecomp.ncomp.gwt.siriusportal.model.*;
+
+
+
+import org.openecomp.ncomp.sirius.manager.Subject;
+
+
+
+import org.openecomp.ncomp.sirius.manager.ManagementServer;
+
+
+
+import org.openecomp.ncomp.sirius.manager.server.AbstractManagementServer;
+
+
+import org.openecomp.ncomp.gwt.siriusportal.model.impl.GuiClientApiImpl;
+
+
+
+public class DockerGuiClientApi extends GuiClientApiImpl {
+ public static final Logger logger = Logger.getLogger(DockerGuiClientApi.class);
+ DockerGuiClientApiProvider controller;
+ ISiriusServer server;
+
+ public DockerGuiClientApi(ISiriusServer server) {
+ this.server = server;
+ this.controller = new DockerGuiClientApiProvider(server,this);
+ }
+
+ public org.openecomp.ncomp.gwt.siriusportal.model.GuiTree getTree() {
+ org.openecomp.ncomp.gwt.siriusportal.model.GuiTree res = null;
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "getTree", ApiRequestStatus.START, duration_);
+ Date now_ = new Date();
+ try {
+ res = controller.getTree();
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getTree", ApiRequestStatus.ERROR, duration_);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getTree", ApiRequestStatus.OKAY, duration_);
+ return res;
+ }
+
+ public org.openecomp.ncomp.gwt.siriusportal.model.GuiObject getObject(java.lang.String path) {
+ org.openecomp.ncomp.gwt.siriusportal.model.GuiObject res = null;
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "getObject", ApiRequestStatus.START, duration_,path);
+ Date now_ = new Date();
+ try {
+ res = controller.getObject(path);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getObject", ApiRequestStatus.ERROR, duration_,path);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getObject", ApiRequestStatus.OKAY, duration_,path);
+ return res;
+ }
+
+ public org.openecomp.ncomp.gwt.siriusportal.model.GuiTimeSerie getTimeSerie(java.lang.String path, java.lang.String start, java.lang.String end, java.lang.String duration) {
+ org.openecomp.ncomp.gwt.siriusportal.model.GuiTimeSerie res = null;
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "getTimeSerie", ApiRequestStatus.START, duration_,path,start,end,duration);
+ Date now_ = new Date();
+ try {
+ res = controller.getTimeSerie(path,start,end,duration);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getTimeSerie", ApiRequestStatus.ERROR, duration_,path,start,end,duration);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getTimeSerie", ApiRequestStatus.OKAY, duration_,path,start,end,duration);
+ return res;
+ }
+
+ public org.openecomp.ncomp.gwt.siriusportal.model.GuiTable getTable(java.lang.String path, java.lang.String start, java.lang.String end) {
+ org.openecomp.ncomp.gwt.siriusportal.model.GuiTable res = null;
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "getTable", ApiRequestStatus.START, duration_,path,start,end);
+ Date now_ = new Date();
+ try {
+ res = controller.getTable(path,start,end);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getTable", ApiRequestStatus.ERROR, duration_,path,start,end);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getTable", ApiRequestStatus.OKAY, duration_,path,start,end);
+ return res;
+ }
+
+ public org.openecomp.ncomp.gwt.siriusportal.model.GuiHtml getHtml(java.lang.String path, java.lang.String start, java.lang.String end) {
+ org.openecomp.ncomp.gwt.siriusportal.model.GuiHtml res = null;
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "getHtml", ApiRequestStatus.START, duration_,path,start,end);
+ Date now_ = new Date();
+ try {
+ res = controller.getHtml(path,start,end);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getHtml", ApiRequestStatus.ERROR, duration_,path,start,end);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getHtml", ApiRequestStatus.OKAY, duration_,path,start,end);
+ return res;
+ }
+
+ public org.openecomp.ncomp.sirius.manager.graph.GuiGraph getGraph(java.lang.String path, java.lang.String start, java.lang.String end) {
+ org.openecomp.ncomp.sirius.manager.graph.GuiGraph res = null;
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "getGraph", ApiRequestStatus.START, duration_,path,start,end);
+ Date now_ = new Date();
+ try {
+ res = controller.getGraph(path,start,end);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getGraph", ApiRequestStatus.ERROR, duration_,path,start,end);
+ System.err.println("ERROR: " + e);
+ throw e;
+ }
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getGraph", ApiRequestStatus.OKAY, duration_,path,start,end);
+ return res;
+ }
+
+
+
+
+
+
+ public static void ecoreSetup() {
+ DockerGuiClientApiProvider.ecoreSetup();
+ }
+ public DockerGuiClientApiProvider getSomfProvider() {
+ return controller;
+ }
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiClient.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiClient.java
new file mode 100644
index 0000000..1cd8dd1
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiClient.java
@@ -0,0 +1,102 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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============================================
+ */
+
+// Autogenerated
+// Do not edit. No need to extend this class.
+package org.openecomp.ncomp.servers.docker.gui;
+
+import org.openecomp.ncomp.sirius.manager.AbstractClient;
+import org.openecomp.ncomp.sirius.manager.HighAvailabilityClient;
+import org.openecomp.ncomp.sirius.manager.GenericHttpClient;
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.openecomp.ncomp.gwt.siriusportal.model.impl.GuiClientApiImpl;
+import org.openecomp.ncomp.gwt.siriusportal.model.ModelPackage;
+
+
+import org.openecomp.ncomp.servers.docker.DockerDockerAdaptor;
+
+
+
+
+@SuppressWarnings("unchecked")
+public class DockerGuiClientApiClient extends GuiClientApiImpl {
+ public static final Logger logger = Logger.getLogger(DockerGuiClientApiClient.class);
+ public AbstractClient client;
+
+ public DockerGuiClientApiClient(String file, String name) {
+ DockerDockerAdaptor.ecoreSetup();
+ client = new GenericHttpClient(file,name);
+ client.add("/gui", this);
+ }
+
+ public DockerGuiClientApiClient(String file, String name1, String name2) {
+ HighAvailabilityClient client1 = new HighAvailabilityClient(file,name1,name2);
+ client = client1.all; // requests should be forwarded to all.
+ client.add("/gui", this);
+ }
+
+ public DockerGuiClientApiClient(AbstractClient c) {
+ client = c;
+ client.add("/resources", this);
+ }
+
+
+
+ @Override
+ public org.openecomp.ncomp.gwt.siriusportal.model.GuiTree getTree() {
+ EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo
+ return (org.openecomp.ncomp.gwt.siriusportal.model.GuiTree) client.operationPath("/gui", c, "getTree", null);
+ }
+
+ @Override
+ public org.openecomp.ncomp.gwt.siriusportal.model.GuiObject getObject(java.lang.String path) {
+ EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo
+ return (org.openecomp.ncomp.gwt.siriusportal.model.GuiObject) client.operationPath("/gui", c, "getObject", null, path);
+ }
+
+ @Override
+ public org.openecomp.ncomp.gwt.siriusportal.model.GuiTimeSerie getTimeSerie(java.lang.String path, java.lang.String start, java.lang.String end, java.lang.String duration) {
+ EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo
+ return (org.openecomp.ncomp.gwt.siriusportal.model.GuiTimeSerie) client.operationPath("/gui", c, "getTimeSerie", null, path,start,end,duration);
+ }
+
+ @Override
+ public org.openecomp.ncomp.gwt.siriusportal.model.GuiTable getTable(java.lang.String path, java.lang.String start, java.lang.String end) {
+ EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo
+ return (org.openecomp.ncomp.gwt.siriusportal.model.GuiTable) client.operationPath("/gui", c, "getTable", null, path,start,end);
+ }
+
+ @Override
+ public org.openecomp.ncomp.gwt.siriusportal.model.GuiHtml getHtml(java.lang.String path, java.lang.String start, java.lang.String end) {
+ EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo
+ return (org.openecomp.ncomp.gwt.siriusportal.model.GuiHtml) client.operationPath("/gui", c, "getHtml", null, path,start,end);
+ }
+
+ @Override
+ public org.openecomp.ncomp.sirius.manager.graph.GuiGraph getGraph(java.lang.String path, java.lang.String start, java.lang.String end) {
+ EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo
+ return (org.openecomp.ncomp.sirius.manager.graph.GuiGraph) client.operationPath("/gui", c, "getGraph", null, path,start,end);
+ }
+
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiConsole.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiConsole.java
new file mode 100644
index 0000000..5086e6a
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiConsole.java
@@ -0,0 +1,123 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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============================================
+ */
+
+// Autogenerated
+// Do not edit but extend this class as needed
+package org.openecomp.ncomp.servers.docker.gui;
+
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.common.util.EList;
+
+import org.openecomp.ncomp.sirius.manager.console.Console;
+import org.openecomp.ncomp.sirius.manager.AbstractClient;
+import org.openecomp.ncomp.sirius.manager.ManagementServerError;
+
+
+
+
+public class DockerGuiClientApiConsole extends Console {
+ public static final Logger logger = Logger.getLogger(DockerGuiClientApiConsole.class);
+ protected DockerGuiClientApiClient controller;
+
+
+
+
+ public DockerGuiClientApiConsole(String filename, String name) {
+ super(filename, name);
+ controller = new DockerGuiClientApiClient(filename,name);
+ client = controller.client;
+
+ }
+
+ public DockerGuiClientApiConsole(AbstractClient c) {
+ controller = new DockerGuiClientApiClient(c);
+ client = controller.client;
+ }
+
+
+ public org.openecomp.ncomp.gwt.siriusportal.model.GuiTree getTree() {
+ org.openecomp.ncomp.gwt.siriusportal.model.GuiTree res = null;
+ try {
+ res = controller.getTree();
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+ return res;
+ }
+
+ public org.openecomp.ncomp.gwt.siriusportal.model.GuiObject getObject(java.lang.String path) {
+ org.openecomp.ncomp.gwt.siriusportal.model.GuiObject res = null;
+ try {
+ res = controller.getObject(path);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+ return res;
+ }
+
+ public org.openecomp.ncomp.gwt.siriusportal.model.GuiTimeSerie getTimeSerie(java.lang.String path, java.lang.String start, java.lang.String end, java.lang.String duration) {
+ org.openecomp.ncomp.gwt.siriusportal.model.GuiTimeSerie res = null;
+ try {
+ res = controller.getTimeSerie(path,start,end,duration);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+ return res;
+ }
+
+ public org.openecomp.ncomp.gwt.siriusportal.model.GuiTable getTable(java.lang.String path, java.lang.String start, java.lang.String end) {
+ org.openecomp.ncomp.gwt.siriusportal.model.GuiTable res = null;
+ try {
+ res = controller.getTable(path,start,end);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+ return res;
+ }
+
+ public org.openecomp.ncomp.gwt.siriusportal.model.GuiHtml getHtml(java.lang.String path, java.lang.String start, java.lang.String end) {
+ org.openecomp.ncomp.gwt.siriusportal.model.GuiHtml res = null;
+ try {
+ res = controller.getHtml(path,start,end);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+ return res;
+ }
+
+ public org.openecomp.ncomp.sirius.manager.graph.GuiGraph getGraph(java.lang.String path, java.lang.String start, java.lang.String end) {
+ org.openecomp.ncomp.sirius.manager.graph.GuiGraph res = null;
+ try {
+ res = controller.getGraph(path,start,end);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+ return res;
+ }
+
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiProviderTemplate.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiProviderTemplate.java
new file mode 100644
index 0000000..6807a7e
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiProviderTemplate.java
@@ -0,0 +1,78 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker.gui;
+
+
+
+
+
+import java.io.InputStream;
+
+import org.openecomp.ncomp.sirius.manager.IRequestHandler;
+import org.openecomp.ncomp.sirius.manager.ISiriusPlugin;
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+import org.openecomp.ncomp.sirius.function.FunctionUtils;
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.common.util.EList;
+import org.json.JSONObject;
+
+
+
+import org.openecomp.ncomp.sirius.gui.tools.*;
+
+
+import org.openecomp.ncomp.gwt.siriusportal.model.*;
+
+
+import org.openecomp.ncomp.sirius.manager.Subject;
+
+
+import org.openecomp.ncomp.sirius.manager.ManagementServer;
+
+
+import org.openecomp.ncomp.sirius.manager.server.AbstractManagementServer;
+
+
+import org.openecomp.ncomp.sirius.manager.BasicGuiClientApiProvider;
+
+
+import org.openecomp.ncomp.gwt.siriusportal.model.impl.GuiClientApiImpl;
+import org.openecomp.ncomp.gwt.siriusportal.model.GuiClientApi;
+
+
+public class DockerGuiClientApiProviderTemplate extends BasicGuiClientApiProvider {
+ private static final Logger logger = Logger.getLogger(DockerGuiClientApiProviderTemplate.class);
+ GuiClientApi o;
+
+ public DockerGuiClientApiProviderTemplate(ISiriusServer controller, GuiClientApi o) {
+ super(controller, o);
+ this.o = o;
+ }
+
+
+
+
+
+
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerModelFactory.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerModelFactory.java
new file mode 100644
index 0000000..906b651
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerModelFactory.java
@@ -0,0 +1,54 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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============================================
+ */
+
+// Autogenerated
+// Do not edit. No need to extend this class.
+package org.openecomp.ncomp.servers.docker.gui;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.apache.log4j.Logger;
+
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+
+import org.openecomp.ncomp.gwt.siriusportal.model.GuiClientApi;
+import org.openecomp.ncomp.gwt.siriusportal.model.ModelPackage;
+import org.openecomp.ncomp.gwt.siriusportal.model.impl.ModelFactoryImpl;
+
+import org.openecomp.ncomp.servers.docker.DockerDockerAdaptorServer;
+
+
+
+public class DockerModelFactory extends ModelFactoryImpl {
+ public static final Logger logger = Logger.getLogger(DockerModelFactory.class);
+ ISiriusServer server = null;
+ @Override
+ public EPackage getEPackage() { return ModelPackage.eINSTANCE; }
+ public DockerModelFactory(ISiriusServer server) {
+ this.server = server;
+ }
+ @Override
+ public GuiClientApi createGuiClientApi() {
+ return new DockerGuiClientApi(server);
+ }
+
+
+
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApi.properties b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApi.properties
new file mode 100644
index 0000000..8705ab8
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApi.properties
@@ -0,0 +1,78 @@
+
+dummy=\
+ null|\
+ null|\
+ null|\
+ null
+
+getTree=\
+ getTree-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+getObject=\
+ getObject-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+getTimeSerie=\
+ getTimeSerie-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+getTable=\
+ getTable-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+getHtml=\
+ getHtml-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+getGraph=\
+ getGraph-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+REMOTE_getTree=\
+ REMOTE-getTree-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_getObject=\
+ REMOTE-getObject-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_getTimeSerie=\
+ REMOTE-getTimeSerie-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_getTable=\
+ REMOTE-getTable-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_getHtml=\
+ REMOTE-getHtml-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_getGraph=\
+ REMOTE-getGraph-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApiMessageEnum.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApiMessageEnum.java
new file mode 100644
index 0000000..dfcab12
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApiMessageEnum.java
@@ -0,0 +1,47 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker.gui.logging;
+
+import com.att.eelf.i18n.EELFResourceManager;
+import org.openecomp.logger.EcompMessageEnum;
+
+public enum GuiClientApiMessageEnum implements EcompMessageEnum {
+
+ dummy,
+ getTree,
+ getObject,
+ getTimeSerie,
+ getTable,
+ getHtml,
+ getGraph,
+ REMOTE_getTree,
+ REMOTE_getObject,
+ REMOTE_getTimeSerie,
+ REMOTE_getTable,
+ REMOTE_getHtml,
+ REMOTE_getGraph;
+
+ static {
+ EELFResourceManager.loadMessageBundle("org.openecomp.ncomp.servers.docker.gui.logging.GuiClientApi");
+ }
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApiOperationEnum.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApiOperationEnum.java
new file mode 100644
index 0000000..d14cf24
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApiOperationEnum.java
@@ -0,0 +1,41 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker.gui.logging;
+
+import org.openecomp.entity.EcompOperationEnum;
+
+public enum GuiClientApiOperationEnum implements EcompOperationEnum {
+
+ getTree,
+ getObject,
+ getTimeSerie,
+ getTable,
+ getHtml,
+ getGraph,
+ REMOTE_getTree,
+ REMOTE_getObject,
+ REMOTE_getTimeSerie,
+ REMOTE_getTable,
+ REMOTE_getHtml,
+ REMOTE_getGraph;
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptor.properties b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptor.properties
new file mode 100644
index 0000000..555c4fc
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptor.properties
@@ -0,0 +1,6 @@
+
+dummy=\
+ null|\
+ null|\
+ null|\
+ null
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptorMessageEnum.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptorMessageEnum.java
new file mode 100644
index 0000000..2efd8de
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptorMessageEnum.java
@@ -0,0 +1,35 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker.logging;
+
+import com.att.eelf.i18n.EELFResourceManager;
+import org.openecomp.logger.EcompMessageEnum;
+
+public enum DockerAdaptorMessageEnum implements EcompMessageEnum {
+
+ dummy;
+
+ static {
+ EELFResourceManager.loadMessageBundle("org.openecomp.ncomp.servers.docker.logging.DockerAdaptor");
+ }
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptorOperationEnum.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptorOperationEnum.java
new file mode 100644
index 0000000..8a36bca
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptorOperationEnum.java
@@ -0,0 +1,29 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker.logging;
+
+import org.openecomp.entity.EcompOperationEnum;
+
+public enum DockerAdaptorOperationEnum implements EcompOperationEnum {
+
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHost.properties b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHost.properties
new file mode 100644
index 0000000..b815973
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHost.properties
@@ -0,0 +1,186 @@
+
+dummy=\
+ null|\
+ null|\
+ null|\
+ null
+
+poll=\
+ poll-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+startContainer=\
+ startContainer-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+stopContainer=\
+ stopContainer-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+restartContainer=\
+ restartContainer-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+pauseContainer=\
+ pauseContainer-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+unpauseContainer=\
+ unpauseContainer-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+removeContainer=\
+ removeContainer-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+inspectContainer=\
+ inspectContainer-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+killContainer=\
+ killContainer-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+dockerRun=\
+ dockerRun-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+dockerRunWithName=\
+ dockerRunWithName-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+dockerRunWithOptions=\
+ dockerRunWithOptions-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+containerStats=\
+ containerStats-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+containerProcesses=\
+ containerProcesses-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+pullImage=\
+ pullImage-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+REMOTE_poll=\
+ REMOTE-poll-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_startContainer=\
+ REMOTE-startContainer-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_stopContainer=\
+ REMOTE-stopContainer-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_restartContainer=\
+ REMOTE-restartContainer-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_pauseContainer=\
+ REMOTE-pauseContainer-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_unpauseContainer=\
+ REMOTE-unpauseContainer-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_removeContainer=\
+ REMOTE-removeContainer-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_inspectContainer=\
+ REMOTE-inspectContainer-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_killContainer=\
+ REMOTE-killContainer-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_dockerRun=\
+ REMOTE-dockerRun-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_dockerRunWithName=\
+ REMOTE-dockerRunWithName-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_dockerRunWithOptions=\
+ REMOTE-dockerRunWithOptions-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_containerStats=\
+ REMOTE-containerStats-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_containerProcesses=\
+ REMOTE-containerProcesses-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_pullImage=\
+ REMOTE-pullImage-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHostMessageEnum.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHostMessageEnum.java
new file mode 100644
index 0000000..aa1d5a2
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHostMessageEnum.java
@@ -0,0 +1,65 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker.logging;
+
+import com.att.eelf.i18n.EELFResourceManager;
+import org.openecomp.logger.EcompMessageEnum;
+
+public enum DockerHostMessageEnum implements EcompMessageEnum {
+
+ dummy,
+ poll,
+ startContainer,
+ stopContainer,
+ restartContainer,
+ pauseContainer,
+ unpauseContainer,
+ removeContainer,
+ inspectContainer,
+ killContainer,
+ dockerRun,
+ dockerRunWithName,
+ dockerRunWithOptions,
+ containerStats,
+ containerProcesses,
+ pullImage,
+ REMOTE_poll,
+ REMOTE_startContainer,
+ REMOTE_stopContainer,
+ REMOTE_restartContainer,
+ REMOTE_pauseContainer,
+ REMOTE_unpauseContainer,
+ REMOTE_removeContainer,
+ REMOTE_inspectContainer,
+ REMOTE_killContainer,
+ REMOTE_dockerRun,
+ REMOTE_dockerRunWithName,
+ REMOTE_dockerRunWithOptions,
+ REMOTE_containerStats,
+ REMOTE_containerProcesses,
+ REMOTE_pullImage;
+
+ static {
+ EELFResourceManager.loadMessageBundle("org.openecomp.ncomp.servers.docker.logging.DockerHost");
+ }
+}
diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHostOperationEnum.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHostOperationEnum.java
new file mode 100644
index 0000000..211c5a7
--- /dev/null
+++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHostOperationEnum.java
@@ -0,0 +1,59 @@
+
+/*-
+ * ============LICENSE_START==========================================
+ * OPENECOMP - DCAE
+ * ===================================================================
+ * 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.ncomp.servers.docker.logging;
+
+import org.openecomp.entity.EcompOperationEnum;
+
+public enum DockerHostOperationEnum implements EcompOperationEnum {
+
+ poll,
+ startContainer,
+ stopContainer,
+ restartContainer,
+ pauseContainer,
+ unpauseContainer,
+ removeContainer,
+ inspectContainer,
+ killContainer,
+ dockerRun,
+ dockerRunWithName,
+ dockerRunWithOptions,
+ containerStats,
+ containerProcesses,
+ pullImage,
+ REMOTE_poll,
+ REMOTE_startContainer,
+ REMOTE_stopContainer,
+ REMOTE_restartContainer,
+ REMOTE_pauseContainer,
+ REMOTE_unpauseContainer,
+ REMOTE_removeContainer,
+ REMOTE_inspectContainer,
+ REMOTE_killContainer,
+ REMOTE_dockerRun,
+ REMOTE_dockerRunWithName,
+ REMOTE_dockerRunWithOptions,
+ REMOTE_containerStats,
+ REMOTE_containerProcesses,
+ REMOTE_pullImage;
+}