summaryrefslogtreecommitdiffstats
path: root/controlloop/common/model-impl/vfc/src/test/java
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/src/test/java
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/src/test/java')
-rw-r--r--controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestDemo.java84
1 files changed, 84 insertions, 0 deletions
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);
+
+ }
+}