aboutsummaryrefslogtreecommitdiffstats
path: root/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src
diff options
context:
space:
mode:
authorlj1412 <lji@research.att.com>2017-02-14 15:12:08 +0000
committerlj1412 <lji@research.att.com>2017-02-14 15:12:10 +0000
commita84b847a3409df445482674feffa2872a8cbae83 (patch)
treea4f2dcaef92e0fb09402f2f28f793928d0a16bfd /dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src
parente6bca17737d1897675e6403e196fc2a61f335651 (diff)
Init dcae.controller
Change-Id: I460f09494faa84b55d9c5d54112e098b0e74d007 Signed-off-by: lj1412 <lji@research.att.com>
Diffstat (limited to 'dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src')
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/assembly/assemble_zip.xml61
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/CLOUDINIT.userdata13
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/HttpInstallationStep.userdata23
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/MavenArtifactInstallationStep.userdata29
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/ShellInstallationStep.userdata2
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceProvider.java872
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerProvider.java164
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/org/openecomp/dcae/controller/service/vm/adaptor/tools/Generator.java91
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/resources/DcaeController.yaml12
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/server-gen/bin/controller-service-vm-adaptor-controller138
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/ControllerVirtualMachineServiceInstance.yaml3
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/VirtualMachineManager.yaml179
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/VirtualMachineService.yaml135
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineService.java408
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceClient.java276
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceConsole.java189
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceProviderTemplate.java137
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceServer.java98
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVmFactory.java54
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/logging/VirtualMachineService.properties150
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/logging/VirtualMachineServiceMessageEnum.java59
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/logging/VirtualMachineServiceOperationEnum.java53
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManager.java529
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerClient.java344
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerConsole.java233
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerProviderTemplate.java108
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerServer.java98
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVmmanagerFactory.java54
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/logging/VirtualMachineManager.properties198
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/logging/VirtualMachineManagerMessageEnum.java67
-rw-r--r--dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/logging/VirtualMachineManagerOperationEnum.java61
31 files changed, 4838 insertions, 0 deletions
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/assembly/assemble_zip.xml b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/assembly/assemble_zip.xml
new file mode 100644
index 0000000..b716317
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/assembly/assemble_zip.xml
@@ -0,0 +1,61 @@
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>runtime</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level as this
+ file is suppose to be unzip on top of a karaf distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>lib</outputDirectory>
+ <includes>
+ <include>dcae-controller-service-vm-adaptor-${project.version}.jar</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/assembly/</directory>
+ <outputDirectory>.</outputDirectory>
+ <excludes>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>.</directory>
+ <outputDirectory>lib</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/server-gen/bin</directory>
+ <outputDirectory>bin</outputDirectory>
+ <fileMode>0744</fileMode>
+ <excludes>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/server/bin</directory>
+ <outputDirectory>bin</outputDirectory>
+ <fileMode>0744</fileMode>
+ <excludes>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/server-gen/scripts</directory>
+ <outputDirectory>scripts</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/server/scripts</directory>
+ <outputDirectory>scripts</outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/CLOUDINIT.userdata b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/CLOUDINIT.userdata
new file mode 100644
index 0000000..ade0065
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/CLOUDINIT.userdata
@@ -0,0 +1,13 @@
+
+##############################################################
+##################### CLOUDINIT ##############################
+##############################################################
+
+## need to fix cloudinit in Centos.
+
+CLOUDHOSTCFG=/etc/cloud/cloud.cfg.d/99_hostname.cfg
+if [ -f /etc/redhat-release ]; then
+ # CentOS/RHEL
+ ( echo "hostname: \$(hostname)"; echo "fqdn: \$(hostname -f)" ) > \$CLOUDHOSTCFG
+fi
+
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/HttpInstallationStep.userdata b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/HttpInstallationStep.userdata
new file mode 100644
index 0000000..9f1ea4f
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/HttpInstallationStep.userdata
@@ -0,0 +1,23 @@
+
+if [ ! -e /home/%{applicationId} ]; then useradd -m -s /bin/bash %{applicationId}; fi
+
+OUT=/tmp/`basename %{url}`
+
+curl -k -f --user '%{userName}:%{password}' -o \$OUT %{url}
+
+case %{type} in
+ deb)
+ dpkg --install \$OUT
+ ;;
+ jar)
+ mkdir -p /opt/app/%{artifactId}/lib
+ mv \$OUT /opt/app/%{artifactId}/lib
+ chown -R %{applicationId}:%{applicationId} /opt/app/%{artifactId}
+ ;;
+ zip)
+ mkdir -p /opt/app/%{artifactId}/lib
+ ( cd /opt/app/%{artifactId} ; cp -p \$OUT . ; unzip -o \$OUT )
+ chown -R %{applicationId}:%{applicationId} /opt/app/%{artifactId}
+ ;;
+esac
+
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/MavenArtifactInstallationStep.userdata b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/MavenArtifactInstallationStep.userdata
new file mode 100644
index 0000000..016bf66
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/MavenArtifactInstallationStep.userdata
@@ -0,0 +1,29 @@
+
+if [ ! -e /home/%{applicationId} ]; then useradd -m -s /bin/bash %{applicationId}; fi
+
+case %{assemblyId} in
+ %*)
+ A1=%{groupId}:%{artifactId}:%{version}:%{type}
+ ;;
+ *)
+ A1=%{groupId}:%{artifactId}:%{version}:%{type}:%{assemblyId}
+ ;;
+esac
+
+mvn -s /tmp/settings.xml org.apache.maven.plugins:maven-dependency-plugin:2.10:copy \
+ -Dartifact=\$A1 \
+ -Dmaven.wagon.http.ssl.insecure=true \
+ -Dmaven.wagon.http.ssl.allowall=true \
+ -DoutputDirectory=/opt/app/%{artifactId}
+
+case %{type} in
+ jar)
+ mkdir /opt/app/%{artifactId}/lib
+ mv /opt/app/%{artifactId}/*.jar /opt/app/%{artifactId}/lib
+ ;;
+ zip)
+ ( cd /opt/app/%{artifactId} ; unzip -o %{artifactId}*.zip )
+ ;;
+esac
+
+chown -R %{applicationId}:%{applicationId} /opt/app/%{artifactId}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/ShellInstallationStep.userdata b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/ShellInstallationStep.userdata
new file mode 100644
index 0000000..b067968
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/ShellInstallationStep.userdata
@@ -0,0 +1,2 @@
+
+%{command}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceProvider.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceProvider.java
new file mode 100644
index 0000000..9dee540
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceProvider.java
@@ -0,0 +1,872 @@
+
+/*-
+ * ============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.dcae.controller.service.servers.vm;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jetty.util.B64Code;
+import org.json.JSONObject;
+import org.yaml.snakeyaml.Yaml;
+
+import org.openecomp.dcae.controller.core.server.DcaeBasicServer;
+import org.openecomp.dcae.controller.core.server.DcaeBasicServerNetwork;
+import org.openecomp.dcae.controller.core.service.DcaeLocation;
+import org.openecomp.dcae.controller.core.service.HealthTestResponse;
+import org.openecomp.dcae.controller.core.service.HealthTestStatus;
+import org.openecomp.dcae.controller.core.service.ServiceFactory;
+import org.openecomp.dcae.controller.core.stream.DcaeStream;
+import org.openecomp.dcae.controller.service.servers.vmmanager.DcaeVirtualMachineManagerConsole;
+import org.openecomp.dcae.controller.service.vm.InstallationStep;
+import org.openecomp.dcae.controller.service.vm.PhysicalMachine;
+import org.openecomp.dcae.controller.service.vm.VirtualMachineService;
+import org.openecomp.dcae.controller.service.vm.VirtualMachineServiceConfiguration;
+import org.openecomp.dcae.controller.service.vm.VirtualMachineServiceInstance;
+import org.openecomp.dcae.controller.service.vm.VmFactory;
+import org.openecomp.ncomp.core.DeploymentStatus;
+import org.openecomp.ncomp.core.User;
+import org.openecomp.ncomp.openstack.compute.Address;
+import org.openecomp.ncomp.openstack.compute.Addresses;
+import org.openecomp.ncomp.openstack.compute.ComputeFactory;
+import org.openecomp.ncomp.openstack.compute.OpenstackRequestNewServer;
+import org.openecomp.ncomp.openstack.compute.Server;
+import org.openecomp.ncomp.openstack.location.OpenStackLocation;
+import org.openecomp.ncomp.openstack.location.OpenStackProject;
+import org.openecomp.ncomp.openstack.neutron.CreatePortRequest;
+import org.openecomp.ncomp.openstack.neutron.FixedIp;
+import org.openecomp.ncomp.openstack.neutron.Network;
+import org.openecomp.ncomp.openstack.neutron.NeutronFactory;
+import org.openecomp.ncomp.openstack.neutron.NeutronFloatingIp;
+import org.openecomp.ncomp.openstack.neutron.Port;
+import org.openecomp.ncomp.sirius.manager.AbstractClient;
+import org.openecomp.ncomp.sirius.manager.BasicAdaptorProvider;
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+import org.openecomp.ncomp.sirius.manager.JavaHttpClient;
+import org.openecomp.ncomp.sirius.manager.Jetty8Client;
+import org.openecomp.ncomp.sirius.manager.ManagementServer;
+import org.openecomp.ncomp.sirius.manager.ManagementServerUtils;
+import org.openecomp.ncomp.sirius.manager.Subject;
+import org.openecomp.ncomp.sirius.manager.console.Utils;
+import org.openecomp.ncomp.sirius.manager.metrics.MetricStore;
+import org.openecomp.ncomp.sirius.manager.server.Response;
+import org.openecomp.ncomp.sirius.manager.server.ResponseStatus;
+import org.openecomp.ncomp.sirius.manager.server.ServerFactory;
+import org.openecomp.ncomp.utils.CryptoUtils;
+import org.openecomp.ncomp.utils.StringUtil;
+
+public class DcaeVirtualMachineServiceProvider extends BasicAdaptorProvider {
+ private static final Logger logger = Logger.getLogger(DcaeVirtualMachineServiceProvider.class);
+ VirtualMachineService o;
+ private String privateKey = CryptoUtils.getKey("config/server.private");
+
+ public DcaeVirtualMachineServiceProvider(ISiriusServer controller, VirtualMachineService o) {
+ super(controller, o);
+ this.o = o;
+ }
+
+ public void deploy(String instanceName, String containerPath) {
+ System.err.println("XXX deploy server: " + instanceName + " " + containerPath);
+ Response res = ServerFactory.eINSTANCE.createResponse();
+ VirtualMachineServiceInstance i = findInstance(instanceName);
+ if (containerPath != null && !containerPath.equals("")) {
+ Subject s = controller.getServer().find(containerPath);
+ if (i == null) {
+ throw new RuntimeException("Unable to find instance: " + instanceName);
+ }
+ if (s == null || s.o == null) {
+ throw new RuntimeException("Unable to find container object: " + containerPath);
+ }
+ if (!(s.o instanceof DcaeLocation))
+ throw new RuntimeException("Unable to deploy to this container: " + containerPath + " " + s.o);
+ i.setLocation((DcaeLocation) s.o);
+ }
+ DcaeLocation location = i.getLocation();
+ if (location == null)
+ throw new RuntimeException("Unable to deploy no location specified: " + ManagementServer.object2ref(i));
+ String networkId = null;
+ String networkName = location.getOpenstackProject().getPrivateNetwork();
+ String subnetId = null;
+ for (Network network : location.getOpenstackProject().getNetworks()) {
+ if (network.getName().equals(networkName)) {
+ networkId = network.getId();
+ subnetId = network.getSubnets().get(0);
+ }
+ }
+ if (networkId == null) {
+ throw new RuntimeException("Unable to find network: " + networkName);
+ }
+ HashMap<DcaeBasicServer, Port> portMap = new LinkedHashMap<DcaeBasicServer, Port>();
+ OpenStackLocation loc = (OpenStackLocation) location.getOpenstackProject().eContainer();
+ for (int j = 0; j < i.getNumberOfServers(); j++) {
+ DcaeBasicServer server = i.getServers().get(j);
+ if (i.getVmType().isNeedPublicIp() && server.getNetworks().get(0).getIp() == null) {
+ throw new RuntimeException("Deployment issue: server not assigned IP: " + server.getName());
+ }
+ for (Port port : location.getOpenstackProject().getPorts()) {
+ if (port.getName().equals(server.getName())) {
+ portMap.put(server, port);
+ }
+ }
+ if (portMap.get(server) == null) {
+ CreatePortRequest portReq = NeutronFactory.eINSTANCE.createCreatePortRequest();
+ portReq.setName(server.getName());
+ portReq.setProjectName(location.getOpenstackProject().getName());
+ portReq.setNetwork_id(networkId);
+ // if assigned ip but no public network, assume IP is on private and available
+ String ip2 = server.getNetworks().get(0).getIp();
+ if (ip2 != null && ! loc.isSupportsFloatingIps()) {
+ FixedIp fip = NeutronFactory.eINSTANCE.createFixedIp();
+ fip.setIp_address(ip2);
+ fip.setSubnet_id(subnetId);
+ portReq.getFixed_ips().add(fip );
+ }
+ // create port in Openstack
+ Port port = loc.createPort(portReq);
+ portMap.put(server, port);
+ }
+ }
+ for (int j = 0; j < i.getNumberOfServers(); j++) {
+ OpenstackRequestNewServer r = ComputeFactory.eINSTANCE.createOpenstackRequestNewServer();
+ r.setVmType(EcoreUtil.copy(i.getVmType()));
+ r.setName(vmName(i, j));
+ r.setProjectName(location.getOpenstackProject().getName());
+ if (i.getAvailabilityZone() != null)
+ r.setHypervisor(i.getAvailabilityZone());
+ if (i.getUsers().size() > 0) {
+ r.setUser(i.getUsers().get(0).getName());
+ }
+ r.setUser_data(B64Code.encode(userdata(i, j, portMap)));
+ DcaeBasicServer server = i.getServers().get(j);
+ if (o.getName().equals("vm-controller")) {
+ if (server.getServer() != null) {
+ // Existing Controller VM. ignore it
+ continue;
+ }
+ }
+ boolean floatingIpDone = false;
+ String ip2 = server.getNetworks().get(0).getIp();
+ for (NeutronFloatingIp fip : location.getOpenstackProject().getFloatingips()) {
+ if (ip2 != null && ip2.equals(fip.getFloating_ip_address())) {
+ if (fip.getFixed_ip_address() != null) {
+ floatingIpDone = true;
+ }
+ }
+ }
+ if (!floatingIpDone && loc.isSupportsFloatingIps())
+ r.setFloatingIp(ip2);
+ else
+ r.getVmType().setNeedPublicIp(false);
+ r.getPorts().add(portMap.get(server).getId());
+ if (! loc.isSupportsFloatingIps() && location.getOpenstackProject().getPublicNetwork() != null) {
+ // find external network.
+ String networkId2 = null;
+ String networkName2 = location.getOpenstackProject().getPublicNetwork();
+ if (networkName2.matches("........-....-....-....-............")) {
+ networkId2 = networkName2;
+ }
+ else {
+ for (Network network : location.getOpenstackProject().getNetworks()) {
+ if (network.getName().equals(networkName)) {
+ networkId2 = network.getId();
+ }
+ }
+ }
+ if (networkId2 == null) {
+ throw new RuntimeException("Unable to find public network: " + networkName2);
+ }
+ r.getNetworks().add(networkId2);
+ }
+ if (i.getOpenstackFlavor() != null)
+ r.getVmType().setFlavorName(i.getOpenstackFlavor());
+ System.out.println("loc.isSupportsFloatingIps(): " + loc.isSupportsFloatingIps());
+ System.out.println("location.getOpenstackProject().getPublicNetwork(): " + location.getOpenstackProject().getPublicNetwork());
+ System.out.println(ManagementServer.ecore2json(r, 100, null, true).toString(2));
+ loc.createServer(r);
+ logger.info("created server: " + r.getName());
+ }
+ controller.getServer().save();
+ long toolate = System.currentTimeMillis() + i.getDeploymentTimeoutMinutes() * 60 * 1000;
+ while (i.getStatus() != DeploymentStatus.DEPLOYED) {
+ if (System.currentTimeMillis() > toolate) {
+ throw new RuntimeException("Deployment timeout: VM did not show up");
+ }
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ie) {
+ }
+ }
+ if (i.getManagerPortNumber() > 0) {
+ while (System.currentTimeMillis() < toolate) {
+ try {
+ o.pushManagerConfiguration(instanceName);
+ break;
+ } catch (Exception e) {
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e1) {
+ throw new RuntimeException("Deployment timeout: Deployment interrupted");
+ }
+ }
+ if (System.currentTimeMillis() >= toolate)
+ throw new RuntimeException("Unable to configure VM");
+ }
+ }
+ res.setStatus(ResponseStatus.OK);
+ // return res;
+ }
+
+ // used for testing only
+ static String userdataStatic(VirtualMachineServiceInstance i, int j, HashMap<DcaeBasicServer, Port> portMap) {
+ DcaeVirtualMachineServiceProvider pp = new DcaeVirtualMachineServiceProvider(null, null);
+ return pp.userdata(i, j, portMap);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected String userdata(VirtualMachineServiceInstance i, int j, HashMap<DcaeBasicServer, Port> portMap) {
+ StringBuffer buf = new StringBuffer();
+ HashMap<String, Object> configMap = new HashMap<String, Object>();
+ buf.append(userdataInitial());
+ String resourceName = "instances/" + i.getService().getName() + "/" + i.getName() + ".yaml";
+ String x = null;
+ try {
+ x = getTemplate(resourceName);
+ } catch (Exception e1) {
+ buf.append("#### No special configuration resource: " + resourceName);
+ buf.append("\n");
+ }
+ if (x != null) {
+ Yaml yaml = new Yaml();
+ configMap = (HashMap<String, Object>) yaml.load(x);
+ buf.append("#### Using special configuration resource: " + resourceName);
+ buf.append("\n");
+ }
+ DcaeBasicServer s = i.getServers().get(j);
+ if (configMap.containsKey("configuration-files"))
+ buf.append(userdataConfig(configMap.get("configuration-files"), s));
+ if (configMap.containsKey("init-script"))
+ buf.append(configMap.get("init-script")).append("\n");
+ buf.append(userdataHosts(s, portMap));
+ buf.append(userdataCertificate(s));
+// buf.append(userdataUam(i, s)).append("\n");
+// buf.append(userdataIeds(i, s)).append("\n");
+ buf.append(userdataFromFile("CLOUDINIT",i, s)).append("\n");
+ for (User u : i.getAdminUsers()) {
+ buf.append(userdataSshKey(i.getAdminId(), u.getPublicKey()));
+ }
+ buf.append(userdataSteps(i, s, portMap)).append("\n");
+ for (String id : i.getApplicationIds()) {
+ buf.append(userdataSshSetup(id));
+ for (User u : i.getUsers()) {
+ buf.append(userdataSshKey(id, u.getPublicKey()));
+ }
+ }
+ try {
+ buf.append(getTemplate(i.getService().getName() + ".userdata"));
+ } catch (Exception e) {
+ buf.append("#no final script: " + i.getService().getName() + ".userdata").append("\n");
+ }
+ if (configMap.containsKey("final-script"))
+ buf.append(configMap.get("final-script")).append("\n");
+ buf.append(userdataFinal(i,s));
+ System.err.println("USER DATA: " + ManagementServer.object2ref(i) + "\n" + buf);
+ return buf.toString();
+ }
+
+ private String userdataSteps(VirtualMachineServiceInstance i, DcaeBasicServer s,
+ HashMap<DcaeBasicServer, Port> portMap) {
+ StringBuffer buf = new StringBuffer();
+ for (InstallationStep step : i.getSteps()) {
+ buf.append("######### ").append(step.getName()).append("\n");
+ String str = null, str1 = null;
+ try {
+ str = getTemplate(step.eClass().getName() + ".userdata");
+ JSONObject json = ManagementServer.ecore2json(step, 100, null, true);
+ str1 = StringUtil.expandUsingJson(str, json, "%");
+ buf.append(str1).append("\n");
+ } catch (Exception e) {
+ System.err.println("userdataSteps error: str=" + str + " str1=" + str1 + " e=" + e);
+ e.printStackTrace();
+ }
+ }
+ return buf.toString();
+ }
+
+ private String userdataConfig(Object o, DcaeBasicServer s) {
+ StringBuffer buf = new StringBuffer();
+ @SuppressWarnings("unchecked")
+ HashMap<String, HashMap<String, String>> m1 = (HashMap<String, HashMap<String, String>>) o;
+ for (String k : m1.keySet()) {
+ HashMap<String, String> m2 = m1.get(k);
+ buf.append("## Adding configuration file: ").append(k).append("\n");
+ String decode = "cat";
+ if (m2.containsKey("encoding") && "base64".equals(m2.get("encoding"))) {
+ decode = "base64 --decode";
+ }
+ buf.append("cat | ").append(decode).append(" > ").append(m2.get("destination")).append(" << EOF_CONFIG\n");
+ String content = m2.get("content");
+ if (m2.containsKey("encrypted-password")) {
+ String pw = CryptoUtils.decryptPrivate(privateKey, m2.get("encrypted-password"));
+ content = CryptoUtils.decrypt(pw, content);
+ }
+ JSONObject json = new JSONObject();
+ String pw = JavaHttpClient.decryptPassword(s.getCertificatePassword());
+ json.put("certPassword", pw == null ? "No Certificate" : pw);
+ if (content.contains("%{")) {
+ System.err.print("CONTENT" + content + " " + json);
+ }
+ content = StringUtil.expandUsingJson(content, json, "%");
+ if (content.contains("%{")) {
+ System.err.print("CONTENT 2" + content);
+ }
+ content = decryptString(content);
+ buf.append(content).append("\n");
+ buf.append("EOF_CONFIG").append("\n");
+ if (m2.containsKey("owner"))
+ buf.append("chown ").append(m2.get("owner")).append(" ").append(m2.get("destination")).append("\n");
+ }
+ return buf.toString();
+ }
+
+ private String decryptString(String content) {
+ Pattern p = Pattern.compile("(rsa:[A-Za-z0-9+/]+ *[A-Za-z0-9+/]+ *[A-Za-z0-9+/]+=*)");
+ Matcher m = p.matcher(content);
+ StringBuffer s = new StringBuffer();
+ while (m.find()) {
+ String k = m.group(1);
+ m.appendReplacement(s, JavaHttpClient.decryptPassword(k));
+ }
+ m.appendTail(s);
+ return s.toString();
+ }
+
+ protected String userdataSshSetup(String id) {
+ StringBuffer buf = new StringBuffer();
+ if (id == null) {
+ buf.append("### userdataSshSetup null ID: ").append("\n");
+ return buf.toString();
+ }
+ buf.append("mkdir /home/ID/.ssh\n".replace("ID", id));
+ buf.append("chmod og-rwx /home/ID/.ssh\n".replace("ID", id));
+ buf.append("chown -R ID:ID /home/ID/.ssh\n".replace("ID", id));
+ buf.append("touch /home/ID/.ssh/authorized_keys\n".replace("ID", id));
+ buf.append("chmod og-rwx /home/ID/.ssh/authorized_keys\n".replace("ID", id));
+ buf.append("chown -R ID:ID /home/ID/.ssh/authorized_keys\n".replace("ID", id));
+ return buf.toString();
+ }
+
+ protected String userdataSshKey(String id, String publicKey) {
+ StringBuffer buf = new StringBuffer();
+ if (id == null) {
+ return "";
+ }
+ if (publicKey == null) {
+ buf.append("### null key: ").append(id).append("\n");
+ return buf.toString();
+ }
+ buf.append("echo ").append(publicKey.trim()).append(" >> /home/").append(id).append("/.ssh/authorized_keys\n");
+ return buf.toString();
+ }
+
+ protected Object userdataCertificate(DcaeBasicServer s) {
+ StringBuffer buf = new StringBuffer();
+ byte[] cert;
+ try {
+ cert = getTemplateBinary(s.getName() + ".pkcs12");
+ // buf.append("### check sum: " +
+ // MD5Checksum.createChecksum(cert)).append("\n");
+ buf.append("cat > /tmp/certificate.pkcs12.b64code << EOF_CERT").append("\n");
+ buf.append(B64Code.encode(cert)).append("\n");
+ buf.append("EOF_CERT").append("\n");
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ buf.append("## UNABLE TO FIND CERTIFICATE FOR: " + s.getName()).append("\n");
+ }
+ return buf.toString();
+ }
+
+ protected Object userdataCertificatePassword(DcaeBasicServer s) {
+ StringBuffer buf = new StringBuffer();
+ buf.append("echo ").append(JavaHttpClient.decryptPassword(s.getCertificatePassword()))
+ .append(" > /tmp/.password\n");
+ return buf.toString();
+ }
+
+ protected String userdataHosts(DcaeBasicServer s, HashMap<DcaeBasicServer, Port> portMap) {
+ StringBuffer buf = new StringBuffer();
+ buf.append("cat >> /etc/hosts << HOSTS_EOF").append("\n");
+ for (DcaeBasicServer s1 : portMap.keySet()) {
+ if (s1 == s) {
+ for (FixedIp x : portMap.get(s1).getFixed_ips()) {
+ buf.append(x.getIp_address() + " " + dnsName(s) + " " + s1.getName()).append("\n");
+ }
+ } else {
+ for (FixedIp x : portMap.get(s1).getFixed_ips()) {
+ buf.append(x.getIp_address() + " " + s1.getName()).append("\n");
+ }
+ }
+ }
+ buf.append("HOSTS_EOF").append("\n");
+ buf.append("echo ").append(s.getName()).append(" > /etc/hostname\n");
+ int index = 0;
+ for (DcaeBasicServer s1 : portMap.keySet()) {
+ for (FixedIp x : portMap.get(s1).getFixed_ips()) {
+ buf.append("IP" + index + "=").append(x.getIp_address()).append("\n");
+ }
+ index++;
+ }
+ return buf.toString();
+ }
+
+ static String getTemplate(String resource) throws IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ byte[] data = new byte[65536];
+ InputStream is = DcaeVirtualMachineServiceProvider.class.getClassLoader().getResourceAsStream(resource);
+ if (is == null) {
+ throw new RuntimeException("Unable to find resource: " + resource);
+ }
+ int i;
+ try {
+ while ((i = is.read(data)) > 0) {
+ baos.write(data, 0, i);
+ }
+ } catch (Exception e) {
+ ManagementServerUtils.printStackTrace(e);
+ } finally {
+ if (is != null)
+ is.close();
+ }
+ return (new String(baos.toByteArray()));
+ }
+
+ static byte[] getTemplateBinary(String rnm) throws IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ byte[] data = new byte[65536];
+ InputStream is = DcaeVirtualMachineServiceProvider.class.getClassLoader().getResourceAsStream(rnm);
+ int i;
+ try {
+ while ((i = is.read(data)) > 0) {
+ baos.write(data, 0, i);
+ }
+ } catch (Exception e) {
+ ManagementServerUtils.printStackTrace(e);
+ } finally {
+ if (is != null)
+ is.close();
+ }
+ return baos.toByteArray();
+ }
+
+ protected Object userdataFromFile(String name, VirtualMachineServiceInstance i, DcaeBasicServer s2) {
+ try {
+ String s = getTemplate(name + ".userdata");
+ JSONObject json = new JSONObject();
+ DcaeBasicServerNetwork n = s2.getNetworks().get(0);
+ String dns = n.getDnsName();
+ json.put("dnsDomain", dns.substring(dns.indexOf(".") + 1));
+ json.put("admin", i.getIedsAdmin());
+ return StringUtil.expandUsingJson(s, json, "%");
+ } catch (Exception e) {
+ return "#error " + name + ".userdata: " + e;
+ }
+ }
+
+
+ protected String userdataInitial() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("#!/bin/bash").append("\n");
+ buf.append("cat > /tmp/dcae_install.sh << EOF_DCAE_INSTALL").append("\n");
+ buf.append("#!/bin/bash").append("\n");
+ buf.append("set -x").append("\n");
+ buf.append("cd /tmp").append("\n");
+ return buf.toString();
+ }
+
+ protected String userdataFinal(VirtualMachineServiceInstance i, DcaeBasicServer s) {
+ StringBuffer buf = new StringBuffer();
+ buf.append("EOF_DCAE_INSTALL").append("\n");
+ buf.append(userdataCertificatePassword(s));
+ buf.append("bash /tmp/dcae_install.sh 2>&1 | tee /tmp/dcae_install.log").append("\n");
+ return buf.toString();
+ }
+
+ public void undeploy(java.lang.String instanceName) {
+ if (o.getName().equals("vm-controller"))
+ throw new RuntimeException("Cannot undeploy vm-controller, please use Horizon");
+ VirtualMachineServiceInstance i = findInstance(instanceName);
+ for (int j = 0; j < i.getNumberOfServers(); j++) {
+ // System.out.println("HHHH: " + i.getServers().get(j).getName());
+ if (i.getLocation() == null)
+ continue;
+ OpenStackLocation loc = (OpenStackLocation) i.getLocation().getOpenstackProject().eContainer();
+ String tname = i.getLocation().getOpenstackProject().getName();
+ loc.deleteServer(tname, vmName(i, j));
+ // System.out.println("HHHH deleted: " + vmName(i, j));
+ }
+ }
+
+ private String dnsName(DcaeBasicServer s) {
+ return s.getNetworks().get(0).getDnsName();
+ }
+
+ public void updateDeploymentStatus() {
+// System.out.println("XXXX updateDeploymentStatus: " + o.getName());
+ for (VirtualMachineServiceInstance instance : o.getInstances()) {
+// System.out.println("XXXX updateDeploymentStatus: " + o.getName() + " " + instance.getName() + " "
+// + instance.getServers().size());
+ if (instance.getServers().size() == 0) {
+ setStatus(instance,DeploymentStatus.UNDEPLOYED,"no servers");
+ continue;
+ }
+ if (instance.getServers().size() != instance.getNumberOfServers()) {
+ setStatus(instance,DeploymentStatus.DEPLOYED_ERRORS,"not the right number of servers");
+ continue;
+ }
+ if (instance.getVmType() == null) {
+ logger.warn("virtual machine instance without vmType: " + ManagementServer.object2ref(instance));
+ setStatus(instance,DeploymentStatus.DEPLOYED_ERRORS,"vm type is null");
+ continue;
+ }
+ boolean allPhysical = true;
+ for (int j = 0; j < instance.getNumberOfServers(); j++) {
+ DcaeBasicServer s1 = instance.getServers().get(j);
+ // check if server is non Openstack managed VM.
+ if (s1 instanceof PhysicalMachine) {
+ continue;
+ }
+ allPhysical = false;
+ }
+ if (allPhysical) {
+ setStatus(instance,DeploymentStatus.DEPLOYED,"all physical");
+ continue;
+ }
+ if (instance.getLocation() == null) {
+ setStatus(instance,DeploymentStatus.UNDEPLOYED,"no location");
+ continue;
+ }
+ boolean needPubIp = instance.getVmType().isNeedPublicIp();
+ boolean errors = false;
+ String incomplete = null;
+ int numDeployed = 0;
+ for (int j = 0; j < instance.getNumberOfServers(); j++) {
+ DcaeBasicServer s1 = instance.getServers().get(j);
+ // check if server is non Openstack managed VM.
+ if (s1 instanceof PhysicalMachine) {
+ numDeployed++;
+ continue;
+ }
+ // VirtualMachine vm = (VirtualMachine) s1;
+ String n = vmName(instance, j);
+ if (!s1.getName().equals(n)) {
+ errors = true;
+ }
+ Server svr = null;
+ String privateip = null;
+ String publicip = null;
+ s1.setServer(null);
+ s1.setPrivateIp(null);
+ s1.setPublicIp(null);
+ OpenStackProject project = instance.getLocation().getOpenstackProject();
+ for (Server s : project.getServers()) {
+ if (n.equals(s.getName())) {
+ svr = s;
+ for (Addresses a : s.getAddresses()) {
+// System.out.println("RRRR: " + o.getName() + " " + instance.getName() + " " + s.getName()
+// + " " + a.getName());
+ for (Address ip : a.getIps()) {
+ if (ip.getOS_EXT_IPS_type() == null || ip.getOS_EXT_IPS_type().equals("fixed")) {
+ if (a.getName().equals(project.getPrivateNetwork()))
+ privateip = ip.getAddr();
+ if (a.getName().equals("public") && ip.getVersion() == 4)
+ publicip = ip.getAddr();
+ }
+ if (ip.getOS_EXT_IPS_type() != null && ip.getOS_EXT_IPS_type().equals("floating")) {
+ publicip = ip.getAddr();
+ }
+ }
+ }
+ }
+ }
+ s1.setPrivateIp(privateip);
+ s1.setPublicIp(publicip);
+ s1.setServer(svr);
+ if (svr != null)
+ numDeployed++;
+ if (publicip == null && needPubIp && project.getPublicNetwork() != null) {
+ incomplete = s1.getName() + " has not public IP";
+ }
+ if (privateip == null) {
+ incomplete = s1.getName() + " has not private IP";
+ }
+ if (svr == null) {
+ incomplete = s1.getName() + " has null openstack server";
+ }
+ }
+// System.out.println("XXXX updateDeploymentStatus: " + o.getName() + " " + instance.getName() + " " + errors
+// + " " + numDeployed + " " + incomplete);
+ if (errors) {
+ setStatus(instance,DeploymentStatus.DEPLOYED_ERRORS,"errors");
+ } else if (numDeployed == 0) {
+ setStatus(instance,DeploymentStatus.UNDEPLOYED,"numDeployed == 0");
+ } else if (incomplete != null) {
+ setStatus(instance,DeploymentStatus.DEPLOYED_PARTIALLY,incomplete);
+ } else {
+ setStatus(instance,DeploymentStatus.DEPLOYED,"all okay");
+ }
+ }
+
+ };
+
+ private void setStatus(VirtualMachineServiceInstance instance, DeploymentStatus newStatus,String reason) {
+ if (instance.getStatus() != newStatus) {
+ String msg = "deployment status changed: " + ManagementServer.object2ref(instance) +
+ " " + instance.getStatus() + " -> " + newStatus + " " + reason;
+ System.err.println("VMDEPLOYMENTSTATUS: " + new Date() + " " + msg);
+ logger.info(msg);
+ }
+ instance.setStatus(newStatus);
+ }
+
+ public HealthTestResponse test(String instance) {
+ VirtualMachineServiceInstance i = findInstance(instance);
+ if (i.getStatus() != DeploymentStatus.DEPLOYED) {
+ HealthTestResponse s = ServiceFactory.eINSTANCE.createHealthTestResponse();
+ s = ServiceFactory.eINSTANCE.createHealthTestResponse();
+ s.setMessageCode("Not deployed");
+ s.setStatus(HealthTestStatus.YELLOW);
+ return s;
+ }
+ if (i.getManagerPortNumber() < 0) {
+ HealthTestResponse s = ServiceFactory.eINSTANCE.createHealthTestResponse();
+ s.setMessageCode("Health Check undefined");
+ s.setStatus(HealthTestStatus.YELLOW);
+ return s;
+ }
+ AbstractClient c = getClient(i);
+ DcaeVirtualMachineManagerConsole console = new DcaeVirtualMachineManagerConsole(c);
+ return console.test();
+ }
+
+ public void suspend(String instance) {
+ VirtualMachineServiceInstance i = findInstance(instance);
+ for (DcaeBasicServer s : getServers(i)) {
+ AbstractClient c = getClient(i, s);
+ DcaeVirtualMachineManagerConsole console = new DcaeVirtualMachineManagerConsole(c);
+ console.suspend();
+ }
+ }
+
+ public void resume(String instance) {
+ VirtualMachineServiceInstance i = findInstance(instance);
+ for (DcaeBasicServer s : getServers(i)) {
+ AbstractClient c = getClient(i,s);
+ DcaeVirtualMachineManagerConsole console = new DcaeVirtualMachineManagerConsole(c);
+ console.resume();
+ }
+ }
+
+ public void pushManagerConfiguration(String instance) {
+ VirtualMachineServiceInstance i = findInstance(instance);
+ for (DcaeBasicServer s : getServers(i)) {
+ AbstractClient c = getClient(i, s);
+ DcaeVirtualMachineManagerConsole console = new DcaeVirtualMachineManagerConsole(c);
+ EObject config = o.managerConfiguration(instance);
+ console.update("/", ManagementServer.ensureHardUpdate(config, 1));
+ EList<DcaeStream> l1 = new BasicEList<DcaeStream>();
+ l1.addAll(EcoreUtil.copyAll(i.getInputStreams()));
+ EList<DcaeStream> l2 = new BasicEList<DcaeStream>();
+ l2.addAll(EcoreUtil.copyAll(i.getOutputStreams()));
+ console.updateStreams(l1, l2);
+ console.configurationChanged();
+ }
+ }
+
+ protected EList<DcaeBasicServer> getServers(VirtualMachineServiceInstance i) {
+ return i.getServers();
+ }
+
+ protected EObject convertToManagerConfiguration(VirtualMachineServiceInstance i) {
+ VirtualMachineServiceConfiguration c = VmFactory.eINSTANCE.createVirtualMachineServiceConfiguration();
+ c.setConfiguration(i.getConfiguration());
+ return c;
+ }
+
+ public void pollManagerConfiguration(String instance) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void start() {
+ Thread t = new Thread("vm service: " + o.getName()) {
+ @Override
+ public void run() {
+ while (true) {
+ try {
+ if (!controller.getServer().isSlave)
+ updateDeploymentStatus();
+ Thread.sleep(10000); // sleep 10 seconds
+ } catch (Exception e) {
+ ManagementServerUtils.printStackTrace(e);
+ logger.fatal("vm service: " + o.getName() + " : " + e);
+ try {
+ Thread.sleep(30000);
+ } catch (InterruptedException e1) {
+ }
+ }
+ }
+ }
+
+ };
+ t.start();
+ }
+
+ public AbstractClient getClient(VirtualMachineServiceInstance i, DcaeBasicServer s) {
+ Jetty8Client c = new Jetty8Client("managers.properties", i.eClass().getInstanceClassName());
+ if (c.getBaseAddress() == null) {
+ throw new RuntimeException("unable to determine baseaddress in managers.properties for: "
+ + i.eClass().getInstanceClassName());
+ }
+ if (i.getServers().size() == 0) {
+ throw new RuntimeException("service instances is not deployed (has no servers): "
+ + ManagementServer.object2ref(i));
+ }
+ int port = i.getService().getManagerPortNumber();
+ if (i.getManagerPortNumber() != null)
+ port = i.getManagerPortNumber();
+ if (s instanceof PhysicalMachine) {
+ PhysicalMachine p = (PhysicalMachine) s;
+ if (p.getManagerPortNumber() != null)
+ port = p.getManagerPortNumber();
+ }
+ String b = c.getBaseAddress();
+ b = b.replaceFirst("PORT", Integer.toString(port));
+ b = b.replaceFirst("IP", dnsName(s));
+ if (s.getCertificatePassword() != null)
+ b = b.replaceFirst("http", "https");
+ c.setBaseAddress(b);
+ logger.info("using baseAdress: " + c.getBaseAddress() + " for " + ManagementServer.object2ref(i));
+ return c;
+ }
+
+ public AbstractClient getClient(VirtualMachineServiceInstance i) {
+ if (i.getLeaderServer() == null) {
+ EList<DcaeBasicServer> l = getServers(i);
+ if (l.size() == 0) {
+ throw new RuntimeException("No servers for vm instance: " + ManagementServer.object2ref(i));
+ }
+ i.setLeaderServer(l.get(0));
+ }
+ return getClient(i, i.getLeaderServer());
+ }
+
+ private String vmName(VirtualMachineServiceInstance i, int index) {
+ return i.getServers().get(index).getName();
+ // return "dcae:" + o.getName() + ":" + i.getName() + ":" + index;
+ }
+
+ protected VirtualMachineServiceInstance findInstance(String instanceName) {
+ for (VirtualMachineServiceInstance ii : o.getInstances()) {
+ if (ii.getName().equals(instanceName)) {
+ return ii;
+ }
+ }
+ throw new RuntimeException("Unable to find instance: " + instanceName);
+ }
+
+ public static void ecoreSetup() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public EObject managerConfiguration(String instanceName) {
+ VirtualMachineServiceInstance i = findInstance(instanceName);
+ AbstractClient c = getClient(i);
+ DcaeVirtualMachineManagerConsole console = new DcaeVirtualMachineManagerConsole(c);
+ Object oo = console.list("/", 100);
+ JSONObject json = (JSONObject) Utils.object2json(oo);
+ // System.err.println("XXXXX" + json.toString(2));
+ return controller.getServer().json2ecore(EcorePackage.eINSTANCE.getEObject(), json);
+ }
+
+ public JSONObject managerOperation(String instanceName, String operation, JSONObject parameters) {
+ VirtualMachineServiceInstance i = findInstance(instanceName);
+ AbstractClient c = getClient(i);
+ DcaeVirtualMachineManagerConsole console = new DcaeVirtualMachineManagerConsole(c);
+ if (operation == null)
+ throw new RuntimeException("no operation: " + instanceName);
+ if (parameters == null)
+ throw new RuntimeException("no parameters: " + instanceName + "@" + operation);
+ Object oo = console.operation("/", operation, parameters);
+ if (oo == null)
+ return null;
+ JSONObject json = (JSONObject) Utils.object2json(oo);
+ // System.err.println("XXXXX" + json.toString(2));
+ return json;
+ }
+
+ public void updateConfigurationFromPolicy(String instanceName) {
+ VirtualMachineServiceInstance i = findInstance(instanceName);
+ JavaHttpClient client = new JavaHttpClient("controller.properties", "policy");
+ HashMap<String, String> headers = new HashMap<String, String>();
+ JSONObject json = new JSONObject();
+ headers.put("ClientAuth", "xxx");
+ JSONObject json2 = new JSONObject();
+ json.put("configAttributes", json2);
+ json2.put("uuid", "xxx");
+ json2.put("service", "ControllerServiceCollectorSdnlService");
+ json2.put("location", "Edge");
+ json.put("configName", "xxxx.sdn-l");
+ json.put("ecompcomponentName", "DCAE");
+ client.httpJsonTransaction("/PyPDPServer/getConfig", "POST", headers, json);
+ }
+
+ public void runHealthTests() {
+ for (VirtualMachineServiceInstance i : o.getInstances()) {
+ HealthTestResponse s = null;
+ try {
+ s = o.test(i.getName());
+ } catch (Exception e) {
+ s = ServiceFactory.eINSTANCE.createHealthTestResponse();
+ s.setMessageCode("Health check failed: " + e);
+ s.setStatus(HealthTestStatus.RED);
+ }
+ i.setHealthTestStatus(s.getStatus());
+ i.setHealthTestMessageCode(s.getMessageCode());
+ MetricStore store = controller.getServer().metrics.getStore(i);
+ Date now = new Date();
+ String path = "/lastHealthTest";
+ store.addLongValue(path, now, now.getTime(), "DateMetricAttribute", false);
+ }
+ }
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerProvider.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerProvider.java
new file mode 100644
index 0000000..d65b6a3
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerProvider.java
@@ -0,0 +1,164 @@
+
+/*-
+ * ============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.dcae.controller.service.servers.vmmanager;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.util.Date;
+
+import org.openecomp.ncomp.sirius.manager.BasicManagementServerProvider;
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+import org.openecomp.ncomp.sirius.manager.ManagementServer;
+import org.openecomp.ncomp.sirius.manager.ManagementServerUtils;
+import org.openecomp.ncomp.webservice.utils.FileUtils;
+
+import org.apache.log4j.Logger;
+import org.eclipse.emf.common.util.EList;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import org.openecomp.dcae.controller.core.manager.ManagerFactory;
+import org.openecomp.dcae.controller.core.service.HealthTestResponse;
+import org.openecomp.dcae.controller.core.service.HealthTestStatus;
+import org.openecomp.dcae.controller.core.service.ServiceFactory;
+import org.openecomp.dcae.controller.core.stream.DcaeStream;
+import org.openecomp.dcae.controller.service.vmmanager.VirtualMachineManager;
+
+public class DcaeVirtualMachineManagerProvider extends BasicManagementServerProvider {
+ private static final Logger logger = Logger.getLogger(DcaeVirtualMachineManagerProvider.class);
+ VirtualMachineManager o;
+ private boolean suspended;
+ private String file = "/etc/dcae/dmaap.conf";
+
+ public DcaeVirtualMachineManagerProvider(ISiriusServer controller, VirtualMachineManager o) {
+ super(controller, o);
+ this.o = o;
+ }
+
+ public HealthTestResponse test() {
+ HealthTestResponse res = ServiceFactory.eINSTANCE.createHealthTestResponse();
+ res.setStatus(HealthTestStatus.GREEN);
+ return res;
+ }
+
+ public void suspend() {
+ suspended = true;
+ }
+
+ public void resume() {
+ suspended = false;
+ }
+
+ public java.lang.String publicKey() {
+ throw new UnsupportedOperationException();
+ }
+
+ // US618656
+ public void configurationChanged() {
+ updateDMaapConfig();
+ }
+
+ // US618665
+ private void updateDMaapConfig() {
+ JSONArray a = new JSONArray();
+ for (DcaeStream s : o.getInputStreams()) {
+ JSONObject json = ManagementServer.ecore2json(s, 100, null, true);
+ json.put("dmaapStreamId", s.getName());
+ a.put(json);
+ }
+ for (DcaeStream s : o.getOutputStreams()) {
+ JSONObject json = ManagementServer.ecore2json(s, 100, null, true);
+ json.put("dmaapStreamId", s.getName());
+ a.put(json);
+ }
+ write2file(a,"/tmp/dmaap.conf2");
+ write2file(a,file );
+
+ }
+
+ private void write2file(JSONArray a, String fileName) {
+ try {
+ OutputStreamWriter w = FileUtils.filename2writer(fileName);
+ w.write(a.toString(2));
+ w.close();
+ } catch (Exception e) {
+ logger.warn("Unable to write file: " + fileName);
+ ManagementServerUtils.printStackTrace(e);
+ }
+ }
+
+ public void updateStreams(EList<DcaeStream> inputStreams, EList<DcaeStream> outputStreams) {
+ o.getInputStreams().clear();
+ o.getInputStreams().addAll(inputStreams);
+ o.getOutputStreams().clear();
+ o.getOutputStreams().addAll(outputStreams);
+ }
+
+ public void scheduleCronjob(final String cmd, final long frequency) {
+ Thread t = new Thread("crontab: " + cmd) {
+ @Override
+ public void run() {
+ while (true) {
+ try {
+ Date now = new Date();
+ long wait = frequency - (now.getTime() % frequency);
+ Thread.sleep(wait);
+ if (suspended) continue;
+ Runtime runtime = Runtime.getRuntime();
+ Process proc;
+ try {
+ now = new Date();
+ proc = runtime.exec(cmd);
+ ByteArrayOutputStream o = new ByteArrayOutputStream();
+ ByteArrayOutputStream e = new ByteArrayOutputStream();
+ FileUtils.copyStream(proc.getInputStream(), o);
+ FileUtils.copyStream(proc.getErrorStream(), e);
+ int i = proc.waitFor();
+ if (i != 0)
+ logger.warn("crontab return error: " + cmd + " " + i);
+ long duration = new Date().getTime()-now.getTime();
+ if (duration > frequency)
+ logger.warn("crontab took too long: " + cmd + " " + duration);
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.warn("ERROR: " + e);
+ }
+ } catch (Exception e) {
+ ManagementServerUtils.printStackTrace(e);
+ logger.fatal("crontab: " + cmd + " " + e);
+ try {
+ Thread.sleep(30000);
+ } catch (InterruptedException e1) {
+ }
+ }
+ }
+ };
+ };
+ t.start();
+ }
+
+ protected void setDmaapConfigurationFile(String dmaapConfFile) {
+ file = dmaapConfFile;
+ }
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/org/openecomp/dcae/controller/service/vm/adaptor/tools/Generator.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/org/openecomp/dcae/controller/service/vm/adaptor/tools/Generator.java
new file mode 100644
index 0000000..3d7c1c5
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/java/org/openecomp/dcae/controller/service/vm/adaptor/tools/Generator.java
@@ -0,0 +1,91 @@
+
+/*-
+ * ============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.dcae.controller.service.vm.adaptor.tools;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.openecomp.ncomp.gwt.siriusportal.model.ModelFactory;
+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.sirius.manager.server.ServerPackage;
+import org.openecomp.dcae.controller.service.vm.VmFactory;
+import org.openecomp.dcae.controller.service.vmmanager.VmmanagerFactory;
+import org.openecomp.utils.YamlToJava;
+
+
+public class Generator {
+
+ public static void main(String[] args) {
+ @SuppressWarnings("unused")
+ ServerPackage f = ServerPackage.eINSTANCE;
+ genManager();
+ genService();
+ }
+
+ private static void genManager() {
+ EObject o = VmmanagerFactory.eINSTANCE.createVirtualMachineManager();
+ 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("Dcae");
+ m.setPluginName(p.getNsURI());
+ m.setName("ControllerServiceVmManager");
+ m.setTitle("ControllerServiceVmManager");
+ ControllerGenerator g = new ControllerGenerator(o, m);
+ g.setEnableIRequestHandler(false);
+ g.setEnableISiriusPlugin(false);
+ // TODO Unclear why this fails.
+// g.addFactory(VmFactory.eINSTANCE);
+ g.generate(dir);
+ String pName = p.getNsURI().replaceAll(p.getNsPrefix()+'$',"") + "servers." + p.getNsPrefix() +".logging";
+ YamlToJava.convert("src/main/sirius-gen/VirtualMachineManager.yaml", dir + "/logging", pName);
+ }
+
+ public static void genService() {
+ @SuppressWarnings("unused")
+ ServerPackage f = ServerPackage.eINSTANCE;
+ EObject o = VmFactory.eINSTANCE.createVirtualMachineService();
+ EPackage p = o.eClass().getEPackage();
+ String dir = p.getNsURI().replace(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("Dcae");
+ m.setPluginName(p.getNsURI());
+ m.setName("ControllerServiceVm");
+ m.setTitle("ControllerServiceVm");
+ ControllerGenerator g = new ControllerGenerator(o,m);
+ g.setEnableIRequestHandler(false);
+ g.setEnableISiriusPlugin(true);
+ g.generate(dir);
+ g.generateScripts("src/main/server-gen/bin","controller-service-vm-adaptor");
+ String pName = p.getNsURI().replaceAll(p.getNsPrefix()+'$',"") + "servers." + p.getNsPrefix() +".logging";
+// YamlToJava.convert("src/main/resources/DcaeServiceVirtualMachineAdaptor.yaml", dir + "/logging", pName);
+ YamlToJava.convert("src/main/sirius-gen/VirtualMachineService.yaml", dir + "/logging", pName);
+ }
+
+
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/resources/DcaeController.yaml b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/resources/DcaeController.yaml
new file mode 100644
index 0000000..a6edb28
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/resources/DcaeController.yaml
@@ -0,0 +1,12 @@
+operations:
+ HEALTHCHECK:
+ description: Heath Check for all DCAE service instances.
+messages:
+ HEALTHCHECK_SERVICE_FAILED:
+ errorCode: DCAE-CONTROLLER-HEALTHCHECK-SERVICE-FAILED-5001W
+ messageFormat: '{0}'
+ parameters:
+ service-name:
+ description: Name of Service for which the health check fails.
+ resolution: Contact Tier 4. This is a software bug.
+ description: Heath Check on the service level fails.
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/server-gen/bin/controller-service-vm-adaptor-controller b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/server-gen/bin/controller-service-vm-adaptor-controller
new file mode 100644
index 0000000..ebe6100
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/server-gen/bin/controller-service-vm-adaptor-controller
@@ -0,0 +1,138 @@
+#!/bin/bash
+
+# setup env if needed. java 6 required
+## JAVA_HOME=
+
+############################## DO NOT EDIT BELOW ##########################
+
+SNAME="Dcae Controller"
+PNAME=controller-service-vm-adaptor-controller
+CLASS=org.openecomp.dcae.controller.service.servers.vm.DcaeVirtualMachineServiceServer
+
+############################## COMMON BELOW ##########################
+
+check_status ()
+{
+ if [ -f "${_PIDFILE}" ]; then
+ _PID=`cat "${_PIDFILE}"`
+ check_status_of_pid $_PID
+ else
+ _STATUS="$SNAME (no pidfile) is NOT running"
+ _RUNNING=0
+ fi
+}
+
+
+check_status_of_pid ()
+{
+ if [ -n "$1" ] && kill -0 $1 2>/dev/null ; then
+ _STATUS="$SNAME (pid $1) is running"
+ _RUNNING=1
+ else
+ _STATUS="$SNAME (pid $1) is NOT running"
+ _RUNNING=0
+ fi
+}
+
+
+check_status_of_pid ()
+{
+ if [ -n "$1" ] && kill -0 $1 2>/dev/null ; then
+ _STATUS="$SNAME (pid $1) is running"
+ _RUNNING=1
+ else
+ _STATUS="$SNAME (pid $1) is NOT running"
+ _RUNNING=0
+ fi
+}
+
+remove_pid_file ()
+{
+ if [ -f "${_PIDFILE}" ]; then
+ rm "${_PIDFILE}"
+ fi
+}
+
+
+_DIR=`dirname "$0"`
+_DIR=`dirname "$_DIR"`
+
+_PIDFILE=$_DIR/PID
+
+CMD=$1
+shift
+
+check_status
+
+CP=$(find $_DIR/lib/*/* -name \*.jar 2>/dev/null | xargs -I X printf ":%s" X)
+
+JVMARGS=$(grep 'server.jvmargs' $_DIR/config/vm.properties | sed -e 's/.*=//')
+
+case $CMD in
+ status)
+ echo $_STATUS
+ exit 0
+ ;;
+ console)
+ $GROOVY_HOME/bin/groovysh -cp $_DIR/config:$_DIR/lib:$_DIR/lib/\*:$CP
+ ;;
+ run)
+ $JAVA_HOME/bin/java -cp $_DIR/config:$_DIR/lib:$_DIR/lib/\*:$CP "$@"
+ ;;
+ groovy)
+ $GROOVY_HOME/bin/groovy -cp $_DIR/config:$_DIR/lib:$_DIR/lib/\*:$CP "$@"
+ ;;
+ start)
+ if [ "$_RUNNING" = "1" ]; then
+ echo $_STATUS
+ exit 0
+ fi
+ mkdir -p $_DIR/logs
+ if [ -e $_DIR/logs/$PNAME.out.1 ]; then mv $_DIR/logs/$PNAME.out.1 $_DIR/logs/$PNAME.out.2; fi
+ if [ -e $_DIR/logs/$PNAME.err.1 ]; then mv $_DIR/logs/$PNAME.err.1 $_DIR/logs/$PNAME.err.2; fi
+ if [ -e $_DIR/logs/$PNAME.out ]; then mv $_DIR/logs/$PNAME.out $_DIR/logs/$PNAME.out.1; fi
+ if [ -e $_DIR/logs/$PNAME.err ]; then mv $_DIR/logs/$PNAME.err $_DIR/logs/$PNAME.err.1; fi
+
+ nohup $JAVA_HOME/bin/java $JVMARGS -cp $_DIR/config:$_DIR/lib:$_DIR/lib/\*:$CP "$@" $CLASS >> $_DIR/logs/$PNAME.out 2>> $_DIR/logs/$PNAME.err &
+
+ _PID=$!
+ echo $_PID > $_PIDFILE
+ sleep 5
+ check_status
+ echo $_STATUS
+ if [ "$_RUNNING" = "1" ]; then
+ exit 0
+ else
+ echo "Failed to start - make sure the $SNAME is fully configured properly"
+ exit 1
+ fi
+ ;;
+ stop)
+ if [ "$_RUNNING" = "0" ]; then
+ echo $_STATUS
+ remove_pid_file
+ exit 0
+ fi
+ echo "Stopping $SNAME..."
+ _PID_TO_KILL=$_PID;
+ echo "$SNAME (pid=${_PID_TO_KILL}) is stopping..."
+ kill -TERM $_PID_TO_KILL
+ sleep 5
+ check_status_of_pid $_PID_TO_KILL
+ if [ "$_RUNNING" = "1" ]; then
+ kill -TERM $_PID_TO_KILL
+ fi
+ while [ "$_RUNNING" = "1" ]; do
+ sleep 2
+ check_status_of_pid $_PID_TO_KILL
+ done
+ remove_pid_file
+ echo "$SNAME has stopped."
+ exit 0
+ ;;
+ *)
+ echo "$0 start|stop"
+ ;;
+esac
+
+
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/ControllerVirtualMachineServiceInstance.yaml b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/ControllerVirtualMachineServiceInstance.yaml
new file mode 100644
index 0000000..d728705
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/ControllerVirtualMachineServiceInstance.yaml
@@ -0,0 +1,3 @@
+operations: {}
+messages:
+ dummy: {}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/VirtualMachineManager.yaml b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/VirtualMachineManager.yaml
new file mode 100644
index 0000000..63cb773
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/VirtualMachineManager.yaml
@@ -0,0 +1,179 @@
+operations:
+ test: {}
+ suspend: {}
+ resume: {}
+ publicKey: {}
+ configurationChanged: {}
+ updateStreams: {}
+ logs: {}
+ metrics: {}
+ properties: {}
+ uploadInfo: {}
+ getValues: {}
+ getValuesAll: {}
+ getMessages: {}
+ getRequestLogger: {}
+ evaluate: {}
+ update: {}
+ REMOTE_test:
+ decription: Remote call test
+ REMOTE_suspend:
+ decription: Remote call suspend
+ REMOTE_resume:
+ decription: Remote call resume
+ REMOTE_publicKey:
+ decription: Remote call publicKey
+ REMOTE_configurationChanged:
+ decription: Remote call configurationChanged
+ REMOTE_updateStreams:
+ decription: Remote call updateStreams
+ REMOTE_logs:
+ decription: Remote call logs
+ REMOTE_metrics:
+ decription: Remote call metrics
+ REMOTE_properties:
+ decription: Remote call properties
+ REMOTE_uploadInfo:
+ decription: Remote call uploadInfo
+ REMOTE_getValues:
+ decription: Remote call getValues
+ REMOTE_getValuesAll:
+ decription: Remote call getValuesAll
+ REMOTE_getMessages:
+ decription: Remote call getMessages
+ REMOTE_getRequestLogger:
+ decription: Remote call getRequestLogger
+ REMOTE_evaluate:
+ decription: Remote call evaluate
+ REMOTE_update:
+ decription: Remote call update
+messages:
+ dummy: {}
+ test:
+ errorCode: test-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ suspend:
+ errorCode: suspend-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ resume:
+ errorCode: resume-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ publicKey:
+ errorCode: publicKey-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ configurationChanged:
+ errorCode: configurationChanged-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ updateStreams:
+ errorCode: updateStreams-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ logs:
+ errorCode: logs-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ metrics:
+ errorCode: metrics-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ properties:
+ errorCode: properties-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ uploadInfo:
+ errorCode: uploadInfo-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ getValues:
+ errorCode: getValues-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ getValuesAll:
+ errorCode: getValuesAll-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ getMessages:
+ errorCode: getMessages-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ getRequestLogger:
+ errorCode: getRequestLogger-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ evaluate:
+ errorCode: evaluate-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ update:
+ errorCode: update-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ REMOTE_test:
+ errorCode: REMOTE-test-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_suspend:
+ errorCode: REMOTE-suspend-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_resume:
+ errorCode: REMOTE-resume-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_publicKey:
+ errorCode: REMOTE-publicKey-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_configurationChanged:
+ errorCode: REMOTE-configurationChanged-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_updateStreams:
+ errorCode: REMOTE-updateStreams-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_logs:
+ errorCode: REMOTE-logs-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_metrics:
+ errorCode: REMOTE-metrics-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_properties:
+ errorCode: REMOTE-properties-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_uploadInfo:
+ errorCode: REMOTE-uploadInfo-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_getValues:
+ errorCode: REMOTE-getValues-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_getValuesAll:
+ errorCode: REMOTE-getValuesAll-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_getMessages:
+ errorCode: REMOTE-getMessages-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_getRequestLogger:
+ errorCode: REMOTE-getRequestLogger-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_evaluate:
+ errorCode: REMOTE-evaluate-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_update:
+ errorCode: REMOTE-update-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/VirtualMachineService.yaml b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/VirtualMachineService.yaml
new file mode 100644
index 0000000..6ac8c34
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/VirtualMachineService.yaml
@@ -0,0 +1,135 @@
+operations:
+ deploy: {}
+ undeploy: {}
+ test: {}
+ suspend: {}
+ resume: {}
+ pushManagerConfiguration: {}
+ pollManagerConfiguration: {}
+ managerConfiguration: {}
+ managerOperation: {}
+ updateConfigurationFromPolicy: {}
+ runHealthTests: {}
+ updateDeploymentStatus: {}
+ REMOTE_deploy:
+ decription: Remote call deploy
+ REMOTE_undeploy:
+ decription: Remote call undeploy
+ REMOTE_test:
+ decription: Remote call test
+ REMOTE_suspend:
+ decription: Remote call suspend
+ REMOTE_resume:
+ decription: Remote call resume
+ REMOTE_pushManagerConfiguration:
+ decription: Remote call pushManagerConfiguration
+ REMOTE_pollManagerConfiguration:
+ decription: Remote call pollManagerConfiguration
+ REMOTE_managerConfiguration:
+ decription: Remote call managerConfiguration
+ REMOTE_managerOperation:
+ decription: Remote call managerOperation
+ REMOTE_updateConfigurationFromPolicy:
+ decription: Remote call updateConfigurationFromPolicy
+ REMOTE_runHealthTests:
+ decription: Remote call runHealthTests
+ REMOTE_updateDeploymentStatus:
+ decription: Remote call updateDeploymentStatus
+messages:
+ dummy: {}
+ deploy:
+ errorCode: deploy-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ undeploy:
+ errorCode: undeploy-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ test:
+ errorCode: test-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ suspend:
+ errorCode: suspend-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ resume:
+ errorCode: resume-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ pushManagerConfiguration:
+ errorCode: pushManagerConfiguration-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ pollManagerConfiguration:
+ errorCode: pollManagerConfiguration-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ managerConfiguration:
+ errorCode: managerConfiguration-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ managerOperation:
+ errorCode: managerOperation-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ updateConfigurationFromPolicy:
+ errorCode: updateConfigurationFromPolicy-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ runHealthTests:
+ errorCode: runHealthTests-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ updateDeploymentStatus:
+ errorCode: updateDeploymentStatus-FAILED-5001W
+ messageFormat: '{0}'
+ description: Operation Failed with Exception
+ REMOTE_deploy:
+ errorCode: REMOTE-deploy-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_undeploy:
+ errorCode: REMOTE-undeploy-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_test:
+ errorCode: REMOTE-test-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_suspend:
+ errorCode: REMOTE-suspend-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_resume:
+ errorCode: REMOTE-resume-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_pushManagerConfiguration:
+ errorCode: REMOTE-pushManagerConfiguration-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_pollManagerConfiguration:
+ errorCode: REMOTE-pollManagerConfiguration-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_managerConfiguration:
+ errorCode: REMOTE-managerConfiguration-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_managerOperation:
+ errorCode: REMOTE-managerOperation-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_updateConfigurationFromPolicy:
+ errorCode: REMOTE-updateConfigurationFromPolicy-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_runHealthTests:
+ errorCode: REMOTE-runHealthTests-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
+ REMOTE_updateDeploymentStatus:
+ errorCode: REMOTE-updateDeploymentStatus-FAILED-5001W
+ messageFormat: '{0}'
+ description: Remote Operation Failed with Exception
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineService.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineService.java
new file mode 100644
index 0000000..1d8d251
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineService.java
@@ -0,0 +1,408 @@
+
+/*-
+ * ============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.dcae.controller.service.servers.vm;
+
+
+
+
+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.manager.ManagementServer;
+import org.openecomp.ncomp.sirius.function.FunctionUtils;
+import org.openecomp.ncomp.component.ApiRequestStatus;
+
+import org.apache.log4j.Logger;
+
+import org.openecomp.logger.EcompLogger;
+
+import org.eclipse.emf.common.util.EList;
+import org.json.JSONObject;
+
+import java.util.Date;
+
+import org.openecomp.dcae.controller.service.servers.vm.logging.VirtualMachineServiceOperationEnum;
+import org.openecomp.dcae.controller.service.servers.vm.logging.VirtualMachineServiceMessageEnum;
+
+
+
+
+import org.openecomp.dcae.controller.service.vm.impl.VirtualMachineServiceImpl;
+
+
+
+public class DcaeVirtualMachineService extends VirtualMachineServiceImpl implements ISiriusPlugin {
+ public static final Logger logger = Logger.getLogger(DcaeVirtualMachineService.class);
+ static final EcompLogger ecomplogger = EcompLogger.getEcompLogger();
+ public DcaeVirtualMachineServiceProvider controller;
+ ISiriusServer server;
+
+ public DcaeVirtualMachineService(ISiriusServer server) {
+ this.server = server;
+ this.controller = new DcaeVirtualMachineServiceProvider(server,this);
+ }
+
+ public void updateDeploymentStatus() {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "updateDeploymentStatus", ApiRequestStatus.START, duration_);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.updateDeploymentStatus);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.updateDeploymentStatus();
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "updateDeploymentStatus", ApiRequestStatus.ERROR, duration_);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.updateDeploymentStatus, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "updateDeploymentStatus", ApiRequestStatus.OKAY, duration_);
+
+ }
+
+ public void deploy(java.lang.String instanceName, java.lang.String containerPath) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "deploy", ApiRequestStatus.START, duration_,instanceName,containerPath);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.deploy);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.deploy(instanceName,containerPath);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "deploy", ApiRequestStatus.ERROR, duration_,instanceName,containerPath);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.deploy, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "deploy", ApiRequestStatus.OKAY, duration_,instanceName,containerPath);
+
+ }
+
+ public void undeploy(java.lang.String instanceName) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "undeploy", ApiRequestStatus.START, duration_,instanceName);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.undeploy);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.undeploy(instanceName);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "undeploy", ApiRequestStatus.ERROR, duration_,instanceName);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.undeploy, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "undeploy", ApiRequestStatus.OKAY, duration_,instanceName);
+
+ }
+
+ public org.openecomp.dcae.controller.core.service.HealthTestResponse test(java.lang.String instanceName) {
+ org.openecomp.dcae.controller.core.service.HealthTestResponse res = null;
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "test", ApiRequestStatus.START, duration_,instanceName);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.test);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ res = controller.test(instanceName);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "test", ApiRequestStatus.ERROR, duration_,instanceName);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.test, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "test", ApiRequestStatus.OKAY, duration_,instanceName);
+ return res;
+ }
+
+ public void suspend(java.lang.String instanceName) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "suspend", ApiRequestStatus.START, duration_,instanceName);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.suspend);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.suspend(instanceName);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "suspend", ApiRequestStatus.ERROR, duration_,instanceName);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.suspend, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "suspend", ApiRequestStatus.OKAY, duration_,instanceName);
+
+ }
+
+ public void resume(java.lang.String instanceName) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "resume", ApiRequestStatus.START, duration_,instanceName);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.resume);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.resume(instanceName);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "resume", ApiRequestStatus.ERROR, duration_,instanceName);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.resume, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "resume", ApiRequestStatus.OKAY, duration_,instanceName);
+
+ }
+
+ public void pushManagerConfiguration(java.lang.String instanceName) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "pushManagerConfiguration", ApiRequestStatus.START, duration_,instanceName);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.pushManagerConfiguration);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.pushManagerConfiguration(instanceName);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "pushManagerConfiguration", ApiRequestStatus.ERROR, duration_,instanceName);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.pushManagerConfiguration, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "pushManagerConfiguration", ApiRequestStatus.OKAY, duration_,instanceName);
+
+ }
+
+ public void pollManagerConfiguration(java.lang.String instanceName) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "pollManagerConfiguration", ApiRequestStatus.START, duration_,instanceName);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.pollManagerConfiguration);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.pollManagerConfiguration(instanceName);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "pollManagerConfiguration", ApiRequestStatus.ERROR, duration_,instanceName);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.pollManagerConfiguration, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "pollManagerConfiguration", ApiRequestStatus.OKAY, duration_,instanceName);
+
+ }
+
+ public org.eclipse.emf.ecore.EObject managerConfiguration(java.lang.String instanceName) {
+ org.eclipse.emf.ecore.EObject res = null;
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "managerConfiguration", ApiRequestStatus.START, duration_,instanceName);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.managerConfiguration);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ res = controller.managerConfiguration(instanceName);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "managerConfiguration", ApiRequestStatus.ERROR, duration_,instanceName);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.managerConfiguration, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "managerConfiguration", ApiRequestStatus.OKAY, duration_,instanceName);
+ return res;
+ }
+
+ public org.json.JSONObject managerOperation(java.lang.String instanceName, java.lang.String operation, org.json.JSONObject parameters) {
+ org.json.JSONObject res = null;
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "managerOperation", ApiRequestStatus.START, duration_,instanceName,operation,parameters);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.managerOperation);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ res = controller.managerOperation(instanceName,operation,parameters);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "managerOperation", ApiRequestStatus.ERROR, duration_,instanceName,operation,parameters);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.managerOperation, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "managerOperation", ApiRequestStatus.OKAY, duration_,instanceName,operation,parameters);
+ return res;
+ }
+
+ public void updateConfigurationFromPolicy(java.lang.String instanceName) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "updateConfigurationFromPolicy", ApiRequestStatus.START, duration_,instanceName);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.updateConfigurationFromPolicy);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.updateConfigurationFromPolicy(instanceName);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "updateConfigurationFromPolicy", ApiRequestStatus.ERROR, duration_,instanceName);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.updateConfigurationFromPolicy, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "updateConfigurationFromPolicy", ApiRequestStatus.OKAY, duration_,instanceName);
+
+ }
+
+ public void runHealthTests() {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "runHealthTests", ApiRequestStatus.START, duration_);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.runHealthTests);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.runHealthTests();
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "runHealthTests", ApiRequestStatus.ERROR, duration_);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.runHealthTests, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "runHealthTests", ApiRequestStatus.OKAY, duration_);
+
+ }
+
+
+
+
+
+
+ @Override
+ public void start() {
+ controller.start();
+ }
+
+ public static void ecoreSetup() {
+ DcaeVirtualMachineServiceProvider.ecoreSetup();
+ }
+ public DcaeVirtualMachineServiceProvider getSomfProvider() {
+ return controller;
+ }
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceClient.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceClient.java
new file mode 100644
index 0000000..65cdc1b
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceClient.java
@@ -0,0 +1,276 @@
+
+/*-
+ * ============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.dcae.controller.service.servers.vm;
+
+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.openecomp.logger.EcompLogger;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+
+import org.openecomp.dcae.controller.service.vm.impl.VirtualMachineServiceImpl;
+import org.openecomp.dcae.controller.service.vm.VmPackage;
+import org.openecomp.dcae.controller.service.servers.vm.logging.VirtualMachineServiceOperationEnum;
+import org.openecomp.dcae.controller.service.servers.vm.logging.VirtualMachineServiceMessageEnum;
+
+
+
+
+
+
+@SuppressWarnings("unchecked")
+public class DcaeVirtualMachineServiceClient extends VirtualMachineServiceImpl {
+ public static final Logger logger = Logger.getLogger(DcaeVirtualMachineServiceClient.class);
+ static final EcompLogger ecomplogger = EcompLogger.getEcompLogger();
+ public AbstractClient client;
+
+ public DcaeVirtualMachineServiceClient(String file, String name) {
+ DcaeVirtualMachineService.ecoreSetup();
+ client = new GenericHttpClient(file,name);
+ client.add("/resources", this);
+ }
+
+ public DcaeVirtualMachineServiceClient(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 DcaeVirtualMachineServiceClient(AbstractClient c) {
+ client = c;
+ client.add("/resources", this);
+ }
+
+
+
+ @Override
+ public void updateDeploymentStatus() {
+ EClass c = VmPackage.eINSTANCE.getVirtualMachineService(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.REMOTE_updateDeploymentStatus);
+
+ try {
+ client.operationPath("/resources", c, "updateDeploymentStatus", null);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.REMOTE_updateDeploymentStatus, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@updateDeploymentStatus: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+ @Override
+ public void deploy(java.lang.String instanceName, java.lang.String containerPath) {
+ EClass c = VmPackage.eINSTANCE.getVirtualMachineService(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.REMOTE_deploy);
+
+ try {
+ client.operationPath("/resources", c, "deploy", null, instanceName,containerPath);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.REMOTE_deploy, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@deploy: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+ @Override
+ public void undeploy(java.lang.String instanceName) {
+ EClass c = VmPackage.eINSTANCE.getVirtualMachineService(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.REMOTE_undeploy);
+
+ try {
+ client.operationPath("/resources", c, "undeploy", null, instanceName);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.REMOTE_undeploy, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@undeploy: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+ @Override
+ public org.openecomp.dcae.controller.core.service.HealthTestResponse test(java.lang.String instanceName) {
+ EClass c = VmPackage.eINSTANCE.getVirtualMachineService(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.REMOTE_test);
+ org.openecomp.dcae.controller.core.service.HealthTestResponse res;
+ try {
+ res = (org.openecomp.dcae.controller.core.service.HealthTestResponse) client.operationPath("/resources", c, "test", null, instanceName);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.REMOTE_test, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@test: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+ return res;
+ }
+
+ @Override
+ public void suspend(java.lang.String instanceName) {
+ EClass c = VmPackage.eINSTANCE.getVirtualMachineService(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.REMOTE_suspend);
+
+ try {
+ client.operationPath("/resources", c, "suspend", null, instanceName);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.REMOTE_suspend, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@suspend: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+ @Override
+ public void resume(java.lang.String instanceName) {
+ EClass c = VmPackage.eINSTANCE.getVirtualMachineService(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.REMOTE_resume);
+
+ try {
+ client.operationPath("/resources", c, "resume", null, instanceName);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.REMOTE_resume, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@resume: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+ @Override
+ public void pushManagerConfiguration(java.lang.String instanceName) {
+ EClass c = VmPackage.eINSTANCE.getVirtualMachineService(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.REMOTE_pushManagerConfiguration);
+
+ try {
+ client.operationPath("/resources", c, "pushManagerConfiguration", null, instanceName);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.REMOTE_pushManagerConfiguration, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@pushManagerConfiguration: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+ @Override
+ public void pollManagerConfiguration(java.lang.String instanceName) {
+ EClass c = VmPackage.eINSTANCE.getVirtualMachineService(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.REMOTE_pollManagerConfiguration);
+
+ try {
+ client.operationPath("/resources", c, "pollManagerConfiguration", null, instanceName);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.REMOTE_pollManagerConfiguration, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@pollManagerConfiguration: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+ @Override
+ public org.eclipse.emf.ecore.EObject managerConfiguration(java.lang.String instanceName) {
+ EClass c = VmPackage.eINSTANCE.getVirtualMachineService(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.REMOTE_managerConfiguration);
+ org.eclipse.emf.ecore.EObject res;
+ try {
+ res = (org.eclipse.emf.ecore.EObject) client.operationPath("/resources", c, "managerConfiguration", null, instanceName);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.REMOTE_managerConfiguration, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@managerConfiguration: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+ return res;
+ }
+
+ @Override
+ public org.json.JSONObject managerOperation(java.lang.String instanceName, java.lang.String operation, org.json.JSONObject parameters) {
+ EClass c = VmPackage.eINSTANCE.getVirtualMachineService(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.REMOTE_managerOperation);
+ org.json.JSONObject res;
+ try {
+ res = (org.json.JSONObject) client.operationPath("/resources", c, "managerOperation", null, instanceName,operation,parameters);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.REMOTE_managerOperation, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@managerOperation: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+ return res;
+ }
+
+ @Override
+ public void updateConfigurationFromPolicy(java.lang.String instanceName) {
+ EClass c = VmPackage.eINSTANCE.getVirtualMachineService(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.REMOTE_updateConfigurationFromPolicy);
+
+ try {
+ client.operationPath("/resources", c, "updateConfigurationFromPolicy", null, instanceName);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.REMOTE_updateConfigurationFromPolicy, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@updateConfigurationFromPolicy: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+ @Override
+ public void runHealthTests() {
+ EClass c = VmPackage.eINSTANCE.getVirtualMachineService(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineServiceOperationEnum.REMOTE_runHealthTests);
+
+ try {
+ client.operationPath("/resources", c, "runHealthTests", null);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineServiceMessageEnum.REMOTE_runHealthTests, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@runHealthTests: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceConsole.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceConsole.java
new file mode 100644
index 0000000..aa306e0
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceConsole.java
@@ -0,0 +1,189 @@
+
+/*-
+ * ============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.dcae.controller.service.servers.vm;
+
+
+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 DcaeVirtualMachineServiceConsole extends Console {
+ public static final Logger logger = Logger.getLogger(DcaeVirtualMachineServiceConsole.class);
+ protected DcaeVirtualMachineServiceClient controller;
+
+
+
+
+ public DcaeVirtualMachineServiceConsole(String filename, String name) {
+ super(filename, name);
+ controller = new DcaeVirtualMachineServiceClient(filename,name);
+ client = controller.client;
+
+ }
+
+ public DcaeVirtualMachineServiceConsole(AbstractClient c) {
+ controller = new DcaeVirtualMachineServiceClient(c);
+ client = controller.client;
+ }
+
+
+ public void updateDeploymentStatus() {
+
+ try {
+ controller.updateDeploymentStatus();
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void deploy(java.lang.String instanceName, java.lang.String containerPath) {
+
+ try {
+ controller.deploy(instanceName,containerPath);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void undeploy(java.lang.String instanceName) {
+
+ try {
+ controller.undeploy(instanceName);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public org.openecomp.dcae.controller.core.service.HealthTestResponse test(java.lang.String instanceName) {
+ org.openecomp.dcae.controller.core.service.HealthTestResponse res = null;
+ try {
+ res = controller.test(instanceName);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+ return res;
+ }
+
+ public void suspend(java.lang.String instanceName) {
+
+ try {
+ controller.suspend(instanceName);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void resume(java.lang.String instanceName) {
+
+ try {
+ controller.resume(instanceName);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void pushManagerConfiguration(java.lang.String instanceName) {
+
+ try {
+ controller.pushManagerConfiguration(instanceName);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void pollManagerConfiguration(java.lang.String instanceName) {
+
+ try {
+ controller.pollManagerConfiguration(instanceName);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public org.eclipse.emf.ecore.EObject managerConfiguration(java.lang.String instanceName) {
+ org.eclipse.emf.ecore.EObject res = null;
+ try {
+ res = controller.managerConfiguration(instanceName);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+ return res;
+ }
+
+ public org.json.JSONObject managerOperation(java.lang.String instanceName, java.lang.String operation, org.json.JSONObject parameters) {
+ org.json.JSONObject res = null;
+ try {
+ res = controller.managerOperation(instanceName,operation,parameters);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+ return res;
+ }
+
+ public void updateConfigurationFromPolicy(java.lang.String instanceName) {
+
+ try {
+ controller.updateConfigurationFromPolicy(instanceName);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void runHealthTests() {
+
+ try {
+ controller.runHealthTests();
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceProviderTemplate.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceProviderTemplate.java
new file mode 100644
index 0000000..5aa1a26
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceProviderTemplate.java
@@ -0,0 +1,137 @@
+
+/*-
+ * ============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.dcae.controller.service.servers.vm;
+
+
+
+
+
+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.dcae.controller.service.vm.impl.VirtualMachineServiceImpl;
+import org.openecomp.dcae.controller.service.vm.VirtualMachineService;
+
+
+public class DcaeVirtualMachineServiceProviderTemplate extends BasicAdaptorProvider {
+ private static final Logger logger = Logger.getLogger(DcaeVirtualMachineServiceProviderTemplate.class);
+ VirtualMachineService o;
+
+ public DcaeVirtualMachineServiceProviderTemplate(ISiriusServer controller, VirtualMachineService o) {
+ super(controller, o);
+ this.o = o;
+ }
+
+ public void updateDeploymentStatus() {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void deploy(java.lang.String instanceName, java.lang.String containerPath) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void undeploy(java.lang.String instanceName) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public org.openecomp.dcae.controller.core.service.HealthTestResponse test(java.lang.String instanceName) {
+ org.openecomp.dcae.controller.core.service.HealthTestResponse res = null;
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void suspend(java.lang.String instanceName) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void resume(java.lang.String instanceName) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void pushManagerConfiguration(java.lang.String instanceName) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void pollManagerConfiguration(java.lang.String instanceName) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public org.eclipse.emf.ecore.EObject managerConfiguration(java.lang.String instanceName) {
+ org.eclipse.emf.ecore.EObject res = null;
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public org.json.JSONObject managerOperation(java.lang.String instanceName, java.lang.String operation, org.json.JSONObject parameters) {
+ org.json.JSONObject res = null;
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateConfigurationFromPolicy(java.lang.String instanceName) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void runHealthTests() {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+
+
+
+
+
+
+
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceServer.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceServer.java
new file mode 100644
index 0000000..56173b7
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVirtualMachineServiceServer.java
@@ -0,0 +1,98 @@
+
+/*-
+ * ============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.dcae.controller.service.servers.vm;
+
+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.entity.EcompComponent;
+import org.openecomp.entity.EcompSubComponent;
+import org.openecomp.entity.EcompSubComponentInstance;
+import org.openecomp.ncomp.sirius.manager.Jetty8Server;
+import org.openecomp.ncomp.sirius.manager.ManagementServer;
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+
+import org.openecomp.dcae.controller.service.vm.VirtualMachineService;
+
+
+
+
+
+
+public class DcaeVirtualMachineServiceServer implements ISiriusServer {
+ public static final Logger logger = Logger.getLogger(DcaeVirtualMachineServiceServer.class);
+ String serverPath;
+ ManagementServer server;
+ DcaeVirtualMachineService controller;
+ String directory = "data";
+// LocationControllerApi api ;
+ Jetty8Server webServer;
+ DcaeVmFactory f = new DcaeVmFactory(this);
+
+
+
+ public DcaeVirtualMachineServiceServer(String filename) throws IOException {
+ logger.warn("controller restarting");
+ DcaeVirtualMachineService.ecoreSetup();
+ props = getPropertiesFromClasspath(filename);
+ serverPath = (String) props.get("server.dir");
+ server = new ManagementServer(f, "VirtualMachineService", serverPath, filename);
+ server.addFactory(f);
+
+ server.addRuntimeFactories(this);
+ server.start();
+ }
+ public void runWebserver() throws IOException {
+ controller = (DcaeVirtualMachineService) server.find("/").o;
+ webServer = new Jetty8Server("vm.properties");
+ webServer.add("/resources",server);
+
+
+
+
+
+ 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"));
+
+ DcaeVirtualMachineServiceServer s = new DcaeVirtualMachineServiceServer("vm.properties");
+ s.runWebserver();
+ }
+ public VirtualMachineService getController() {
+ return controller;
+ }
+ public ManagementServer getServer() {
+ return server;
+ }
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVmFactory.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVmFactory.java
new file mode 100644
index 0000000..0e24bee
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/DcaeVmFactory.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.dcae.controller.service.servers.vm;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.apache.log4j.Logger;
+
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+
+import org.openecomp.dcae.controller.service.vm.VirtualMachineService;
+import org.openecomp.dcae.controller.service.vm.VmPackage;
+import org.openecomp.dcae.controller.service.vm.impl.VmFactoryImpl;
+
+
+
+
+
+public class DcaeVmFactory extends VmFactoryImpl {
+ public static final Logger logger = Logger.getLogger(DcaeVmFactory.class);
+ ISiriusServer server = null;
+ @Override
+ public EPackage getEPackage() { return VmPackage.eINSTANCE; }
+ public DcaeVmFactory(ISiriusServer server) {
+ this.server = server;
+ }
+ @Override
+ public VirtualMachineService createVirtualMachineService() {
+ return new DcaeVirtualMachineService(server);
+ }
+
+
+
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/logging/VirtualMachineService.properties b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/logging/VirtualMachineService.properties
new file mode 100644
index 0000000..d32cf07
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/logging/VirtualMachineService.properties
@@ -0,0 +1,150 @@
+
+dummy=\
+ null|\
+ null|\
+ null|\
+ null
+
+deploy=\
+ deploy-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+undeploy=\
+ undeploy-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+test=\
+ test-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+suspend=\
+ suspend-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+resume=\
+ resume-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+pushManagerConfiguration=\
+ pushManagerConfiguration-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+pollManagerConfiguration=\
+ pollManagerConfiguration-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+managerConfiguration=\
+ managerConfiguration-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+managerOperation=\
+ managerOperation-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+updateConfigurationFromPolicy=\
+ updateConfigurationFromPolicy-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+runHealthTests=\
+ runHealthTests-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+updateDeploymentStatus=\
+ updateDeploymentStatus-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+REMOTE_deploy=\
+ REMOTE-deploy-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_undeploy=\
+ REMOTE-undeploy-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_test=\
+ REMOTE-test-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_suspend=\
+ REMOTE-suspend-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_resume=\
+ REMOTE-resume-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_pushManagerConfiguration=\
+ REMOTE-pushManagerConfiguration-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_pollManagerConfiguration=\
+ REMOTE-pollManagerConfiguration-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_managerConfiguration=\
+ REMOTE-managerConfiguration-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_managerOperation=\
+ REMOTE-managerOperation-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_updateConfigurationFromPolicy=\
+ REMOTE-updateConfigurationFromPolicy-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_runHealthTests=\
+ REMOTE-runHealthTests-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_updateDeploymentStatus=\
+ REMOTE-updateDeploymentStatus-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/logging/VirtualMachineServiceMessageEnum.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/logging/VirtualMachineServiceMessageEnum.java
new file mode 100644
index 0000000..d0f7bf2
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/logging/VirtualMachineServiceMessageEnum.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.dcae.controller.service.servers.vm.logging;
+
+import com.att.eelf.i18n.EELFResourceManager;
+import org.openecomp.logger.EcompMessageEnum;
+
+public enum VirtualMachineServiceMessageEnum implements EcompMessageEnum {
+
+ dummy,
+ deploy,
+ undeploy,
+ test,
+ suspend,
+ resume,
+ pushManagerConfiguration,
+ pollManagerConfiguration,
+ managerConfiguration,
+ managerOperation,
+ updateConfigurationFromPolicy,
+ runHealthTests,
+ updateDeploymentStatus,
+ REMOTE_deploy,
+ REMOTE_undeploy,
+ REMOTE_test,
+ REMOTE_suspend,
+ REMOTE_resume,
+ REMOTE_pushManagerConfiguration,
+ REMOTE_pollManagerConfiguration,
+ REMOTE_managerConfiguration,
+ REMOTE_managerOperation,
+ REMOTE_updateConfigurationFromPolicy,
+ REMOTE_runHealthTests,
+ REMOTE_updateDeploymentStatus;
+
+ static {
+ EELFResourceManager.loadMessageBundle("org.openecomp.dcae.controller.service.servers.vm.logging.VirtualMachineService");
+ }
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/logging/VirtualMachineServiceOperationEnum.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/logging/VirtualMachineServiceOperationEnum.java
new file mode 100644
index 0000000..52d420c
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vm/logging/VirtualMachineServiceOperationEnum.java
@@ -0,0 +1,53 @@
+
+/*-
+ * ============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.dcae.controller.service.servers.vm.logging;
+
+import org.openecomp.entity.EcompOperationEnum;
+
+public enum VirtualMachineServiceOperationEnum implements EcompOperationEnum {
+
+ deploy,
+ undeploy,
+ test,
+ suspend,
+ resume,
+ pushManagerConfiguration,
+ pollManagerConfiguration,
+ managerConfiguration,
+ managerOperation,
+ updateConfigurationFromPolicy,
+ runHealthTests,
+ updateDeploymentStatus,
+ REMOTE_deploy,
+ REMOTE_undeploy,
+ REMOTE_test,
+ REMOTE_suspend,
+ REMOTE_resume,
+ REMOTE_pushManagerConfiguration,
+ REMOTE_pollManagerConfiguration,
+ REMOTE_managerConfiguration,
+ REMOTE_managerOperation,
+ REMOTE_updateConfigurationFromPolicy,
+ REMOTE_runHealthTests,
+ REMOTE_updateDeploymentStatus;
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManager.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManager.java
new file mode 100644
index 0000000..889b01c
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManager.java
@@ -0,0 +1,529 @@
+
+/*-
+ * ============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.dcae.controller.service.servers.vmmanager;
+
+
+
+
+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.manager.ManagementServer;
+import org.openecomp.ncomp.sirius.function.FunctionUtils;
+import org.openecomp.ncomp.component.ApiRequestStatus;
+
+import org.apache.log4j.Logger;
+
+import org.openecomp.logger.EcompLogger;
+
+import org.eclipse.emf.common.util.EList;
+import org.json.JSONObject;
+
+import java.util.Date;
+
+import org.openecomp.dcae.controller.service.servers.vmmanager.logging.VirtualMachineManagerOperationEnum;
+import org.openecomp.dcae.controller.service.servers.vmmanager.logging.VirtualMachineManagerMessageEnum;
+
+
+
+
+
+
+
+import java.util.Date;
+
+
+
+
+
+import org.openecomp.ncomp.sirius.manager.server.LoggerInfo;
+
+
+
+
+
+import org.openecomp.ncomp.sirius.manager.server.ServerFactory;
+
+
+import org.openecomp.dcae.controller.service.vmmanager.impl.VirtualMachineManagerImpl;
+
+
+
+public class DcaeVirtualMachineManager extends VirtualMachineManagerImpl {
+ public static final Logger logger = Logger.getLogger(DcaeVirtualMachineManager.class);
+ static final EcompLogger ecomplogger = EcompLogger.getEcompLogger();
+ public DcaeVirtualMachineManagerProvider controller;
+ ISiriusServer server;
+
+ public DcaeVirtualMachineManager(ISiriusServer server) {
+ this.server = server;
+ this.controller = new DcaeVirtualMachineManagerProvider(server,this);
+ }
+
+ public org.openecomp.dcae.controller.core.service.HealthTestResponse test() {
+ org.openecomp.dcae.controller.core.service.HealthTestResponse res = null;
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "test", ApiRequestStatus.START, duration_);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.test);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ res = controller.test();
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "test", ApiRequestStatus.ERROR, duration_);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.test, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "test", ApiRequestStatus.OKAY, duration_);
+ return res;
+ }
+
+ public void suspend() {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "suspend", ApiRequestStatus.START, duration_);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.suspend);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.suspend();
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "suspend", ApiRequestStatus.ERROR, duration_);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.suspend, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "suspend", ApiRequestStatus.OKAY, duration_);
+
+ }
+
+ public void resume() {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "resume", ApiRequestStatus.START, duration_);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.resume);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.resume();
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "resume", ApiRequestStatus.ERROR, duration_);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.resume, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "resume", ApiRequestStatus.OKAY, duration_);
+
+ }
+
+ public java.lang.String publicKey() {
+ java.lang.String res = null;
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "publicKey", ApiRequestStatus.START, duration_);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.publicKey);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ res = controller.publicKey();
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "publicKey", ApiRequestStatus.ERROR, duration_);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.publicKey, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "publicKey", ApiRequestStatus.OKAY, duration_);
+ return res;
+ }
+
+ public void configurationChanged() {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "configurationChanged", ApiRequestStatus.START, duration_);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.configurationChanged);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.configurationChanged();
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "configurationChanged", ApiRequestStatus.ERROR, duration_);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.configurationChanged, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "configurationChanged", ApiRequestStatus.OKAY, duration_);
+
+ }
+
+ public void updateStreams(EList<org.openecomp.dcae.controller.core.stream.DcaeStream> inputStreams, EList<org.openecomp.dcae.controller.core.stream.DcaeStream> outputStreams) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "updateStreams", ApiRequestStatus.START, duration_,inputStreams,outputStreams);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.updateStreams);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.updateStreams(inputStreams,outputStreams);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "updateStreams", ApiRequestStatus.ERROR, duration_,inputStreams,outputStreams);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.updateStreams, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "updateStreams", ApiRequestStatus.OKAY, duration_,inputStreams,outputStreams);
+
+ }
+
+ public void logs(org.json.JSONObject cx, EList<org.openecomp.ncomp.core.logs.LogMessage> logs) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "logs", ApiRequestStatus.START, duration_,cx,logs);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.logs);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.logs(cx,logs);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "logs", ApiRequestStatus.ERROR, duration_,cx,logs);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.logs, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "logs", ApiRequestStatus.OKAY, duration_,cx,logs);
+
+ }
+
+ public void metrics(org.json.JSONObject cx, EList<org.openecomp.ncomp.core.metrics.Metric> metrics) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "metrics", ApiRequestStatus.START, duration_,cx,metrics);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.metrics);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.metrics(cx,metrics);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "metrics", ApiRequestStatus.ERROR, duration_,cx,metrics);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.metrics, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "metrics", ApiRequestStatus.OKAY, duration_,cx,metrics);
+
+ }
+
+ public void properties(org.json.JSONObject cx, EList<org.openecomp.ncomp.sirius.manager.properties.AbstractProperty> l) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "properties", ApiRequestStatus.START, duration_,cx,l);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.properties);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.properties(cx,l);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "properties", ApiRequestStatus.ERROR, duration_,cx,l);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.properties, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "properties", ApiRequestStatus.OKAY, duration_,cx,l);
+
+ }
+
+ public void uploadInfo(org.json.JSONObject cx, EList<org.openecomp.ncomp.sirius.manager.server.ManagementInfo> info) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "uploadInfo", ApiRequestStatus.START, duration_,cx,info);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.uploadInfo);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.uploadInfo(cx,info);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "uploadInfo", ApiRequestStatus.ERROR, duration_,cx,info);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.uploadInfo, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "uploadInfo", ApiRequestStatus.OKAY, duration_,cx,info);
+
+ }
+
+ public EList<org.openecomp.ncomp.core.metrics.DoubleMetric> getValues(org.json.JSONObject cx, java.lang.String path, java.lang.Long start, java.lang.Long end, org.openecomp.ncomp.core.metrics.MetricValueOption option, boolean relativeInterval) {
+ EList<org.openecomp.ncomp.core.metrics.DoubleMetric> res = null;
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "getValues", ApiRequestStatus.START, duration_,cx,path,start,end,option,relativeInterval);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.getValues);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ res = controller.getValues(cx,path,start,end,option,relativeInterval);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getValues", ApiRequestStatus.ERROR, duration_,cx,path,start,end,option,relativeInterval);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.getValues, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getValues", ApiRequestStatus.OKAY, duration_,cx,path,start,end,option,relativeInterval);
+ return res;
+ }
+
+ public EList<org.openecomp.ncomp.core.metrics.DoubleMetric> getValuesAll(org.json.JSONObject cx, java.lang.String path, EList<java.lang.String> metrics, java.lang.Long start, java.lang.Long end, org.openecomp.ncomp.core.metrics.MetricValueOption option, boolean relativeInterval) {
+ EList<org.openecomp.ncomp.core.metrics.DoubleMetric> res = null;
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "getValuesAll", ApiRequestStatus.START, duration_,cx,path,metrics,start,end,option,relativeInterval);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.getValuesAll);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ res = controller.getValuesAll(cx,path,metrics,start,end,option,relativeInterval);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getValuesAll", ApiRequestStatus.ERROR, duration_,cx,path,metrics,start,end,option,relativeInterval);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.getValuesAll, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getValuesAll", ApiRequestStatus.OKAY, duration_,cx,path,metrics,start,end,option,relativeInterval);
+ return res;
+ }
+
+ public EList<org.openecomp.ncomp.core.logs.LogMessage> getMessages(org.json.JSONObject cx, java.lang.String path, java.lang.Long start, java.lang.Long end) {
+ EList<org.openecomp.ncomp.core.logs.LogMessage> res = null;
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "getMessages", ApiRequestStatus.START, duration_,cx,path,start,end);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.getMessages);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ res = controller.getMessages(cx,path,start,end);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getMessages", ApiRequestStatus.ERROR, duration_,cx,path,start,end);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.getMessages, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getMessages", ApiRequestStatus.OKAY, duration_,cx,path,start,end);
+ return res;
+ }
+
+ public org.openecomp.ncomp.sirius.manager.server.LoggerInfo getRequestLogger(java.lang.String userName, java.lang.String action, java.lang.String resourcePath, org.json.JSONObject context) {
+ org.openecomp.ncomp.sirius.manager.server.LoggerInfo res = null;
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "getRequestLogger", ApiRequestStatus.START, duration_,userName,action,resourcePath,context);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.getRequestLogger);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ res = controller.getRequestLogger(userName,action,resourcePath,context);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getRequestLogger", ApiRequestStatus.ERROR, duration_,userName,action,resourcePath,context);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.getRequestLogger, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "getRequestLogger", ApiRequestStatus.OKAY, duration_,userName,action,resourcePath,context);
+ return res;
+ }
+
+ public EList<org.openecomp.ncomp.core.function.ValuePair> evaluate(java.lang.String path, org.openecomp.ncomp.core.function.Function function) {
+ EList<org.openecomp.ncomp.core.function.ValuePair> res = null;
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "evaluate", ApiRequestStatus.START, duration_,path,function);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.evaluate);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ res = controller.evaluate(path,function);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "evaluate", ApiRequestStatus.ERROR, duration_,path,function);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.evaluate, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "evaluate", ApiRequestStatus.OKAY, duration_,path,function);
+ return res;
+ }
+
+ public void update(java.lang.String path, org.openecomp.ncomp.core.function.Function function) {
+
+ long duration_ = 0;
+ if (server != null)
+ server.getServer().recordApi(null, this, "update", ApiRequestStatus.START, duration_,path,function);
+ Date now_ = new Date();
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.update);
+ ecomplogger.setInstanceId(ManagementServer.object2ref(this));
+ try {
+ controller.update(path,function);
+ }
+ catch (Exception e) {
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "update", ApiRequestStatus.ERROR, duration_,path,function);
+ System.err.println("ERROR: " + e);
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.update, e.toString());
+ throw e;
+ }
+ ecomplogger.recordMetricEventEnd();
+ duration_ = new Date().getTime()-now_.getTime();
+ if (server != null)
+ server.getServer().recordApi(null, this, "update", ApiRequestStatus.OKAY, duration_,path,function);
+
+ }
+
+
+
+
+
+
+ public static void ecoreSetup() {
+ DcaeVirtualMachineManagerProvider.ecoreSetup();
+ }
+ public DcaeVirtualMachineManagerProvider getSomfProvider() {
+ return controller;
+ }
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerClient.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerClient.java
new file mode 100644
index 0000000..1030b1c
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerClient.java
@@ -0,0 +1,344 @@
+
+/*-
+ * ============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.dcae.controller.service.servers.vmmanager;
+
+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.openecomp.logger.EcompLogger;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+
+import org.openecomp.dcae.controller.service.vmmanager.impl.VirtualMachineManagerImpl;
+import org.openecomp.dcae.controller.service.vmmanager.VmmanagerPackage;
+import org.openecomp.dcae.controller.service.servers.vmmanager.logging.VirtualMachineManagerOperationEnum;
+import org.openecomp.dcae.controller.service.servers.vmmanager.logging.VirtualMachineManagerMessageEnum;
+
+
+
+
+
+
+@SuppressWarnings("unchecked")
+public class DcaeVirtualMachineManagerClient extends VirtualMachineManagerImpl {
+ public static final Logger logger = Logger.getLogger(DcaeVirtualMachineManagerClient.class);
+ static final EcompLogger ecomplogger = EcompLogger.getEcompLogger();
+ public AbstractClient client;
+
+ public DcaeVirtualMachineManagerClient(String file, String name) {
+ DcaeVirtualMachineManager.ecoreSetup();
+ client = new GenericHttpClient(file,name);
+ client.add("/resources", this);
+ }
+
+ public DcaeVirtualMachineManagerClient(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 DcaeVirtualMachineManagerClient(AbstractClient c) {
+ client = c;
+ client.add("/resources", this);
+ }
+
+
+
+ @Override
+ public org.openecomp.dcae.controller.core.service.HealthTestResponse test() {
+ EClass c = VmmanagerPackage.eINSTANCE.getVirtualMachineManager(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.REMOTE_test);
+ org.openecomp.dcae.controller.core.service.HealthTestResponse res;
+ try {
+ res = (org.openecomp.dcae.controller.core.service.HealthTestResponse) client.operationPath("/resources", c, "test", null);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.REMOTE_test, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@test: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+ return res;
+ }
+
+ @Override
+ public void suspend() {
+ EClass c = VmmanagerPackage.eINSTANCE.getVirtualMachineManager(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.REMOTE_suspend);
+
+ try {
+ client.operationPath("/resources", c, "suspend", null);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.REMOTE_suspend, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@suspend: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+ @Override
+ public void resume() {
+ EClass c = VmmanagerPackage.eINSTANCE.getVirtualMachineManager(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.REMOTE_resume);
+
+ try {
+ client.operationPath("/resources", c, "resume", null);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.REMOTE_resume, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@resume: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+ @Override
+ public java.lang.String publicKey() {
+ EClass c = VmmanagerPackage.eINSTANCE.getVirtualMachineManager(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.REMOTE_publicKey);
+ java.lang.String res;
+ try {
+ res = (java.lang.String) client.operationPath("/resources", c, "publicKey", null);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.REMOTE_publicKey, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@publicKey: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+ return res;
+ }
+
+ @Override
+ public void configurationChanged() {
+ EClass c = VmmanagerPackage.eINSTANCE.getVirtualMachineManager(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.REMOTE_configurationChanged);
+
+ try {
+ client.operationPath("/resources", c, "configurationChanged", null);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.REMOTE_configurationChanged, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@configurationChanged: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+ @Override
+ public void updateStreams(EList<org.openecomp.dcae.controller.core.stream.DcaeStream> inputStreams, EList<org.openecomp.dcae.controller.core.stream.DcaeStream> outputStreams) {
+ EClass c = VmmanagerPackage.eINSTANCE.getVirtualMachineManager(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.REMOTE_updateStreams);
+
+ try {
+ client.operationPath("/resources", c, "updateStreams", null, inputStreams,outputStreams);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.REMOTE_updateStreams, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@updateStreams: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+ @Override
+ public void logs(org.json.JSONObject cx, EList<org.openecomp.ncomp.core.logs.LogMessage> logs) {
+ EClass c = VmmanagerPackage.eINSTANCE.getVirtualMachineManager(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.REMOTE_logs);
+
+ try {
+ client.operationPath("/resources", c, "logs", cx != null && cx.has("timeout") ? cx.getLong("timeout") : null, cx,logs);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.REMOTE_logs, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@logs: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+ @Override
+ public void metrics(org.json.JSONObject cx, EList<org.openecomp.ncomp.core.metrics.Metric> metrics) {
+ EClass c = VmmanagerPackage.eINSTANCE.getVirtualMachineManager(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.REMOTE_metrics);
+
+ try {
+ client.operationPath("/resources", c, "metrics", cx != null && cx.has("timeout") ? cx.getLong("timeout") : null, cx,metrics);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.REMOTE_metrics, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@metrics: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+ @Override
+ public void properties(org.json.JSONObject cx, EList<org.openecomp.ncomp.sirius.manager.properties.AbstractProperty> l) {
+ EClass c = VmmanagerPackage.eINSTANCE.getVirtualMachineManager(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.REMOTE_properties);
+
+ try {
+ client.operationPath("/resources", c, "properties", cx != null && cx.has("timeout") ? cx.getLong("timeout") : null, cx,l);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.REMOTE_properties, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@properties: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+ @Override
+ public void uploadInfo(org.json.JSONObject cx, EList<org.openecomp.ncomp.sirius.manager.server.ManagementInfo> info) {
+ EClass c = VmmanagerPackage.eINSTANCE.getVirtualMachineManager(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.REMOTE_uploadInfo);
+
+ try {
+ client.operationPath("/resources", c, "uploadInfo", cx != null && cx.has("timeout") ? cx.getLong("timeout") : null, cx,info);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.REMOTE_uploadInfo, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@uploadInfo: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+ @Override
+ public EList<org.openecomp.ncomp.core.metrics.DoubleMetric> getValues(org.json.JSONObject cx, java.lang.String path, java.lang.Long start, java.lang.Long end, org.openecomp.ncomp.core.metrics.MetricValueOption option, boolean relativeInterval) {
+ EClass c = VmmanagerPackage.eINSTANCE.getVirtualMachineManager(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.REMOTE_getValues);
+ EList<org.openecomp.ncomp.core.metrics.DoubleMetric> res;
+ try {
+ res = (EList<org.openecomp.ncomp.core.metrics.DoubleMetric>) client.operationPath("/resources", c, "getValues", cx != null && cx.has("timeout") ? cx.getLong("timeout") : null, cx,path,start,end,option,relativeInterval);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.REMOTE_getValues, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@getValues: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+ return res;
+ }
+
+ @Override
+ public EList<org.openecomp.ncomp.core.metrics.DoubleMetric> getValuesAll(org.json.JSONObject cx, java.lang.String path, EList<java.lang.String> metrics, java.lang.Long start, java.lang.Long end, org.openecomp.ncomp.core.metrics.MetricValueOption option, boolean relativeInterval) {
+ EClass c = VmmanagerPackage.eINSTANCE.getVirtualMachineManager(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.REMOTE_getValuesAll);
+ EList<org.openecomp.ncomp.core.metrics.DoubleMetric> res;
+ try {
+ res = (EList<org.openecomp.ncomp.core.metrics.DoubleMetric>) client.operationPath("/resources", c, "getValuesAll", cx != null && cx.has("timeout") ? cx.getLong("timeout") : null, cx,path,metrics,start,end,option,relativeInterval);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.REMOTE_getValuesAll, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@getValuesAll: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+ return res;
+ }
+
+ @Override
+ public EList<org.openecomp.ncomp.core.logs.LogMessage> getMessages(org.json.JSONObject cx, java.lang.String path, java.lang.Long start, java.lang.Long end) {
+ EClass c = VmmanagerPackage.eINSTANCE.getVirtualMachineManager(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.REMOTE_getMessages);
+ EList<org.openecomp.ncomp.core.logs.LogMessage> res;
+ try {
+ res = (EList<org.openecomp.ncomp.core.logs.LogMessage>) client.operationPath("/resources", c, "getMessages", cx != null && cx.has("timeout") ? cx.getLong("timeout") : null, cx,path,start,end);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.REMOTE_getMessages, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@getMessages: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+ return res;
+ }
+
+ @Override
+ public org.openecomp.ncomp.sirius.manager.server.LoggerInfo getRequestLogger(java.lang.String userName, java.lang.String action, java.lang.String resourcePath, org.json.JSONObject context) {
+ EClass c = VmmanagerPackage.eINSTANCE.getVirtualMachineManager(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.REMOTE_getRequestLogger);
+ org.openecomp.ncomp.sirius.manager.server.LoggerInfo res;
+ try {
+ res = (org.openecomp.ncomp.sirius.manager.server.LoggerInfo) client.operationPath("/resources", c, "getRequestLogger", null, userName,action,resourcePath,context);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.REMOTE_getRequestLogger, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@getRequestLogger: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+ return res;
+ }
+
+ @Override
+ public EList<org.openecomp.ncomp.core.function.ValuePair> evaluate(java.lang.String path, org.openecomp.ncomp.core.function.Function function) {
+ EClass c = VmmanagerPackage.eINSTANCE.getVirtualMachineManager(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.REMOTE_evaluate);
+ EList<org.openecomp.ncomp.core.function.ValuePair> res;
+ try {
+ res = (EList<org.openecomp.ncomp.core.function.ValuePair>) client.operationPath("/resources", c, "evaluate", null, path,function);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.REMOTE_evaluate, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@evaluate: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+ return res;
+ }
+
+ @Override
+ public void update(java.lang.String path, org.openecomp.ncomp.core.function.Function function) {
+ EClass c = VmmanagerPackage.eINSTANCE.getVirtualMachineManager(); //foo
+ ecomplogger.recordMetricEventStart();
+ ecomplogger.setOperation(VirtualMachineManagerOperationEnum.REMOTE_update);
+
+ try {
+ client.operationPath("/resources", c, "update", null, path,function);
+ }
+ catch (Exception e) {
+ ecomplogger.warn(VirtualMachineManagerMessageEnum.REMOTE_update, e.toString());
+ throw new RuntimeException("remote call failed: " + client.getRemote() + "@update: " + e);
+ }
+ ecomplogger.recordMetricEventEnd();
+
+ }
+
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerConsole.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerConsole.java
new file mode 100644
index 0000000..585fcec
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerConsole.java
@@ -0,0 +1,233 @@
+
+/*-
+ * ============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.dcae.controller.service.servers.vmmanager;
+
+
+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 DcaeVirtualMachineManagerConsole extends Console {
+ public static final Logger logger = Logger.getLogger(DcaeVirtualMachineManagerConsole.class);
+ protected DcaeVirtualMachineManagerClient controller;
+
+
+
+
+ public DcaeVirtualMachineManagerConsole(String filename, String name) {
+ super(filename, name);
+ controller = new DcaeVirtualMachineManagerClient(filename,name);
+ client = controller.client;
+
+ }
+
+ public DcaeVirtualMachineManagerConsole(AbstractClient c) {
+ controller = new DcaeVirtualMachineManagerClient(c);
+ client = controller.client;
+ }
+
+
+ public org.openecomp.dcae.controller.core.service.HealthTestResponse test() {
+ org.openecomp.dcae.controller.core.service.HealthTestResponse res = null;
+ try {
+ res = controller.test();
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+ return res;
+ }
+
+ public void suspend() {
+
+ try {
+ controller.suspend();
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void resume() {
+
+ try {
+ controller.resume();
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public java.lang.String publicKey() {
+ java.lang.String res = null;
+ try {
+ res = controller.publicKey();
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+ return res;
+ }
+
+ public void configurationChanged() {
+
+ try {
+ controller.configurationChanged();
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void updateStreams(EList<org.openecomp.dcae.controller.core.stream.DcaeStream> inputStreams, EList<org.openecomp.dcae.controller.core.stream.DcaeStream> outputStreams) {
+
+ try {
+ controller.updateStreams(inputStreams,outputStreams);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void logs(EList<org.openecomp.ncomp.core.logs.LogMessage> logs) {
+
+ try {
+ controller.logs(null,logs);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void metrics(EList<org.openecomp.ncomp.core.metrics.Metric> metrics) {
+
+ try {
+ controller.metrics(null,metrics);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void properties(EList<org.openecomp.ncomp.sirius.manager.properties.AbstractProperty> l) {
+
+ try {
+ controller.properties(null,l);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public void uploadInfo(EList<org.openecomp.ncomp.sirius.manager.server.ManagementInfo> info) {
+
+ try {
+ controller.uploadInfo(null,info);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+ public EList<org.openecomp.ncomp.core.metrics.DoubleMetric> getValues(java.lang.String path, java.lang.Long start, java.lang.Long end, org.openecomp.ncomp.core.metrics.MetricValueOption option, boolean relativeInterval) {
+ EList<org.openecomp.ncomp.core.metrics.DoubleMetric> res = null;
+ try {
+ res = controller.getValues(null,path,start,end,option,relativeInterval);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+ return res;
+ }
+
+ public EList<org.openecomp.ncomp.core.metrics.DoubleMetric> getValuesAll(java.lang.String path, EList<java.lang.String> metrics, java.lang.Long start, java.lang.Long end, org.openecomp.ncomp.core.metrics.MetricValueOption option, boolean relativeInterval) {
+ EList<org.openecomp.ncomp.core.metrics.DoubleMetric> res = null;
+ try {
+ res = controller.getValuesAll(null,path,metrics,start,end,option,relativeInterval);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+ return res;
+ }
+
+ public EList<org.openecomp.ncomp.core.logs.LogMessage> getMessages(java.lang.String path, java.lang.Long start, java.lang.Long end) {
+ EList<org.openecomp.ncomp.core.logs.LogMessage> res = null;
+ try {
+ res = controller.getMessages(null,path,start,end);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+ return res;
+ }
+
+ public org.openecomp.ncomp.sirius.manager.server.LoggerInfo getRequestLogger(java.lang.String userName, java.lang.String action, java.lang.String resourcePath, org.json.JSONObject context) {
+ org.openecomp.ncomp.sirius.manager.server.LoggerInfo res = null;
+ try {
+ res = controller.getRequestLogger(userName,action,resourcePath,context);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+ return res;
+ }
+
+ public EList<org.openecomp.ncomp.core.function.ValuePair> evaluate(java.lang.String path, org.openecomp.ncomp.core.function.Function function) {
+ EList<org.openecomp.ncomp.core.function.ValuePair> res = null;
+ try {
+ res = controller.evaluate(path,function);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+ return res;
+ }
+
+ public void update(java.lang.String path, org.openecomp.ncomp.core.function.Function function) {
+
+ try {
+ controller.update(path,function);
+ }
+ catch (ManagementServerError e) {
+ System.err.println("ERROR: " + e.getJson().toString(2));
+ }
+
+ }
+
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerProviderTemplate.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerProviderTemplate.java
new file mode 100644
index 0000000..bc197dd
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerProviderTemplate.java
@@ -0,0 +1,108 @@
+
+/*-
+ * ============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.dcae.controller.service.servers.vmmanager;
+
+
+
+
+
+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 java.util.Date;
+
+
+import org.openecomp.ncomp.sirius.manager.server.LoggerInfo;
+
+
+import org.openecomp.ncomp.sirius.manager.server.ServerFactory;
+
+
+import org.openecomp.ncomp.sirius.manager.BasicManagementServerProvider;
+
+
+import org.openecomp.dcae.controller.service.vmmanager.impl.VirtualMachineManagerImpl;
+import org.openecomp.dcae.controller.service.vmmanager.VirtualMachineManager;
+
+
+public class DcaeVirtualMachineManagerProviderTemplate extends BasicManagementServerProvider {
+ private static final Logger logger = Logger.getLogger(DcaeVirtualMachineManagerProviderTemplate.class);
+ VirtualMachineManager o;
+
+ public DcaeVirtualMachineManagerProviderTemplate(ISiriusServer controller, VirtualMachineManager o) {
+ super(controller, o);
+ this.o = o;
+ }
+
+ public org.openecomp.dcae.controller.core.service.HealthTestResponse test() {
+ org.openecomp.dcae.controller.core.service.HealthTestResponse res = null;
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void suspend() {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void resume() {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public java.lang.String publicKey() {
+ java.lang.String res = null;
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void configurationChanged() {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+ public void updateStreams(EList<org.openecomp.dcae.controller.core.stream.DcaeStream> inputStreams, EList<org.openecomp.dcae.controller.core.stream.DcaeStream> outputStreams) {
+
+ // TODO IMPLEMENT
+ throw new UnsupportedOperationException();
+ }
+
+
+
+
+
+
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerServer.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerServer.java
new file mode 100644
index 0000000..b769ee8
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVirtualMachineManagerServer.java
@@ -0,0 +1,98 @@
+
+/*-
+ * ============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.dcae.controller.service.servers.vmmanager;
+
+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.entity.EcompComponent;
+import org.openecomp.entity.EcompSubComponent;
+import org.openecomp.entity.EcompSubComponentInstance;
+import org.openecomp.ncomp.sirius.manager.Jetty8Server;
+import org.openecomp.ncomp.sirius.manager.ManagementServer;
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+
+import org.openecomp.dcae.controller.service.vmmanager.VirtualMachineManager;
+
+
+
+
+
+
+public class DcaeVirtualMachineManagerServer implements ISiriusServer {
+ public static final Logger logger = Logger.getLogger(DcaeVirtualMachineManagerServer.class);
+ String serverPath;
+ ManagementServer server;
+ DcaeVirtualMachineManager controller;
+ String directory = "data";
+// LocationControllerApi api ;
+ Jetty8Server webServer;
+ DcaeVmmanagerFactory f = new DcaeVmmanagerFactory(this);
+
+
+
+ public DcaeVirtualMachineManagerServer(String filename) throws IOException {
+ logger.warn("controller restarting");
+ DcaeVirtualMachineManager.ecoreSetup();
+ props = getPropertiesFromClasspath(filename);
+ serverPath = (String) props.get("server.dir");
+ server = new ManagementServer(f, "VirtualMachineManager", serverPath, filename);
+ server.addFactory(f);
+
+ server.addRuntimeFactories(this);
+ server.start();
+ }
+ public void runWebserver() throws IOException {
+ controller = (DcaeVirtualMachineManager) server.find("/").o;
+ webServer = new Jetty8Server("vmmanager.properties");
+ webServer.add("/resources",server);
+
+
+
+
+
+ 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"));
+
+ DcaeVirtualMachineManagerServer s = new DcaeVirtualMachineManagerServer("vmmanager.properties");
+ s.runWebserver();
+ }
+ public VirtualMachineManager getController() {
+ return controller;
+ }
+ public ManagementServer getServer() {
+ return server;
+ }
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVmmanagerFactory.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVmmanagerFactory.java
new file mode 100644
index 0000000..99d954b
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/DcaeVmmanagerFactory.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.dcae.controller.service.servers.vmmanager;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.apache.log4j.Logger;
+
+import org.openecomp.ncomp.sirius.manager.ISiriusServer;
+
+import org.openecomp.dcae.controller.service.vmmanager.VirtualMachineManager;
+import org.openecomp.dcae.controller.service.vmmanager.VmmanagerPackage;
+import org.openecomp.dcae.controller.service.vmmanager.impl.VmmanagerFactoryImpl;
+
+
+
+
+
+public class DcaeVmmanagerFactory extends VmmanagerFactoryImpl {
+ public static final Logger logger = Logger.getLogger(DcaeVmmanagerFactory.class);
+ ISiriusServer server = null;
+ @Override
+ public EPackage getEPackage() { return VmmanagerPackage.eINSTANCE; }
+ public DcaeVmmanagerFactory(ISiriusServer server) {
+ this.server = server;
+ }
+ @Override
+ public VirtualMachineManager createVirtualMachineManager() {
+ return new DcaeVirtualMachineManager(server);
+ }
+
+
+
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/logging/VirtualMachineManager.properties b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/logging/VirtualMachineManager.properties
new file mode 100644
index 0000000..9eb6331
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/logging/VirtualMachineManager.properties
@@ -0,0 +1,198 @@
+
+dummy=\
+ null|\
+ null|\
+ null|\
+ null
+
+test=\
+ test-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+suspend=\
+ suspend-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+resume=\
+ resume-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+publicKey=\
+ publicKey-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+configurationChanged=\
+ configurationChanged-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+updateStreams=\
+ updateStreams-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+logs=\
+ logs-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+metrics=\
+ metrics-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+properties=\
+ properties-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+uploadInfo=\
+ uploadInfo-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+getValues=\
+ getValues-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+getValuesAll=\
+ getValuesAll-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+getMessages=\
+ getMessages-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+getRequestLogger=\
+ getRequestLogger-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+evaluate=\
+ evaluate-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+update=\
+ update-FAILED-5001W|\
+ {0}|\
+ null|\
+ Operation Failed with Exception
+
+REMOTE_test=\
+ REMOTE-test-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_suspend=\
+ REMOTE-suspend-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_resume=\
+ REMOTE-resume-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_publicKey=\
+ REMOTE-publicKey-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_configurationChanged=\
+ REMOTE-configurationChanged-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_updateStreams=\
+ REMOTE-updateStreams-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_logs=\
+ REMOTE-logs-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_metrics=\
+ REMOTE-metrics-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_properties=\
+ REMOTE-properties-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_uploadInfo=\
+ REMOTE-uploadInfo-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_getValues=\
+ REMOTE-getValues-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_getValuesAll=\
+ REMOTE-getValuesAll-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_getMessages=\
+ REMOTE-getMessages-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_getRequestLogger=\
+ REMOTE-getRequestLogger-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_evaluate=\
+ REMOTE-evaluate-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
+
+REMOTE_update=\
+ REMOTE-update-FAILED-5001W|\
+ {0}|\
+ null|\
+ Remote Operation Failed with Exception
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/logging/VirtualMachineManagerMessageEnum.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/logging/VirtualMachineManagerMessageEnum.java
new file mode 100644
index 0000000..f8087ef
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/logging/VirtualMachineManagerMessageEnum.java
@@ -0,0 +1,67 @@
+
+/*-
+ * ============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.dcae.controller.service.servers.vmmanager.logging;
+
+import com.att.eelf.i18n.EELFResourceManager;
+import org.openecomp.logger.EcompMessageEnum;
+
+public enum VirtualMachineManagerMessageEnum implements EcompMessageEnum {
+
+ dummy,
+ test,
+ suspend,
+ resume,
+ publicKey,
+ configurationChanged,
+ updateStreams,
+ logs,
+ metrics,
+ properties,
+ uploadInfo,
+ getValues,
+ getValuesAll,
+ getMessages,
+ getRequestLogger,
+ evaluate,
+ update,
+ REMOTE_test,
+ REMOTE_suspend,
+ REMOTE_resume,
+ REMOTE_publicKey,
+ REMOTE_configurationChanged,
+ REMOTE_updateStreams,
+ REMOTE_logs,
+ REMOTE_metrics,
+ REMOTE_properties,
+ REMOTE_uploadInfo,
+ REMOTE_getValues,
+ REMOTE_getValuesAll,
+ REMOTE_getMessages,
+ REMOTE_getRequestLogger,
+ REMOTE_evaluate,
+ REMOTE_update;
+
+ static {
+ EELFResourceManager.loadMessageBundle("org.openecomp.dcae.controller.service.servers.vmmanager.logging.VirtualMachineManager");
+ }
+}
diff --git a/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/logging/VirtualMachineManagerOperationEnum.java b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/logging/VirtualMachineManagerOperationEnum.java
new file mode 100644
index 0000000..71aeeda
--- /dev/null
+++ b/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/vmmanager/logging/VirtualMachineManagerOperationEnum.java
@@ -0,0 +1,61 @@
+
+/*-
+ * ============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.dcae.controller.service.servers.vmmanager.logging;
+
+import org.openecomp.entity.EcompOperationEnum;
+
+public enum VirtualMachineManagerOperationEnum implements EcompOperationEnum {
+
+ test,
+ suspend,
+ resume,
+ publicKey,
+ configurationChanged,
+ updateStreams,
+ logs,
+ metrics,
+ properties,
+ uploadInfo,
+ getValues,
+ getValuesAll,
+ getMessages,
+ getRequestLogger,
+ evaluate,
+ update,
+ REMOTE_test,
+ REMOTE_suspend,
+ REMOTE_resume,
+ REMOTE_publicKey,
+ REMOTE_configurationChanged,
+ REMOTE_updateStreams,
+ REMOTE_logs,
+ REMOTE_metrics,
+ REMOTE_properties,
+ REMOTE_uploadInfo,
+ REMOTE_getValues,
+ REMOTE_getValuesAll,
+ REMOTE_getMessages,
+ REMOTE_getRequestLogger,
+ REMOTE_evaluate,
+ REMOTE_update;
+}