summaryrefslogtreecommitdiffstats
path: root/controlloop/common/model-impl/vfc
diff options
context:
space:
mode:
authorRitu Sood <ritu.sood@intel.com>2017-08-23 07:52:20 -0700
committerRitu Sood <ritu.sood@intel.com>2017-08-24 06:33:57 -0700
commit1c4fcf40b4cd33454bb57bde1e82a3819cb6ccff (patch)
tree1e0ea36076cf9249c2a66ef9eb3d331b10cb9493 /controlloop/common/model-impl/vfc
parent945627aef4645a9a696aeb2150669e43aae9f98a (diff)
Add VFC integration code
This patch adds VFC Actor code and updates drool template for VFC. This is WIP patch. There are two opens for this patch that are still in discussion 1) AA&I fields in onset event 2) VFC URL, username and password Issue-ID: POLICY-57 Change-Id: Idc1d1fada295fa1c2e563ba37dd359f7b5c59f87 Signed-off-by: Ritu Sood <ritu.sood@intel.com>
Diffstat (limited to 'controlloop/common/model-impl/vfc')
-rw-r--r--controlloop/common/model-impl/vfc/pom.xml49
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealActionVmInfo.java40
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealAdditionalParams.java39
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealRequest.java42
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java107
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java38
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponse.java38
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseDescriptor.java50
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseHistoryList.java36
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java30
-rw-r--r--controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestDemo.java84
11 files changed, 553 insertions, 0 deletions
diff --git a/controlloop/common/model-impl/vfc/pom.xml b/controlloop/common/model-impl/vfc/pom.xml
new file mode 100644
index 000000000..db86345e8
--- /dev/null
+++ b/controlloop/common/model-impl/vfc/pom.xml
@@ -0,0 +1,49 @@
+<!--
+ ============LICENSE_START=======================================================
+ Copyright (C) 2017 Intel Corp. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>vfc</artifactId>
+
+ <parent>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>model-impl</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>rest</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealActionVmInfo.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealActionVmInfo.java
new file mode 100644
index 000000000..b2535e3af
--- /dev/null
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealActionVmInfo.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2017 Intel Corp. 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.onap.policy.vfc;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+import com.google.gson.annotations.SerializedName;
+
+public class VFCHealActionVmInfo implements Serializable {
+
+ private static final long serialVersionUID = 3208673205100673119L;
+
+ @SerializedName("vmid")
+ public String vmid;
+
+ @SerializedName("vmname")
+ public String vmname;
+
+
+ public VFCHealActionVmInfo() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealAdditionalParams.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealAdditionalParams.java
new file mode 100644
index 000000000..a65ad8aac
--- /dev/null
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealAdditionalParams.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2017 Intel Corp. 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.onap.policy.vfc;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+import com.google.gson.annotations.SerializedName;
+
+public class VFCHealAdditionalParams implements Serializable {
+
+ private static final long serialVersionUID = 2656694137285096191L;
+
+ @SerializedName("action")
+ public String action;
+
+ @SerializedName("actionvminfo")
+ public VFCHealActionVmInfo actionInfo;
+
+ public VFCHealAdditionalParams() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealRequest.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealRequest.java
new file mode 100644
index 000000000..f7fc891c0
--- /dev/null
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealRequest.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2017 Intel Corp. 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.onap.policy.vfc;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+import com.google.gson.annotations.SerializedName;
+
+public class VFCHealRequest implements Serializable {
+
+ private static final long serialVersionUID = -7341931593089709247L;
+
+ @SerializedName("vnfInstanceId")
+ public String vnfInstanceId;
+
+ @SerializedName("cause")
+ public String cause;
+
+ @SerializedName("additionalParams")
+ public VFCHealAdditionalParams additionalParams;
+
+ public VFCHealRequest() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java
new file mode 100644
index 000000000..44f9905b2
--- /dev/null
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2017 Intel Corp. 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.onap.policy.vfc;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.onap.policy.vfc.util.Serialization;
+import org.onap.policy.rest.RESTManager;
+import org.onap.policy.rest.RESTManager.Pair;
+
+import com.google.gson.JsonSyntaxException;
+
+public final class VFCManager implements Runnable {
+
+ private String vfcUrlBase;
+ private String username;
+ private String password;
+ private VFCRequest vfcRequest;
+
+ public VFCManager(VFCRequest request) {
+ vfcRequest = request;
+ // TODO: Get base URL, username and password from MSB?
+ // TODO: Following code is a placeholder, needs to be updated
+ setVFCParams("https://", "vfc", "vfc");
+
+ }
+
+ public void setVFCParams(String baseUrl, String name, String pwd) {
+ vfcUrlBase = baseUrl + "/api/nslcm/v1";
+ username = name;
+ password = pwd;
+ }
+
+ @Override
+ public void run() {
+
+ Map<String, String> headers = new HashMap<String, String>();
+ headers.put("Accept", "application/json");
+
+ String vfcUrl = vfcUrlBase + "/ns/" + vfcRequest.nsInstanceId + "/heal";
+ Pair<Integer, String> httpDetails = RESTManager.post(vfcUrl, username, password, headers,
+ "application/json", Serialization.gsonPretty.toJson(vfcRequest));
+
+ if (httpDetails == null) {
+ return;
+ }
+
+ if (httpDetails.a == 202) {
+ try {
+ VFCResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, VFCResponse.class);
+
+ String body = Serialization.gsonPretty.toJson(response);
+ System.out.println("Response to VFC Heal post:");
+ System.out.println(body);
+
+ String jobId = response.jobId;
+ int attemptsLeft = 20;
+
+ String urlGet = vfcUrlBase + "/jobs/" + jobId;
+ VFCResponse responseGet = null;
+
+ while (attemptsLeft-- > 0) {
+
+ Pair<Integer, String> httpDetailsGet = RESTManager.get(urlGet, username, password, headers);
+ responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.b, VFCResponse.class);
+ body = Serialization.gsonPretty.toJson(responseGet);
+ System.out.println("Response to VFC Heal get:");
+ System.out.println(body);
+
+ if (httpDetailsGet.a == 200) {
+ if (responseGet.responseDescriptor.status.equalsIgnoreCase("finished") ||
+ responseGet.responseDescriptor.status.equalsIgnoreCase("error")) {
+ System.out.println("VFC Heal Status " + responseGet.responseDescriptor.status);
+ break;
+ }
+ }
+ Thread.sleep(20000);
+ }
+ if (attemptsLeft <= 0)
+ System.out.println("VFC timeout. Status: (" + responseGet.responseDescriptor.status + ")");
+ } catch (JsonSyntaxException e) {
+ System.err.println("Failed to deserialize into VFCResponse" + e.getLocalizedMessage());
+ } catch (InterruptedException e) {
+ System.err.println("Interrupted exception: " + e.getLocalizedMessage());
+ }
+ } else {
+ System.out.println("VFC Heal Restcall failed");
+ }
+ }
+}
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java
new file mode 100644
index 000000000..a45a62dfa
--- /dev/null
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2017 Intel Corp. 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.onap.policy.vfc;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+import com.google.gson.annotations.SerializedName;
+
+public class VFCRequest implements Serializable {
+
+ private static final long serialVersionUID = 3736300970326332512L;
+ // This field is not serialized and not part of JSON
+ public transient String nsInstanceId;
+
+ @SerializedName("healVnfData")
+ public VFCHealRequest healRequest;
+
+ public VFCRequest() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponse.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponse.java
new file mode 100644
index 000000000..775d78f1d
--- /dev/null
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponse.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2017 Intel Corp. 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.onap.policy.vfc;
+
+import java.io.Serializable;
+
+import com.google.gson.annotations.SerializedName;
+
+public class VFCResponse implements Serializable {
+
+ private static final long serialVersionUID = 9151443891238218455L;
+
+ @SerializedName("jobId")
+ public String jobId;
+
+ @SerializedName("responseDescriptor")
+ VFCResponseDescriptor responseDescriptor;
+
+ public VFCResponse() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseDescriptor.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseDescriptor.java
new file mode 100644
index 000000000..f156fa0d0
--- /dev/null
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseDescriptor.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2017 Intel Corp. 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.onap.policy.vfc;
+
+import java.io.Serializable;
+
+import com.google.gson.annotations.SerializedName;
+
+public class VFCResponseDescriptor implements Serializable {
+
+ private static final long serialVersionUID = 6827782899144150158L;
+
+ @SerializedName("progress")
+ public String progress;
+
+ @SerializedName("status")
+ String status;
+
+ @SerializedName("statusDescription")
+ String statusDescription;
+
+ @SerializedName("errorCode")
+ String errorCode;
+
+ @SerializedName("responseId")
+ String responseId;
+
+ @SerializedName("responseHistoryList")
+ VFCResponseHistoryList responseHistoryList;
+
+ public VFCResponseDescriptor() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseHistoryList.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseHistoryList.java
new file mode 100644
index 000000000..3fe62ea25
--- /dev/null
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseHistoryList.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2017 Intel Corp. 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.onap.policy.vfc;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+public class VFCResponseHistoryList implements Serializable {
+
+ private static final long serialVersionUID = 3340914325806649762L;
+
+ public List<VFCResponseDescriptor> responseDescriptorList= new LinkedList<>();
+
+ public VFCResponseHistoryList() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java
new file mode 100644
index 000000000..655085288
--- /dev/null
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2017 Intel Corp. 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.onap.policy.vfc.util;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+public final class Serialization {
+
+ final static public Gson gsonPretty = new GsonBuilder().disableHtmlEscaping()
+ .setPrettyPrinting()
+ .create();
+
+}
diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestDemo.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestDemo.java
new file mode 100644
index 000000000..7e8c212e1
--- /dev/null
+++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestDemo.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2017 Intel Corp. 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.onap.policy.vfc;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.onap.policy.vfc.VFCRequest;
+import org.onap.policy.vfc.VFCHealRequest;
+import org.onap.policy.vfc.VFCHealAdditionalParams;
+import org.onap.policy.vfc.VFCHealActionVmInfo;
+import org.onap.policy.vfc.VFCResponse;
+import org.onap.policy.vfc.VFCResponseDescriptor;
+import org.onap.policy.vfc.VFCResponseHistoryList;
+import org.junit.Test;
+import org.onap.policy.vfc.util.Serialization;
+
+public class TestDemo {
+
+ @Test
+ public void test() {
+ VFCRequest request = new VFCRequest();
+
+ request.nsInstanceId = "100";
+ request.healRequest = new VFCHealRequest();
+ request.healRequest.vnfInstanceId = "1";
+ request.healRequest.cause = "vm is down";
+
+ request.healRequest.additionalParams = new VFCHealAdditionalParams();
+ request.healRequest.additionalParams.action = "restartvm";
+
+ request.healRequest.additionalParams.actionInfo = new VFCHealActionVmInfo();
+ request.healRequest.additionalParams.actionInfo.vmid = "33";
+ request.healRequest.additionalParams.actionInfo.vmname = "xgw-smp11";
+
+ String body = Serialization.gsonPretty.toJson(request);
+ System.out.println(body);
+
+ VFCResponse response = new VFCResponse();
+ response.jobId = "1";
+
+ body = Serialization.gsonPretty.toJson(response);
+ System.out.println(body);
+
+ response.responseDescriptor = new VFCResponseDescriptor();
+ response.responseDescriptor.progress = "40";
+ response.responseDescriptor.status = "processing";
+ response.responseDescriptor.statusDescription = "OMC VMs are decommissioned in VIM";
+ response.responseDescriptor.errorCode = null;
+ response.responseDescriptor.responseId = "42";
+ body = Serialization.gsonPretty.toJson(response);
+ System.out.println(body);
+
+ VFCResponseDescriptor responseDescriptor = new VFCResponseDescriptor();
+ responseDescriptor.progress = "20";
+ responseDescriptor.status = "processing";
+ responseDescriptor.statusDescription = "OMC VMs are decommissioned in VIM";
+ responseDescriptor.errorCode = null;
+ responseDescriptor.responseId = "11";
+
+ response.responseDescriptor.responseHistoryList = new VFCResponseHistoryList();
+ response.responseDescriptor.responseHistoryList.responseDescriptorList.add(responseDescriptor);
+
+ body = Serialization.gsonPretty.toJson(response);
+ System.out.println(body);
+
+ }
+}