From 1c4fcf40b4cd33454bb57bde1e82a3819cb6ccff Mon Sep 17 00:00:00 2001 From: Ritu Sood Date: Wed, 23 Aug 2017 07:52:20 -0700 Subject: 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 --- .../test/java/org/onap/policy/vfc/TestDemo.java | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestDemo.java (limited to 'controlloop/common/model-impl/vfc/src/test') 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); + + } +} -- cgit 1.2.3-korg