diff options
Diffstat (limited to 'adapters')
34 files changed, 1610 insertions, 57 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java index 012c560689..47ff6c1b5f 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java @@ -1330,13 +1330,13 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ logger.debug("Parameter: {} is of type {}", key, type); if ("string".equalsIgnoreCase(type)) { // Easiest! - String str = inputs.get(key).toString(); + String str = inputs.get(key) != null ? inputs.get(key).toString() : null; if (alias) newInputs.put(realName, str); else newInputs.put(key, str); } else if ("number".equalsIgnoreCase(type)) { - String integerString = inputs.get(key).toString(); + String integerString = inputs.get(key) != null ? inputs.get(key).toString() : null; Integer anInteger = null; try { anInteger = Integer.parseInt(integerString); @@ -1375,7 +1375,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ else newInputs.put(key, json); } else if ("comma_delimited_list".equalsIgnoreCase(type)) { - String commaSeparated = inputs.get(key).toString(); + String commaSeparated = inputs.get(key) != null ? inputs.get(key).toString() : null; try { List<String> anArrayList = this.convertCdlToArrayList(commaSeparated); if (alias) @@ -1390,7 +1390,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ newInputs.put(key, commaSeparated); } } else if ("boolean".equalsIgnoreCase(type)) { - String booleanString = inputs.get(key).toString(); + String booleanString = inputs.get(key) != null ? inputs.get(key).toString() : null; Boolean aBool = Boolean.valueOf(booleanString); if (alias) newInputs.put(realName, aBool); diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java index 70617fda4a..8469ad506c 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 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========================================================= + */ + /* * ============LICENSE_START========================================== * ONAP - SO diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsUnitTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsUnitTest.java index 66d6f59e79..9edc805cf3 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsUnitTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsUnitTest.java @@ -1,12 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 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.onap.so.openstack.utils; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; @@ -71,6 +95,99 @@ public class MsoHeatUtilsUnitTest { JSONAssert.assertEquals(getJson("free-form.json"), mapper.writeValueAsString(output.get("my-json-escaped")), false); } + @Test + public final void convertInputMapValuesTest() { + MsoHeatUtils utils = new MsoHeatUtils(); + Map<String, Object> inputs = new HashMap<>(); + Set<HeatTemplateParam> params = new HashSet<>(); + HeatTemplate ht = new HeatTemplate(); + HeatTemplateParam htp = new HeatTemplateParam(); + htp.setParamName("vnf_name"); + htp.setParamType("string"); + params.add(htp); + inputs.put("vnf_name", "a_vnf_name"); + htp = new HeatTemplateParam(); + htp.setParamName("image_size"); + htp.setParamType("number"); + params.add(htp); + inputs.put("image_size", "1024"); + htp = new HeatTemplateParam(); + htp.setParamName("external"); + htp.setParamType("boolean"); + params.add(htp); + inputs.put("external", "false"); + htp = new HeatTemplateParam(); + htp.setParamName("oam_ips"); + htp.setParamType("comma_delimited_list"); + params.add(htp); + inputs.put("oam_ips", "a,b"); + htp = new HeatTemplateParam(); + htp.setParamName("oam_prefixes"); + htp.setParamType("json"); + params.add(htp); + String jsonEscInput = "[{\"prefix\": \"aValue\"}, {\"prefix\": \"aValue2\"}]"; + inputs.put("oam_prefixes", jsonEscInput); + ht.setParameters(params); + + Map<String, Object> output = utils.convertInputMap(inputs, ht); + + assertEquals("a_vnf_name", output.get("vnf_name")); + assertEquals(1024, output.get("image_size")); + assertEquals(false, output.get("external")); + List<String> cdl = new ArrayList<>(); + cdl.add(0, "a"); + cdl.add(1, "b"); + assertEquals(cdl, output.get("oam_ips")); + ObjectMapper JSON_MAPPER = new ObjectMapper(); + JsonNode jn = null; + try { + jn = JSON_MAPPER.readTree(jsonEscInput); + } catch (Exception e) { + } + assertEquals(jn, output.get("oam_prefixes")); + } + + @Test + public final void convertInputMapNullsTest() { + MsoHeatUtils utils = new MsoHeatUtils(); + Map<String, Object> inputs = new HashMap<>(); + Set<HeatTemplateParam> params = new HashSet<>(); + HeatTemplate ht = new HeatTemplate(); + HeatTemplateParam htp = new HeatTemplateParam(); + htp.setParamName("vnf_name"); + htp.setParamType("string"); + params.add(htp); + inputs.put("vnf_name", null); + htp = new HeatTemplateParam(); + htp.setParamName("image_size"); + htp.setParamType("number"); + params.add(htp); + inputs.put("image_size", null); + htp = new HeatTemplateParam(); + htp.setParamName("external"); + htp.setParamType("boolean"); + params.add(htp); + inputs.put("external", null); + htp = new HeatTemplateParam(); + htp.setParamName("oam_ips"); + htp.setParamType("comma_delimited_list"); + params.add(htp); + inputs.put("oam_ips", null); + htp = new HeatTemplateParam(); + htp.setParamName("oam_prefixes"); + htp.setParamType("json"); + params.add(htp); + inputs.put("oam_prefixes", null); + ht.setParameters(params); + + Map<String, Object> output = utils.convertInputMap(inputs, ht); + + assertNull(output.get("vnf_name")); + assertNull(output.get("image_size")); + assertEquals(false, output.get("external")); + assertNull(output.get("oam_ips")); + assertNull(output.get("oam_prefixes")); + } private String getJson(String filename) throws IOException { return new String(Files.readAllBytes(Paths.get("src/test/resources/__files/MsoHeatUtils/" + filename))); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java index c62dc0dfbf..a136ff778d 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java @@ -23,9 +23,14 @@ package org.onap.so.adapters.vnfrest; import java.util.HashMap; import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.mappers.MapAdapter; import com.fasterxml.jackson.annotation.JsonRootName; @@ -35,6 +40,7 @@ import com.fasterxml.jackson.annotation.JsonRootName; */ @JsonRootName("createVfModuleRequest") @XmlRootElement(name = "createVfModuleRequest") +@XmlAccessorType(XmlAccessType.FIELD) public class CreateVfModuleRequest extends VfRequestCommon { private String cloudSiteId; private String tenantId; @@ -57,7 +63,7 @@ public class CreateVfModuleRequest extends VfRequestCommon { private Boolean failIfExists = false; private Boolean backout = true; private Boolean enableBridge; - + @XmlJavaTypeAdapter(MapAdapter.class) private Map<String, Object> vfModuleParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java index 214abd4e9d..d402004d57 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java @@ -24,14 +24,19 @@ package org.onap.so.adapters.vnfrest; import java.util.HashMap; import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.mappers.MapAdapter; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("createVolumeGroupRequest") @XmlRootElement(name = "createVolumeGroupRequest") +@XmlAccessorType(XmlAccessType.FIELD) public class CreateVolumeGroupRequest extends VfRequestCommon { private String cloudSiteId; private String tenantId; @@ -41,6 +46,7 @@ public class CreateVolumeGroupRequest extends VfRequestCommon { private String vnfVersion; private String vfModuleType; private String modelCustomizationUuid; + @XmlJavaTypeAdapter(MapAdapter.class) private Map<String,Object> volumeGroupParams = new HashMap<>(); private Boolean failIfExists; private Boolean enableBridge; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java index 1c7696a79b..bac9eae2c5 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java @@ -24,14 +24,19 @@ package org.onap.so.adapters.vnfrest; import java.util.HashMap; import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.mappers.MapAdapter; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("updateVfModuleRequest") @XmlRootElement(name = "updateVfModuleRequest") +@XmlAccessorType(XmlAccessType.FIELD) public class UpdateVfModuleRequest extends VfRequestCommon { private String cloudSiteId; @@ -57,7 +62,8 @@ public class UpdateVfModuleRequest extends VfRequestCommon { private String requestType; private Boolean failIfExists; private Boolean backout; - + + @XmlJavaTypeAdapter(MapAdapter.class) private Map<String,Object> vfModuleParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java index 8ddef1eeaf..d3b685a1d0 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java @@ -24,14 +24,19 @@ package org.onap.so.adapters.vnfrest; import java.util.HashMap; import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.mappers.MapAdapter; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("updateVolumeGroupRequest") @XmlRootElement(name = "updateVolumeGroupRequest") +@XmlAccessorType(XmlAccessType.FIELD) public class UpdateVolumeGroupRequest extends VfRequestCommon { private String cloudSiteId; private String tenantId; @@ -41,6 +46,7 @@ public class UpdateVolumeGroupRequest extends VfRequestCommon { private String vnfVersion; private String vfModuleType; private String modelCustomizationUuid; + @XmlJavaTypeAdapter(MapAdapter.class) private Map<String,Object> volumeGroupParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java new file mode 100644 index 0000000000..e816646e1c --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 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.onap.so.openstack.mappers; + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.bind.annotation.adapters.XmlAdapter; + +import org.w3c.dom.Element; + +public class MapAdapter extends XmlAdapter<MapEntry, Map<String, Object>> { + + @Override + public MapEntry marshal(Map<String, Object> v) throws Exception { + + if (v == null || v.isEmpty()) {return null;} + + MapEntry map = new MapEntry(); + + for (String key : v.keySet()) { + map.addEntry(key, v.get(key)); + } + + return map; + } + + @Override + public Map<String, Object> unmarshal(MapEntry v) throws Exception { + if (v == null) {return null;} + + Map<String, Object> map = new HashMap<>(v.entry.size()); + + for(MapElements entry: v.entry) { + if (entry.value instanceof Element) { + map.put(entry.key, ((Element)entry.value).getTextContent()); + } else { + map.put(entry.key, entry.value); + } + } + + return map; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java new file mode 100644 index 0000000000..709393bb84 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 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.onap.so.openstack.mappers; + +import javax.xml.bind.annotation.XmlElement; + +public class MapElements +{ + @XmlElement public String key; + @XmlElement public Object value; + + public MapElements() {} //Required by JAXB + + public MapElements(String key, Object value) + { + this.key = key; + this.value = value; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java new file mode 100644 index 0000000000..e6dc0e0538 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 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.onap.so.openstack.mappers; + +import java.util.ArrayList; +import java.util.List; + +public class MapEntry { + + public List<MapElements> entry = new ArrayList<>(); + + public MapEntry() {} //Required by JAXB + + public void addEntry(String key, Object value) { + entry.add(new MapElements(key, value)); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java new file mode 100644 index 0000000000..038e88317d --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 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.onap.so.openstack.mappers; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; + +import org.junit.Test; +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; + + +public class JAXBMarshallingTest { + + + @Test + public void xmlMarshalTest() throws IOException, JAXBException { + JAXBContext context = JAXBContext.newInstance(CreateVfModuleRequest.class); + + CreateVfModuleRequest request = (CreateVfModuleRequest) context.createUnmarshaller().unmarshal(Files.newBufferedReader(Paths.get("src/test/resources/createVfModuleRequest-with-params.xml"))); + + assertEquals("ubuntu-16-04-cloud-amd64", request.getVfModuleParams().get("vcpe_image_name")); + assertEquals("10.2.0.0/24", request.getVfModuleParams().get("cpe_public_net_cidr")); + assertEquals("", request.getVfModuleParams().get("workload_context")); + + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml b/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml new file mode 100644 index 0000000000..76ba3695f2 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml @@ -0,0 +1,206 @@ +<createVfModuleRequest> + <cloudSiteId>RegionOne</cloudSiteId> + <tenantId>09d8566ea45e43aa974cf447ed591d77</tenantId> + <vnfId>8daea639-82b9-4da6-aec9-5054f006a82d</vnfId> + <vnfName>vcpe_vnf_vcpe_infra_201903101808</vnfName> + <vfModuleName>vcpe_vfmodule_vcpeinfra53f27a6285bd_201903101808</vfModuleName> + <vfModuleId>1ea78add-a36c-4af4-959f-4c43292b3aac</vfModuleId> + <vnfType>demoVCPEInfra/vCPE_infra 53f27a62-85bd 0</vnfType> + <vfModuleType>VcpeInfra53f27a6285bd..base_vcpe_infra..module-0</vfModuleType> + <vnfVersion>1.0</vnfVersion> + <modelCustomizationUuid>76135970-0c64-4b62-a4d0-56606fc040b3</modelCustomizationUuid> + <requestType></requestType> + <volumeGroupId></volumeGroupId> + <volumeGroupStackId></volumeGroupStackId> + <baseVfModuleId></baseVfModuleId> + <baseVfModuleStackId></baseVfModuleStackId> + <skipAAI>true</skipAAI> + <backout>false</backout> + <failIfExists>true</failIfExists> + <vfModuleParams> + <entry> + <key>vf_module_id</key> + <value>1ea78add-a36c-4af4-959f-4c43292b3aac</value> + </entry> + <entry> + <key>cpe_public_subnet_id</key> + <value>vcpe_net_cpe_public_subnet_201903101808</value> + </entry> + <entry> + <key>oof_directives</key> + <value>{}</value> + </entry> + <entry> + <key>cpe_signal_subnet_id</key> + <value>vcpe_net_cpe_signal_subnet_201903101808</value> + </entry> + <entry> + <key>onap_private_net_id</key> + <value>oam_network_hkV9</value> + </entry> + <entry> + <key>vnf_name</key> + <value>vcpe_vnf_vcpe_infra_201903101808</value> + </entry> + <entry> + <key>key_name</key> + <value>vaaa_key</value> + </entry> + <entry> + <key>workload_context</key> + <value></value> + </entry> + <entry> + <key>vweb_name_0</key> + <value>zdcpe1cpe01web01_201903101808</value> + </entry> + <entry> + <key>vf_module_name</key> + <value>vcpe_vfmodule_vcpeinfra53f27a6285bd_201903101808</value> + </entry> + <entry> + <key>vcpe_flavor_name</key> + <value>m1.medium</value> + </entry> + <entry> + <key>vdhcp_name_0</key> + <value>zdcpe1cpe01dhcp01_201903101808</value> + </entry> + <entry> + <key>vdhcp_private_ip_0</key> + <value>10.4.0.1</value> + </entry> + <entry> + <key>install_script_version</key> + <value>1.3.0</value> + </entry> + <entry> + <key>vdhcp_private_ip_1</key> + <value>10.0.101.1</value> + </entry> + <entry> + <key>vnf_id</key> + <value>8daea639-82b9-4da6-aec9-5054f006a82d</value> + </entry> + <entry> + <key>cloud_env</key> + <value>openstack</value> + </entry> + <entry> + <key>mr_ip_addr</key> + <value>10.12.5.69</value> + </entry> + <entry> + <key>repo_url_artifacts</key> + <value>https://nexus.onap.org/content/repositories/releases</value> + </entry> + <entry> + <key>dcae_collector_port</key> + <value>8080</value> + </entry> + <entry> + <key>repo_url_blob</key> + <value>https://nexus.onap.org/content/sites/raw</value> + </entry> + <entry> + <key>public_net_id</key> + <value>971040b2-7059-49dc-b220-4fab50cb2ad4</value> + </entry> + <entry> + <key>onap_private_net_cidr</key> + <value>10.0.0.0/16</value> + </entry> + <entry> + <key>cpe_signal_net_cidr</key> + <value>10.4.0.0/24</value> + </entry> + <entry> + <key>environment_context</key> + <value></value> + </entry> + <entry> + <key>onap_private_subnet_id</key> + <value>oam_network_hkV9</value> + </entry> + <entry> + <key>vweb_private_ip_0</key> + <value>10.2.0.10</value> + </entry> + <entry> + <key>vaaa_private_ip_1</key> + <value>10.0.101.2</value> + </entry> + <entry> + <key>cpe_public_net_id</key> + <value>vcpe_net_cpe_public_201903101808</value> + </entry> + <entry> + <key>vweb_private_ip_1</key> + <value>10.0.101.40</value> + </entry> + <entry> + <key>mr_ip_port</key> + <value>30227</value> + </entry> + <entry> + <key>vaaa_private_ip_0</key> + <value>10.4.0.2</value> + </entry> + <entry> + <key>pub_key</key> + <value>ssh-rsa + AAAAB3NzaC1yc2EAAAADAQABAAABAQDKXDgoo3+WOqcUG8/5uUbk81+yczgwC4Y8ywTmuQqbNxlY1oQ0YxdMUqUnhitSXs5S/yRuAVOYHwGg2mCs20oAINrP+mxBI544AMIb9itPjCtgqtE2EWo6MmnFGbHB4Sx3XioE7F4VPsh7japsIwzOjbrQe+Mua1TGQ5d4nfEOQaaglXLLPFfuc7WbhbJbK6Q7rHqZfRcOwAMXgDoBqlyqKeiKwnumddo2RyNT8ljYmvB6buz7KnMinzo7qB0uktVT05FH9Rg0CTWH5norlG5qXgP2aukL0gk1ph8iAt7uYLf1ktp+LJI2gaF6L0/qli9EmVCSLr1uJ38Q8CBflhkh</value> + </entry> + <entry> + <key>sdnc_directives</key> + <value>{}</value> + </entry> + <entry> + <key>vdns_private_ip_0</key> + <value>10.2.0.1</value> + </entry> + <entry> + <key>cpe_signal_net_id</key> + <value>vcpe_net_cpe_signal_201903101808</value> + </entry> + <entry> + <key>vdns_private_ip_1</key> + <value>10.0.101.3</value> + </entry> + <entry> + <key>demo_artifacts_version</key> + <value>1.3.0</value> + </entry> + <entry> + <key>vdns_name_0</key> + <value>zdcpe1cpe01dns01_201903101808</value> + </entry> + <entry> + <key>cpe_public_net_cidr</key> + <value>10.2.0.0/24</value> + </entry> + <entry> + <key>vaaa_name_0</key> + <value>zdcpe1cpe01aaa01_201903101808</value> + </entry> + <entry> + <key>dcae_collector_ip</key> + <value>10.0.4.102</value> + </entry> + <entry> + <key>vcpe_image_name</key> + <value>ubuntu-16-04-cloud-amd64</value> + </entry> + <entry> + <key>vf_module_index</key> + <value>0</value> + </entry> + + </vfModuleParams> + <msoRequest> + <requestId>11c8ec20-a1f8-4aa2-926f-e55d67a30f8b</requestId> + <serviceInstanceId>807648fc-c84c-4662-bf23-23c7d8cbe0c8</serviceInstanceId> + </msoRequest> + <messageId>11c8ec20-a1f8-4aa2-926f-e55d67a30f8b-1552241542248</messageId> + <notificationUrl>http://so-bpmn-infra.onap:8081/mso/WorkflowMessage/VNFAResponse/11c8ec20-a1f8-4aa2-926f-e55d67a30f8b-1552241542248</notificationUrl> +</createVfModuleRequest>
\ No newline at end of file diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java index 25d8e564da..d0ffa27027 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java @@ -126,9 +126,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - MsoLogger.setLogContext (msoRequest); logger.debug("Async Create Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); // Use the synchronous method to perform the actual Create @@ -252,7 +250,6 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { MsoRequest msoRequest, String notificationUrl) { - MsoLogger.setLogContext (msoRequest); logger.debug("Async Update Network: {} of type {} in {}/{}", networkId, networkType, cloudSiteId, tenantId); // Use the synchronous method to perform the actual Create @@ -342,9 +339,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - MsoLogger.setLogContext (msoRequest); logger.debug("Async Query Network {} in {}/{}", networkNameOrId, cloudSiteId, tenantId); String errorCreateNetworkMessage = "{} {} Error sending createNetwork notification {} "; @@ -440,8 +435,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - MsoLogger.setLogContext (msoRequest); + String serviceName = "DeleteNetworkA"; logger.debug("Async Delete Network {} in {}/{}", networkId, cloudSiteId, tenantId); @@ -507,7 +501,6 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { return; } - MsoLogger.setLogContext (rollback.getMsoRequest ()); logger.info("{} {}", MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId()); // Use the synchronous method to perform the actual Create diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index bcb6b1be42..fc2fc4844b 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -266,7 +266,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Holder <String> networkFqdn, Holder <Map <String, String>> subnetIdMap, Holder <NetworkRollback> rollback) throws NetworkException { - MsoLogger.setLogContext (msoRequest); logger.debug("*** CREATE Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); // Will capture execution time for metrics @@ -712,7 +711,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { MsoRequest msoRequest, Holder <Map <String, String>> subnetIdMap, Holder <NetworkRollback> rollback) throws NetworkException { - MsoLogger.setLogContext (msoRequest); + logger.debug("***UPDATE Network adapter with Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); @@ -1147,7 +1146,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Holder <List <Integer>> vlans, Holder <List <RouteTarget>> routeTargets, Holder <Map <String, String>> subnetIdMap) throws NetworkException { - MsoLogger.setLogContext (msoRequest); + logger.debug("*** QUERY Network with Network: {} in {}/{}", networkNameOrId, cloudSiteId, tenantId); // Will capture execution time for metrics @@ -1285,7 +1284,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String networkId, MsoRequest msoRequest, Holder <Boolean> networkDeleted) throws NetworkException { - MsoLogger.setLogContext (msoRequest); + logger.debug("*** DELETE Network adapter with Network: {} in {}/{}", networkId, cloudSiteId, tenantId); // Will capture execution time for metrics @@ -1386,8 +1385,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { return; } - MsoLogger.setLogContext (rollback.getMsoRequest()); - // Get the elements of the VnfRollback object for easier access String cloudSiteId = rollback.getCloudId (); String tenantId = rollback.getTenantId (); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java index a937bd9499..f46a95df91 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java @@ -88,7 +88,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { MsoRequest msoRequest, Holder <String> tenantId, Holder <TenantRollback> rollback) throws TenantException { - MsoLogger.setLogContext (msoRequest); logger.debug("Call to MSO createTenant adapter. Creating Tenant: {} in {}", tenantName, cloudSiteId); @@ -152,7 +151,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { Holder <String> tenantId, Holder <String> tenantName, Holder <Map <String, String>> metadata) throws TenantException { - MsoLogger.setLogContext (msoRequest); + logger.debug ("Querying Tenant {} in {}", tenantNameOrId, cloudSiteId); MsoTenantUtils tUtils; @@ -196,7 +195,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { String tenantId, MsoRequest msoRequest, Holder <Boolean> tenantDeleted) throws TenantException { - MsoLogger.setLogContext (msoRequest); logger.debug ("Deleting Tenant {} in {}", tenantId, cloudSiteId); @@ -238,7 +236,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { String cloudSiteId = rollback.getCloudId (); String tenantId = rollback.getTenantId (); - MsoLogger.setLogContext (rollback.getMsoRequest ()); logger.debug("Rolling Back Tenant {} in {}", rollback.getTenantId(), cloudSiteId); if (rollback.getTenantCreated ()) { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java index b445dc8a26..cf52280b3f 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java @@ -132,7 +132,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - MsoLogger.setLogContext (msoRequest); + logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF); // Use the synchronous method to perform the actual Create MsoVnfAdapter vnfAdapter = vnfImpl; @@ -213,7 +213,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - MsoLogger.setLogContext (msoRequest); + logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF); // Use the synchronous method to perform the actual Create @@ -289,9 +289,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; + String serviceName = "QueryVnfA"; - MsoLogger.setLogContext (msoRequest); logger.info("{}", MessageEnum.RA_ASYNC_QUERY_VNF); // Use the synchronous method to perform the actual query @@ -376,9 +375,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; + String serviceName = "DeleteVnfA"; - MsoLogger.setLogContext (msoRequest); logger.info("{}", MessageEnum.RA_ASYNC_DELETE_VNF); // Use the synchronous method to perform the actual delete @@ -441,7 +439,6 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { return; } - MsoLogger.setLogContext (rollback.getMsoRequest ()); logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF); // Use the synchronous method to perform the actual rollback diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java index a1d7698ad1..4d915f9e84 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java @@ -302,7 +302,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { Holder <String> vnfId, Holder <VnfStatus> status, Holder <Map <String, String>> outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); + logger.debug("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); // Will capture execution time for metrics @@ -361,7 +361,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String tenantId, String vnfName, MsoRequest msoRequest) throws VnfException { - MsoLogger.setLogContext (msoRequest); + logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); @@ -409,15 +409,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String tenantId = rollback.getTenantId (); String vnfId = rollback.getVnfId (); - MsoLogger.setLogContext (rollback.getMsoRequest()); - logger.debug("Rolling Back VNF {} in {}", vnfId, cloudSiteId + "/" + tenantId); // Use the MsoHeatUtils to delete the stack. Set the polling flag to true. // The possible outcomes of deleteStack are a StackInfo object with status // of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException // could be thrown. - long subStartTime = System.currentTimeMillis (); try { heat.deleteStack (tenantId, cloudSiteId, vnfId, true); } catch (MsoException me) { @@ -600,7 +597,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { useMCUuid = true; } } - MsoLogger.setLogContext (msoRequest); + String requestTypeString = ""; if (requestType != null && !"".equals(requestType)) { requestTypeString = requestType; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java index bba960cddf..833e200ce9 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java @@ -206,7 +206,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { Holder <Map <String, String>> outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); logger.debug ("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); // Will capture execution time for metrics @@ -264,7 +263,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String tenantId, String vnfName, MsoRequest msoRequest) throws VnfException { - MsoLogger.setLogContext (msoRequest); // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules. logger.debug("DeleteVNF command attempted but not supported"); @@ -285,8 +283,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { long startTime = System.currentTimeMillis (); // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { - logger.info ("{} {} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf", MsoLogger - .getServiceName()); + logger.info ("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf"); return; } @@ -300,8 +297,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String tenantId = rollback.getTenantId (); String vfModuleId = rollback.getVfModuleStackId (); - MsoLogger.setLogContext (rollback.getMsoRequest()); - logger.debug("Rolling Back VF Module {} in {}", vfModuleId, cloudSiteId + "/" + tenantId); DeploymentInfo deployment = null; @@ -576,8 +571,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Will capture execution time for metrics long startTime = System.currentTimeMillis (); - MsoLogger.setLogContext (msoRequest); - // Require a model customization ID. Every VF Module definition must have one. if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) { logger.debug("Missing required input: modelCustomizationUuid"); @@ -1179,7 +1172,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String vnfName, MsoRequest msoRequest, Holder <Map <String, String>> outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); + logger.debug ("Deleting VF " + vnfName + " in " + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java index 704d54c918..b1b97b695e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -225,7 +225,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { Holder <Map <String, String>> outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); logger.debug("Querying VNF " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics @@ -281,7 +280,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String tenantId, String vnfName, MsoRequest msoRequest) throws VnfException { - MsoLogger.setLogContext (msoRequest); // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules. logger.debug("DeleteVNF command attempted but not supported"); @@ -302,8 +300,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { long startTime = System.currentTimeMillis (); // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { - logger.info("{} {} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf", - MsoLogger.getServiceName()); + logger.info("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf"); return; } @@ -319,8 +316,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String vfModuleId = rollback.getVfModuleStackId (); - MsoLogger.setLogContext (rollback.getMsoRequest()); - logger.debug("Rolling Back VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId); VduInstance vduInstance = null; @@ -618,8 +613,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Will capture execution time for metrics long startTime = System.currentTimeMillis (); - MsoLogger.setLogContext (msoRequest); - // Require a model customization ID. Every VF Module definition must have one. if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) { logger.debug("Missing required input: modelCustomizationUuid"); @@ -1165,7 +1158,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { MsoRequest msoRequest, Holder <Map <String, String>> outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java index efb5932e51..304b025bf8 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java @@ -218,11 +218,17 @@ public class RequestsDbClientTest { } @Test - public void findOneByOperationalEnvIdAndServiceModelVersionIdTest(){ - OperationalEnvServiceModelStatus operationalEnvServiceModelStatus =requestsDbClient.findOneByOperationalEnvIdAndServiceModelVersionId("1234","TEST1234"); + public void findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdTest(){ + OperationalEnvServiceModelStatus operationalEnvServiceModelStatus =requestsDbClient.findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId("1234","TEST1234", "00032ab7-3fb3-42e5-965d-8ea592502017"); assertNotNull(operationalEnvServiceModelStatus); assertEquals("1234",operationalEnvServiceModelStatus.getOperationalEnvId()); assertEquals("TEST1234",operationalEnvServiceModelStatus.getServiceModelVersionId()); + + OperationalEnvServiceModelStatus operationalEnvServiceModelStatus1 =requestsDbClient.findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId("1234","TEST1235", "00032ab7-3fb3-42e5-965d-8ea592502018"); + assertNotNull(operationalEnvServiceModelStatus1); + assertEquals("00032ab7-3fb3-42e5-965d-8ea592502018",operationalEnvServiceModelStatus1.getRequestId()); + assertEquals("1234",operationalEnvServiceModelStatus1.getOperationalEnvId()); + assertEquals("TEST1235",operationalEnvServiceModelStatus1.getServiceModelVersionId()); } @Test @@ -238,5 +244,7 @@ public class RequestsDbClientTest { OperationalEnvDistributionStatus operationalEnvDistributionStatus =requestsDbClient.getDistributionStatusById("111"); assertNotNull(operationalEnvDistributionStatus); assertEquals("111",operationalEnvDistributionStatus.getDistributionId()); + assertEquals("ERROR",operationalEnvDistributionStatus.getDistributionIdErrorReason()); + assertEquals("00032ab7-3fb3-42e5-965d-8ea592502017",operationalEnvDistributionStatus.getRequestId()); } } diff --git a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql index de1ae85cc6..48d589592f 100644 --- a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql +++ b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql @@ -43,6 +43,9 @@ VALUES INSERT INTO activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME) VALUES ('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59'); +INSERT INTO activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME) +VALUES +('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502018', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59'); INSERT INTO `activate_operational_env_per_distributionid_status` (`DISTRIBUTION_ID`, `DISTRIBUTION_ID_STATUS`, `DISTRIBUTION_ID_ERROR_REASON`, `CREATE_TIME`, `MODIFY_TIME`, `OPERATIONAL_ENV_ID`, `SERVICE_MODEL_VERSION_ID`, `REQUEST_ID`) VALUES diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml new file mode 100644 index 0000000000..56d425745f --- /dev/null +++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml @@ -0,0 +1,104 @@ +<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> + <parent> + <groupId>org.onap.so.adapters</groupId> + <artifactId>mso-vnfm-adapter</artifactId> + <version>1.4.0-SNAPSHOT</version> + </parent> + <artifactId>mso-vnfm-adapter-api</artifactId> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <gson-fire-version>1.8.2</gson-fire-version> + <retrofit-version>2.3.0</retrofit-version> + <threetenbp-version>1.3.5</threetenbp-version> + <oltu-version>1.0.1</oltu-version> + <swagger-core-version>1.5.15</swagger-core-version> + </properties> + <name>mso-vnfm-adapter-api</name> + <description>MSO VNFM adapter API</description> + + <build> + <plugins> + <plugin> + <groupId>io.swagger</groupId> + <artifactId>swagger-codegen-maven-plugin</artifactId> + <version>2.3.1</version> + <executions> + <execution> + <id>vnfmadapter</id> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <inputSpec>${basedir}/src/main/resources/vnfmadapter.yaml</inputSpec> + <language>java</language> + <library>retrofit2</library> + <output>${project.build.directory}/generated-sources/vnfmadapter</output> + <apiPackage>org.onap.vnfmadapter.v1.api</apiPackage> + <modelPackage>org.onap.vnfmadapter.v1.model</modelPackage> + <configOptions> + <jackson>true</jackson> + <sourceFolder>src/gen/java/main</sourceFolder> + <withXml>true</withXml> + <useRxJava2>true</useRxJava2> + </configOptions> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-annotations</artifactId> + <version>${swagger-core-version}</version> + </dependency> + <dependency> + <groupId>com.squareup.retrofit2</groupId> + <artifactId>converter-gson</artifactId> + <version>${retrofit-version}</version> + </dependency> + <dependency> + <groupId>com.squareup.retrofit2</groupId> + <artifactId>retrofit</artifactId> + <version>${retrofit-version}</version> + </dependency> + <dependency> + <groupId>com.squareup.retrofit2</groupId> + <artifactId>converter-scalars</artifactId> + <version>${retrofit-version}</version> + </dependency> + <dependency> + <groupId>org.apache.oltu.oauth2</groupId> + <artifactId>org.apache.oltu.oauth2.client</artifactId> + <version>${oltu-version}</version> + </dependency> + <dependency> + <groupId>io.gsonfire</groupId> + <artifactId>gson-fire</artifactId> + <version>${gson-fire-version}</version> + </dependency> + <dependency> + <groupId>org.threeten</groupId> + <artifactId>threetenbp</artifactId> + <version>${threetenbp-version}</version> + </dependency> + <dependency> + <groupId>io.reactivex.rxjava2</groupId> + <artifactId>rxjava</artifactId> + </dependency> + <dependency> + <groupId>com.squareup.retrofit2</groupId> + <artifactId>adapter-rxjava2</artifactId> + <version>${retrofit-version}</version> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + </dependency> + </dependencies> +</project> diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/vnfmadapter.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/vnfmadapter.yaml new file mode 100644 index 0000000000..dc5f85e5fe --- /dev/null +++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/vnfmadapter.yaml @@ -0,0 +1,522 @@ +swagger: '2.0' +info: + version: 1.0.0 + title: ONAP SO VNFM Adapter API + description: >- + Describes the API between SO (Service Orchestrator) and the adapter for VNFM + (Virtual Network Function Manager) +basePath: /so/vnfm-adapter/v1 +schemes: + - http + - https +consumes: + - application/json +produces: + - application/json +paths: + '/vnfs/{vnfId}': + post: + tags: + - SO VNFM Adapter + summary: VNF create + description: Create a VNF instance using a VNFM. + operationId: vnf_create + consumes: + - application/json + parameters: + - required: true + type: string + description: >- + The identifier of the VNF. This must be the vnf-id of an existing + generic-vnf in AAI. + name: vnfId + in: path + - in: body + name: body + description: VNF creation parameters + required: true + schema: + $ref: '#/definitions/CreateVnfRequest' + - name: X-ONAP-RequestID + description: >- + Used to track REST requests for logging purposes. Identifies a + single top level invocation of ONAP + in: header + required: true + type: string + - name: X-InvocationID + description: >- + Used to track REST requests for logging purposes. Identifies a + single invocation of a single component + in: header + required: true + type: string + responses: + '202': + description: >- + The request was accepted for processing, but the processing has not + been completed. + schema: + $ref: '#/definitions/CreateVnfResponse' + '400': + description: >- + An error occurred in the VNFM adapter relating to the given input, + for example, if the definition of the given VNF in AAI does not + included required information. + '404': + description: A VNF with the specified ID was not found in AAI. + '500': + description: >- + An error occurred in the VNFM adapter not relating to the given + input, or an error is received from the VNFM. + delete: + tags: + - SO VNFM Adapter + summary: VNF delete + description: Delete an instance of a VNF using a VNFM. + operationId: vnf_delete + consumes: + - application/json + parameters: + - required: true + type: string + description: >- + The identifier of the VNF. This must be the vnf-id of an existing + generic-vnf in AAI + name: vnfId + in: path + - name: X-ONAP-RequestID + description: >- + Used to track REST requests for logging purposes. Identifies a + single top level invocation of ONAP + in: header + required: true + type: string + - name: X-InvocationID + description: >- + Used to track REST requests for logging purposes. Identifies a + single invocation of a single component + in: header + required: true + type: string + responses: + '202': + description: >- + The request was accepted for processing, but the processing has not + been completed. + schema: + $ref: '#/definitions/DeleteVnfResponse' + '400': + description: >- + An error occurred in the VNFM adapter relating to the given input, + for example, if the definition of the given VNF in AAI does not + included required information. + '404': + description: A VNF with the specified ID was not found in AAI. + '500': + description: >- + An error occurred in the VNFM adapter not relating to the given + input, or an error is received from the VNFM. + '/jobs/{jobId}': + get: + tags: + - SO VNFM Adapter + summary: Job query + description: Query the status of a job. + operationId: job_query + consumes: + - application/json + produces: + - application/json + parameters: + - required: true + type: string + description: The identifier of the Job. + name: jobId + in: path + - name: X-ONAP-RequestID + description: >- + Used to track REST requests for logging purposes. Identifies a + single top level invocation of ONAP + in: header + required: true + type: string + - name: X-InvocationID + description: >- + Used to track REST requests for logging purposes. Identifies a + single invocation of a single component + in: header + required: true + type: string + responses: + '200': + description: '' + schema: + $ref: '#/definitions/QueryJobResponse' + '404': + description: A job with the specified ID was not found. + '500': + description: >- + An error occurred in the VNFM adapter not relating to the given + input, or an error is received from the VNFM. +definitions: + CreateVnfRequest: + type: object + properties: + name: + type: string + description: The name to be applied to the VNF. + tenant: + $ref: '#/definitions/Tenant' + additionalParams: + type: object + description: >- + Additional input parameters for the instantiation process, specific to + the VNF being instantiated, as declared in the VNFD as part of + "InstantiateVnfOpConfig". + additionalProperties: + type: string + externalVirtualLinks: + type: array + description: Information about external VLs to connect the VNF to. + items: + $ref: '#/definitions/ExternalVirtualLink' + required: + - name + - tenant + Tenant: + type: object + description: Details of the tenant that VNFs can be deployed into + properties: + cloudOwner: + type: string + description: The owner in AAI of the cloud to which the tenant belongs. + regionName: + type: string + description: The regionName in AAI of the cloud to which the tenant belongs. + tenantId: + type: string + description: The identifier of the tenant in the VIM. + required: + - cloudOwner + - regionName + - tenantId + CreateVnfResponse: + type: object + properties: + jobId: + description: The ID of the job which can be used to query the status of the job + type: string + required: + - jobId + DeleteVnfResponse: + type: object + properties: + jobId: + description: >- + The ID of the job which can be used to query the status of the delete + job + type: string + required: + - jobId + QueryJobResponse: + type: object + properties: + operationStatusRetrievalStatus: + $ref: '#/definitions/OperationStatusRetrievalStatusEnum' + id: + type: string + operation: + $ref: '#/definitions/OperationEnum' + operationState: + $ref: '#/definitions/OperationStateEnum' + startTime: + type: string + format: date-time + stateEnteredTime: + type: string + format: date-time + vnfInstanceId: + type: string + required: + - operationStatusRetrievalStatus + OperationStatusRetrievalStatusEnum: + description: The status of the attempt to retrrieve the operation from the VNFM + type: string + enum: + - STATUS_FOUND + - WAITING_FOR_STATUS + - OPERATION_NOT_FOUND + - CANNOT_RETRIEVE_STATUS + OperationEnum: + description: The operation + type: string + enum: + - INSTANTIATE + - SCALE + - SCALE_TO_LEVEL + - CHANGE_FLAVOUR + - TERMINATE + - HEAL + - OPERATE + - CHANGE_EXT_CONN + - MODIFY_INFO + OperationStateEnum: + description: The status of the operation + type: string + enum: + - STARTING + - PROCESSING + - COMPLETED + - FAILED_TEMP + - FAILED + - ROLLING_BACK + - ROLLED_BACK + ExternalVirtualLink: + description: | + This type represents an external VL. + type: object + required: + - id + - resourceId + - extCps + properties: + id: + description: | + An identifier with the intention of being globally unique. + type: string + tenant: + $ref: '#/definitions/Tenant' + resourceId: + description: | + An identifier maintained by the VIM. + type: string + extCps: + description: | + External CPs of the VNF to be connected to this external VL. + type: array + items: + description: > + This type represents configuration information for external CPs + created from a CPD. + type: object + required: + - cpdId + properties: + cpdId: + description: | + An identifier that is unique within a VNF descriptor. + type: string + cpConfig: + description: > + List of instance data that need to be configured on the CP + instances created from the respective CPD. + type: array + items: + description: > + This type represents an externally provided link port or + network address information per instance of an external + connection point. In case a link port is provided, the VNFM + shall use that link port when connecting the external CP to + the external VL. In a link port is not provided, the VNFM + shall create a link port on the external VL, and use that link + port to connect the external CP to the external VL. + type: object + properties: + cpInstanceId: + description: > + An identifier that is unique for the respective type + within a VNF instance, but may not be globally unique. + type: string + linkPortId: + description: | + An identifier with the intention of being globally unique. + type: string + cpProtocolData: + description: > + Parameters for configuring the network protocols on the + link port that connects the CP to a VL. The following + conditions apply to the attributes "linkPortId" and + "cpProtocolData": * The "linkPortId" and "cpProtocolData" + attributes shall both be absent for the deletion of an + existing external CP instance + addressed by cpInstanceId. + * At least one of these attributes shall be present for a + to-be-created external CP instance or an existing external + CP instance. + * If the "linkPortId" attribute is absent, the VNFM shall + create a link port. + + * If the "cpProtocolData" attribute is absent, the + "linkPortId" attribute shall be provided referencing a + pre-created link port, + and the VNFM can use means outside the scope of the present + document to obtain the pre-configured address information for the + connection point from the resource representing the link port. + * If both "cpProtocolData" and "linkportId" are provided, + the API consumer shall ensure that the cpProtocolData can + be used with the + pre-created link port referenced by "linkPortId". + type: array + items: + description: | + This type represents network protocol data. + type: object + required: + - layerProtocol + properties: + layerProtocol: + description: > + Identifier of layer(s) and protocol(s). This + attribute allows to signal the addition of further + types of layer and protocol in future versions of + the present document in a backwards-compatible way. + In the current version of the present document, only + IP over Ethernet is supported. + type: string + enum: + - IP_OVER_ETHERNET + ipOverEthernet: + description: > + This type represents network address data for IP + over Ethernet. + type: object + properties: + macAddress: + description: > + A MAC address. Representation: string that + consists of groups of two hexadecimal digits, + separated by hyphens or colons. + type: string + format: MAC + ipAddresses: + description: > + List of IP addresses to assign to the CP + instance. Each entry represents IP address data + for fixed or dynamic IP address assignment per + subnet. If this attribute is not present, no IP + address shall be assigned. + type: array + items: + type: object + required: + - type + properties: + type: + description: > + The type of the IP addresses. Permitted + values: IPV4, IPV6. + type: string + enum: + - IPV4 + - IPV6 + fixedAddresses: + description: > + Fixed addresses to assign (from the subnet + defined by "subnetId" if provided). + Exactly one of "fixedAddresses", + "numDynamicAddresses" or "ipAddressRange" + shall be present. + type: array + items: + description: > + An IPV4 or IPV6 address. Representation: + In case of an IPV4 address, string that + consists of four decimal integers + separated by dots, each integer ranging + from 0 to 255. In case of an IPV6 + address, string that consists of groups + of zero to four hexadecimal digits, + separated by colons. + type: string + format: IP + numDynamicAddresses: + description: > + Number of dynamic addresses to assign + (from the subnet defined by "subnetId" if + provided). Exactly one of + "fixedAddresses", "numDynamicAddresses" or + "ipAddressRange" shall be present. + type: integer + addressRange: + description: > + An IP address range to be used, e.g. in + case of egress connections. In case this + attribute is present, IP addresses from + the range will be used. + type: object + required: + - minAddress + - maxAddress + properties: + minAddress: + description: > + An IPV4 or IPV6 address. Representation: + In case of an IPV4 address, string that + consists of four decimal integers + separated by dots, each integer ranging + from 0 to 255. In case of an IPV6 + address, string that consists of groups + of zero to four hexadecimal digits, + separated by colons. + type: string + format: IP + maxAddress: + description: > + An IPV4 or IPV6 address. Representation: + In case of an IPV4 address, string that + consists of four decimal integers + separated by dots, each integer ranging + from 0 to 255. In case of an IPV6 + address, string that consists of groups + of zero to four hexadecimal digits, + separated by colons. + type: string + format: IP + subnetId: + description: > + An identifier maintained by the VIM or + other resource provider. It is expected to + be unique within the VIM instance. + type: string + extLinkPorts: + description: > + Externally provided link ports to be used to connect external + connection points to this external VL. If this attribute is not + present, the VNFM shall create the link ports on the external VL. + type: array + items: + description: > + This type represents an externally provided link port to be used to + connect an external connection point to an external VL. + type: object + required: + - id + - resourceHandle + properties: + id: + description: | + An identifier with the intention of being globally unique. + type: string + resourceHandle: + required: + - tenant + - resourceId + type: object + description: > + This type represents the information that allows addressing a + virtualised resource that is used by a VNF instance. + properties: + tenant: + $ref: '#/definitions/Tenant' + resourceId: + description: > + An identifier maintained by the VIM or other resource + provider. It is expected to be unique within the VIM + instance. + type: string + vimLevelResourceType: + description: > + Type of the resource in the scope of the VIM or the resource + provider. + type: string
\ No newline at end of file diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml new file mode 100644 index 0000000000..0cf1ce72e2 --- /dev/null +++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml @@ -0,0 +1,17 @@ +<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> + <parent> + <groupId>org.onap.so.adapters</groupId> + <artifactId>mso-vnfm-adapter</artifactId> + <version>1.4.0-SNAPSHOT</version> + </parent> + <artifactId>mso-vnfm-adapter-ext-clients</artifactId> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + </properties> + <name>mso-vnfm-adapter-ext-clients</name> + <description>Clients for the vnfm adpater to use towards REST endpoints which are external to the VNFM adapter/</description> +</project> diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml new file mode 100644 index 0000000000..4554835b33 --- /dev/null +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml @@ -0,0 +1,80 @@ +<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> + <parent> + <groupId>org.onap.so.adapters</groupId> + <artifactId>mso-vnfm-adapter</artifactId> + <version>1.4.0-SNAPSHOT</version> + </parent> + <artifactId>mso-vnfm-etsi-adapter</artifactId> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + </properties> + <name>mso-vnfm-etsi-adapter</name> + <description>MSO ETSI compliant VNFM Adapter</description> + + <build> + <finalName>${project.artifactId}-${project.version}</finalName> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <mainClass>org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication</mainClass> + </configuration> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <id>original</id> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-security</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-tomcat</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-actuator</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.so.adapters</groupId> + <artifactId>mso-adapters-rest-interface</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> +</project> diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java new file mode 100644 index 0000000000..cdf7de869e --- /dev/null +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfmadapter; + +/** + * Adapter constants + */ +public class Constants { + + public static final String SERVICE_NAME = "vnfm-adapter"; + public static final String SERVICE_VERSION = "v1"; + public static final String BASE_URL = "/so/" + SERVICE_NAME + "/" + SERVICE_VERSION; + + private Constants() {} +} diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java new file mode 100755 index 0000000000..024e936cfb --- /dev/null +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfmadapter; + +import static org.slf4j.LoggerFactory.getLogger; +import org.onap.so.adapters.vnfmadapter.rest.VnfmAdapterController; +import org.slf4j.Logger; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * The spring boot application for the VNFM (Virtual Network Function Manager) Adapter. + * <p> + * The VNFM Adapter receives requests through its REST API {@link VnfmAdapterController} which it adapts + * into ETSI SOL003 compliant LCM (Life Cycle Management) calls towards an ETSI compliant VNFM. + * + * @see <a href= + * "https://www.etsi.org/deliver/etsi_gs/NFV-SOL/001_099/003/02.05.01_60/gs_nfv-sol003v020501p.pdf">ETSI + * SOL003 v2.5.1</a> + */ +@SpringBootApplication(scanBasePackages = {"org.onap.so"}) +public class VnfmAdapterApplication { + private static final Logger logger = getLogger(VnfmAdapterApplication.class); + + + /** + * Entry point for the Spring boot application + * + * @param args arguments for the application + */ + public static void main(final String[] args) { + new SpringApplication(VnfmAdapterApplication.class).run(args); + logger.info("VnfmAdapterApplication started!"); + } + +} diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java new file mode 100644 index 0000000000..6baa672535 --- /dev/null +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfmadapter; + +import org.onap.so.security.MSOSpringFirewall; +import org.onap.so.security.WebSecurityConfig; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.builders.WebSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.web.firewall.StrictHttpFirewall; +import org.springframework.util.StringUtils; + +/** + * Configure the web security for the application. + */ +@EnableWebSecurity +public class WebSecurityConfigImpl extends WebSecurityConfig { + + @Override + protected void configure(final HttpSecurity http) throws Exception { + http.csrf().disable().authorizeRequests().antMatchers("/manage/health","/manage/info").permitAll() + .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and() + .httpBasic(); + } + + @Override + public void configure(final WebSecurity web) throws Exception { + super.configure(web); + final StrictHttpFirewall firewall = new MSOSpringFirewall(); + web.httpFirewall(firewall); + } + +} diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java new file mode 100644 index 0000000000..4dabec3e9b --- /dev/null +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfmadapter.rest; + +import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * Controller for handling requests to the VNFM (Virtual Network Function Manager) adapter REST API. + */ +@Controller +@RequestMapping(value = BASE_URL) +public class VnfmAdapterController { + +} diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml new file mode 100644 index 0000000000..7719c0c98c --- /dev/null +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml @@ -0,0 +1,31 @@ +# Copyright © 2019 Nordix Foundation +# +# 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. +server: + port: 9092 + tomcat: + max-threads: 50 + +#Actuator +management: + endpoints: + web: + base-path: /manage + exposure: + include: "*" + metrics: + se-global-registry: false + export: + prometheus: + enabled: true # Whether exporting of metrics to Prometheus is enabled. + step: 1m # Step size (i.e. reporting frequency) to use. diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/HealthCheckTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/HealthCheckTest.java new file mode 100644 index 0000000000..ee22e03f87 --- /dev/null +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/HealthCheckTest.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfmadapter.rest; + +import static org.junit.Assert.assertEquals; +import java.net.URI; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.http.RequestEntity; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class HealthCheckTest { + + @LocalServerPort + private int port; + + private final TestRestTemplate restTemplate = new TestRestTemplate(); + + @Test + public void testHealthcheck() throws Exception { + final RequestEntity<Void> request = + RequestEntity.get(new URI("http://localhost:" + port + "/manage/health")).build(); + final ResponseEntity<Void> response = restTemplate.exchange(request, Void.class); + assertEquals(200, response.getStatusCode().value()); + } + +} diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml new file mode 100644 index 0000000000..cc5a068d69 --- /dev/null +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml @@ -0,0 +1,19 @@ +# Copyright © 2019 Nordix Foundation +# +# 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. +spring: + security: + usercredentials: + - username: test + password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu' + role: BPEL-Client
\ No newline at end of file diff --git a/adapters/mso-vnfm-adapter/pom.xml b/adapters/mso-vnfm-adapter/pom.xml new file mode 100644 index 0000000000..9cc17056c2 --- /dev/null +++ b/adapters/mso-vnfm-adapter/pom.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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> + <parent> + <groupId>org.onap.so</groupId> + <artifactId>adapters</artifactId> + <version>1.4.0-SNAPSHOT</version> + </parent> + <groupId>org.onap.so.adapters</groupId> + <artifactId>mso-vnfm-adapter</artifactId> + <name>MSO VNFM Adapter</name> + <description>MSO Adapter for VNFM</description> + <packaging>pom</packaging> + + <modules> + <module>mso-vnfm-adapter-api</module> + <module>mso-vnfm-adapter-ext-clients</module> + <module>mso-vnfm-etsi-adapter</module> + </modules> +</project> diff --git a/adapters/pom.xml b/adapters/pom.xml index 634a1616e6..d00304b837 100644 --- a/adapters/pom.xml +++ b/adapters/pom.xml @@ -20,6 +20,7 @@ <module>mso-catalog-db-adapter</module> <module>mso-vfc-adapter</module> <module>mso-openstack-adapters</module> + <module>mso-vnfm-adapter</module> </modules> <dependencies> |