diff options
Diffstat (limited to 'adapters')
43 files changed, 1923 insertions, 247 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java index f50a6fd1bd..97e1627fd3 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java @@ -1047,7 +1047,11 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ } } else if (type.equalsIgnoreCase("json")) { try { - return JSON_MAPPER.writeValueAsString(inputValue); + if (inputValue instanceof String) { + return JSON_MAPPER.readTree(inputValue.toString()); + } + //will already marshal to json without intervention + return inputValue; } catch (Exception e) { logger.debug("Unable to convert {} to a JsonNode!", inputValue); 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 a0fbd485d1..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 @@ -38,6 +38,8 @@ import com.woorea.openstack.keystone.Keystone; import com.woorea.openstack.keystone.model.Access; import com.woorea.openstack.keystone.model.Authentication; import com.woorea.openstack.keystone.utils.KeystoneUtils; + +import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; @@ -1328,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); @@ -1356,20 +1358,24 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } } else if ("json".equalsIgnoreCase(type)) { Object jsonObj = inputs.get(key); - String jsonString; + Object json; try { - jsonString = JSON_MAPPER.writeValueAsString(jsonObj); - } catch (JsonProcessingException e) { + if (jsonObj instanceof String) { + json = JSON_MAPPER.readTree(jsonObj.toString()); + } else { + //will already marshal to json without intervention + json = jsonObj; + } + } catch (IOException e) { logger.error("failed to map to json, directly converting to string instead", e); - jsonString = jsonObj.toString(); + json = jsonObj.toString(); } if (alias) - newInputs.put(realName, jsonString); + newInputs.put(realName, json); else - newInputs.put(key, jsonString); - //} + 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) @@ -1384,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 af24975771..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,6 +1,26 @@ +/*- + * ============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========================================== - * org.onap.music + * ONAP - SO * =================================================================== * Copyright (c) 2019 IBM. * =================================================================== diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest.java index f63aab7ce1..833b4ab760 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest.java @@ -24,6 +24,7 @@ package org.onap.so.cloudify.utils; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; @@ -70,6 +71,7 @@ import org.skyscreamer.jsonassert.JSONAssert; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; public class MsoCloudifyUtilsTest { @@ -305,11 +307,18 @@ public class MsoCloudifyUtilsTest { paramJson.setParamType("json"); paramJson.setParamName("my-json"); - Map<String, Object> jsonMap = mapper.readValue(getJson("free-form.json"), new TypeReference<Map<String, Object>>(){}); + HeatTemplateParam paramJsonEscaped = new HeatTemplateParam(); + paramJsonEscaped.setParamType("json"); + paramJsonEscaped.setParamName("my-json-escaped"); + Map<String, Object> jsonMap = mapper.readValue(getJson("free-form.json"), new TypeReference<Map<String, Object>>(){}); + assertEquals(3, utils.convertInputValue("3", paramNum)); assertEquals("hello", utils.convertInputValue("hello", paramString)); - JSONAssert.assertEquals(getJson("free-form.json"), utils.convertInputValue(jsonMap, paramJson).toString(), false); + assertTrue("expect no change in type", utils.convertInputValue(jsonMap, paramJson) instanceof Map); + assertTrue("expect string to become jsonNode", utils.convertInputValue(getJson("free-form.json"), paramJsonEscaped) instanceof JsonNode); + + JSONAssert.assertEquals(getJson("free-form.json"), mapper.writeValueAsString(utils.convertInputValue(getJson("free-form.json"), paramJsonEscaped)), false); } 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 40bbe90218..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,11 +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; @@ -17,6 +42,7 @@ import org.skyscreamer.jsonassert.JSONAssert; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; public class MsoHeatUtilsUnitTest { @@ -45,20 +71,123 @@ public class MsoHeatUtilsUnitTest { paramJson.setParamType("json"); paramJson.setParamName("my-json"); + HeatTemplateParam paramJsonEscaped = new HeatTemplateParam(); + paramJsonEscaped.setParamType("json"); + paramJsonEscaped.setParamName("my-json-escaped"); + Map<String, Object> jsonMap = mapper.readValue(getJson("free-form.json"), new TypeReference<Map<String, Object>>(){}); input.put("my-json", jsonMap); + input.put("my-json-escaped", getJson("free-form.json")); + parameters.add(paramNum); parameters.add(paramString); parameters.add(paramJson); - + parameters.add(paramJsonEscaped); + Map<String, Object> output = utils.convertInputMap(input, template); assertEquals(3, output.get("my-number")); assertEquals("hello", output.get("my-string")); - JSONAssert.assertEquals(getJson("free-form.json"), (String)output.get("my-json"), false); + assertTrue("expect no change in type", output.get("my-json") instanceof Map); + assertTrue("expect string to become jsonNode", output.get("my-json-escaped") instanceof JsonNode); + + 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-catalog-db-adapter/src/main/resources/db/migration/V5.3__AddBluePrintNameVersion.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.3__AddBluePrintNameVersion.sql new file mode 100644 index 0000000000..97397df290 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.3__AddBluePrintNameVersion.sql @@ -0,0 +1,8 @@ +use catalogdb; + +ALTER TABLE vnf_resource_customization +ADD CDS_BLUEPRINT_NAME varchar(200) null; + +ALTER TABLE vnf_resource_customization +ADD CDS_BLUEPRINT_VERSION varchar(20) null; + diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.4__AddPnfResourceAndCustomization.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.4__AddPnfResourceAndCustomization.sql new file mode 100644 index 0000000000..5571bf89ee --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.4__AddPnfResourceAndCustomization.sql @@ -0,0 +1,39 @@ +use catalogdb; + +CREATE TABLE IF NOT EXISTS `pnf_resource` ( + `ORCHESTRATION_MODE` varchar(20) DEFAULT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `MODEL_UUID` varchar(200) NOT NULL, + `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL, + `MODEL_VERSION` varchar(20) NOT NULL, + `MODEL_NAME` varchar(200) DEFAULT NULL, + `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL, + `RESOURCE_CATEGORY` varchar(200) DEFAULT NULL, + `RESOURCE_SUB_CATEGORY` varchar(200) DEFAULT NULL, + PRIMARY KEY (`MODEL_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `pnf_resource_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `NF_TYPE` varchar(200) DEFAULT NULL, + `NF_ROLE` varchar(200) DEFAULT NULL, + `NF_FUNCTION` varchar(200) DEFAULT NULL, + `NF_NAMING_CODE` varchar(200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `PNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, + `MULTI_STAGE_DESIGN` varchar(20) DEFAULT NULL, + `RESOURCE_INPUT` varchar(2000) DEFAULT NULL, + CDS_BLUEPRINT_NAME varchar(200) DEFAULT NULL, + CDS_BLUEPRINT_VERSION varchar(20) DEFAULT NULL, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), + KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`), + CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `pnf_resource_customization_to_service` ( + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) +)ENGINE=InnoDB DEFAULT CHARSET=latin1;
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java index b08b93eb87..89f4824492 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java @@ -170,6 +170,14 @@ public class CvnfcCatalogDbQueryTest { } else { Assert.fail("No linked VnfVfmoduleCvnfcConfigurationCustomization found for CvnfcCustomization"); } + + VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomizationFound = client. + getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid( + "6912dd02-2b16-11e9-b210-d663bd873d93", + "bdbf984a-2b16-11e9-b210-d663bd873d93", + "0c042562-2bac-11e9-b210-d663bd873d93"); + assertNotNull(vnfVfmoduleCvnfcConfigurationCustomizationFound); + System.out.println(vnfVfmoduleCvnfcConfigurationCustomizationFound.getModelCustomizationUUID()); } protected CvnfcCustomization setUpCvnfcCustomization(String id){ @@ -198,4 +206,4 @@ public class CvnfcCatalogDbQueryTest { vnfcCustomization.setDescription("testVnfcCustomizationDescription"); return vnfcCustomization; } -} +}
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java index 4479e1ba4a..d28784bb93 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java @@ -7,9 +7,9 @@ * 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. @@ -22,6 +22,7 @@ package org.onap.so.db.catalog.client; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.when; import java.util.List; @@ -42,6 +43,8 @@ import org.onap.so.db.catalog.beans.ExternalServiceToInternalService; import org.onap.so.db.catalog.beans.HomingInstance; import org.onap.so.db.catalog.beans.InstanceGroup; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.PnfResource; +import org.onap.so.db.catalog.beans.PnfResourceCustomization; import org.onap.so.db.catalog.beans.ServerType; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceRecipe; @@ -59,6 +62,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.security.core.parameters.P; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; @@ -68,31 +72,36 @@ import com.fasterxml.jackson.databind.ObjectMapper; @SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") public class CatalogDbClientTest { + public static final String MTN13 = "mtn13"; - + @LocalServerPort private int port; @Value("${mso.db.auth}") private String msoAdaptersAuth; - + @Autowired CatalogDbClientPortChanger client; @Before - public void initialize(){ - client.wiremockPort= String.valueOf(port); + public void initialize() { + client.wiremockPort = String.valueOf(port); } @Test - public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(){ - RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "*", "*", "*", "*"); + public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep() { + RainyDayHandlerStatus rainyDayHandlerStatus = client + .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep( + "AssignServiceInstanceBB", "*", "*", "*", "*"); Assert.assertEquals("Rollback", rainyDayHandlerStatus.getPolicy()); } @Test - public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStepRecordNotFound(){ - RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(UUID.randomUUID().toString(), "*", "*", "*", "*"); + public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStepRecordNotFound() { + RainyDayHandlerStatus rainyDayHandlerStatus = client + .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep( + UUID.randomUUID().toString(), "*", "*", "*", "*"); Assert.assertNull(rainyDayHandlerStatus); } @@ -184,7 +193,8 @@ public class CatalogDbClientTest { @Test public void testGetVnfResourceCustomizationByModelCustomizationUUID() { - VnfResourceCustomization vnfResourceCustomization = client.getVnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671"); + VnfResourceCustomization vnfResourceCustomization = client + .getVnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671"); Assert.assertNotNull(vnfResourceCustomization); Assert.assertEquals("vSAMP", vnfResourceCustomization.getNfRole()); Assert.assertNotNull(vnfResourceCustomization.getModelCustomizationUUID()); @@ -196,7 +206,8 @@ public class CatalogDbClientTest { @Test public void testGetVnfResourceCustomizationByModelCustomizationUUINotFound() { - VnfResourceCustomization vnfResourceCustomization = client.getVnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString()); + VnfResourceCustomization vnfResourceCustomization = client + .getVnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString()); Assert.assertNull(vnfResourceCustomization); } @@ -205,12 +216,14 @@ public class CatalogDbClientTest { InstanceGroup instanceGroup = client.getInstanceGroupByModelUUID("0c8692ef-b9c0-435d-a738-edf31e71f38b"); Assert.assertNotNull(instanceGroup); Assert.assertEquals("network_collection_resource_1806..NetworkCollection..0", instanceGroup.getModelName()); - Assert.assertEquals("org.openecomp.resource.cr.NetworkCollectionResource1806", instanceGroup.getToscaNodeType().toString()); + Assert.assertEquals("org.openecomp.resource.cr.NetworkCollectionResource1806", + instanceGroup.getToscaNodeType().toString()); } @Test public void testGetVfModuleCustomizationByModelCuztomizationUUID() { - VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCuztomizationUUID("cb82ffd8-252a-11e7-93ae-92361f002671"); + VfModuleCustomization vfModuleCustomization = client + .getVfModuleCustomizationByModelCuztomizationUUID("cb82ffd8-252a-11e7-93ae-92361f002671"); Assert.assertNotNull(vfModuleCustomization); Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID()); Assert.assertEquals("base", vfModuleCustomization.getLabel()); @@ -218,13 +231,15 @@ public class CatalogDbClientTest { @Test public void testGetVfModuleCustomizationByModelCuztomizationUUIDNotFound() { - VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCuztomizationUUID(UUID.randomUUID().toString()); + VfModuleCustomization vfModuleCustomization = client + .getVfModuleCustomizationByModelCuztomizationUUID(UUID.randomUUID().toString()); Assert.assertNull(vfModuleCustomization); } @Test public void testGetNetworkResourceCustomizationByModelCustomizationUUID() { - NetworkResourceCustomization networkResourceCustomization = client.getNetworkResourceCustomizationByModelCustomizationUUID("3bdbb104-476c-483e-9f8b-c095b3d308ac"); + NetworkResourceCustomization networkResourceCustomization = client + .getNetworkResourceCustomizationByModelCustomizationUUID("3bdbb104-476c-483e-9f8b-c095b3d308ac"); Assert.assertNotNull(networkResourceCustomization); Assert.assertNotNull(networkResourceCustomization.getModelCustomizationUUID()); Assert.assertEquals("CONTRAIL30_GNDIRECT 9", networkResourceCustomization.getModelInstanceName()); @@ -233,13 +248,16 @@ public class CatalogDbClientTest { @Test public void testGetNetworkResourceCustomizationByModelCustomizationUUIDNotFound() { - NetworkResourceCustomization networkResourceCustomization = client.getNetworkResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString()); + NetworkResourceCustomization networkResourceCustomization = client + .getNetworkResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString()); Assert.assertNull(networkResourceCustomization); } @Test public void testGgetVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID() { - VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID("cb82ffd8-252a-11e7-93ae-92361f002672", "20c4431c-246d-11e7-93ae-92361f002672"); + VfModuleCustomization vfModuleCustomization = client + .getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID( + "cb82ffd8-252a-11e7-93ae-92361f002672", "20c4431c-246d-11e7-93ae-92361f002672"); Assert.assertNotNull(vfModuleCustomization); Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID()); Assert.assertNotNull(vfModuleCustomization.getVfModule()); @@ -248,29 +266,35 @@ public class CatalogDbClientTest { @Test public void testGgetVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUIDNotFound() { - VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID("cb82ffd8-252a-11e7-93ae-92361f002672", UUID.randomUUID().toString()); + VfModuleCustomization vfModuleCustomization = client + .getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID( + "cb82ffd8-252a-11e7-93ae-92361f002672", UUID.randomUUID().toString()); Assert.assertNull(vfModuleCustomization); } @Test public void testGetFirstByServiceModelUUIDAndAction() { - ServiceRecipe serviceRecipe = client.getFirstByServiceModelUUIDAndAction("4694a55f-58b3-4f17-92a5-796d6f5ffd0d", "createInstance"); + ServiceRecipe serviceRecipe = client + .getFirstByServiceModelUUIDAndAction("4694a55f-58b3-4f17-92a5-796d6f5ffd0d", "createInstance"); Assert.assertNotNull(serviceRecipe); Assert.assertNotNull(serviceRecipe.getServiceModelUUID()); Assert.assertNotNull(serviceRecipe.getAction()); - Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", serviceRecipe.getOrchestrationUri()); + Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", + serviceRecipe.getOrchestrationUri()); Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription()); } @Test public void testGetFirstByServiceModelUUIDAndActionNotFound() { - ServiceRecipe serviceRecipe = client.getFirstByServiceModelUUIDAndAction("5df8b6de-2083-11e7-93ae-92361f002671", UUID.randomUUID().toString()); + ServiceRecipe serviceRecipe = client + .getFirstByServiceModelUUIDAndAction("5df8b6de-2083-11e7-93ae-92361f002671", UUID.randomUUID().toString()); Assert.assertNull(serviceRecipe); } - + @Test public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersion() { - VnfResource vnfResource = client.getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", "2.0"); + VnfResource vnfResource = client + .getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", "2.0"); Assert.assertNotNull(vnfResource); Assert.assertNotNull(vnfResource.getModelInvariantId()); Assert.assertNotNull(vnfResource.getModelVersion()); @@ -281,7 +305,9 @@ public class CatalogDbClientTest { @Test public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersionNotFound() { - VnfResource vnfResource = client.getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", UUID.randomUUID().toString()); + VnfResource vnfResource = client + .getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", + UUID.randomUUID().toString()); Assert.assertNull(vnfResource); } @@ -289,12 +315,15 @@ public class CatalogDbClientTest { public void testGetFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources() { VnfResource vnfr = new VnfResource(); vnfr.setModelUUID("ff2ae348-214a-11e7-93ae-92361f002671"); - VnfResourceCustomization firstVnfResourceCustomizationByModelInstanceNameAndVnfResources = client.getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources("vSAMP10a 1", vnfr); + VnfResourceCustomization firstVnfResourceCustomizationByModelInstanceNameAndVnfResources = client + .getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources("vSAMP10a 1", vnfr); Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources); Assert.assertEquals("vSAMP", firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getNfRole()); - Assert.assertEquals("vSAMP10a 1", firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getModelInstanceName()); + Assert.assertEquals("vSAMP10a 1", + firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getModelInstanceName()); Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVnfResources()); - Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVfModuleCustomizations()); + Assert + .assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVfModuleCustomizations()); } @Test @@ -315,7 +344,9 @@ public class CatalogDbClientTest { @Test public void testGetFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction() { - VnfComponentsRecipe vnfComponentsRecipe = client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction("20c4431c-246d-11e7-93ae-92361f002671", "volumeGroup", "createInstance"); + VnfComponentsRecipe vnfComponentsRecipe = client + .getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction( + "20c4431c-246d-11e7-93ae-92361f002671", "volumeGroup", "createInstance"); Assert.assertNotNull(vnfComponentsRecipe); Assert.assertNotNull(vnfComponentsRecipe.getAction()); Assert.assertNotNull(vnfComponentsRecipe.getVfModuleModelUUID()); @@ -328,23 +359,28 @@ public class CatalogDbClientTest { @Test public void testGetFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndActionNotFound() { - VnfComponentsRecipe vnfComponentsRecipe = client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(UUID.randomUUID().toString(), "volumeGroup", "createInstance"); + VnfComponentsRecipe vnfComponentsRecipe = client + .getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(UUID.randomUUID().toString(), + "volumeGroup", "createInstance"); Assert.assertNull(vnfComponentsRecipe); } @Test public void testGetFirstVnfComponentsRecipeByVnfComponentTypeAndAction() { - VnfComponentsRecipe vnfComponentsRecipe = client.getFirstVnfComponentsRecipeByVnfComponentTypeAndAction("volumeGroup", "createInstance"); + VnfComponentsRecipe vnfComponentsRecipe = client + .getFirstVnfComponentsRecipeByVnfComponentTypeAndAction("volumeGroup", "createInstance"); Assert.assertNotNull(vnfComponentsRecipe); Assert.assertNotNull(vnfComponentsRecipe.getAction()); Assert.assertNotNull(vnfComponentsRecipe.getVnfComponentType()); Assert.assertEquals("VID_DEFAULT recipe t", vnfComponentsRecipe.getDescription()); - Assert.assertEquals("/mso/async/services/CreateVfModuleVolumeInfraV1", vnfComponentsRecipe.getOrchestrationUri()); + Assert + .assertEquals("/mso/async/services/CreateVfModuleVolumeInfraV1", vnfComponentsRecipe.getOrchestrationUri()); } @Test public void testGetServiceByModelVersionAndModelInvariantUUID() { - Service service = client.getServiceByModelVersionAndModelInvariantUUID("2.0", "9647dfc4-2083-11e7-93ae-92361f002671"); + Service service = client + .getServiceByModelVersionAndModelInvariantUUID("2.0", "9647dfc4-2083-11e7-93ae-92361f002671"); Assert.assertNotNull(service); Assert.assertNotNull(service.getModelVersion()); Assert.assertNotNull(service.getModelInvariantUUID()); @@ -360,7 +396,8 @@ public class CatalogDbClientTest { @Test public void testGetVfModuleByModelInvariantUUIDAndModelVersion() { - VfModule vfModule = client.getVfModuleByModelInvariantUUIDAndModelVersion("78ca26d0-246d-11e7-93ae-92361f002671", "2"); + VfModule vfModule = client + .getVfModuleByModelInvariantUUIDAndModelVersion("78ca26d0-246d-11e7-93ae-92361f002671", "2"); Assert.assertNotNull(vfModule); Assert.assertNotNull(vfModule.getModelVersion()); Assert.assertNotNull(vfModule.getModelInvariantUUID()); @@ -373,10 +410,11 @@ public class CatalogDbClientTest { VfModule vfModule = client.getVfModuleByModelInvariantUUIDAndModelVersion(UUID.randomUUID().toString(), "2"); Assert.assertNull(vfModule); } - + @Test public void testGetServiceByModelInvariantUUIDOrderByModelVersionDesc() { - List<Service> serviceList = client.getServiceByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671"); + List<Service> serviceList = client + .getServiceByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671"); Assert.assertFalse(serviceList.isEmpty()); Assert.assertEquals(2, serviceList.size()); Service service = serviceList.get(0); @@ -385,22 +423,25 @@ public class CatalogDbClientTest { @Test public void testGetServiceByModelInvariantUUIDOrderByModelVersionDescNotFound() { - List<Service> serviceList = client.getServiceByModelInvariantUUIDOrderByModelVersionDesc(UUID.randomUUID().toString()); + List<Service> serviceList = client + .getServiceByModelInvariantUUIDOrderByModelVersionDesc(UUID.randomUUID().toString()); Assert.assertTrue(serviceList.isEmpty()); } @Test public void testGetVfModuleByModelInvariantUUIDOrderByModelVersionDesc() { - List<VfModule> moduleList = client.getVfModuleByModelInvariantUUIDOrderByModelVersionDesc("78ca26d0-246d-11e7-93ae-92361f002671"); + List<VfModule> moduleList = client + .getVfModuleByModelInvariantUUIDOrderByModelVersionDesc("78ca26d0-246d-11e7-93ae-92361f002671"); Assert.assertFalse(moduleList.isEmpty()); Assert.assertEquals(2, moduleList.size()); VfModule module = moduleList.get(0); - Assert.assertEquals("vSAMP10a DEV Base",module.getDescription()); + Assert.assertEquals("vSAMP10a DEV Base", module.getDescription()); } @Test public void testPostCloudSite() { - CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger("http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort); + CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger( + "http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort); CloudSite cloudSite = new CloudSite(); cloudSite.setId("MTN6"); cloudSite.setClli("TESTCLLI"); @@ -438,60 +479,61 @@ public class CatalogDbClientTest { @Test public void testPostHomingInstance() { - CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger("http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort); + CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger( + "http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort); HomingInstance homingInstance = new HomingInstance(); homingInstance.setServiceInstanceId("5df8d6be-2083-11e7-93ae-92361f232671"); homingInstance.setCloudOwner("CloudOwner-1"); homingInstance.setCloudRegionId("CloudRegionOne"); homingInstance.setOofDirectives("{\n" + - "\"directives\": [\n" + - "{\n" + - "\"directives\": [\n" + - "{\n" + - "\"attributes\": [\n" + - "{\n" + - "\"attribute_value\": \"onap.hpa.flavor31\",\n" + - "\"attribute_name\": \"firewall_flavor_name\"\n" + - "}\n" + - "],\n" + - "\"type\": \"flavor_directives\"\n" + - "}\n" + - "],\n" + - "\"type\": \"vnfc\",\n" + - "\"id\": \"vfw\"\n" + - "},\n" + - "{\n" + - "\"directives\": [\n" + - "{\n" + - "\"attributes\": [\n" + - "{\n" + - "\"attribute_value\": \"onap.hpa.flavor32\",\n" + - "\"attribute_name\": \"packetgen_flavor_name\"\n" + - "}\n" + - "],\n" + - "\"type\": \"flavor_directives\"\n" + - "}\n" + - "],\n" + - "\"type\": \"vnfc\",\n" + - "\"id\": \"vgenerator\"\n" + - "},\n" + - "{\n" + - "\"directives\": [\n" + - "{\n" + - "\"attributes\": [\n" + - "{\n" + - "\"attribute_value\": \"onap.hpa.flavor31\",\n" + - "\"attribute_name\": \"sink_flavor_name\"\n" + - "}\n" + - "],\n" + - "\"type\": \"flavor_directives\"\n" + - "}\n" + - "],\n" + - "\"type\": \"vnfc\",\n" + - "\"id\": \"vsink\"\n" + - "}\n" + - "]\n" + - "}"); + "\"directives\": [\n" + + "{\n" + + "\"directives\": [\n" + + "{\n" + + "\"attributes\": [\n" + + "{\n" + + "\"attribute_value\": \"onap.hpa.flavor31\",\n" + + "\"attribute_name\": \"firewall_flavor_name\"\n" + + "}\n" + + "],\n" + + "\"type\": \"flavor_directives\"\n" + + "}\n" + + "],\n" + + "\"type\": \"vnfc\",\n" + + "\"id\": \"vfw\"\n" + + "},\n" + + "{\n" + + "\"directives\": [\n" + + "{\n" + + "\"attributes\": [\n" + + "{\n" + + "\"attribute_value\": \"onap.hpa.flavor32\",\n" + + "\"attribute_name\": \"packetgen_flavor_name\"\n" + + "}\n" + + "],\n" + + "\"type\": \"flavor_directives\"\n" + + "}\n" + + "],\n" + + "\"type\": \"vnfc\",\n" + + "\"id\": \"vgenerator\"\n" + + "},\n" + + "{\n" + + "\"directives\": [\n" + + "{\n" + + "\"attributes\": [\n" + + "{\n" + + "\"attribute_value\": \"onap.hpa.flavor31\",\n" + + "\"attribute_name\": \"sink_flavor_name\"\n" + + "}\n" + + "],\n" + + "\"type\": \"flavor_directives\"\n" + + "}\n" + + "],\n" + + "\"type\": \"vnfc\",\n" + + "\"id\": \"vsink\"\n" + + "}\n" + + "]\n" + + "}"); localClient.postHomingInstance(homingInstance); HomingInstance getHomingInstance = this.client.getHomingInstance("5df8d6be-2083-11e7-93ae-92361f232671"); Assert.assertNotNull(getHomingInstance); @@ -501,7 +543,7 @@ public class CatalogDbClientTest { Assert.assertEquals("CloudRegionOne", getHomingInstance.getCloudRegionId()); } - @Test + @Test public void testGetServiceByModelName() { Service service = client.getServiceByModelName("MSOTADevInfra_Test_Service"); Assert.assertNotNull(service); @@ -534,39 +576,44 @@ public class CatalogDbClientTest { } @Test - public void testGetNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(){ - NorthBoundRequest northBoundRequest = new NorthBoundRequest(); - northBoundRequest.setAction("createService"); - northBoundRequest.setRequestScope("service"); - northBoundRequest.setIsAlacarte(true); - northBoundRequest.setCloudOwner("my-custom-cloud-owner"); - client.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner("createService", "service", true, "my-custom-cloud-owner"); - Assert.assertNotNull(northBoundRequest); - Assert.assertEquals("createService",northBoundRequest.getAction()); - Assert.assertEquals("service",northBoundRequest.getRequestScope()); - Assert.assertEquals(true,northBoundRequest.getIsAlacarte() ); - Assert.assertEquals("my-custom-cloud-owner", northBoundRequest.getCloudOwner()); + public void testGetNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner() { + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + northBoundRequest.setAction("createService"); + northBoundRequest.setRequestScope("service"); + northBoundRequest.setIsAlacarte(true); + northBoundRequest.setCloudOwner("my-custom-cloud-owner"); + client.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner("createService", "service", true, + "my-custom-cloud-owner"); + Assert.assertNotNull(northBoundRequest); + Assert.assertEquals("createService", northBoundRequest.getAction()); + Assert.assertEquals("service", northBoundRequest.getRequestScope()); + Assert.assertEquals(true, northBoundRequest.getIsAlacarte()); + Assert.assertEquals("my-custom-cloud-owner", northBoundRequest.getCloudOwner()); } - + @Test public void testFindServiceRecipeByActionAndServiceModelUUID() { - ServiceRecipe serviceRecipe = client.findServiceRecipeByActionAndServiceModelUUID("createInstance","4694a55f-58b3-4f17-92a5-796d6f5ffd0d" ); + ServiceRecipe serviceRecipe = client + .findServiceRecipeByActionAndServiceModelUUID("createInstance", "4694a55f-58b3-4f17-92a5-796d6f5ffd0d"); Assert.assertNotNull(serviceRecipe); Assert.assertNotNull(serviceRecipe.getServiceModelUUID()); Assert.assertNotNull(serviceRecipe.getAction()); - Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", serviceRecipe.getOrchestrationUri()); + Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", + serviceRecipe.getOrchestrationUri()); Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription()); } @Test public void testFindServiceRecipeByActionAndServiceModelUUIDNotFound() { - ServiceRecipe serviceRecipe = client.findServiceRecipeByActionAndServiceModelUUID("not_found","5df8b6de-2083-11e7-93ae-test" ); + ServiceRecipe serviceRecipe = client + .findServiceRecipeByActionAndServiceModelUUID("not_found", "5df8b6de-2083-11e7-93ae-test"); Assert.assertNull(serviceRecipe); } @Test public void testFindExternalToInternalServiceByServiceName() { - ExternalServiceToInternalService externalServiceToInternalService = client.findExternalToInternalServiceByServiceName("MySpecialServiceName"); + ExternalServiceToInternalService externalServiceToInternalService = client + .findExternalToInternalServiceByServiceName("MySpecialServiceName"); Assert.assertNotNull(externalServiceToInternalService); Assert.assertNotNull(externalServiceToInternalService.getServiceName()); Assert.assertNotNull(externalServiceToInternalService.getServiceModelUUID()); @@ -575,7 +622,51 @@ public class CatalogDbClientTest { @Test public void testFindExternalToInternalServiceByServiceNameNotFound() { - ExternalServiceToInternalService externalServiceToInternalService = client.findExternalToInternalServiceByServiceName("Not_Found"); + ExternalServiceToInternalService externalServiceToInternalService = client + .findExternalToInternalServiceByServiceName("Not_Found"); Assert.assertNull(externalServiceToInternalService); } + + @Test + public void getPnfResourceByModelUUID_validUuid_expectedOutput() { + PnfResource pnfResource = client.getPnfResourceByModelUUID("ff2ae348-214a-11e7-93ae-92361f002680"); + Assert.assertNotNull(pnfResource); + assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID()); + assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680", + pnfResource.getModelInvariantUUID()); + assertEquals("PNFResource modelVersion", "1.0", pnfResource.getModelVersion()); + assertEquals("PNFResource orchestration mode", "", pnfResource.getOrchestrationMode()); + } + + @Test + public void getPnfResourceByModelUUID_invalidUuid_NullOutput() { + PnfResource pnfResource = client.getPnfResourceByModelUUID(UUID.randomUUID().toString()); + Assert.assertNull(pnfResource); + } + + @Test + public void getPnfResourceCustomizationByModelCustomizationUUID_validUuid_expectedOutput() { + PnfResourceCustomization pnfResourceCustomization = client + .getPnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002680"); + assertEquals("modelInstanceName", "PNF routing", pnfResourceCustomization.getModelInstanceName()); + assertEquals("blueprintName", "test_configuration_restconf", pnfResourceCustomization.getBlueprintName()); + assertEquals("blueprintVersion", "1.0.0", pnfResourceCustomization.getBlueprintVersion()); + PnfResource pnfResource = pnfResourceCustomization.getPnfResources(); + assertNotNull(pnfResource); + + assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID()); + assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680", + pnfResource.getModelInvariantUUID()); + assertEquals("PNFResource modelVersion", "1.0", pnfResource.getModelVersion()); + assertEquals("PNFResource orchestration mode", "", pnfResource.getOrchestrationMode()); + + } + + @Test + public void getPnfResourceCustomizationByModelCustomizationUUID_invalidUuid_nullOutput() { + PnfResourceCustomization pnfResourceCustomization = client + .getPnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString()); + Assert.assertNull(pnfResourceCustomization); + } + } diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql index 1223080e59..91deab8fff 100644 --- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql +++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql @@ -293,3 +293,15 @@ VALUES ( '1', '68dc9a92-214c-11e7-93ae-92361f002671', 'cb82ffd8-252a-11e7-93ae-92361f002671', '9bcce658-9b37-11e8-98d0-529269fb1459'); + +insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values +('5df8b6de-2083-11e7-93ae-92361f002676', 'PNF_routing_service', '9647dfc4-2083-11e7-93ae-92361f002676', '1.0', 'PNF service', '2019-03-08 12:00:29', null, 'NA', 'NA', 'Luna', 'Oxygen'); + +insert into pnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, model_invariant_uuid, model_version, model_name, tosca_node_type) values +('', 'PNF routing', '2019-03-08 12:00:28', 'ff2ae348-214a-11e7-93ae-92361f002680', '2fff5b20-214b-11e7-93ae-92361f002680', '1.0', 'PNF resource', null); + +insert into pnf_resource_customization(model_customization_uuid, model_instance_name, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, pnf_resource_model_uuid, multi_stage_design, cds_blueprint_name, cds_blueprint_version) values +('68dc9a92-214c-11e7-93ae-92361f002680', 'PNF routing', 'routing', 'routing', 'routing', 'routing', '2019-03-08 12:00:29', 'ff2ae348-214a-11e7-93ae-92361f002680', null, "test_configuration_restconf", "1.0.0"); + +insert into pnf_resource_customization_to_service(service_model_uuid, resource_model_customization_uuid) values +('5df8b6de-2083-11e7-93ae-92361f002676', '68dc9a92-214c-11e7-93ae-92361f002680');
\ 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 80333d6c7e..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,10 +126,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("CreateNetworkA"); logger.debug("Async Create Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); // Use the synchronous method to perform the actual Create @@ -252,11 +249,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - String serviceName = "UpdateNetworkA"; - MsoLogger.setServiceName (serviceName); - MsoLogger.setLogContext (msoRequest); logger.debug("Async Update Network: {} of type {} in {}/{}", networkId, networkType, cloudSiteId, tenantId); // Use the synchronous method to perform the actual Create @@ -292,9 +285,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { msoRequest, subnetIdMap, networkRollback); - MsoLogger.setServiceName (serviceName); } catch (NetworkException e) { - MsoLogger.setServiceName (serviceName); logger.debug ("Got a NetworkException on updateNetwork: ", e); MsoExceptionCategory exCat = null; String eMsg = null; @@ -348,11 +339,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - MsoLogger.setLogContext (msoRequest); - String serviceName = "QueryNetworkA"; - MsoLogger.setServiceName (serviceName); logger.debug("Async Query Network {} in {}/{}", networkNameOrId, cloudSiteId, tenantId); String errorCreateNetworkMessage = "{} {} Error sending createNetwork notification {} "; @@ -378,9 +365,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { status, vlans, subnetIdMap); - MsoLogger.setServiceName (serviceName); } catch (NetworkException e) { - MsoLogger.setServiceName (serviceName); logger.debug (NETWORK_EXCEPTION_MSG, e); MsoExceptionCategory exCat = null; String eMsg = null; @@ -450,10 +435,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - MsoLogger.setLogContext (msoRequest); + String serviceName = "DeleteNetworkA"; - MsoLogger.setServiceName (serviceName); logger.debug("Async Delete Network {} in {}/{}", networkId, cloudSiteId, tenantId); // Use the synchronous method to perform the actual Create @@ -464,9 +447,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { try { networkAdapter.deleteNetwork (cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkId, msoRequest, networkDeleted); - MsoLogger.setServiceName (serviceName); } catch (NetworkException e) { - MsoLogger.setServiceName (serviceName); logger.debug (NETWORK_EXCEPTION_MSG, e); MsoExceptionCategory exCat = null; String eMsg = null; @@ -513,9 +494,6 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { */ @Override public void rollbackNetworkA (NetworkRollback rollback, String messageId, String notificationUrl) { - String error; - String serviceName = "RollbackNetworkA"; - MsoLogger.setServiceName (serviceName); // rollback may be null (e.g. if network already existed when Create was called) if (rollback == null) { logger.warn("{} {} Rollback is null", MessageEnum.RA_ROLLBACK_NULL, @@ -523,16 +501,13 @@ 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 try { networkAdapter.rollbackNetwork (rollback); - MsoLogger.setServiceName (serviceName); } catch (NetworkException e) { - MsoLogger.setServiceName (serviceName); logger.debug ("Got a NetworkException on rollbackNetwork: ", e); // Build and send Asynchronous error response MsoExceptionCategory exCat = null; 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 79966577f8..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,9 +266,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Holder <String> networkFqdn, Holder <Map <String, String>> subnetIdMap, Holder <NetworkRollback> rollback) throws NetworkException { - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName (CREATE_NETWORK_CONTEXT); - logger.debug("*** CREATE Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); // Will capture execution time for metrics @@ -714,8 +711,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { MsoRequest msoRequest, Holder <Map <String, String>> subnetIdMap, Holder <NetworkRollback> rollback) throws NetworkException { - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName (UPDATE_NETWORK_CONTEXT); + logger.debug("***UPDATE Network adapter with Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); @@ -1150,8 +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); - MsoLogger.setServiceName ("QueryNetwork"); + logger.debug("*** QUERY Network with Network: {} in {}/{}", networkNameOrId, cloudSiteId, tenantId); // Will capture execution time for metrics @@ -1289,8 +1284,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String networkId, MsoRequest msoRequest, Holder <Boolean> networkDeleted) throws NetworkException { - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("DeleteNetwork"); + logger.debug("*** DELETE Network adapter with Network: {} in {}/{}", networkId, cloudSiteId, tenantId); // Will capture execution time for metrics @@ -1382,7 +1376,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { */ @Override public void rollbackNetwork (NetworkRollback rollback) throws NetworkException { - MsoLogger.setServiceName ("RollbackNetwork"); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); @@ -1392,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 db9226bb19..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,8 +88,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { MsoRequest msoRequest, Holder <String> tenantId, Holder <TenantRollback> rollback) throws TenantException { - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName (CREATE_TENANT); logger.debug("Call to MSO createTenant adapter. Creating Tenant: {} in {}", tenantName, cloudSiteId); @@ -153,8 +151,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { Holder <String> tenantId, Holder <String> tenantName, Holder <Map <String, String>> metadata) throws TenantException { - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName (QUERY_TENANT); + logger.debug ("Querying Tenant {} in {}", tenantNameOrId, cloudSiteId); MsoTenantUtils tUtils; @@ -198,8 +195,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { String tenantId, MsoRequest msoRequest, Holder <Boolean> tenantDeleted) throws TenantException { - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName (DELETE_TENANT); logger.debug ("Deleting Tenant {} in {}", tenantId, cloudSiteId); @@ -230,7 +225,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { */ @Override public void rollbackTenant (TenantRollback rollback) throws TenantException { - MsoLogger.setServiceName (ROLLBACK_TENANT); // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { logger.warn("{} {} rollbackTenant, rollback is null", MessageEnum.RA_ROLLBACK_NULL, @@ -242,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 2c9d3776a7..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,10 +132,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - String serviceName = "CreateVnfA"; - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName (serviceName); + logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF); // Use the synchronous method to perform the actual Create MsoVnfAdapter vnfAdapter = vnfImpl; @@ -160,9 +157,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { vnfId, outputs, vnfRollback); - MsoLogger.setServiceName (serviceName); } catch (VnfException e) { - MsoLogger.setServiceName (serviceName); logger.error("{} {} VnfException in createVnfA ", MessageEnum.RA_CREATE_VNF_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; @@ -218,10 +213,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - String serviceName = "UpdateVnfA"; - MsoLogger.setServiceName (serviceName); - MsoLogger.setLogContext (msoRequest); + logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF); // Use the synchronous method to perform the actual Create @@ -234,9 +226,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { try { vnfAdapter.updateVnf (cloudSiteId, tenantId, vnfType,vnfVersion, vnfName, requestType, volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback); - MsoLogger.setServiceName (serviceName); } catch (VnfException e) { - MsoLogger.setServiceName (serviceName); logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_UPDATE_VNF_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; @@ -299,10 +289,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; + String serviceName = "QueryVnfA"; - MsoLogger.setServiceName (serviceName); - MsoLogger.setLogContext (msoRequest); logger.info("{}", MessageEnum.RA_ASYNC_QUERY_VNF); // Use the synchronous method to perform the actual query @@ -316,9 +304,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { try { vnfAdapter.queryVnf (cloudSiteId, tenantId, vnfName, msoRequest, vnfExists, vnfId, status, outputs); - MsoLogger.setServiceName (serviceName); } catch (VnfException e) { - MsoLogger.setServiceName (serviceName); logger.error("{} {} Exception sending queryVnfA notification ", MessageEnum.RA_QUERY_VNF_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; @@ -389,10 +375,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; + String serviceName = "DeleteVnfA"; - MsoLogger.setServiceName (serviceName); - MsoLogger.setLogContext (msoRequest); logger.info("{}", MessageEnum.RA_ASYNC_DELETE_VNF); // Use the synchronous method to perform the actual delete @@ -400,9 +384,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { try { vnfAdapter.deleteVnf (cloudSiteId, tenantId, vnfName, msoRequest); - MsoLogger.setServiceName (serviceName); } catch (VnfException e) { - MsoLogger.setServiceName (serviceName); logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_DELETE_VNF_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; @@ -451,16 +433,12 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { */ @Override public void rollbackVnfA (VnfRollback rollback, String messageId, String notificationUrl) { - String serviceName = "RollbackVnfA"; - MsoLogger.setServiceName (serviceName); - String error; // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { logger.info("{} rollbackVnfA: Empty Rollback: No action to perform", MessageEnum.RA_ROLLBACK_NULL); return; } - MsoLogger.setLogContext (rollback.getMsoRequest ()); logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF); // Use the synchronous method to perform the actual rollback @@ -468,9 +446,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { try { vnfAdapter.rollbackVnf (rollback); - MsoLogger.setServiceName (serviceName); } catch (VnfException e) { - MsoLogger.setServiceName (serviceName); logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_ROLLBACK_VNF_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; 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 ce060abee8..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 @@ -275,7 +275,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { Holder <VnfRollback> rollback) throws VnfException { // As of 1707 - this method should no longer be called MsoLogger.setLogContext (msoRequest.getRequestId (), msoRequest.getServiceInstanceId ()); - MsoLogger.setServiceName ("UpdateVnf"); logger.debug("UpdateVnf called?? This should not be called any longer - update vfModule"); } @@ -303,8 +302,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { Holder <String> vnfId, Holder <VnfStatus> status, Holder <Map <String, String>> outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("QueryVnf"); + logger.debug("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); // Will capture execution time for metrics @@ -363,8 +361,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String tenantId, String vnfName, MsoRequest msoRequest) throws VnfException { - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("DeleteVnf"); + logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); @@ -401,7 +398,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { @Override public void rollbackVnf (VnfRollback rollback) throws VnfException { long startTime = System.currentTimeMillis (); - MsoLogger.setServiceName ("RollbackVnf"); // 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"); @@ -413,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) { @@ -604,8 +597,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { useMCUuid = true; } } - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("CreateVfModule"); + String requestTypeString = ""; if (requestType != null && !"".equals(requestType)) { requestTypeString = requestType; @@ -1377,7 +1369,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String methodName = "updateVfModule"; MsoLogger.setLogContext (msoRequest.getRequestId (), msoRequest.getServiceInstanceId ()); String serviceName = VNF_ADAPTER_SERVICE_NAME + methodName; - MsoLogger.setServiceName (serviceName); StringBuilder sbInit = new StringBuilder(); sbInit.append("updateVfModule: \n"); @@ -1505,7 +1496,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { throw new VnfException (me); } if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) { - MsoLogger.setServiceName (serviceName); String error = "Update VFModule: Attached volume heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), error); @@ -1538,7 +1528,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { throw new VnfException (me); } if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) { - MsoLogger.setServiceName (serviceName); String error = "Update VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; logger.error ("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, tenantId, error, "OpenStack", 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 b0601e9264..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,8 +206,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { Holder <Map <String, String>> outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("QueryVnfCloudify"); logger.debug ("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); // Will capture execution time for metrics @@ -265,8 +263,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String tenantId, String vnfName, MsoRequest msoRequest) throws VnfException { - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("DeleteVnf"); // 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,11 +281,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { @Override public void rollbackVnf (VnfRollback rollback) throws VnfException { long startTime = System.currentTimeMillis (); - MsoLogger.setServiceName ("RollbackVnf"); // 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; } @@ -303,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; @@ -579,9 +571,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Will capture execution time for metrics long startTime = System.currentTimeMillis (); - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("CreateVfModule"); - // Require a model customization ID. Every VF Module definition must have one. if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) { logger.debug("Missing required input: modelCustomizationUuid"); @@ -1183,8 +1172,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String vnfName, MsoRequest msoRequest, Holder <Map <String, String>> outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("DeleteVf"); + 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 cb1e350774..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,8 +225,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { Holder <Map <String, String>> outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("QueryVnf"); logger.debug("Querying VNF " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics @@ -282,8 +280,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String tenantId, String vnfName, MsoRequest msoRequest) throws VnfException { - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("DeleteVnf"); // 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,11 +298,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { @Override public void rollbackVnf (VnfRollback rollback) throws VnfException { long startTime = System.currentTimeMillis (); - MsoLogger.setServiceName ("RollbackVnf"); // 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; } @@ -322,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; @@ -621,9 +613,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Will capture execution time for metrics long startTime = System.currentTimeMillis (); - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("CreateVfModule"); - // Require a model customization ID. Every VF Module definition must have one. if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) { logger.debug("Missing required input: modelCustomizationUuid"); @@ -1169,8 +1158,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { MsoRequest msoRequest, Holder <Map <String, String>> outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("DeleteVfModule"); logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql index e9f2a09860..ac08f8b645 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql +++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql @@ -384,6 +384,8 @@ create table `vnf_resource_customization` ( `vnf_resource_model_uuid` varchar(200) not null, `multi_stage_design` varchar(20) default null, `resource_input` varchar(20000) default null, + `cds_blueprint_name` varchar(200), + `cds_blueprint_version` varchar(200), primary key (`model_customization_uuid`), key `fk_vnf_resource_customization__vnf_resource1_idx` (`vnf_resource_model_uuid`), constraint `fk_vnf_resource_customization__vnf_resource1` foreign key (`vnf_resource_model_uuid`) references `vnf_resource` (`model_uuid`) on delete cascade on update cascade 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-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java index 62233273b1..d0973d3c44 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java @@ -66,7 +66,6 @@ public class SDNCServiceRequestTask { public void runRequest(SDNCServiceRequest request,String msoRequestId,String msoServiceInstanceId,String myUrlSuffix) { MsoLogger.setLogContext(msoRequestId, msoServiceInstanceId); - MsoLogger.setServiceName(getClass().getSimpleName()); String sdncRequestId = request.getSdncRequestId(); String sdncService = request.getSdncService(); 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> |