diff options
63 files changed, 1639 insertions, 255 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java index 012c560689..47ff6c1b5f 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java @@ -1330,13 +1330,13 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ logger.debug("Parameter: {} is of type {}", key, type); if ("string".equalsIgnoreCase(type)) { // Easiest! - String str = inputs.get(key).toString(); + String str = inputs.get(key) != null ? inputs.get(key).toString() : null; if (alias) newInputs.put(realName, str); else newInputs.put(key, str); } else if ("number".equalsIgnoreCase(type)) { - String integerString = inputs.get(key).toString(); + String integerString = inputs.get(key) != null ? inputs.get(key).toString() : null; Integer anInteger = null; try { anInteger = Integer.parseInt(integerString); @@ -1375,7 +1375,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ else newInputs.put(key, json); } else if ("comma_delimited_list".equalsIgnoreCase(type)) { - String commaSeparated = inputs.get(key).toString(); + String commaSeparated = inputs.get(key) != null ? inputs.get(key).toString() : null; try { List<String> anArrayList = this.convertCdlToArrayList(commaSeparated); if (alias) @@ -1390,7 +1390,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ newInputs.put(key, commaSeparated); } } else if ("boolean".equalsIgnoreCase(type)) { - String booleanString = inputs.get(key).toString(); + String booleanString = inputs.get(key) != null ? inputs.get(key).toString() : null; Boolean aBool = Boolean.valueOf(booleanString); if (alias) newInputs.put(realName, aBool); diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java index 70617fda4a..8469ad506c 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + /* * ============LICENSE_START========================================== * ONAP - SO diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsUnitTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsUnitTest.java index 66d6f59e79..9edc805cf3 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsUnitTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsUnitTest.java @@ -1,12 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.openstack.utils; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; @@ -71,6 +95,99 @@ public class MsoHeatUtilsUnitTest { JSONAssert.assertEquals(getJson("free-form.json"), mapper.writeValueAsString(output.get("my-json-escaped")), false); } + @Test + public final void convertInputMapValuesTest() { + MsoHeatUtils utils = new MsoHeatUtils(); + Map<String, Object> inputs = new HashMap<>(); + Set<HeatTemplateParam> params = new HashSet<>(); + HeatTemplate ht = new HeatTemplate(); + HeatTemplateParam htp = new HeatTemplateParam(); + htp.setParamName("vnf_name"); + htp.setParamType("string"); + params.add(htp); + inputs.put("vnf_name", "a_vnf_name"); + htp = new HeatTemplateParam(); + htp.setParamName("image_size"); + htp.setParamType("number"); + params.add(htp); + inputs.put("image_size", "1024"); + htp = new HeatTemplateParam(); + htp.setParamName("external"); + htp.setParamType("boolean"); + params.add(htp); + inputs.put("external", "false"); + htp = new HeatTemplateParam(); + htp.setParamName("oam_ips"); + htp.setParamType("comma_delimited_list"); + params.add(htp); + inputs.put("oam_ips", "a,b"); + htp = new HeatTemplateParam(); + htp.setParamName("oam_prefixes"); + htp.setParamType("json"); + params.add(htp); + String jsonEscInput = "[{\"prefix\": \"aValue\"}, {\"prefix\": \"aValue2\"}]"; + inputs.put("oam_prefixes", jsonEscInput); + ht.setParameters(params); + + Map<String, Object> output = utils.convertInputMap(inputs, ht); + + assertEquals("a_vnf_name", output.get("vnf_name")); + assertEquals(1024, output.get("image_size")); + assertEquals(false, output.get("external")); + List<String> cdl = new ArrayList<>(); + cdl.add(0, "a"); + cdl.add(1, "b"); + assertEquals(cdl, output.get("oam_ips")); + ObjectMapper JSON_MAPPER = new ObjectMapper(); + JsonNode jn = null; + try { + jn = JSON_MAPPER.readTree(jsonEscInput); + } catch (Exception e) { + } + assertEquals(jn, output.get("oam_prefixes")); + } + + @Test + public final void convertInputMapNullsTest() { + MsoHeatUtils utils = new MsoHeatUtils(); + Map<String, Object> inputs = new HashMap<>(); + Set<HeatTemplateParam> params = new HashSet<>(); + HeatTemplate ht = new HeatTemplate(); + HeatTemplateParam htp = new HeatTemplateParam(); + htp.setParamName("vnf_name"); + htp.setParamType("string"); + params.add(htp); + inputs.put("vnf_name", null); + htp = new HeatTemplateParam(); + htp.setParamName("image_size"); + htp.setParamType("number"); + params.add(htp); + inputs.put("image_size", null); + htp = new HeatTemplateParam(); + htp.setParamName("external"); + htp.setParamType("boolean"); + params.add(htp); + inputs.put("external", null); + htp = new HeatTemplateParam(); + htp.setParamName("oam_ips"); + htp.setParamType("comma_delimited_list"); + params.add(htp); + inputs.put("oam_ips", null); + htp = new HeatTemplateParam(); + htp.setParamName("oam_prefixes"); + htp.setParamType("json"); + params.add(htp); + inputs.put("oam_prefixes", null); + ht.setParameters(params); + + Map<String, Object> output = utils.convertInputMap(inputs, ht); + + assertNull(output.get("vnf_name")); + assertNull(output.get("image_size")); + assertEquals(false, output.get("external")); + assertNull(output.get("oam_ips")); + assertNull(output.get("oam_prefixes")); + } private String getJson(String filename) throws IOException { return new String(Files.readAllBytes(Paths.get("src/test/resources/__files/MsoHeatUtils/" + filename))); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java index c62dc0dfbf..a136ff778d 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java @@ -23,9 +23,14 @@ package org.onap.so.adapters.vnfrest; import java.util.HashMap; import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.mappers.MapAdapter; import com.fasterxml.jackson.annotation.JsonRootName; @@ -35,6 +40,7 @@ import com.fasterxml.jackson.annotation.JsonRootName; */ @JsonRootName("createVfModuleRequest") @XmlRootElement(name = "createVfModuleRequest") +@XmlAccessorType(XmlAccessType.FIELD) public class CreateVfModuleRequest extends VfRequestCommon { private String cloudSiteId; private String tenantId; @@ -57,7 +63,7 @@ public class CreateVfModuleRequest extends VfRequestCommon { private Boolean failIfExists = false; private Boolean backout = true; private Boolean enableBridge; - + @XmlJavaTypeAdapter(MapAdapter.class) private Map<String, Object> vfModuleParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java index 214abd4e9d..d402004d57 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java @@ -24,14 +24,19 @@ package org.onap.so.adapters.vnfrest; import java.util.HashMap; import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.mappers.MapAdapter; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("createVolumeGroupRequest") @XmlRootElement(name = "createVolumeGroupRequest") +@XmlAccessorType(XmlAccessType.FIELD) public class CreateVolumeGroupRequest extends VfRequestCommon { private String cloudSiteId; private String tenantId; @@ -41,6 +46,7 @@ public class CreateVolumeGroupRequest extends VfRequestCommon { private String vnfVersion; private String vfModuleType; private String modelCustomizationUuid; + @XmlJavaTypeAdapter(MapAdapter.class) private Map<String,Object> volumeGroupParams = new HashMap<>(); private Boolean failIfExists; private Boolean enableBridge; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java index 1c7696a79b..bac9eae2c5 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java @@ -24,14 +24,19 @@ package org.onap.so.adapters.vnfrest; import java.util.HashMap; import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.mappers.MapAdapter; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("updateVfModuleRequest") @XmlRootElement(name = "updateVfModuleRequest") +@XmlAccessorType(XmlAccessType.FIELD) public class UpdateVfModuleRequest extends VfRequestCommon { private String cloudSiteId; @@ -57,7 +62,8 @@ public class UpdateVfModuleRequest extends VfRequestCommon { private String requestType; private Boolean failIfExists; private Boolean backout; - + + @XmlJavaTypeAdapter(MapAdapter.class) private Map<String,Object> vfModuleParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java index 8ddef1eeaf..d3b685a1d0 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java @@ -24,14 +24,19 @@ package org.onap.so.adapters.vnfrest; import java.util.HashMap; import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.mappers.MapAdapter; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("updateVolumeGroupRequest") @XmlRootElement(name = "updateVolumeGroupRequest") +@XmlAccessorType(XmlAccessType.FIELD) public class UpdateVolumeGroupRequest extends VfRequestCommon { private String cloudSiteId; private String tenantId; @@ -41,6 +46,7 @@ public class UpdateVolumeGroupRequest extends VfRequestCommon { private String vnfVersion; private String vfModuleType; private String modelCustomizationUuid; + @XmlJavaTypeAdapter(MapAdapter.class) private Map<String,Object> volumeGroupParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java new file mode 100644 index 0000000000..e816646e1c --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.openstack.mappers; + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.bind.annotation.adapters.XmlAdapter; + +import org.w3c.dom.Element; + +public class MapAdapter extends XmlAdapter<MapEntry, Map<String, Object>> { + + @Override + public MapEntry marshal(Map<String, Object> v) throws Exception { + + if (v == null || v.isEmpty()) {return null;} + + MapEntry map = new MapEntry(); + + for (String key : v.keySet()) { + map.addEntry(key, v.get(key)); + } + + return map; + } + + @Override + public Map<String, Object> unmarshal(MapEntry v) throws Exception { + if (v == null) {return null;} + + Map<String, Object> map = new HashMap<>(v.entry.size()); + + for(MapElements entry: v.entry) { + if (entry.value instanceof Element) { + map.put(entry.key, ((Element)entry.value).getTextContent()); + } else { + map.put(entry.key, entry.value); + } + } + + return map; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java new file mode 100644 index 0000000000..709393bb84 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.openstack.mappers; + +import javax.xml.bind.annotation.XmlElement; + +public class MapElements +{ + @XmlElement public String key; + @XmlElement public Object value; + + public MapElements() {} //Required by JAXB + + public MapElements(String key, Object value) + { + this.key = key; + this.value = value; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java new file mode 100644 index 0000000000..e6dc0e0538 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.openstack.mappers; + +import java.util.ArrayList; +import java.util.List; + +public class MapEntry { + + public List<MapElements> entry = new ArrayList<>(); + + public MapEntry() {} //Required by JAXB + + public void addEntry(String key, Object value) { + entry.add(new MapElements(key, value)); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java new file mode 100644 index 0000000000..038e88317d --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.openstack.mappers; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; + +import org.junit.Test; +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; + + +public class JAXBMarshallingTest { + + + @Test + public void xmlMarshalTest() throws IOException, JAXBException { + JAXBContext context = JAXBContext.newInstance(CreateVfModuleRequest.class); + + CreateVfModuleRequest request = (CreateVfModuleRequest) context.createUnmarshaller().unmarshal(Files.newBufferedReader(Paths.get("src/test/resources/createVfModuleRequest-with-params.xml"))); + + assertEquals("ubuntu-16-04-cloud-amd64", request.getVfModuleParams().get("vcpe_image_name")); + assertEquals("10.2.0.0/24", request.getVfModuleParams().get("cpe_public_net_cidr")); + assertEquals("", request.getVfModuleParams().get("workload_context")); + + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml b/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml new file mode 100644 index 0000000000..76ba3695f2 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml @@ -0,0 +1,206 @@ +<createVfModuleRequest> + <cloudSiteId>RegionOne</cloudSiteId> + <tenantId>09d8566ea45e43aa974cf447ed591d77</tenantId> + <vnfId>8daea639-82b9-4da6-aec9-5054f006a82d</vnfId> + <vnfName>vcpe_vnf_vcpe_infra_201903101808</vnfName> + <vfModuleName>vcpe_vfmodule_vcpeinfra53f27a6285bd_201903101808</vfModuleName> + <vfModuleId>1ea78add-a36c-4af4-959f-4c43292b3aac</vfModuleId> + <vnfType>demoVCPEInfra/vCPE_infra 53f27a62-85bd 0</vnfType> + <vfModuleType>VcpeInfra53f27a6285bd..base_vcpe_infra..module-0</vfModuleType> + <vnfVersion>1.0</vnfVersion> + <modelCustomizationUuid>76135970-0c64-4b62-a4d0-56606fc040b3</modelCustomizationUuid> + <requestType></requestType> + <volumeGroupId></volumeGroupId> + <volumeGroupStackId></volumeGroupStackId> + <baseVfModuleId></baseVfModuleId> + <baseVfModuleStackId></baseVfModuleStackId> + <skipAAI>true</skipAAI> + <backout>false</backout> + <failIfExists>true</failIfExists> + <vfModuleParams> + <entry> + <key>vf_module_id</key> + <value>1ea78add-a36c-4af4-959f-4c43292b3aac</value> + </entry> + <entry> + <key>cpe_public_subnet_id</key> + <value>vcpe_net_cpe_public_subnet_201903101808</value> + </entry> + <entry> + <key>oof_directives</key> + <value>{}</value> + </entry> + <entry> + <key>cpe_signal_subnet_id</key> + <value>vcpe_net_cpe_signal_subnet_201903101808</value> + </entry> + <entry> + <key>onap_private_net_id</key> + <value>oam_network_hkV9</value> + </entry> + <entry> + <key>vnf_name</key> + <value>vcpe_vnf_vcpe_infra_201903101808</value> + </entry> + <entry> + <key>key_name</key> + <value>vaaa_key</value> + </entry> + <entry> + <key>workload_context</key> + <value></value> + </entry> + <entry> + <key>vweb_name_0</key> + <value>zdcpe1cpe01web01_201903101808</value> + </entry> + <entry> + <key>vf_module_name</key> + <value>vcpe_vfmodule_vcpeinfra53f27a6285bd_201903101808</value> + </entry> + <entry> + <key>vcpe_flavor_name</key> + <value>m1.medium</value> + </entry> + <entry> + <key>vdhcp_name_0</key> + <value>zdcpe1cpe01dhcp01_201903101808</value> + </entry> + <entry> + <key>vdhcp_private_ip_0</key> + <value>10.4.0.1</value> + </entry> + <entry> + <key>install_script_version</key> + <value>1.3.0</value> + </entry> + <entry> + <key>vdhcp_private_ip_1</key> + <value>10.0.101.1</value> + </entry> + <entry> + <key>vnf_id</key> + <value>8daea639-82b9-4da6-aec9-5054f006a82d</value> + </entry> + <entry> + <key>cloud_env</key> + <value>openstack</value> + </entry> + <entry> + <key>mr_ip_addr</key> + <value>10.12.5.69</value> + </entry> + <entry> + <key>repo_url_artifacts</key> + <value>https://nexus.onap.org/content/repositories/releases</value> + </entry> + <entry> + <key>dcae_collector_port</key> + <value>8080</value> + </entry> + <entry> + <key>repo_url_blob</key> + <value>https://nexus.onap.org/content/sites/raw</value> + </entry> + <entry> + <key>public_net_id</key> + <value>971040b2-7059-49dc-b220-4fab50cb2ad4</value> + </entry> + <entry> + <key>onap_private_net_cidr</key> + <value>10.0.0.0/16</value> + </entry> + <entry> + <key>cpe_signal_net_cidr</key> + <value>10.4.0.0/24</value> + </entry> + <entry> + <key>environment_context</key> + <value></value> + </entry> + <entry> + <key>onap_private_subnet_id</key> + <value>oam_network_hkV9</value> + </entry> + <entry> + <key>vweb_private_ip_0</key> + <value>10.2.0.10</value> + </entry> + <entry> + <key>vaaa_private_ip_1</key> + <value>10.0.101.2</value> + </entry> + <entry> + <key>cpe_public_net_id</key> + <value>vcpe_net_cpe_public_201903101808</value> + </entry> + <entry> + <key>vweb_private_ip_1</key> + <value>10.0.101.40</value> + </entry> + <entry> + <key>mr_ip_port</key> + <value>30227</value> + </entry> + <entry> + <key>vaaa_private_ip_0</key> + <value>10.4.0.2</value> + </entry> + <entry> + <key>pub_key</key> + <value>ssh-rsa + AAAAB3NzaC1yc2EAAAADAQABAAABAQDKXDgoo3+WOqcUG8/5uUbk81+yczgwC4Y8ywTmuQqbNxlY1oQ0YxdMUqUnhitSXs5S/yRuAVOYHwGg2mCs20oAINrP+mxBI544AMIb9itPjCtgqtE2EWo6MmnFGbHB4Sx3XioE7F4VPsh7japsIwzOjbrQe+Mua1TGQ5d4nfEOQaaglXLLPFfuc7WbhbJbK6Q7rHqZfRcOwAMXgDoBqlyqKeiKwnumddo2RyNT8ljYmvB6buz7KnMinzo7qB0uktVT05FH9Rg0CTWH5norlG5qXgP2aukL0gk1ph8iAt7uYLf1ktp+LJI2gaF6L0/qli9EmVCSLr1uJ38Q8CBflhkh</value> + </entry> + <entry> + <key>sdnc_directives</key> + <value>{}</value> + </entry> + <entry> + <key>vdns_private_ip_0</key> + <value>10.2.0.1</value> + </entry> + <entry> + <key>cpe_signal_net_id</key> + <value>vcpe_net_cpe_signal_201903101808</value> + </entry> + <entry> + <key>vdns_private_ip_1</key> + <value>10.0.101.3</value> + </entry> + <entry> + <key>demo_artifacts_version</key> + <value>1.3.0</value> + </entry> + <entry> + <key>vdns_name_0</key> + <value>zdcpe1cpe01dns01_201903101808</value> + </entry> + <entry> + <key>cpe_public_net_cidr</key> + <value>10.2.0.0/24</value> + </entry> + <entry> + <key>vaaa_name_0</key> + <value>zdcpe1cpe01aaa01_201903101808</value> + </entry> + <entry> + <key>dcae_collector_ip</key> + <value>10.0.4.102</value> + </entry> + <entry> + <key>vcpe_image_name</key> + <value>ubuntu-16-04-cloud-amd64</value> + </entry> + <entry> + <key>vf_module_index</key> + <value>0</value> + </entry> + + </vfModuleParams> + <msoRequest> + <requestId>11c8ec20-a1f8-4aa2-926f-e55d67a30f8b</requestId> + <serviceInstanceId>807648fc-c84c-4662-bf23-23c7d8cbe0c8</serviceInstanceId> + </msoRequest> + <messageId>11c8ec20-a1f8-4aa2-926f-e55d67a30f8b-1552241542248</messageId> + <notificationUrl>http://so-bpmn-infra.onap:8081/mso/WorkflowMessage/VNFAResponse/11c8ec20-a1f8-4aa2-926f-e55d67a30f8b-1552241542248</notificationUrl> +</createVfModuleRequest>
\ No newline at end of file diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java index 25d8e564da..d0ffa27027 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java @@ -126,9 +126,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - MsoLogger.setLogContext (msoRequest); logger.debug("Async Create Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); // Use the synchronous method to perform the actual Create @@ -252,7 +250,6 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { MsoRequest msoRequest, String notificationUrl) { - MsoLogger.setLogContext (msoRequest); logger.debug("Async Update Network: {} of type {} in {}/{}", networkId, networkType, cloudSiteId, tenantId); // Use the synchronous method to perform the actual Create @@ -342,9 +339,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - MsoLogger.setLogContext (msoRequest); logger.debug("Async Query Network {} in {}/{}", networkNameOrId, cloudSiteId, tenantId); String errorCreateNetworkMessage = "{} {} Error sending createNetwork notification {} "; @@ -440,8 +435,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; - MsoLogger.setLogContext (msoRequest); + String serviceName = "DeleteNetworkA"; logger.debug("Async Delete Network {} in {}/{}", networkId, cloudSiteId, tenantId); @@ -507,7 +501,6 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { return; } - MsoLogger.setLogContext (rollback.getMsoRequest ()); logger.info("{} {}", MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId()); // Use the synchronous method to perform the actual Create diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index bcb6b1be42..fc2fc4844b 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -266,7 +266,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Holder <String> networkFqdn, Holder <Map <String, String>> subnetIdMap, Holder <NetworkRollback> rollback) throws NetworkException { - MsoLogger.setLogContext (msoRequest); logger.debug("*** CREATE Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); // Will capture execution time for metrics @@ -712,7 +711,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { MsoRequest msoRequest, Holder <Map <String, String>> subnetIdMap, Holder <NetworkRollback> rollback) throws NetworkException { - MsoLogger.setLogContext (msoRequest); + logger.debug("***UPDATE Network adapter with Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); @@ -1147,7 +1146,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Holder <List <Integer>> vlans, Holder <List <RouteTarget>> routeTargets, Holder <Map <String, String>> subnetIdMap) throws NetworkException { - MsoLogger.setLogContext (msoRequest); + logger.debug("*** QUERY Network with Network: {} in {}/{}", networkNameOrId, cloudSiteId, tenantId); // Will capture execution time for metrics @@ -1285,7 +1284,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String networkId, MsoRequest msoRequest, Holder <Boolean> networkDeleted) throws NetworkException { - MsoLogger.setLogContext (msoRequest); + logger.debug("*** DELETE Network adapter with Network: {} in {}/{}", networkId, cloudSiteId, tenantId); // Will capture execution time for metrics @@ -1386,8 +1385,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { return; } - MsoLogger.setLogContext (rollback.getMsoRequest()); - // Get the elements of the VnfRollback object for easier access String cloudSiteId = rollback.getCloudId (); String tenantId = rollback.getTenantId (); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java index a937bd9499..f46a95df91 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java @@ -88,7 +88,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { MsoRequest msoRequest, Holder <String> tenantId, Holder <TenantRollback> rollback) throws TenantException { - MsoLogger.setLogContext (msoRequest); logger.debug("Call to MSO createTenant adapter. Creating Tenant: {} in {}", tenantName, cloudSiteId); @@ -152,7 +151,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { Holder <String> tenantId, Holder <String> tenantName, Holder <Map <String, String>> metadata) throws TenantException { - MsoLogger.setLogContext (msoRequest); + logger.debug ("Querying Tenant {} in {}", tenantNameOrId, cloudSiteId); MsoTenantUtils tUtils; @@ -196,7 +195,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { String tenantId, MsoRequest msoRequest, Holder <Boolean> tenantDeleted) throws TenantException { - MsoLogger.setLogContext (msoRequest); logger.debug ("Deleting Tenant {} in {}", tenantId, cloudSiteId); @@ -238,7 +236,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { String cloudSiteId = rollback.getCloudId (); String tenantId = rollback.getTenantId (); - MsoLogger.setLogContext (rollback.getMsoRequest ()); logger.debug("Rolling Back Tenant {} in {}", rollback.getTenantId(), cloudSiteId); if (rollback.getTenantCreated ()) { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java index b445dc8a26..cf52280b3f 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java @@ -132,7 +132,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - MsoLogger.setLogContext (msoRequest); + logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF); // Use the synchronous method to perform the actual Create MsoVnfAdapter vnfAdapter = vnfImpl; @@ -213,7 +213,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - MsoLogger.setLogContext (msoRequest); + logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF); // Use the synchronous method to perform the actual Create @@ -289,9 +289,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; + String serviceName = "QueryVnfA"; - MsoLogger.setLogContext (msoRequest); logger.info("{}", MessageEnum.RA_ASYNC_QUERY_VNF); // Use the synchronous method to perform the actual query @@ -376,9 +375,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String messageId, MsoRequest msoRequest, String notificationUrl) { - String error; + String serviceName = "DeleteVnfA"; - MsoLogger.setLogContext (msoRequest); logger.info("{}", MessageEnum.RA_ASYNC_DELETE_VNF); // Use the synchronous method to perform the actual delete @@ -441,7 +439,6 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { return; } - MsoLogger.setLogContext (rollback.getMsoRequest ()); logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF); // Use the synchronous method to perform the actual rollback diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java index a1d7698ad1..4d915f9e84 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java @@ -302,7 +302,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { Holder <String> vnfId, Holder <VnfStatus> status, Holder <Map <String, String>> outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); + logger.debug("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); // Will capture execution time for metrics @@ -361,7 +361,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String tenantId, String vnfName, MsoRequest msoRequest) throws VnfException { - MsoLogger.setLogContext (msoRequest); + logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); @@ -409,15 +409,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String tenantId = rollback.getTenantId (); String vnfId = rollback.getVnfId (); - MsoLogger.setLogContext (rollback.getMsoRequest()); - logger.debug("Rolling Back VNF {} in {}", vnfId, cloudSiteId + "/" + tenantId); // Use the MsoHeatUtils to delete the stack. Set the polling flag to true. // The possible outcomes of deleteStack are a StackInfo object with status // of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException // could be thrown. - long subStartTime = System.currentTimeMillis (); try { heat.deleteStack (tenantId, cloudSiteId, vnfId, true); } catch (MsoException me) { @@ -600,7 +597,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { useMCUuid = true; } } - MsoLogger.setLogContext (msoRequest); + String requestTypeString = ""; if (requestType != null && !"".equals(requestType)) { requestTypeString = requestType; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java index bba960cddf..833e200ce9 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java @@ -206,7 +206,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { Holder <Map <String, String>> outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); logger.debug ("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); // Will capture execution time for metrics @@ -264,7 +263,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String tenantId, String vnfName, MsoRequest msoRequest) throws VnfException { - MsoLogger.setLogContext (msoRequest); // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules. logger.debug("DeleteVNF command attempted but not supported"); @@ -285,8 +283,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { long startTime = System.currentTimeMillis (); // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { - logger.info ("{} {} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf", MsoLogger - .getServiceName()); + logger.info ("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf"); return; } @@ -300,8 +297,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String tenantId = rollback.getTenantId (); String vfModuleId = rollback.getVfModuleStackId (); - MsoLogger.setLogContext (rollback.getMsoRequest()); - logger.debug("Rolling Back VF Module {} in {}", vfModuleId, cloudSiteId + "/" + tenantId); DeploymentInfo deployment = null; @@ -576,8 +571,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Will capture execution time for metrics long startTime = System.currentTimeMillis (); - MsoLogger.setLogContext (msoRequest); - // Require a model customization ID. Every VF Module definition must have one. if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) { logger.debug("Missing required input: modelCustomizationUuid"); @@ -1179,7 +1172,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String vnfName, MsoRequest msoRequest, Holder <Map <String, String>> outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); + logger.debug ("Deleting VF " + vnfName + " in " + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java index 704d54c918..b1b97b695e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -225,7 +225,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { Holder <Map <String, String>> outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); logger.debug("Querying VNF " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics @@ -281,7 +280,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String tenantId, String vnfName, MsoRequest msoRequest) throws VnfException { - MsoLogger.setLogContext (msoRequest); // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules. logger.debug("DeleteVNF command attempted but not supported"); @@ -302,8 +300,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { long startTime = System.currentTimeMillis (); // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { - logger.info("{} {} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf", - MsoLogger.getServiceName()); + logger.info("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf"); return; } @@ -319,8 +316,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String vfModuleId = rollback.getVfModuleStackId (); - MsoLogger.setLogContext (rollback.getMsoRequest()); - logger.debug("Rolling Back VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId); VduInstance vduInstance = null; @@ -618,8 +613,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Will capture execution time for metrics long startTime = System.currentTimeMillis (); - MsoLogger.setLogContext (msoRequest); - // Require a model customization ID. Every VF Module definition must have one. if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) { logger.debug("Missing required input: modelCustomizationUuid"); @@ -1165,7 +1158,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { MsoRequest msoRequest, Holder <Map <String, String>> outputs) throws VnfException { - MsoLogger.setLogContext (msoRequest); logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java index efb5932e51..304b025bf8 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java @@ -218,11 +218,17 @@ public class RequestsDbClientTest { } @Test - public void findOneByOperationalEnvIdAndServiceModelVersionIdTest(){ - OperationalEnvServiceModelStatus operationalEnvServiceModelStatus =requestsDbClient.findOneByOperationalEnvIdAndServiceModelVersionId("1234","TEST1234"); + public void findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdTest(){ + OperationalEnvServiceModelStatus operationalEnvServiceModelStatus =requestsDbClient.findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId("1234","TEST1234", "00032ab7-3fb3-42e5-965d-8ea592502017"); assertNotNull(operationalEnvServiceModelStatus); assertEquals("1234",operationalEnvServiceModelStatus.getOperationalEnvId()); assertEquals("TEST1234",operationalEnvServiceModelStatus.getServiceModelVersionId()); + + OperationalEnvServiceModelStatus operationalEnvServiceModelStatus1 =requestsDbClient.findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId("1234","TEST1235", "00032ab7-3fb3-42e5-965d-8ea592502018"); + assertNotNull(operationalEnvServiceModelStatus1); + assertEquals("00032ab7-3fb3-42e5-965d-8ea592502018",operationalEnvServiceModelStatus1.getRequestId()); + assertEquals("1234",operationalEnvServiceModelStatus1.getOperationalEnvId()); + assertEquals("TEST1235",operationalEnvServiceModelStatus1.getServiceModelVersionId()); } @Test @@ -238,5 +244,7 @@ public class RequestsDbClientTest { OperationalEnvDistributionStatus operationalEnvDistributionStatus =requestsDbClient.getDistributionStatusById("111"); assertNotNull(operationalEnvDistributionStatus); assertEquals("111",operationalEnvDistributionStatus.getDistributionId()); + assertEquals("ERROR",operationalEnvDistributionStatus.getDistributionIdErrorReason()); + assertEquals("00032ab7-3fb3-42e5-965d-8ea592502017",operationalEnvDistributionStatus.getRequestId()); } } diff --git a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql index de1ae85cc6..48d589592f 100644 --- a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql +++ b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql @@ -43,6 +43,9 @@ VALUES INSERT INTO activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME) VALUES ('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59'); +INSERT INTO activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME) +VALUES +('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502018', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59'); INSERT INTO `activate_operational_env_per_distributionid_status` (`DISTRIBUTION_ID`, `DISTRIBUTION_ID_STATUS`, `DISTRIBUTION_ID_ERROR_REASON`, `CREATE_TIME`, `MODIFY_TIME`, `OPERATIONAL_ENV_ID`, `SERVICE_MODEL_VERSION_ID`, `REQUEST_ID`) VALUES diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml index c24c45c8cf..56d425745f 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml +++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml @@ -11,7 +11,94 @@ <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/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java index a1c660f75f..cbe16d864a 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java @@ -30,19 +30,31 @@ import org.onap.sdc.api.notification.INotificationData; import org.onap.sdc.api.notification.IResourceInstance; import org.springframework.stereotype.Component; -import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; @Component +@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE) public class NotificationDataImpl implements INotificationData { + @JsonProperty("distributionID") private String distributionID; + @JsonProperty("serviceName") private String serviceName; + @JsonProperty("serviceVersion") private String serviceVersion; + @JsonProperty("serviceUUID") private String serviceUUID; + @JsonProperty("serviceDescription") private String serviceDescription; + @JsonProperty("serviceInvariantUUID") private String serviceInvariantUUID; + @JsonProperty("resources") private List<ResourceInfoImpl> resources; + @JsonProperty("serviceArtifacts") private List<ArtifactInfoImpl> serviceArtifacts; + @JsonProperty("workloadContext") private String workloadContext; @Override @@ -118,7 +130,6 @@ public class NotificationDataImpl implements INotificationData { return ret; } - @JsonIgnore public List<ResourceInfoImpl> getResourcesImpl(){ return resources; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 892a96eb4e..6d9e2fbb0c 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -1483,7 +1483,6 @@ public class ToscaResourceInstaller { vfModuleMemberName = node.getName(); } - // Extract CVFC lists List<NodeTemplate> cvfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfTemplate, SdcTypes.CVFC); @@ -1491,7 +1490,7 @@ public class ToscaResourceInstaller { CvnfcCustomization existingCvnfcCustomization = findExistingCvfc(existingCvnfcSet, cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); - if(existingCvnfcCustomization == null && (vfModuleMemberName != null && vfModuleMemberName.equalsIgnoreCase(cvfcTemplate.getName()))){ + if(vfModuleMemberName != null && vfModuleMemberName.equalsIgnoreCase(cvfcTemplate.getName())){ //Extract associated VFC - Should always be just one List<NodeTemplate> vfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC); @@ -1502,6 +1501,12 @@ public class ToscaResourceInstaller { VnfcCustomization existingVnfcCustomization = null; existingVnfcCustomization = findExistingVfc(existingVnfcSet, vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + + if(existingVnfcCustomization == null){ + vnfcCustomization = new VnfcCustomization(); + } else { + vnfcCustomization = existingVnfcCustomization; + } // Only Add Abstract VNFC's to our DB, ignore all others if(existingVnfcCustomization == null && vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY).equalsIgnoreCase("Abstract")){ @@ -1524,32 +1529,40 @@ public class ToscaResourceInstaller { // This check is needed incase the VFC subcategory is something other than Abstract. In that case we want to skip adding that record to our DB. if(vnfcCustomization.getModelCustomizationUUID() != null){ - CvnfcCustomization cvnfcCustomization = new CvnfcCustomization(); - cvnfcCustomization.setModelCustomizationUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); - cvnfcCustomization.setModelInstanceName(cvfcTemplate.getName()); - cvnfcCustomization.setModelInvariantUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); - cvnfcCustomization.setModelName(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); - cvnfcCustomization.setModelUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); - - cvnfcCustomization.setModelVersion( - testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); - cvnfcCustomization.setDescription( - testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); - cvnfcCustomization.setToscaNodeType(testNull(cvfcTemplate.getType())); + CvnfcCustomization cvnfcCustomization = null; - if(existingVnfcCustomization != null){ - cvnfcCustomization.setVnfcCustomization(existingVnfcCustomization); - }else{ - cvnfcCustomization.setVnfcCustomization(vnfcCustomization); + if(existingCvnfcCustomization != null){ + cvnfcCustomization = existingCvnfcCustomization; } + else{ - cvnfcCustomization.setNfcFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_function")); - cvnfcCustomization.setNfcNamingCode(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_naming_code")); - cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization); - cvnfcCustomization.setVnfResourceCustomization(vnfResource); - - cvnfcCustomizations.add(cvnfcCustomization); - existingCvnfcSet.add(cvnfcCustomization); + cvnfcCustomization = new CvnfcCustomization(); + cvnfcCustomization.setModelCustomizationUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + cvnfcCustomization.setModelInstanceName(cvfcTemplate.getName()); + cvnfcCustomization.setModelInvariantUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + cvnfcCustomization.setModelName(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + cvnfcCustomization.setModelUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + + cvnfcCustomization.setModelVersion( + testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + cvnfcCustomization.setDescription( + testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + cvnfcCustomization.setToscaNodeType(testNull(cvfcTemplate.getType())); + + if(existingVnfcCustomization != null){ + cvnfcCustomization.setVnfcCustomization(existingVnfcCustomization); + }else{ + cvnfcCustomization.setVnfcCustomization(vnfcCustomization); + } + + cvnfcCustomization.setNfcFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_function")); + cvnfcCustomization.setNfcNamingCode(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_naming_code")); + cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization); + cvnfcCustomization.setVnfResourceCustomization(vnfResource); + + cvnfcCustomizations.add(cvnfcCustomization); + existingCvnfcSet.add(cvnfcCustomization); + } //***************************************************************************************************************************************** //* Extract Fabric Configuration @@ -1595,8 +1608,7 @@ public class ToscaResourceInstaller { VnfResourceCustomization vnfResource, VfModuleCustomization vfModuleCustomization, CvnfcCustomization cvnfcCustomization, ConfigurationResource configResource, NodeTemplate vfTemplate, String vfModuleMemberName) { - Metadata fabricMetadata = fabricTemplate.getMetaData(); - + Metadata fabricMetadata = fabricTemplate.getMetaData(); VnfVfmoduleCvnfcConfigurationCustomization vfModuleToCvnfc = new VnfVfmoduleCvnfcConfigurationCustomization(); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/Skip.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/Skip.java index 0148e8f10c..fe03a10795 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/Skip.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/Skip.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.bpmn.common.validation; import java.lang.annotation.Retention; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java index db7f1da10f..61f92313f7 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java @@ -131,7 +131,7 @@ public class WorkflowContextHolder { Thread.currentThread().interrupt(); } catch (Exception e) { logger.debug("WorkflowContextHolder timeout thread caught exception: ", e); - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Error in WorkflowContextHolder timeout thread"); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java index a23f85bae9..d3f3dcd359 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; @@ -55,4 +75,4 @@ public class Tenant implements Serializable { } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index d43218c584..916d24e8dc 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -54,8 +54,8 @@ public class ExceptionBuilder { } } - logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString()); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString()); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex){ //log trace, allow process to complete gracefully @@ -83,8 +83,8 @@ public class ExceptionBuilder { break; } } - logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString()); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString()); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex){ //log trace, allow process to complete gracefully diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java index dfdef74886..1967e5a1ce 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java @@ -1,18 +1,23 @@ -/* - * Copyright (C) 2019 Bell Canada. - * +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 Bell Canada. + * ================================================================================ * 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.client.restproperties; import java.net.URL; diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java index f4617f9978..4ab22f4616 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java @@ -220,7 +220,7 @@ public class CallbackHandlerService { + " = '" + correlationValue + "'; last exception was:" + queryException; logger.debug(msg); - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), msg, queryException); } @@ -263,8 +263,8 @@ public class CallbackHandlerService { + " with " + correlationVariable + " = '" + correlationValue + "': " + ole; logger.debug(msg); - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg, ole); + logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -", + MsoLogger.ErrorCode.UnknownError.getValue(), msg, ole); //Retry for OptimisticLocking Exceptions int retryCount = 0; @@ -296,14 +296,14 @@ public class CallbackHandlerService { //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException; String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + olex; logger.debug(strMsg); - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), strMsg, olex); } catch (Exception excep) { retryCount = 0; //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException; String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + excep; logger.debug(strMsg); - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), strMsg, excep); } @@ -317,7 +317,7 @@ public class CallbackHandlerService { + " with " + correlationVariable + " = '" + correlationValue + "': " + e; logger.debug(msg); - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), msg, e); } } catch (Exception e) { @@ -327,8 +327,8 @@ public class CallbackHandlerService { + " with " + correlationVariable + " = '" + correlationValue + "': " + e; logger.debug(msg); - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg, e); + logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -", + MsoLogger.ErrorCode.UnknownError.getValue(), msg, e); } return true; @@ -363,10 +363,10 @@ public class CallbackHandlerService { */ protected void logCallbackError(String method, long startTime, String msg, Exception e) { if (e == null) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), msg); } else { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), msg, e); } } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java index 072dec28c6..a5af553e1c 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java @@ -90,7 +90,7 @@ public class WorkflowMessageResource{ if (messageType == null || messageType.isEmpty()) { String msg = "Missing message type"; logger.debug(LOGMARKER + " " + msg); - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); return Response.status(400).entity(msg).build(); } @@ -98,7 +98,7 @@ public class WorkflowMessageResource{ if (correlator == null || correlator.isEmpty()) { String msg = "Missing correlator"; logger.debug(LOGMARKER + " " + msg); - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); return Response.status(400).entity(msg).build(); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index 5534a39685..8dd55d9eac 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -120,8 +120,8 @@ public class AAICreateTasks { if (null == customer) { String errorMessage = "Exception in creating ServiceSubscription. Customer not present for ServiceInstanceID: " + serviceInstance.getServiceInstanceId(); - logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), errorMessage); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, "BPMN", + MsoLogger.ErrorCode.UnknownError.getValue(), errorMessage); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessage); } aaiSIResources.createServiceSubscription(customer); @@ -165,14 +165,14 @@ public class AAICreateTasks { } else { if (owningEntityName == null || "".equals(owningEntityName)) { String msg = "Exception in AAICreateOwningEntity. Can't create an owningEntity with no owningEntityName."; - logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + MsoLogger.ErrorCode.UnknownError.getValue(), msg); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); } else { if(aaiSIResources.existsOwningEntityName(owningEntityName)){ String msg = "Exception in AAICreateOwningEntity. Can't create OwningEntity as name already exists in AAI associated with a different owning-entity-id (name must be unique)"; - logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + MsoLogger.ErrorCode.UnknownError.getValue(), msg); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); }else{ aaiSIResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java index 1402cebfbc..dc8f72c7a5 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java @@ -135,8 +135,8 @@ public class ExecuteActivity implements JavaDelegate { } protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) { - logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg, ex); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + MsoLogger.ErrorCode.UnknownError.getValue(), msg, ex); execution.setVariable("ExecuteActivityErrorMessage", msg); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java index e0516ce9af..5ed84e006a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java @@ -134,8 +134,8 @@ public class AppcRunTasks { mapRollbackVariables(execution, action, appcCode); } catch (Exception e) { - logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), - "Caught exception in runAppcCommand", "BPMN", MsoLogger.getServiceName(), + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), + "Caught exception in runAppcCommand", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e); appcMessage = e.getMessage(); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java index ba04b16b14..6c0cdb39f6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java @@ -153,9 +153,9 @@ public class ConfigurationScaleOut { appcMessage = appCClient.getErrorMessage(); } catch (Exception e) { - logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "Caught exception in runAppcCommand in ConfigurationScaleOut", "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e); + MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e); appcMessage = e.getMessage(); } logger.error("Error Message: " + appcMessage); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java index bb33b521d6..feb9fb81b4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java @@ -110,23 +110,22 @@ public class GenericVnfHealthCheck { appcCode = appCClient.getErrorCode(); appcMessage = appCClient.getErrorMessage(); } catch (BpmnError ex) { - logger.error("", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in GenericVnfHealthCheck", "BPMN", - MsoLogger - .getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), ex); - appcMessage = ex.getMessage(); + logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Caught exception in GenericVnfHealthCheck", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), ex); + appcMessage = ex.getMessage(); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } catch (Exception e) { if (e instanceof java.util.concurrent.TimeoutException ) { appcMessage = "Request to APPC timed out. "; - logger.error("{} {} {} {} {} {}", MessageEnum.RA_CONNECTION_EXCEPTION.toString(), + logger.error("{} {} {} {} {}", MessageEnum.RA_CONNECTION_EXCEPTION.toString(), "Caught timedOut exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e); + MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e); throw e; } else { - logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), - "Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", MsoLogger.getServiceName(), + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), + "Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e); appcMessage = e.getMessage(); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java index c457034eca..3763fca34f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.bpmn.infrastructure.validations; import java.util.Optional; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java index 787b811501..17fa10a186 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java @@ -51,8 +51,8 @@ public class NamingClientResponseValidator { public String validateNameGenResponse(ResponseEntity<NameGenResponse> response) throws BadResponseException { if (response == null) { - logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE, - "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), + logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE, + "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE); } @@ -61,8 +61,8 @@ public class NamingClientResponseValidator { String generatedName = ""; NameGenResponse responseBody = response.getBody(); if (responseBody == null) { - logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE, - "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), + logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE, + "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), NULL_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE); } @@ -91,16 +91,16 @@ public class NamingClientResponseValidator { errorMessageString = error.getMessage(); } String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); - logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError.getValue(), errorMessage); + logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", + MsoLogger.ErrorCode.DataError.getValue(), errorMessage); throw new BadResponseException(errorMessage); } } public String validateNameGenDeleteResponse(ResponseEntity<NameGenDeleteResponse> response) throws BadResponseException { if (response == null) { - logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE, - "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), + logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE, + "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE); } @@ -109,8 +109,8 @@ public class NamingClientResponseValidator { String responseMessage = ""; NameGenDeleteResponse responseBody = response.getBody(); if (responseBody == null) { - logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE, - "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), + logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE, + "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), NULL_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE); } @@ -122,7 +122,7 @@ public class NamingClientResponseValidator { String errorMessageString = NAMING_SERVICE_ERROR; String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); - logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", MsoLogger.getServiceName(), + logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", MsoLogger.ErrorCode.DataError.getValue(), errorMessage); throw new BadResponseException(errorMessage); } @@ -142,7 +142,7 @@ public class NamingClientResponseValidator { errorMessageString = error.getMessage(); } String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); - logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", MsoLogger.getServiceName(), + logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", MsoLogger.ErrorCode.DataError.getValue(), errorMessage); return errorMessage; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java index 2f9c8da5f0..8513b26a5d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java @@ -67,9 +67,9 @@ public class SdnCommonTasks { try { jsonRequest = objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(request); } catch (JsonProcessingException e) { - logger.error("{} {} {} {} {} {}", MessageEnum.JAXB_EXCEPTION.toString(), + logger.error("{} {} {} {} {}", MessageEnum.JAXB_EXCEPTION.toString(), COULD_NOT_CONVERT_SDNC_POJO_TO_JSON, - "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError.getValue(), e.getMessage()); + "BPMN", MsoLogger.ErrorCode.DataError.getValue(), e.getMessage()); throw new MapperException(COULD_NOT_CONVERT_SDNC_POJO_TO_JSON); } jsonRequest = "{\"input\":" + jsonRequest + "}"; @@ -100,8 +100,8 @@ public class SdnCommonTasks { */ public String validateSDNResponse(LinkedHashMap<String, Object> output) throws BadResponseException { if (CollectionUtils.isEmpty(output)) { - logger.error("{} {} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC); + logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN", + MsoLogger.ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC); throw new BadResponseException(NO_RESPONSE_FROM_SDNC); } LinkedHashMap<String, Object> embeddedResponse =(LinkedHashMap<String, Object>) output.get("output"); @@ -127,8 +127,8 @@ public class SdnCommonTasks { return jsonResponse; } else { String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage); - logger.error("{} {} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError.getValue(), errorMessage); + logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN", + MsoLogger.ErrorCode.DataError.getValue(), errorMessage); throw new BadResponseException(errorMessage); } } @@ -141,8 +141,8 @@ public class SdnCommonTasks { */ public String validateSDNGetResponse(LinkedHashMap<String, Object> output) throws BadResponseException { if (CollectionUtils.isEmpty(output)) { - logger.error("{} {} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC); + logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN", + MsoLogger.ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC); throw new BadResponseException(NO_RESPONSE_FROM_SDNC); } ObjectMapper objMapper = new ObjectMapper(); @@ -152,8 +152,8 @@ public class SdnCommonTasks { stringOutput = objMapper.writeValueAsString(output); } catch (Exception e) { - logger.error("{} {} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC, - "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), + logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC, + "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), BAD_RESPONSE_FROM_SDNC); throw new BadResponseException(BAD_RESPONSE_FROM_SDNC); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java index f70ac8399f..5124435a79 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java @@ -173,8 +173,8 @@ public class VfModuleTopologyOperationRequestMapper { GenericResourceApiVfModuleResponseInformation assignResponseInfo = mapper.readValue(sdncAssignResponse, GenericResourceApiVfModuleResponseInformation.class); objectPath = assignResponseInfo.getVfModuleResponseInformation().getObjectPath(); } catch (Exception e) { - logger.error("{} {} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage()); + logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), "BPMN", + MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage()); } } return objectPath; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidatorTest.java index f6988fdcd4..81ec388649 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidatorTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidatorTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.bpmn.infrastructure.validations; import static org.junit.Assert.assertEquals; diff --git a/common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java b/common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java index 384d479501..edd4e6dfa4 100644 --- a/common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java +++ b/common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java @@ -1,18 +1,23 @@ -/* - * Copyright (C) 2019 Bell Canada. - * +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 Bell Canada. + * ================================================================================ * 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.client.cds; import io.grpc.CallOptions; diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java b/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java index 1e372112f1..756c26ddef 100644 --- a/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java +++ b/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java @@ -1,18 +1,23 @@ -/* - * Copyright (C) 2019 Bell Canada. - * +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 Bell Canada. + * ================================================================================ * 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.client.cds; import io.grpc.ManagedChannel; @@ -110,4 +115,4 @@ public class CDSProcessingClient implements AutoCloseable { } log.info("CDSProcessingClient stopped"); } -}
\ No newline at end of file +} diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java b/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java index 244b89a6f5..1791be2991 100644 --- a/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java +++ b/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java @@ -1,18 +1,23 @@ -/* - * Copyright (C) 2019 Bell Canada. - * +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 Bell Canada. + * ================================================================================ * 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.client.cds; import io.grpc.ManagedChannel; @@ -79,4 +84,4 @@ class CDSProcessingHandler { } return finishLatch; } -}
\ No newline at end of file +} diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProcessingListener.java b/common/src/main/java/org/onap/so/client/cds/CDSProcessingListener.java index 2eae4ef5a7..8c92a5810c 100644 --- a/common/src/main/java/org/onap/so/client/cds/CDSProcessingListener.java +++ b/common/src/main/java/org/onap/so/client/cds/CDSProcessingListener.java @@ -1,18 +1,23 @@ -/* - * Copyright (C) 2019 Bell Canada. - * +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 Bell Canada. + * ================================================================================ * 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.client.cds; import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceOutput; diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProperties.java b/common/src/main/java/org/onap/so/client/cds/CDSProperties.java index 52d1d614ed..42a4b47aa2 100644 --- a/common/src/main/java/org/onap/so/client/cds/CDSProperties.java +++ b/common/src/main/java/org/onap/so/client/cds/CDSProperties.java @@ -1,18 +1,23 @@ -/* - * Copyright (C) 2019 Bell Canada. - * +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 Bell Canada. + * ================================================================================ * 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.client.cds; import org.onap.so.client.RestProperties; diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java index 39d2d01da9..e1519d61a2 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.client.graphinventory; import java.lang.reflect.InvocationTargetException; @@ -303,4 +323,4 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven return client.getRestProperties(); } -}
\ No newline at end of file +} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java b/common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java index 2cab4b5654..88a6228d2b 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.client.graphinventory; public interface TransactionBuilder { diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java index 76492dc38b..2951bc8d45 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.client.graphinventory.entities; public class Id extends Resource { diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java index a53bdc0259..b848f1c597 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.client.graphinventory.entities; public class Pathed extends Resource { diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java index 5c53f2cbf1..8d49fb5640 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.client.graphinventory.entities; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java index e53fc02da7..6e7312c1f3 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.client.graphinventory.entities; import org.onap.so.client.graphinventory.GraphInventoryObjectType; diff --git a/common/src/main/java/org/onap/so/logger/MsoLogger.java b/common/src/main/java/org/onap/so/logger/MsoLogger.java index 341d7996a9..f8ff530c3b 100644 --- a/common/src/main/java/org/onap/so/logger/MsoLogger.java +++ b/common/src/main/java/org/onap/so/logger/MsoLogger.java @@ -888,16 +888,6 @@ public class MsoLogger { MDC.remove(TARGETSERVICENAME); } - - public void logStackTrace(Exception ex){ - StringWriter errors = new StringWriter(); - ex.printStackTrace(new PrintWriter(errors)); - logger.error(errors.toString()); - } - - public boolean isDebugEnabled() { - return logger.isDebugEnabled(); - } private void prepareMsg(String loggingLevel) { prepareMsg(loggingLevel, null, null); @@ -959,7 +949,6 @@ public class MsoLogger { MDC.put(ERRORDESC, errorDesc); MDC.put(TARGETENTITY, targetEntity); MDC.put(TARGETSERVICENAME, targetServiceName); - MDC.put(SERVICE_NAME, getFinalServiceName(getServiceName())); } private void prepareMetricMsg(long startTime, StatusCode statusCode, int responseCode, String responseDesc, @@ -1042,7 +1031,7 @@ public class MsoLogger { /** * Set the requestId and serviceInstanceId - * + * * @param reqId * The requestId * @param svcId @@ -1067,22 +1056,6 @@ public class MsoLogger { return MDC.get(SERVICE_NAME); } - /** - * Set the requestId and serviceInstanceId based on the mso request - * - * @param msoRequest - * The mso request - */ - public static void setLogContext(MsoRequest msoRequest) { - if (msoRequest != null) { - MDC.put(REQUEST_ID, msoRequest.getRequestId()); - MDC.put(SERVICE_INSTANCE_ID, msoRequest.getServiceInstanceId()); - } else { - MDC.put(REQUEST_ID, DUMMY_VALUE); - MDC.put(SERVICE_INSTANCE_ID, DUMMY_VALUE); - } - } - private String normalize(String input) { if (input == null) { return null; diff --git a/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java b/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java index 2bfa754f0e..135277fa47 100644 --- a/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java +++ b/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java @@ -1,18 +1,23 @@ -/* - * Copyright (C) 2019 Bell Canada. - * +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 Bell Canada. + * ================================================================================ * 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.client.cds; @@ -159,4 +164,4 @@ public class CDSProcessingClientTest { assertTrue(finishLatch.await(1, TimeUnit.SECONDS)); } -}
\ No newline at end of file +} diff --git a/common/src/test/java/org/onap/so/client/cds/TestCDSProcessingListener.java b/common/src/test/java/org/onap/so/client/cds/TestCDSProcessingListener.java index df302f6e35..977f1d41be 100644 --- a/common/src/test/java/org/onap/so/client/cds/TestCDSProcessingListener.java +++ b/common/src/test/java/org/onap/so/client/cds/TestCDSProcessingListener.java @@ -1,18 +1,23 @@ -/* - * Copyright (C) 2019 Bell Canada. - * +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 Bell Canada. + * ================================================================================ * 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.client.cds; import io.grpc.Status; diff --git a/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java b/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java index a2937869c8..514c595100 100644 --- a/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java +++ b/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java @@ -1,18 +1,23 @@ -/* - * Copyright (C) 2019 Bell Canada. - * +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 Bell Canada. + * ================================================================================ * 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.client.cds; import java.net.MalformedURLException; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java index 31c65e1bd2..9303e12071 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java @@ -82,7 +82,6 @@ public class SDCClientHelper { try { String urlString = this.buildUriBuilder(serviceModelVersionId, operationalEnvironmentId); - logger.debug("Url ASDC Activate request: {}", urlString); String jsonPayload = this.buildJsonWorkloadContext(workloadContext); String basicAuthCred = getBasicAuth(); @@ -158,7 +157,6 @@ public class SDCClientHelper { enhancedAsdcResponseJsonObj.put("statusCode", Integer.toString(statusCode)); enhancedAsdcResponseJsonObj.put("messageId", ""); enhancedAsdcResponseJsonObj.put("message", "Success"); - logger.debug("Url ASDC Activate response: {} {}", "distributionId ", sdcResponseJsonObj.get("distributionId")); } else { // error if (sdcResponseJsonObj.has("requestError") ) { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java index 219a2efcac..352bf8fb0b 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java @@ -86,26 +86,31 @@ public class ActivateVnfStatusOperationalEnvironment { */ public void execute(String requestId, CloudOrchestrationRequest request) throws ApiException { - - String operationalEnvironmentId = ""; + try { + + String operationalEnvironmentId = ""; String sdcDistributionId = request.getDistributionId(); Distribution sdcStatus = request.getDistribution(); - // Distribution, Query for operationalEnvironmentId, serviceModelVersionId + // Distribution, Query for operationalEnvironmentId, serviceModelVersionId, origRequestId this.queryDistributionDbResponse = client.getDistributionStatusById(sdcDistributionId); operationalEnvironmentId = this.queryDistributionDbResponse.getOperationalEnvId(); + this.origRequestId = this.queryDistributionDbResponse.getRequestId(); - // ServiceModel, Query for dbRequestId, recoveryAction, retryCountString - this.queryServiceModelResponse = client.findOneByOperationalEnvIdAndServiceModelVersionId(operationalEnvironmentId, queryDistributionDbResponse.getServiceModelVersionId()); - this.origRequestId = this.queryServiceModelResponse.getRequestId(); - + // ServiceModel, Query for recoveryAction, retryCountString + this.queryServiceModelResponse = client.findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId(operationalEnvironmentId, queryDistributionDbResponse.getServiceModelVersionId(), this.origRequestId); + processActivateSDCStatus(sdcDistributionId, sdcStatus, this.queryDistributionDbResponse, this.queryServiceModelResponse); // After EVERY status processed, need to query the status of all service modelId // to determine the OVERALL status if "COMPLETE" or "FAILURE": checkOrUpdateOverallStatus(operationalEnvironmentId, this.origRequestId); - + + } catch(Exception e) { + requestDb.updateInfraFailureCompletion(e.getMessage(), this.origRequestId, this.queryDistributionDbResponse.getOperationalEnvId()); + } + } /** @@ -161,13 +166,11 @@ public class ActivateVnfStatusOperationalEnvironment { } sdcStatusValue = modifiedStatus; - // should update 1 row, modified status & retryCount set 0 OperationalEnvServiceModelStatus updateRetryCountZeroAndStatus = dbHelper.updateRetryCountAndStatusInOperationalEnvServiceModelStatus(queryServiceModelResponse, modifiedStatus, - RETRY_COUNT_ZERO); + RETRY_COUNT_ZERO); client.save(updateRetryCountZeroAndStatus); - // should update 1 row, modified status OperationalEnvDistributionStatus updateDistStatus = dbHelper.updateStatusInOperationalEnvDistributionStatus(queryDistributionDbResponse, modifiedStatus, diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java index 29fa1a34b3..a26848bf21 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java @@ -109,7 +109,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ iar.setRequestId(requestIdOrig); iar.setRequestStatus("PENDING"); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId")) + stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); @@ -134,7 +134,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ serviceModelDb.setOperationalEnvId(operationalEnvironmentId); serviceModelDb.setRetryCount(retryCountZero); serviceModelDb.setServiceModelVersionDistrStatus(statusError); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId")) + stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); @@ -169,7 +169,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ serviceModelDb.setOperationalEnvId(operationalEnvironmentId); serviceModelDb.setRetryCount(retryCountTwo); serviceModelDb.setServiceModelVersionDistrStatus(statusError); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId")) + stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); @@ -208,7 +208,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ iar.setRequestId(requestIdOrig); iar.setRequestStatus("PENDING"); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId")) + stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); @@ -244,7 +244,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ serviceModelDb.setOperationalEnvId(operationalEnvironmentId); serviceModelDb.setRetryCount(retryCountThree); serviceModelDb.setServiceModelVersionDistrStatus(statusError); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId")) + stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); @@ -276,7 +276,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ stubFor(post(urlPathMatching("/sdc/v1/catalog/services/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId")) + stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); @@ -339,7 +339,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ iar.setRequestId(requestIdOrig); iar.setRequestStatus("PENDING"); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId")) + stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); @@ -415,7 +415,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ InfraActiveRequests iar = new InfraActiveRequests(); iar.setRequestId(requestIdOrig); iar.setRequestStatus("PENDING"); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId")) + stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); @@ -477,7 +477,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ iar.setRequestId(requestIdOrig); iar.setRequestStatus("PENDING"); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId")) + stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); @@ -536,7 +536,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ iar.setRequestId(requestIdOrig); iar.setRequestStatus("PENDING"); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId")) + stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java index bcad9ce6d5..ecf1dcb183 100644 --- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java @@ -37,7 +37,8 @@ public interface OperationalEnvServiceModelStatusRepository extends JpaRepositor public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndRequestId(String operationalEnvId, String requestId); public List<OperationalEnvServiceModelStatus> findAllByOperationalEnvIdAndRequestId(@Param("OPERATIONAL_ENV_ID") String operationalEnvId, @Param("REQUEST_ID") String requestId); - public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionId(@Param("OPERATIONAL_ENV_ID") String operationalEnvId, - @Param("SERVICE_MODEL_VERSION_ID") String serviceModelVersionId); + public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId(@Param("OPERATIONAL_ENV_ID") String operationalEnvId, + @Param("SERVICE_MODEL_VERSION_ID") String serviceModelVersionId, + @Param("REQUEST_ID") String requestId); } diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java index ef3466278e..9eec860cc9 100644 --- a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java @@ -54,8 +54,9 @@ public class OperationalEnvServiceModelStatusTest { status.setRetryCount(0); repository.saveAndFlush(status); - OperationalEnvServiceModelStatus status2 = repository.findOneByOperationalEnvIdAndServiceModelVersionId("oper-env-id-1", "service-model-ver-id-1"); + OperationalEnvServiceModelStatus status2 = repository.findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId("oper-env-id-1", "service-model-ver-id-1", "request-id-1"); status2.setRetryCount(1); + assertEquals("request-id-1", status2.getRequestId()); repository.saveAndFlush(status2); diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java index b809691b31..5958397851 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java @@ -96,7 +96,7 @@ public class RequestsDbClient { private String findOneByServiceIdAndOperationIdURI = "/findOneByServiceIdAndOperationId"; - private String findOneByOperationalEnvIdAndServiceModelVersionIdURI = "/findOneByOperationalEnvIdAndServiceModelVersionId"; + private String findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI = "/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"; private String findAllByOperationalEnvIdAndRequestIdURI = "/findAllByOperationalEnvIdAndRequestId"; @@ -123,7 +123,7 @@ public class RequestsDbClient { findOneByServiceIdAndOperationIdURI = endpoint + OPERATION_STATUS_SEARCH + findOneByServiceIdAndOperationIdURI; requestProcessingDataURI = endpoint + requestProcessingDataURI; operationalEnvDistributionStatusURI = endpoint + operationalEnvDistributionStatusURI; - findOneByOperationalEnvIdAndServiceModelVersionIdURI = endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findOneByOperationalEnvIdAndServiceModelVersionIdURI; + findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI = endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI; findAllByOperationalEnvIdAndRequestIdURI = endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findAllByOperationalEnvIdAndRequestIdURI; } @@ -227,16 +227,18 @@ public class RequestsDbClient { } } - public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionId(String operationalEnvironmentId, String serviceModelVersionId) { + public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId(String operationalEnvironmentId, String serviceModelVersionId, String requestId) { try { HttpEntity<?> entity = getHttpEntity(); - OperationalEnvServiceModelStatus modelStatus = restTemplate.exchange(getUri(UriBuilder.fromUri(findOneByOperationalEnvIdAndServiceModelVersionIdURI) + OperationalEnvServiceModelStatus modelStatus = restTemplate.exchange(getUri(UriBuilder.fromUri(findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI) .queryParam(OPERATIONAL_ENVIRONMENT_ID, operationalEnvironmentId) .queryParam(SERVICE_MODEL_VERSION_ID, serviceModelVersionId) + .queryParam(REQUEST_ID, requestId) .build().toString()), HttpMethod.GET, entity, OperationalEnvServiceModelStatus.class).getBody(); if (null != modelStatus) { modelStatus.setOperationalEnvId(operationalEnvironmentId); modelStatus.setServiceModelVersionId(serviceModelVersionId); + modelStatus.setRequestId(requestId); } return modelStatus; }catch(HttpClientErrorException e){ |