diff options
269 files changed, 4236 insertions, 3286 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java index 9212fbcc6c..f50a6fd1bd 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java @@ -1032,14 +1032,14 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ * Normalize an input value to an Object, based on the target parameter type. * If the type is not recognized, it will just be returned unchanged (as a string). */ - public Object convertInputValue (String inputValue, HeatTemplateParam templateParam) + public Object convertInputValue (Object inputValue, HeatTemplateParam templateParam) { String type = templateParam.getParamType(); logger.debug("Parameter: {} is of type {}", templateParam.getParamName(), type); if (type.equalsIgnoreCase("number")) { try { - return Integer.valueOf(inputValue); + return Integer.valueOf(inputValue.toString()); } catch (Exception e) { logger.debug("Unable to convert {} to an integer!", inputValue); @@ -1047,14 +1047,14 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ } } else if (type.equalsIgnoreCase("json")) { try { - return new ObjectMapper().readTree(inputValue); + return JSON_MAPPER.writeValueAsString(inputValue); } catch (Exception e) { logger.debug("Unable to convert {} to a JsonNode!", inputValue); return null; } } else if (type.equalsIgnoreCase("boolean")) { - return new Boolean(inputValue); + return new Boolean(inputValue.toString()); } // Nothing else matched. Return the original string 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 efc232e79e..ee1c79c09c 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 @@ -86,6 +86,24 @@ import org.springframework.context.annotation.Primary; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.woorea.openstack.base.client.OpenStackConnectException; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.base.client.OpenStackResponseException; +import com.woorea.openstack.heat.Heat; +import com.woorea.openstack.heat.model.CreateStackParam; +import com.woorea.openstack.heat.model.Resources; +import com.woorea.openstack.heat.model.Stack; +import com.woorea.openstack.heat.model.Stack.Output; +import com.woorea.openstack.heat.model.Stacks; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.Authentication; +import com.woorea.openstack.keystone.utils.KeystoneUtils; + @Primary @Component public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ @@ -1005,7 +1023,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ return heatStack.getOutputs(); } - public void copyStringOutputsToInputs(Map<String, String> inputs, + public void copyStringOutputsToInputs(Map<String, Object> inputs, Map<String, Object> otherStackOutputs, boolean overWrite) { if (inputs == null || otherStackOutputs == null) return; @@ -1245,7 +1263,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ * (heat variable type) -> java Object type * string -> String * number -> Integer - * json -> JsonNode XXX Removed with MSO-1475 / 1802 + * json -> marshal object to json * comma_delimited_list -> ArrayList * boolean -> Boolean * if any of the conversions should fail, we will default to adding it to the inputs @@ -1256,7 +1274,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ * @param template the HeatTemplate object - this is so we can also verify if the param is valid for this template * @return HashMap<String, Object> of the inputs, cleaned and converted */ - public Map<String, Object> convertInputMap(Map<String, String> inputs, HeatTemplate template) { + public Map<String, Object> convertInputMap(Map<String, Object> inputs, HeatTemplate template) { HashMap<String, Object> newInputs = new HashMap<>(); HashMap<String, HeatTemplateParam> params = new HashMap<>(); HashMap<String, HeatTemplateParam> paramAliases = new HashMap<>(); @@ -1309,13 +1327,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); + String str = inputs.get(key).toString(); if (alias) newInputs.put(realName, str); else newInputs.put(key, str); } else if ("number".equalsIgnoreCase(type)) { - String integerString = inputs.get(key); + String integerString = inputs.get(key).toString(); Integer anInteger = null; try { anInteger = Integer.parseInt(integerString); @@ -1336,16 +1354,21 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ newInputs.put(key, integerString); } } else if ("json".equalsIgnoreCase(type)) { - // MSO-1475 - Leave this as a string now - String jsonString = inputs.get(key); - logger.debug("Skipping conversion to jsonNode..."); - if (alias) + Object jsonObj = inputs.get(key); + String jsonString; + try { + jsonString = JSON_MAPPER.writeValueAsString(jsonObj); + } catch (JsonProcessingException e) { + logger.error("failed to map to json, directly converting to string instead", e); + jsonString = jsonObj.toString(); + } + if (alias) newInputs.put(realName, jsonString); else newInputs.put(key, jsonString); //} } else if ("comma_delimited_list".equalsIgnoreCase(type)) { - String commaSeparated = inputs.get(key); + String commaSeparated = inputs.get(key).toString(); try { List<String> anArrayList = this.convertCdlToArrayList(commaSeparated); if (alias) @@ -1360,7 +1383,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ newInputs.put(key, commaSeparated); } } else if ("boolean".equalsIgnoreCase(type)) { - String booleanString = inputs.get(key); + String booleanString = inputs.get(key).toString(); Boolean aBool = Boolean.valueOf(booleanString); if (alias) newInputs.put(realName, aBool); @@ -1368,7 +1391,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ newInputs.put(key, aBool); } else { // it's null or something undefined - just add it back as a String - String str = inputs.get(key); + String str = inputs.get(key).toString(); if (alias) newInputs.put(realName, str); else 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 new file mode 100644 index 0000000000..af24975771 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java @@ -0,0 +1,59 @@ +/* + * ============LICENSE_START========================================== + * org.onap.music + * =================================================================== + * Copyright (c) 2019 IBM. + * =================================================================== + * 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.cloud.authentication; + +import static org.junit.Assert.assertEquals; + +import java.util.Calendar; + +import org.junit.Before; +import org.junit.Test; + +public class KeystoneAuthHolderTest { + + private KeystoneAuthHolder keystoneAuthHolder; + private Calendar calendar = Calendar.getInstance(); + + @Before + public void setUp() { + keystoneAuthHolder = new KeystoneAuthHolder(); + } + + @Test + public void testGetId() { + keystoneAuthHolder.setId("001"); + assertEquals("001", keystoneAuthHolder.getId()); + } + + @Test + public void testGetexpiration() { + keystoneAuthHolder.setexpiration(calendar); + assertEquals(calendar, keystoneAuthHolder.getexpiration()); + } + + @Test + public void testGetServiceUrl() { + keystoneAuthHolder.setHeatUrl("testURL"); + assertEquals("testURL", keystoneAuthHolder.getServiceUrl()); + } + +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest.java index 7c5111bd18..f63aab7ce1 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest.java @@ -23,7 +23,7 @@ package org.onap.so.cloudify.utils; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; @@ -33,7 +33,9 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import com.fasterxml.jackson.databind.JsonNode; +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.List; @@ -52,17 +54,23 @@ import org.onap.so.adapters.vdu.VduModelInfo; import org.onap.so.adapters.vdu.VduStateType; import org.onap.so.adapters.vdu.VduStatus; import org.onap.so.cloud.CloudConfig; -import org.onap.so.cloudify.beans.DeploymentInfoBuilder; -import org.onap.so.db.catalog.beans.CloudIdentity; -import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.cloudify.beans.DeploymentInfo; +import org.onap.so.cloudify.beans.DeploymentInfoBuilder; import org.onap.so.cloudify.beans.DeploymentStatus; import org.onap.so.cloudify.v3.client.Cloudify; import org.onap.so.cloudify.v3.model.AzureConfig; +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.CloudifyManager; import org.onap.so.db.catalog.beans.HeatTemplateParam; import org.onap.so.openstack.exceptions.MsoAdapterException; import org.onap.so.openstack.exceptions.MsoException; +import org.skyscreamer.jsonassert.JSONAssert; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; public class MsoCloudifyUtilsTest { @@ -282,21 +290,31 @@ public class MsoCloudifyUtilsTest { } @Test - public void convertInputValue_successful() { - MsoCloudifyUtils testedObject = new MsoCloudifyUtils(); - - HeatTemplateParam heatTemplateParam = new HeatTemplateParam(); - heatTemplateParam.setParamType("number"); - Object result = testedObject.convertInputValue("5", heatTemplateParam); - assertTrue(result instanceof Integer); - - heatTemplateParam.setParamType("json"); - Object result2 = testedObject.convertInputValue("{\"key\": \"value\"}", heatTemplateParam); - assertTrue(result2 instanceof JsonNode); + public void convertInputValueTest() throws JsonParseException, JsonMappingException, IOException { + MsoCloudifyUtils utils = new MsoCloudifyUtils(); + ObjectMapper mapper = new ObjectMapper(); + HeatTemplateParam paramNum = new HeatTemplateParam(); + paramNum.setParamType("number"); + paramNum.setParamName("my-number"); + + HeatTemplateParam paramString = new HeatTemplateParam(); + paramString.setParamType("string"); + paramString.setParamName("my-string"); + + HeatTemplateParam paramJson = new HeatTemplateParam(); + paramJson.setParamType("json"); + paramJson.setParamName("my-json"); + + Map<String, Object> jsonMap = mapper.readValue(getJson("free-form.json"), new TypeReference<Map<String, Object>>(){}); + + assertEquals(3, utils.convertInputValue("3", paramNum)); + assertEquals("hello", utils.convertInputValue("hello", paramString)); + JSONAssert.assertEquals(getJson("free-form.json"), utils.convertInputValue(jsonMap, paramJson).toString(), false); + + } - heatTemplateParam.setParamType("boolean"); - Object result3 = testedObject.convertInputValue("true", heatTemplateParam); - assertTrue(result3 instanceof Boolean); + private String getJson(String filename) throws IOException { + return new String(Files.readAllBytes(Paths.get("src/test/resources/__files/MsoHeatUtils/" + filename))); } private void mockCloudConfig(MsoCloudifyUtils testedObjectSpy) { 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 new file mode 100644 index 0000000000..40bbe90218 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsUnitTest.java @@ -0,0 +1,67 @@ +package org.onap.so.openstack.utils; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.junit.Test; +import org.onap.so.db.catalog.beans.HeatTemplate; +import org.onap.so.db.catalog.beans.HeatTemplateParam; +import org.skyscreamer.jsonassert.JSONAssert; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class MsoHeatUtilsUnitTest { + + + private ObjectMapper mapper = new ObjectMapper(); + @Test + public void convertInputMapTest() throws JsonParseException, JsonMappingException, IOException { + MsoHeatUtils utils = new MsoHeatUtils(); + + Map<String, Object> input = new HashMap<>(); + HeatTemplate template = new HeatTemplate(); + template.setArtifactUuid("my-uuid"); + Set<HeatTemplateParam> parameters = template.getParameters(); + HeatTemplateParam paramNum = new HeatTemplateParam(); + paramNum.setParamType("number"); + paramNum.setParamName("my-number"); + input.put("my-number", "3"); + + HeatTemplateParam paramString = new HeatTemplateParam(); + paramString.setParamType("string"); + paramString.setParamName("my-string"); + input.put("my-string", "hello"); + + HeatTemplateParam paramJson = new HeatTemplateParam(); + paramJson.setParamType("json"); + paramJson.setParamName("my-json"); + + Map<String, Object> jsonMap = mapper.readValue(getJson("free-form.json"), new TypeReference<Map<String, Object>>(){}); + input.put("my-json", jsonMap); + + parameters.add(paramNum); + parameters.add(paramString); + parameters.add(paramJson); + + Map<String, Object> output = utils.convertInputMap(input, template); + + assertEquals(3, output.get("my-number")); + assertEquals("hello", output.get("my-string")); + JSONAssert.assertEquals(getJson("free-form.json"), (String)output.get("my-json"), false); + } + + + 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-adapter-utils/src/test/resources/__files/MsoHeatUtils/free-form.json b/adapters/mso-adapter-utils/src/test/resources/__files/MsoHeatUtils/free-form.json new file mode 100644 index 0000000000..3efe43682d --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/MsoHeatUtils/free-form.json @@ -0,0 +1,7 @@ +{ + "a" : "value", + "b" : { + "my-key" : "my-value", + "array" : [1, 3, 4] + } +}
\ No newline at end of file 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 a383aac77f..c62dc0dfbf 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 @@ -58,7 +58,7 @@ public class CreateVfModuleRequest extends VfRequestCommon { private Boolean backout = true; private Boolean enableBridge; - private Map<String, String> vfModuleParams = new HashMap<>(); + private Map<String, Object> vfModuleParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); public String getCloudSiteId() { @@ -189,11 +189,11 @@ public class CreateVfModuleRequest extends VfRequestCommon { this.backout = backout; } - public Map<String, String> getVfModuleParams() { + public Map<String, Object> getVfModuleParams() { return vfModuleParams; } - public void setVfModuleParams(Map<String, String> vfModuleParams) { + public void setVfModuleParams(Map<String, Object> vfModuleParams) { this.vfModuleParams = vfModuleParams; } 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 698b2ccebe..214abd4e9d 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 @@ -41,7 +41,7 @@ public class CreateVolumeGroupRequest extends VfRequestCommon { private String vnfVersion; private String vfModuleType; private String modelCustomizationUuid; - private Map<String,String> volumeGroupParams = new HashMap<>(); + private Map<String,Object> volumeGroupParams = new HashMap<>(); private Boolean failIfExists; private Boolean enableBridge; private Boolean suppressBackout; @@ -91,11 +91,11 @@ public class CreateVolumeGroupRequest extends VfRequestCommon { this.vfModuleType = vfModuleType; } - public Map<String, String> getVolumeGroupParams() { + public Map<String, Object> getVolumeGroupParams() { return volumeGroupParams; } - public void setVolumeGroupParams(Map<String, String> volumeGroupParams) { + public void setVolumeGroupParams(Map<String, Object> volumeGroupParams) { this.volumeGroupParams = volumeGroupParams; } 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 0fb5c05e2a..1c7696a79b 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 @@ -58,7 +58,7 @@ public class UpdateVfModuleRequest extends VfRequestCommon { private Boolean failIfExists; private Boolean backout; - private Map<String,String> vfModuleParams = new HashMap<>(); + private Map<String,Object> vfModuleParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); public String getCloudSiteId() { @@ -197,11 +197,11 @@ public class UpdateVfModuleRequest extends VfRequestCommon { this.backout = backout; } - public Map<String, String> getVfModuleParams() { + public Map<String, Object> getVfModuleParams() { return vfModuleParams; } - public void setVfModuleParams(Map<String, String> vfModuleParams) { + public void setVfModuleParams(Map<String, Object> vfModuleParams) { this.vfModuleParams = vfModuleParams; } 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 d9f83aad2f..8ddef1eeaf 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 @@ -41,7 +41,7 @@ public class UpdateVolumeGroupRequest extends VfRequestCommon { private String vnfVersion; private String vfModuleType; private String modelCustomizationUuid; - private Map<String,String> volumeGroupParams = new HashMap<>(); + private Map<String,Object> volumeGroupParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); public UpdateVolumeGroupRequest() { @@ -112,11 +112,11 @@ public class UpdateVolumeGroupRequest extends VfRequestCommon { this.modelCustomizationUuid = modelCustomizationUuid; } - public Map<String, String> getVolumeGroupParams() { + public Map<String, Object> getVolumeGroupParams() { return volumeGroupParams; } - public void setVolumeGroupParams(Map<String, String> volumeGroupParams) { + public void setVolumeGroupParams(Map<String, Object> volumeGroupParams) { this.volumeGroupParams = volumeGroupParams; } diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml index dbfc5b7f6b..390c775cb2 100644 --- a/adapters/mso-catalog-db-adapter/pom.xml +++ b/adapters/mso-catalog-db-adapter/pom.xml @@ -153,10 +153,6 @@ </dependency> <dependency> <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-jdbc</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml b/adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml index 078e22b8ee..d7c13eaa14 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml +++ b/adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml @@ -13,15 +13,7 @@ mso: endpoint: http://localhost:8090 db: auth: Basic YnBlbDptc28tZGItMTUwNyE= - spring: - datasource: - jdbc-url: jdbc:mariadb://localhost:3306/catalogdb - username: catalog - password: catalog123 - driver-class-name: org.mariadb.jdbc.Driver - initialization-mode: never - security: usercredentials: - @@ -40,8 +32,4 @@ spring: server: port: 8090 -flyway: - baseline-on-migrate: false - jdbc-url: jdbc:mariadb://localhost:3306/catalogdb - user: catalog - password: catalog123 + diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml index 0977bf95fb..aa9317c920 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml +++ b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml @@ -16,7 +16,7 @@ mso: spring: datasource: - jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb + url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb username: ${DB_USERNAME} password: ${DB_PASSWORD} driver-class-name: org.mariadb.jdbc.Driver diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml index 12aee67a74..f2f411d5b6 100644 --- a/adapters/mso-openstack-adapters/pom.xml +++ b/adapters/mso-openstack-adapters/pom.xml @@ -13,8 +13,8 @@ <build> <finalName>${project.artifactId}-${project.version}</finalName> - - <plugins> + + <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> @@ -36,75 +36,25 @@ </executions> </plugin> -<!-- run the following plugin only when there's a wsdl change and you need to recompile the java classes + <!-- run the following plugin only when there's a wsdl change and you + need to recompile the java classes <plugin> <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxws-maven-plugin</artifactId> <version>2.4.1</version> <executions> + <execution> <id>generate-network-async-stubs</id> <phase>process-classes</phase> + <goals> <goal>wsimport</goal> </goals> <configuration> <vmArgs> <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg> + </vmArgs> <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory> <wsdlFiles> + <wsdlFile>NetworkAdapterNotify.wsdl</wsdlFile> </wsdlFiles> <wsdlLocation>/NetworkAdapterNotify.wsdl</wsdlLocation> + <packageName>org.onap.so.adapters.network.async.client</packageName> <xnocompile>false</xnocompile> + <keep>true</keep> </configuration> </execution> <execution> <id>generate-vnf-async-stubs</id> + <phase>process-classes</phase> <goals> <goal>wsimport</goal> </goals> <configuration> + <vmArgs> <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg> </vmArgs> <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory> + <wsdlFiles> <wsdlFile>VnfAdapterNotify.wsdl</wsdlFile> </wsdlFiles> <wsdlLocation>/VnfAdapterNotify.wsdl</wsdlLocation> + <packageName>org.onap.so.adapters.vnf.async.client</packageName> <xnocompile>false</xnocompile> + <keep>true</keep> </configuration> </execution> </executions> </plugin> <plugin> + <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> + <version>3.0.0</version> <executions> <execution> <id>add-source</id> <phase>generate-sources</phase> + <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>${project.build.directory}/generated-sources/wsimport/</source> + </sources> </configuration> </execution> </executions> </plugin> --> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>jaxws-maven-plugin</artifactId> - <version>2.4.1</version> - <executions> - <execution> - <id>generate-network-async-stubs</id> - <phase>process-classes</phase> - <goals> - <goal>wsimport</goal> - </goals> - <configuration> - <vmArgs> - <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg> - </vmArgs> - <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory> - <wsdlFiles> - <wsdlFile>NetworkAdapterNotify.wsdl</wsdlFile> - </wsdlFiles> - <wsdlLocation>/NetworkAdapterNotify.wsdl</wsdlLocation> - <packageName>org.onap.so.adapters.network.async.client</packageName> - <xnocompile>false</xnocompile> - <keep>true</keep> - </configuration> - </execution> - - <execution> - <id>generate-vnf-async-stubs</id> - <phase>process-classes</phase> - <goals> - <goal>wsimport</goal> - </goals> - <configuration> - <vmArgs> - <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg> - </vmArgs> - <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory> - <wsdlFiles> - <wsdlFile>VnfAdapterNotify.wsdl</wsdlFile> - </wsdlFiles> - <wsdlLocation>/VnfAdapterNotify.wsdl</wsdlLocation> - <packageName>org.onap.so.adapters.vnf.async.client</packageName> - <xnocompile>false</xnocompile> - <keep>true</keep> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <version>3.0.0</version> - <executions> - <execution> - <id>add-source</id> - <phase>generate-sources</phase> - <goals> - <goal>add-source</goal> - </goals> - <configuration> - <sources> - <source>${project.build.directory}/generated-sources/wsimport/</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - --> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> </plugin> @@ -126,12 +76,12 @@ </execution> </executions> </plugin> - </plugins> - - + </plugins> + + <pluginManagement> <plugins> - <!--This plugin's configuration is used to store Eclipse m2e settings + <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. --> <plugin> <groupId>org.eclipse.m2e</groupId> @@ -168,10 +118,10 @@ </build> <dependencies> - <!-- added for spring boot support --> + <!-- added for spring boot support --> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> @@ -180,21 +130,11 @@ <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> - <exclusions> - <exclusion> - <groupId>org.apache.tomcat</groupId> - <artifactId>tomcat-jdbc</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxws</artifactId> - <version>${cxf.version}</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> @@ -202,32 +142,31 @@ <version>${cxf.version}</version> </dependency> <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-rs-service-description-swagger</artifactId> - <version>${cxf.version}</version> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-service-description-swagger</artifactId> + <version>${cxf.version}</version> </dependency> <dependency> - <groupId>org.webjars</groupId> - <artifactId>swagger-ui</artifactId> - <version>3.5.0</version> - </dependency> - + <groupId>org.webjars</groupId> + <artifactId>swagger-ui</artifactId> + <version>3.5.0</version> + </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> - <groupId>janino</groupId> - <artifactId>janino</artifactId> - <version>2.5.15</version> + <groupId>janino</groupId> + <artifactId>janino</artifactId> + <version>2.5.15</version> </dependency> - - <!-- end added for spring boot support --> - - - - <!-- added for unit testing --> + + <!-- end added for spring boot support --> + + + + <!-- added for unit testing --> <dependency> <groupId>org.onap.so.adapters</groupId> <artifactId>mso-adapter-utils</artifactId> @@ -242,23 +181,23 @@ <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <scope>test</scope> - </dependency> + </dependency> <dependency> <groupId>org.mariadb.jdbc</groupId> <artifactId>mariadb-java-client</artifactId> - </dependency> + </dependency> <dependency> <groupId>org.onap.so</groupId> <artifactId>common</artifactId> <version>${project.version}</version> </dependency> <dependency> - <groupId>ch.vorburger.mariaDB4j</groupId> - <artifactId>mariaDB4j</artifactId> - <version>2.2.3</version> - <scope>test</scope> - </dependency> - <dependency> + <groupId>ch.vorburger.mariaDB4j</groupId> + <artifactId>mariaDB4j</artifactId> + <version>2.2.3</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-contract-wiremock</artifactId> <version>1.2.4.RELEASE</version> @@ -271,13 +210,13 @@ </dependency> <dependency> <groupId>org.onap.so.libs.openstack-java-sdk</groupId> - <artifactId>nova-model</artifactId> + <artifactId>nova-model</artifactId> <version>${openstack.version}</version> </dependency> <dependency> - <groupId>org.camunda.bpm</groupId> - <artifactId>camunda-external-task-client</artifactId> - <version>1.2.0-SNAPSHOT</version> - </dependency> + <groupId>org.camunda.bpm</groupId> + <artifactId>camunda-external-task-client</artifactId> + <version>1.0.0</version> + </dependency> </dependencies> </project> diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java index aace75ff99..499c1137c7 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java @@ -59,9 +59,9 @@ public class AuditStackService { ClientRequestInterceptor interceptor = new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth); ExternalTaskClient client = ExternalTaskClient.create() - .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(5).addInterceptor(interceptor) - .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(5000, 2, 30000)).build(); - client.subscribe("InventoryAudit").lockDuration(5000) + .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor) + .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(10000, 2, 120000)).build(); + client.subscribe("InventoryAudit").lockDuration(60000) .handler(auditStack::executeExternalTask).open(); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackServiceData.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackServiceData.java index d1f952c829..773705d566 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackServiceData.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackServiceData.java @@ -72,7 +72,7 @@ public class AuditStackServiceData { }else if(externalTask.getRetries() != null && externalTask.getRetries()-1 == 0){ logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId()); - externalTaskService.handleBpmnError(externalTask, "AuditAAIInventoryFailure", "Number of Retries Exceeded auditing inventory"); + externalTaskService.handleBpmnError(externalTask, "AuditAAIInventoryFailure"); }else{ logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ", externalTask.getId(),externalTask.getRetries()-1, calculateRetryDelay(externalTask.getRetries())); externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, externalTask.getRetries()-1, calculateRetryDelay(externalTask.getRetries())); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java index 46fb651afe..613ab0d2f9 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -21,15 +23,17 @@ package org.onap.so.adapters.network; -import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ContrailPolicyRef { - private static final MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, ContrailPolicyRef.class); + + private static final Logger logger = LoggerFactory.getLogger(ContrailPolicyRef.class); @JsonProperty("network_policy_refs_data_sequence") private ContrailPolicyRefSeq seq; @@ -44,7 +48,8 @@ public class ContrailPolicyRef { } catch (Exception e) { - logger.error (MessageEnum.RA_MARSHING_ERROR, "Error creating JsonString for Contrail Policy Ref", "", "", MsoLogger.ErrorCode.SchemaError, "Exception creating JsonString for Contrail Policy Ref", e); + logger.error("{} {} Error creating JsonString for Contrail Policy Ref: ", MessageEnum.RA_MARSHING_ERROR, + MsoLogger.ErrorCode.SchemaError.getValue(), e); } return node; @@ -60,7 +65,8 @@ public class ContrailPolicyRef { } catch (Exception e) { - logger.error (MessageEnum.RA_MARSHING_ERROR, "Error creating JsonString for Contrail Policy Ref", "", "", MsoLogger.ErrorCode.SchemaError, "Exception creating JsonString for Contrail Policy Ref", e); + logger.error("{} {} Error creating JsonString for Contrail Policy Ref: ", MessageEnum.RA_MARSHING_ERROR, + MsoLogger.ErrorCode.SchemaError.getValue(), e); } return jsonString; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java index 019963b242..6f80e0ee15 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -20,23 +22,24 @@ package org.onap.so.adapters.network; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import java.util.ArrayList; import java.util.List; - import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.HostRoute; import org.onap.so.openstack.beans.Pool; import org.onap.so.openstack.beans.Subnet; import org.onap.so.openstack.utils.MsoCommonUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; - public class ContrailSubnet { - private static final MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, ContrailSubnet.class); + + private static final Logger logger = LoggerFactory.getLogger(ContrailSubnet.class); @Autowired private MsoCommonUtils msoCommonUtils; @@ -129,8 +132,8 @@ public class ContrailSubnet { } catch (Exception e) { - String error = "Error creating JsonNode for Contrail Subnet:" + subnetName; - logger.error (MessageEnum.RA_MARSHING_ERROR, error, "", "", MsoLogger.ErrorCode.SchemaError, "Exception creating JsonNode for Contrail Subnet", e); + logger.error("{} {} Error creating JsonNode for Contrail Subnet: {} ", MessageEnum.RA_MARSHING_ERROR, + MsoLogger.ErrorCode.SchemaError.getValue(), subnetName, e); } return node; @@ -146,8 +149,8 @@ public class ContrailSubnet { } catch (Exception e) { - String error = "Error creating JsonString for Contrail Subnet:" + subnetName; - logger.error (MessageEnum.RA_MARSHING_ERROR, error, "", "", MsoLogger.ErrorCode.SchemaError, "Exception creating JsonString for Contrail Subnet", e); + logger.error("{} {} Error creating JsonString for Contrail Subnet: {} ", MessageEnum.RA_MARSHING_ERROR, + MsoLogger.ErrorCode.SchemaError.getValue(), subnetName, e); } return jsonString; 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 8181714c0a..80333d6c7e 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 @@ -6,6 +6,7 @@ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2018 IBM. + * Modifications Copyright (c) 2019 Samsung * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +23,7 @@ */ package org.onap.so.adapters.network; - + import java.net.MalformedURLException; import java.net.URL; @@ -31,14 +32,12 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; - import javax.jws.WebService; import javax.xml.bind.DatatypeConverter; import javax.xml.namespace.QName; import javax.xml.ws.BindingProvider; import javax.xml.ws.Holder; import javax.xml.ws.handler.MessageContext; - import org.onap.so.adapters.network.async.client.CreateNetworkNotification; import org.onap.so.adapters.network.async.client.MsoExceptionCategory; import org.onap.so.adapters.network.async.client.NetworkAdapterNotify; @@ -48,12 +47,13 @@ import org.onap.so.adapters.network.async.client.UpdateNetworkNotification; import org.onap.so.adapters.network.exceptions.NetworkException; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; - import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.NetworkRollback; import org.onap.so.openstack.beans.NetworkStatus; import org.onap.so.openstack.beans.Subnet; import org.onap.so.utils.CryptoUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @@ -62,14 +62,14 @@ import org.springframework.stereotype.Component; @WebService(serviceName = "NetworkAdapterAsync", endpointInterface = "org.onap.so.adapters.network.MsoNetworkAdapterAsync", targetNamespace = "http://org.onap.so/networkA") public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoNetworkAdapterAsyncImpl.class); + private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterAsyncImpl.class); private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.network.bpelauth"; private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; private static final String NETWORK_EXCEPTION_MSG="Got a NetworkException on createNetwork: "; - private static final String CREATE_NETWORK_ERROR_MSG="Error sending createNetwork notification "; - private static final String CREATE_NETWORK_EXCEPTON_MSG="Exception sending createNetwork notification"; - private static final String MSO_INTERNAL_ERROR_MSG="MsoInternalError"; + private static final String CREATE_NETWORK_ERROR_LOGMSG ="{} {} Error sending createNetwork notification {} "; + private static final String FAULT_INFO_ERROR_LOGMSG = "{} {} Exception - fault info "; + @Autowired private Environment environment; @@ -80,7 +80,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { */ @Override public void healthCheckA () { - LOGGER.debug ("Health check call in Network Adapter"); + logger.debug ("Health check call in Network Adapter"); } /** @@ -130,13 +130,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { MsoLogger.setLogContext (msoRequest); MsoLogger.setServiceName ("CreateNetworkA"); - LOGGER.debug ("Async Create Network: " + networkName - + " of type " - + networkType - + " in " - + cloudSiteId - + "/" - + tenantId); + logger.debug("Async Create Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); // Use the synchronous method to perform the actual Create @@ -177,27 +171,28 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { subnetIdMap, networkRollback); } catch (NetworkException e) { - LOGGER.debug (NETWORK_EXCEPTION_MSG, e); + logger.debug (NETWORK_EXCEPTION_MSG, e); MsoExceptionCategory exCat = null; String eMsg = null; try { eMsg = e.getFaultInfo ().getMessage (); exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ()); } catch (Exception e1) { - LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1); + logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC, + MsoLogger.ErrorCode.DataError.getValue(), e1); } // Build and send Asynchronous error response try { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.createNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null); } catch (Exception e1) { - error = CREATE_NETWORK_ERROR_MSG + e1.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError,CREATE_NETWORK_EXCEPTON_MSG, e1); + logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, + MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(), e1); } return; } - LOGGER.debug ("Async Create Network:Name " + networkName + " physicalNetworkName:" + physicalNetworkName); + logger.debug("Async Create Network:Name {} physicalNetworkName:{}", networkName, physicalNetworkName); // Build and send Asynchronous response try { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); @@ -210,8 +205,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { copyCreateSubnetIdMap (subnetIdMap), copyNrb (networkRollback)); } catch (Exception e) { - error = CREATE_NETWORK_ERROR_MSG + e.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e); + logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, + MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e); } return; @@ -262,13 +257,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String serviceName = "UpdateNetworkA"; MsoLogger.setServiceName (serviceName); MsoLogger.setLogContext (msoRequest); - LOGGER.debug ("Async Update Network: " + networkId - + " of type " - + networkType - + "in " - + cloudSiteId - + "/" - + tenantId); + logger.debug("Async Update Network: {} of type {} in {}/{}", networkId, networkType, cloudSiteId, tenantId); // Use the synchronous method to perform the actual Create @@ -306,27 +295,29 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { MsoLogger.setServiceName (serviceName); } catch (NetworkException e) { MsoLogger.setServiceName (serviceName); - LOGGER.debug ("Got a NetworkException on updateNetwork: ", e); + logger.debug ("Got a NetworkException on updateNetwork: ", e); MsoExceptionCategory exCat = null; String eMsg = null; try { eMsg = e.getFaultInfo ().getMessage (); exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ()); } catch (Exception e1) { - LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1); + logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC, + MsoLogger.ErrorCode.DataError.getValue(), e1); } // Build and send Asynchronous error response try { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.updateNetworkNotification (messageId, false, exCat, eMsg, null, copyNrb (networkRollback)); } catch (Exception e1) { - error = "Error sending updateNetwork notification " + e1.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNetwork notification", e1); + logger.error("{} {} Error sending updateNetwork notification {} ", + MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(), + e1); } return; } - LOGGER.debug ("Async Update Network:Name " + networkName + " NetworkId:" + networkId); + logger.debug("Async Update Network:Name {} NetworkId:{}", networkName, networkId); // Build and send Asynchronous response try { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); @@ -337,9 +328,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { copyUpdateSubnetIdMap (subnetIdMap), copyNrb (networkRollback)); } catch (Exception e) { - error = "Error sending updateNotification request" + e.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNotification request", e); - + logger.error("{} {} Error sending updateNotification request {} ", MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, + MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e); } return; } @@ -363,7 +353,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { MsoLogger.setLogContext (msoRequest); String serviceName = "QueryNetworkA"; MsoLogger.setServiceName (serviceName); - LOGGER.debug ("Async Query Network " + networkNameOrId + " in " + cloudSiteId + "/" + tenantId); + logger.debug("Async Query Network {} in {}/{}", networkNameOrId, cloudSiteId, tenantId); + String errorCreateNetworkMessage = "{} {} Error sending createNetwork notification {} "; // Use the synchronous method to perform the actual Create @@ -390,27 +381,27 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { MsoLogger.setServiceName (serviceName); } catch (NetworkException e) { MsoLogger.setServiceName (serviceName); - LOGGER.debug (NETWORK_EXCEPTION_MSG, e); + logger.debug (NETWORK_EXCEPTION_MSG, e); MsoExceptionCategory exCat = null; String eMsg = null; try { eMsg = e.getFaultInfo ().getMessage (); exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ()); } catch (Exception e1) { - LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1); + logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC, + MsoLogger.ErrorCode.DataError.getValue(), e1); } // Build and send Asynchronous error response try { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.queryNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null, null, null); } catch (Exception e1) { - error = "Error sending createNetwork notification " + e1.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1); - + logger.error(errorCreateNetworkMessage, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, + MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(), e1); } return; } - LOGGER.debug ("Async Query Network:NameOrId " + networkNameOrId + " tenantId:" + tenantId); + logger.debug("Async Query Network:NameOrId {} tenantId:{}", networkNameOrId, tenantId); // Build and send Asynchronous response try { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); @@ -426,9 +417,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { vlans.value, copyQuerySubnetIdMap (subnetIdMap)); } catch (Exception e) { - error = "Error sending createNetwork notification " + e.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e); - + logger.error(errorCreateNetworkMessage, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, + MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e); } return; } @@ -464,7 +454,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { MsoLogger.setLogContext (msoRequest); String serviceName = "DeleteNetworkA"; MsoLogger.setServiceName (serviceName); - LOGGER.debug ("Async Delete Network " + networkId + " in " + cloudSiteId + "/" + tenantId); + logger.debug("Async Delete Network {} in {}/{}", networkId, cloudSiteId, tenantId); // Use the synchronous method to perform the actual Create @@ -477,34 +467,36 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { MsoLogger.setServiceName (serviceName); } catch (NetworkException e) { MsoLogger.setServiceName (serviceName); - LOGGER.debug (NETWORK_EXCEPTION_MSG, e); + logger.debug (NETWORK_EXCEPTION_MSG, e); MsoExceptionCategory exCat = null; String eMsg = null; try { eMsg = e.getFaultInfo ().getMessage (); exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ()); } catch (Exception e1) { - LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1); + logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC, + MsoLogger.ErrorCode.DataError.getValue(), e1); } // Build and send Asynchronous error response try { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.deleteNetworkNotification (messageId, false, exCat, eMsg, null); } catch (Exception e1) { - error = "Error sending createNetwork notification " + e1.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1); + logger.error("{} {} Error sending createNetwork notification {} ", + MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(), + e1); } return; } - LOGGER.debug ("Async Delete NetworkId: " + networkId + " tenantId:" + tenantId); + logger.debug("Async Delete NetworkId: {} tenantId:{}", networkId, tenantId); // Build and send Asynchronous response try { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.deleteNetworkNotification (messageId, true, null, null, networkDeleted.value); } catch (Exception e) { - error = "Error sending deleteNetwork notification " + e.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending deleteNetwork notification", e); + logger.error("{} {} Error sending deleteNetwork notification {} ", MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, + MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e); } return; @@ -526,12 +518,13 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { MsoLogger.setServiceName (serviceName); // rollback may be null (e.g. if network already existed when Create was called) if (rollback == null) { - LOGGER.warn (MessageEnum.RA_ROLLBACK_NULL, "", "", MsoLogger.ErrorCode.SchemaError, "Rollback is null"); + logger.warn("{} {} Rollback is null", MessageEnum.RA_ROLLBACK_NULL, + MsoLogger.ErrorCode.SchemaError.getValue()); return; } MsoLogger.setLogContext (rollback.getMsoRequest ()); - LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId (), "", ""); + logger.info("{} {}", MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId()); // Use the synchronous method to perform the actual Create @@ -540,7 +533,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { MsoLogger.setServiceName (serviceName); } catch (NetworkException e) { MsoLogger.setServiceName (serviceName); - LOGGER.debug ("Got a NetworkException on rollbackNetwork: ", e); + logger.debug ("Got a NetworkException on rollbackNetwork: ", e); // Build and send Asynchronous error response MsoExceptionCategory exCat = null; String eMsg = null; @@ -548,27 +541,29 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { eMsg = e.getFaultInfo ().getMessage (); exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ()); } catch (Exception e1) { - LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in get fault info", e1); + logger.error("{} {} Exception in get fault info ", MessageEnum.RA_FAULT_INFO_EXC, + MsoLogger.ErrorCode.DataError.getValue(), e1); } // Build and send Asynchronous error response try { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.rollbackNetworkNotification (rollback.getMsoRequest ().getRequestId (), false, exCat, eMsg); } catch (Exception e1) { - error = CREATE_NETWORK_ERROR_MSG + e1.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending createNetwork notification ", e1); + logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, + MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(), e1); } return; } - LOGGER.debug ("Async Rollback NetworkId: " + rollback.getNetworkStackId () + " tenantId:" + rollback.getTenantId ()); + logger.debug("Async Rollback NetworkId: {} tenantId:{}", rollback.getNetworkStackId(), rollback.getTenantId()); // Build and send Asynchronous response try { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.rollbackNetworkNotification (rollback.getMsoRequest ().getRequestId (), true, null, null); } catch (Exception e) { - error = "Error sending rollbackNetwork notification " + e.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending rollbackNetwork notification", e); + logger + .error("{} {} Error sending rollbackNetwork notification {} ", MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, + MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e); } return; @@ -607,15 +602,18 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { try { warWsdlLoc = Thread.currentThread ().getContextClassLoader ().getResource ("NetworkAdapterNotify.wsdl"); } catch (Exception e) { - LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e); + logger.error("{} {} Exception - WSDL not found ", MessageEnum.RA_WSDL_NOT_FOUND, + MsoLogger.ErrorCode.DataError.getValue(), e); } if (warWsdlLoc == null) { - LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.DataError, "WSDL not found"); + logger + .error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND, MsoLogger.ErrorCode.DataError.getValue()); } else { try { - LOGGER.debug ("NetworkAdpaterNotify.wsdl location:" + warWsdlLoc.toURI ().toString ()); + logger.debug("NetworkAdpaterNotify.wsdl location: {}", warWsdlLoc.toURI().toString()); } catch (Exception e) { - LOGGER.error (MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.SchemaError, "Exception - WSDL URL convention", e); + logger.error("{} {} Exception - WSDL URL convention ", MessageEnum.RA_WSDL_URL_CONVENTION_EXC, + MsoLogger.ErrorCode.SchemaError.getValue(), e); } } @@ -631,15 +629,16 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { try { epUrl = new URL (notificationUrl); } catch (MalformedURLException e1) { - LOGGER.error (MessageEnum.RA_INIT_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - init notification", e1); + logger.error("{} {} Exception - init notification ", MessageEnum.RA_INIT_NOTIF_EXC, + MsoLogger.ErrorCode.DataError.getValue(), e1); } if(null != epUrl) { - LOGGER.debug ("Notification Endpoint URL: " + epUrl.toExternalForm ()); + logger.debug("Notification Endpoint URL: {}", epUrl.toExternalForm()); bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ()); } else { - LOGGER.debug ("Notification Endpoint URL is NULL: "); + logger.debug("Notification Endpoint URL is NULL: "); } // authentication @@ -653,9 +652,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { reqCtx.put (MessageContext.HTTP_REQUEST_HEADERS, headers); headers.put ("Authorization", Collections.singletonList (basicAuth)); } catch (Exception e) { - String error1 = "Unable to set authorization in callback request" + e.getMessage (); - LOGGER.error (MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - Unable to set authorization in callback request", e); - + logger.error("{} {} Unable to set authorization in callback request {} ", + MessageEnum.RA_SET_CALLBACK_AUTH_EXC, MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e); } return notifyPort; @@ -665,7 +663,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { try { return CryptoUtils.decrypt(this.environment.getProperty(key), this.environment.getProperty(encryptionKey)); } catch (GeneralSecurityException e) { - LOGGER.debug("Exception while decrypting property: " + this.environment.getProperty(key), e); + logger.debug("Exception while decrypting property: {} ", this.environment.getProperty(key), e); } return defaultValue; 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 d250561f16..79966577f8 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 @@ -6,6 +6,7 @@ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2018 IBM. + * Modifications Copyright (c) 2019 Samsung * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,17 +22,17 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.adapters.network; +package org.onap.so.adapters.network; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; - import javax.jws.WebService; import javax.xml.ws.Holder; - import org.onap.so.adapters.network.beans.ContrailPolicyRef; import org.onap.so.adapters.network.beans.ContrailPolicyRefSeq; import org.onap.so.adapters.network.beans.ContrailSubnet; @@ -39,17 +40,16 @@ import org.onap.so.adapters.network.exceptions.NetworkException; import org.onap.so.adapters.network.mappers.ContrailSubnetMapper; import org.onap.so.cloud.CloudConfig; import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.HeatTemplate; import org.onap.so.db.catalog.beans.NetworkResource; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; -import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.data.repository.CollectionNetworkResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; - import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.NetworkInfo; @@ -67,14 +67,13 @@ import org.onap.so.openstack.utils.MsoHeatUtils; import org.onap.so.openstack.utils.MsoHeatUtilsWithUpdate; import org.onap.so.openstack.utils.MsoNeutronUtils; import org.onap.so.openstack.utils.MsoNeutronUtils.NetworkType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; - @Component @Transactional @WebService(serviceName = "NetworkAdapter", endpointInterface = "org.onap.so.adapters.network.MsoNetworkAdapter", targetNamespace = "http://org.onap.so/network") @@ -91,7 +90,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError"; private static final String NEUTRON_MODE = "NEUTRON"; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoNetworkAdapterImpl.class); + private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class); @Autowired private CloudConfig cloudConfig; @@ -119,7 +118,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { */ @Override public void healthCheck () { - LOGGER.debug ("Health check call in Network Adapter"); + logger.debug ("Health check call in Network Adapter"); } /** @@ -270,13 +269,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { MsoLogger.setLogContext (msoRequest); MsoLogger.setServiceName (CREATE_NETWORK_CONTEXT); - LOGGER.debug ("*** CREATE Network: " + networkName - + " of type " - + networkType - + " in " - + cloudSiteId - + "/" - + tenantId); + logger.debug("*** CREATE Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); @@ -295,16 +288,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Optional<CloudSite> cloudSiteOpt = cloudConfig.getCloudSite(cloudSiteId); if (!cloudSiteOpt.isPresent()) { - String error = "Configuration Error. Stack " + networkName + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + " CloudSite does not exist in MSO Configuration"; - LOGGER.error (MessageEnum.RA_CONFIG_EXC, error, "", "", MsoLogger.ErrorCode.DataError, "Configuration Error"); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error); - // Set the detailed error as the Exception 'message' - throw new NetworkException (error, MsoExceptionCategory.USERDATA); + String error = String + .format("Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration", + networkName, cloudSiteId, tenantId); + logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error); + // Set the detailed error as the Exception 'message' + throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -329,12 +318,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { long queryNetworkStarttime = System.currentTimeMillis (); try { netInfo = neutron.queryNetwork (networkName, tenantId, cloudSiteId); - LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Response successfully received from OpenStack", "OpenStack", "QueryNetwork", null); } catch (MsoException me) { - LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while querying network from OpenStack", "OpenStack", "QueryNetwork", null); - LOGGER.error (MessageEnum.RA_QUERY_NETWORK_EXC, networkName, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception while querying network from OpenStack", me); + logger.error( + "{} {} Exception while querying network {} for CloudSite {} from Tenant {} from OpenStack ", + MessageEnum.RA_QUERY_NETWORK_EXC, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + networkName, cloudSiteId, tenantId, me); me.addContext (CREATE_NETWORK_CONTEXT); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while querying network from OpenStack"); throw new NetworkException (me); } @@ -342,23 +331,20 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Exists. If that's OK, return success with the network ID. // Otherwise, return an exception. if (failIfExists != null && failIfExists) { - String error = "Create Nework: Network " + networkName - + " already exists in " - + cloudSiteId - + "/" - + tenantId - + " with ID " + netInfo.getId(); - LOGGER.error (MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Network already exists"); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error); + String error = String + .format("Create Nework: Network %s already exists in %s/%s with ID %s", networkName, + cloudSiteId, tenantId, netInfo.getId()); + logger.error("{} {} {}", MessageEnum.RA_NETWORK_ALREADY_EXIST, + MsoLogger.ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } else { // Populate the outputs from the existing network. networkId.value = netInfo.getId (); neutronNetworkId.value = netInfo.getId (); rollback.value = networkRollback; // Default rollback - no updates performed - String msg = "Found Existing network, status=" + netInfo.getStatus () + " for Neutron mode"; - LOGGER.warn (MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "", MsoLogger.ErrorCode.DataError, "Found Existing network, status=" + netInfo.getStatus ()); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, msg); + logger.warn("{} {} Found Existing network, status={} for Neutron mode ", + MessageEnum.RA_NETWORK_ALREADY_EXIST, MsoLogger.ErrorCode.DataError.getValue(), + netInfo.getStatus()); } return; } @@ -371,19 +357,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { networkName, physicalNetworkName, vlans); - LOGGER.recordMetricEvent (createNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Response successfully received from OpenStack", "OpenStack", "CreateNetwork", null); } catch (MsoException me) { - me.addContext (CREATE_NETWORK_CONTEXT); - LOGGER.recordMetricEvent (createNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with OpenStack", "OpenStack", "CreateNetwork", null); - String error = "Create Network: type " + neutronNetworkType - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_EXC, networkName, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception while communicate with OpenStack", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + me.addContext(CREATE_NETWORK_CONTEXT); + logger.error("{} {} Create Network: type {} in {}/{}: ", MessageEnum.RA_CREATE_NETWORK_EXC, + MsoLogger.ErrorCode.DataError.getValue(), neutronNetworkType, cloudSiteId, tenantId, me); throw new NetworkException (me); } @@ -401,18 +378,19 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { networkRollback.setNeutronNetworkId (netInfo.getId ()); networkRollback.setNetworkType (networkType); - LOGGER.debug ("Network " + networkName + " created, id = " + netInfo.getId ()); + logger.debug("Network {} created, id = {}", networkName, netInfo.getId()); } else if ("HEAT".equals (mode)) { HeatTemplate heatTemplate = networkResource.getHeatTemplate(); if (heatTemplate == null) { - String error = "Network error - undefined Heat Template. Network Type = " + networkType; - LOGGER.error (MessageEnum.RA_PARAM_NOT_FOUND, "Heat Template", "Network Type", networkType, "Openstack", "", MsoLogger.ErrorCode.DataError, "Network error - undefined Heat Template. Network Type = " + networkType); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); + String error = String + .format("Network error - undefined Heat Template. Network Type = %s", networkType); + logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, MsoLogger.ErrorCode.DataError.getValue(), + error); throw new NetworkException (error, MsoExceptionCategory.INTERNAL); } - - LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.toString()); + + logger.debug("Got HEAT Template from DB: {}", heatTemplate.toString()); // "Fix" the template if it has CR/LF (getting this from Oracle) String template = heatTemplate.getHeatTemplate (); @@ -432,33 +410,22 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { long queryNetworkStarttime = System.currentTimeMillis (); try { heatStack = heat.queryStack (cloudSiteId, tenantId, networkName); - LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Response successfully received from OpenStack", "OpenStack", "QueryNetwork", null); } catch (MsoException me) { me.addContext (CREATE_NETWORK_CONTEXT); - LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while querying stack from OpenStack", "OpenStack", "QueryNetwork", null); - String error = "Create Network (heat): query network " + networkName - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.error (MessageEnum.RA_QUERY_NETWORK_EXC, networkName, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception while querying stack from OpenStack", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + logger.error("{} {} Create Network (heat): query network {} in {}/{}: ", + MessageEnum.RA_QUERY_NETWORK_EXC, MsoLogger.ErrorCode.DataError.getValue(), networkName, + cloudSiteId, tenantId, me); throw new NetworkException (me); } if (heatStack != null && (heatStack.getStatus () != HeatStatus.NOTFOUND)) { // Stack exists. Return success or error depending on input directive if (failIfExists != null && failIfExists) { - String error = "CreateNetwork: Stack " + networkName - + " already exists in " - + cloudSiteId - + "/" - + tenantId - + " as " + heatStack.getCanonicalName(); - LOGGER.error (MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "", "", MsoLogger.ErrorCode.DataError, "Network already exists"); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error); + String error = String + .format("CreateNetwork: Stack %s already exists in %s/%s as %s", networkName, cloudSiteId, + tenantId, heatStack.getCanonicalName()); + logger.error("{} {} {}", MessageEnum.RA_NETWORK_ALREADY_EXIST, + MsoLogger.ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } else { // Populate the outputs from the existing stack. @@ -489,8 +456,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } } subnetIdMap.value = sMap; - LOGGER.warn (MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "", MsoLogger.ErrorCode.DataError, "Found Existing network stack, status=" + heatStack.getStatus ()); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Suc, "Found Existing network stack"); + logger.warn("{} {} Found Existing network stack, status={} networkName={} for {}/{}", + MessageEnum.RA_NETWORK_ALREADY_EXIST, MsoLogger.ErrorCode.DataError.getValue(), + heatStack.getStatus(), networkName, cloudSiteId, tenantId); } return; } @@ -513,8 +481,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { stackParams = heat.validateStackParams (stackParams, heatTemplate); } catch (IllegalArgumentException e) { String error = "Create Network: Configuration Error: " + e.getMessage (); - LOGGER.error (MessageEnum.RA_CONFIG_EXC, e.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - Create Network, Configuration Error", e); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error); + logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, + MsoLogger.ErrorCode.DataError.getValue(), error,e); // Input parameters were not valid throw new NetworkException (error, MsoExceptionCategory.INTERNAL); } @@ -531,15 +499,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } } catch (MsoException me) { me.addContext (CREATE_NETWORK_CONTEXT); - String error = "Create Network (heat): type " + neutronNetworkType - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_EXC, neutronNetworkType.toString(), cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception Create Network, merging subnets", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error); + logger + .error("{} {} Exception Create Network, merging subnets for network (heat) type {} in {}/{} ", + MessageEnum.RA_CREATE_NETWORK_EXC, MsoLogger.ErrorCode.DataError.getValue(), + neutronNetworkType.toString(), cloudSiteId, tenantId, me); throw new NetworkException (me); } } @@ -549,15 +512,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { mergePolicyRefs (policyFqdns, stackParams); } catch (MsoException me) { me.addContext (CREATE_NETWORK_CONTEXT); - String error = "Create Network (heat) mergePolicyRefs type " + neutronNetworkType - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_EXC, neutronNetworkType.toString(), cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception Create Network, merging policyRefs", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error); + logger.error("{} {} Exception Create Network, merging policyRefs type {} in {}/{} ", + MessageEnum.RA_CREATE_NETWORK_EXC, MsoLogger.ErrorCode.DataError.getValue(), + neutronNetworkType.toString(), cloudSiteId, tenantId, me); throw new NetworkException (me); } } @@ -567,15 +524,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { mergeRouteTableRefs (routeTableFqdns, stackParams); } catch (MsoException me) { me.addContext (CREATE_NETWORK_CONTEXT); - String error = "Create Network (heat) mergeRouteTableRefs type " + neutronNetworkType - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_EXC, neutronNetworkType.toString(), cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception Create Network, merging routeTableRefs", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error); + logger.error("{} {} Exception Create Network, merging routeTableRefs type {} in {}/{} ", + MessageEnum.RA_CREATE_NETWORK_EXC, MsoLogger.ErrorCode.DataError.getValue(), + neutronNetworkType.toString(), cloudSiteId, tenantId, me); throw new NetworkException (me); } } @@ -598,15 +549,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { backout.booleanValue()); } catch (MsoException me) { me.addContext (CREATE_NETWORK_CONTEXT); - String error = "Create Network (heat): type " + neutronNetworkType - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_EXC, networkName, cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception creating network", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + logger + .error("{} {} Exception creating network type {} in {}/{} ", MessageEnum.RA_CREATE_NETWORK_EXC, + MsoLogger.ErrorCode.DataError.getValue(), networkName, cloudSiteId, tenantId, me); throw new NetworkException (me); } @@ -648,10 +593,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { networkRollback.setNetworkCreated (true); networkRollback.setNetworkType (networkType); - LOGGER.debug ("Network " + networkName + " successfully created via HEAT"); + logger.debug("Network {} successfully created via HEAT", networkName); } - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Suc, "Successfully created network"); return; } @@ -772,14 +716,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Holder <NetworkRollback> rollback) throws NetworkException { MsoLogger.setLogContext (msoRequest); MsoLogger.setServiceName (UPDATE_NETWORK_CONTEXT); - LOGGER.debug ("***UPDATE Network adapter with Network: " + networkName - + " of type " - + networkType - + " in " - + cloudSiteId - + "/" - + tenantId); - + logger.debug("***UPDATE Network adapter with Network: {} of type {} in {}/{}", networkName, networkType, + cloudSiteId, tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); @@ -792,16 +730,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Optional<CloudSite> cloudSiteOpt = cloudConfig.getCloudSite (cloudSiteId); if (!cloudSiteOpt.isPresent()) { - String error = "UpdateNetwork: Configuration Error. Stack " + networkName + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + " CloudSite does not exist in MSO Configuration"; - LOGGER.error (MessageEnum.RA_CONFIG_EXC, error, "Openstack", "", MsoLogger.ErrorCode.DataError, "CloudSite does not exist in MSO Configuration"); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error); - // Set the detailed error as the Exception 'message' - throw new NetworkException (error, MsoExceptionCategory.USERDATA); + String error = String.format( + "UpdateNetwork: Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration", + networkName, cloudSiteId, tenantId); + logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error); + // Set the detailed error as the Exception 'message' + throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -830,30 +764,18 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { long queryNetworkStarttime = System.currentTimeMillis(); try { netInfo = neutron.queryNetwork(networkId, tenantId, cloudSiteId); - LOGGER.recordMetricEvent(queryNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryNetwork", null); } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); - String error = "Update Network (neutron): query " + networkId - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.recordMetricEvent(queryNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryNetwork", null); - LOGGER.error(MessageEnum.RA_QUERY_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "QueryNetwork", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryNetwork", me); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + logger.error("{} {} Exception - queryNetwork query {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), networkId, cloudSiteId, tenantId, me); throw new NetworkException(me); } if (netInfo == null) { - String error = "Update Nework: Network " + networkId - + " does not exist in " - + cloudSiteId - + "/" - + tenantId; - LOGGER.error(MessageEnum.RA_NETWORK_NOT_FOUND, networkId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Network not found"); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error); + String error = String + .format("Update Nework: Network %s does not exist in %s/%s", networkId, cloudSiteId, tenantId); + logger.error("{} {} {}", MessageEnum.RA_NETWORK_NOT_FOUND, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), error); // Does not exist. Throw an exception (can't update a non-existent network) throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -865,19 +787,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { neutronNetworkType, physicalNetworkName, vlans); - LOGGER.recordMetricEvent(updateNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "UpdateNetwork", null); } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); - String error = "Update Network (neutron): " + networkId - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, networkId, cloudSiteId, tenantId, "Openstack", "updateNetwork", MsoLogger.ErrorCode.DataError, "Exception - updateNetwork", me); - LOGGER.recordMetricEvent(updateNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "UpdateNetwork", null); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + logger.error("{} {} Exception - updateNetwork {} in {}/{} ", MessageEnum.RA_UPDATE_NETWORK_ERR, + MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me); throw new NetworkException(me); } @@ -890,7 +803,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { networkRollback.setPhysicalNetwork(netInfo.getProvider()); networkRollback.setVlans(netInfo.getVlans()); - LOGGER.debug("Network " + networkId + " updated, id = " + netInfo.getId()); + logger.debug("Network {} updated, id = {}", networkId, netInfo.getId()); } else if ("HEAT".equals(mode)) { // First, look up to see that the Network already exists. @@ -899,30 +812,18 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { long queryStackStarttime = System.currentTimeMillis(); try { heatStack = heat.queryStack(cloudSiteId, tenantId, networkName); - LOGGER.recordMetricEvent(queryStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", null); } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); - String error = "UpdateNetwork (heat): query " + networkName - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.recordMetricEvent(queryStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null); - LOGGER.error(MessageEnum.RA_QUERY_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Exception - QueryStack", me); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + logger.error("{} {} Exception - QueryStack query {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC, + MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me); throw new NetworkException(me); } if (heatStack == null || (heatStack.getStatus() == HeatStatus.NOTFOUND)) { - String error = "UpdateNetwork: Stack " + networkName - + " does not exist in " - + cloudSiteId - + "/" - + tenantId; - LOGGER.error(MessageEnum.RA_NETWORK_NOT_FOUND, networkId, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Network not found"); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error); + String error = String + .format("UpdateNetwork: Stack %s does not exist in %s/%s", networkName, cloudSiteId, tenantId); + logger.error("{} {} {}", MessageEnum.RA_NETWORK_NOT_FOUND, MsoLogger.ErrorCode.DataError.getValue(), + error); // Network stack does not exist. Return an error throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -940,11 +841,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { try { previousVlans.add(Integer.parseInt(vlan)); } catch (NumberFormatException e) { - LOGGER.warn(MessageEnum.RA_VLAN_PARSE, networkId, vlansParam, "", MsoLogger.ErrorCode.DataError, "Exception - VLAN parse", e); + logger.warn("{} {} Exception - VLAN parse for params {} ", MessageEnum.RA_VLAN_PARSE, + MsoLogger.ErrorCode.DataError.getValue(), vlansParam, e); } } } - LOGGER.debug("Update Stack: Previous VLANS: " + previousVlans); + logger.debug("Update Stack: Previous VLANS: {}", previousVlans); // Ready to deploy the updated Network via Heat @@ -952,13 +854,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { HeatTemplate heatTemplate = networkResource.getHeatTemplate(); if (heatTemplate == null) { String error = "Network error - undefined Heat Template. Network Type=" + networkType; - LOGGER.error(MessageEnum.RA_PARAM_NOT_FOUND, "Heat Template", "Network Type", networkType, "OpenStack", "getHeatTemplate", MsoLogger.ErrorCode.DataError, "Network error - undefined Heat Template. Network Type=" + networkType); - - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error); + logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, MsoLogger.ErrorCode.DataError.getValue(), + error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } - LOGGER.debug("Got HEAT Template from DB: " + heatTemplate.toString()); + logger.debug("Got HEAT Template from DB: {}", heatTemplate.toString()); // "Fix" the template if it has CR/LF (getting this from Oracle) String template = heatTemplate.getHeatTemplate(); @@ -988,9 +889,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { stackParams = heat.validateStackParams(stackParams, heatTemplate); } catch (IllegalArgumentException e) { String error = "UpdateNetwork: Configuration Error: Network Type=" + networkType; - LOGGER.error(MessageEnum.RA_CONFIG_EXC, "Network Type=" + networkType, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork: Configuration Error"); - - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, error); + logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL, e); } @@ -1003,15 +902,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); - String error = "Update Network (heat): type " + neutronNetworkType - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork mergeSubnets ", me); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error); + logger.error("{} {} Exception - UpdateNetwork mergeSubnets for network type {} in {}/{} ", + MessageEnum.RA_UPDATE_NETWORK_ERR, MsoLogger.ErrorCode.DataError.getValue(), + neutronNetworkType.toString(), cloudSiteId, tenantId, me); throw new NetworkException(me); } } @@ -1021,15 +914,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { mergePolicyRefs(policyFqdns, stackParams); } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); - String error = "UpdateNetwork (heat) mergePolicyRefs type " + neutronNetworkType - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork mergePolicyRefs", me); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error); + logger.error("{} {} Exception - UpdateNetwork mergePolicyRefs type {} in {}/{} ", + MessageEnum.RA_UPDATE_NETWORK_ERR, MsoLogger.ErrorCode.DataError.getValue(), + neutronNetworkType.toString(), cloudSiteId, tenantId, me); throw new NetworkException(me); } } @@ -1039,15 +926,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { mergeRouteTableRefs(routeTableFqdns, stackParams); } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); - String error = "UpdateNetwork (heat) mergeRouteTableRefs type " + neutronNetworkType - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork mergeRouteTableRefs", me); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error); + logger.error("{} {} Exception - UpdateNetwork mergeRouteTableRefs type {} in {}/{} ", + MessageEnum.RA_UPDATE_NETWORK_ERR, MsoLogger.ErrorCode.DataError.getValue(), + neutronNetworkType.toString(), cloudSiteId, tenantId, me); throw new NetworkException(me); } } @@ -1063,13 +944,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { stackParams, true, heatTemplate.getTimeoutMinutes()); - LOGGER.recordMetricEvent(updateStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "UpdateStack", null); } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); - String error = "Update Network: " + networkId + " in " + cloudSiteId + "/" + tenantId + ": " + me; - LOGGER.recordMetricEvent(updateStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "UpdateStack", null); - LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, networkId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - update network", me); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + logger.error("{} {} Exception - update network {} in {}/{} ", MessageEnum.RA_UPDATE_NETWORK_ERR, + MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me); throw new NetworkException(me); } @@ -1100,7 +978,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { networkRollback.setNeutronNetworkId((String) outputs.get(NETWORK_ID)); } else { - LOGGER.debug("outputs is NULL"); + logger.debug("outputs is NULL"); } networkRollback.setNetworkType(networkType); // Save previous parameters @@ -1110,10 +988,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { rollback.value = networkRollback; - LOGGER.debug("Network " + networkId + " successfully updated via HEAT"); + logger.debug("Network {} successfully updated via HEAT", networkId); } - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully updated network"); return; } @@ -1141,30 +1018,23 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } } if(networkCust != null){ - LOGGER.debug("Got Network Customization definition from Catalog: " - + networkCust.toString()); + logger.debug("Got Network Customization definition from Catalog: {}", networkCust.toString()); networkResource = networkCust.getNetworkResource(); } else if (collectionNetworkCust != null) { - LOGGER.debug("Retrieved Collection Network Resource Customization from Catalog: " - + collectionNetworkCust.toString()); + logger.debug("Retrieved Collection Network Resource Customization from Catalog: {}", + collectionNetworkCust.toString()); networkResource = collectionNetworkCust.getNetworkResource(); } if (networkResource == null) { - String error = "Create/UpdateNetwork: Unable to get network resource with NetworkType:" - + networkType - + " or ModelCustomizationUUID:" - + modelCustomizationUuid; - LOGGER.error(MessageEnum.RA_UNKOWN_PARAM, - "NetworkType/ModelCustomizationUUID", networkType + "/" - + modelCustomizationUuid, "OpenStack", "", - MsoLogger.ErrorCode.DataError, - "Create/UpdateNetwork: Unknown NetworkType/ModelCustomizationUUID"); + String error = String.format( + "Create/UpdateNetwork: Unable to get network resource with NetworkType: %s or ModelCustomizationUUID:%s", + networkType, modelCustomizationUuid); + logger.error("{} {} {} ", MessageEnum.RA_UNKOWN_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); - } - LOGGER.debug("Got Network definition from Catalog: " - + networkResource.toString()); + } + logger.debug("Got Network definition from Catalog: {}", networkResource.toString()); String mode = networkResource.getOrchestrationMode(); NetworkType neutronNetworkType = NetworkType @@ -1172,12 +1042,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // All Networks are orchestrated via HEAT or Neutron if (!("HEAT".equals(mode) || NEUTRON_MODE.equals(mode))) { - String error = "CreateNetwork: Configuration Error: Network Type = " - + networkType; - LOGGER.error(MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT, - mode, "OpenStack", "", MsoLogger.ErrorCode.DataError, - "CreateNetwork: Configuration Error"); - throw new NetworkException(error, MsoExceptionCategory.INTERNAL); + String error = "CreateNetwork: Configuration Error: Network Type = " + networkType; + logger.error("{} {} {}", MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT, + MsoLogger.ErrorCode.DataError.getValue(), error); + throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } MavenLikeVersioning aicV = new MavenLikeVersioning(); @@ -1191,22 +1059,15 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { .isMoreRecentThan(networkResource .getAicVersionMax())))) // aic <= max { - LOGGER.debug("Network Type:" + networkType + " VersionMin:" - + networkResource.getAicVersionMin() + " VersionMax:" - + networkResource.getAicVersionMax() - + " supported on Cloud:" + cloudSiteId - + " with AIC_Version:" + cloudSite.getCloudVersion()); + logger.debug("Network Type:{} VersionMin:{} VersionMax:{} supported on Cloud:{} with AIC_Version:{}", + networkType, networkResource.getAicVersionMin(), networkResource.getAicVersionMax(), cloudSiteId, + cloudSite.getCloudVersion()); } else { - String error = "Network Type:" + networkType + " Version_Min:" - + networkResource.getAicVersionMin() + " Version_Max:" - + networkResource.getAicVersionMax() - + " not supported on Cloud:" + cloudSiteId - + " with AIC_Version:" + cloudSite.getCloudVersion(); - LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", - MsoLogger.ErrorCode.DataError, - "Network Type not supported on Cloud"); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.DataError, error); + String error = String + .format("Network Type:%s Version_Min:%s Version_Max:%s not supported on Cloud:%s with AIC_Version:%s", + networkType, networkType, networkResource.getAicVersionMin(), + networkResource.getAicVersionMax(), cloudSiteId, cloudSite.getCloudVersion()); + logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -1215,9 +1076,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { networkName, physicalNetworkName, vlans, routeTargets); if (!missing.isEmpty()) { String error = "Create Network: Missing parameters: " + missing; - LOGGER.error(MessageEnum.RA_MISSING_PARAM, missing, - "OpenStack", "", MsoLogger.ErrorCode.DataError, - "Create Network: Missing parameters"); + logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -1293,11 +1152,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Holder <Map <String, String>> subnetIdMap) throws NetworkException { MsoLogger.setLogContext (msoRequest); MsoLogger.setServiceName ("QueryNetwork"); - LOGGER.debug ("*** QUERY Network with Network: " + networkNameOrId - + " in " - + cloudSiteId - + "/" - + tenantId); + logger.debug("*** QUERY Network with Network: {} in {}/{}", networkNameOrId, cloudSiteId, tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); @@ -1307,22 +1162,17 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { || commonUtils.isNullOrEmpty(networkNameOrId)) { String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId"; - LOGGER.error (MessageEnum.RA_MISSING_PARAM, "cloudSiteId or tenantId or networkNameOrId", "OpenStack", "", MsoLogger.ErrorCode.DataError, "Missing mandatory parameter cloudSiteId, tenantId or networkId"); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error); + logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error); throw new NetworkException (error, MsoExceptionCategory.USERDATA); } Optional<CloudSite> cloudSiteOpt = cloudConfig.getCloudSite(cloudSiteId); if (!cloudSiteOpt.isPresent()) { - String error = "Configuration Error. Stack " + networkNameOrId + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + " CloudSite does not exist in MSO Configuration"; - LOGGER.error (MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Configuration Error"); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error); + String error = String + .format("Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration", + networkNameOrId, cloudSiteId, tenantId); + logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error); // Set the detailed error as the Exception 'message' throw new NetworkException (error, MsoExceptionCategory.USERDATA); } @@ -1336,19 +1186,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { long queryStackStarttime = System.currentTimeMillis (); try { heatStack = heat.queryStack (cloudSiteId, tenantId, networkNameOrId); - LOGGER.recordMetricEvent (queryStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", null); } catch (MsoException me) { me.addContext ("QueryNetwork"); - String error = "Query Network (heat): " + networkNameOrId - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.recordMetricEvent (queryStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "BPMN", "QueryStack", null); - LOGGER.error (MessageEnum.RA_QUERY_NETWORK_EXC, networkNameOrId, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Exception - Query Network (heat)", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + logger.error("{} {} Exception - Query Network (heat): {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC, + MsoLogger.ErrorCode.DataError.getValue(), networkNameOrId, cloudSiteId, tenantId, me); throw new NetworkException (me); } @@ -1388,7 +1229,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { long queryNetworkStarttime = System.currentTimeMillis (); try { NetworkInfo netInfo = neutron.queryNetwork (neutronId, tenantId, cloudSiteId); - LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryNetwork", null); if (netInfo != null) { // Found. Populate the output elements networkExists.value = Boolean.TRUE; @@ -1402,12 +1242,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (vlans != null) vlans.value = netInfo.getVlans (); - LOGGER.debug ("Network " + networkNameOrId - + " found (" - + mode - + "), ID = " - + networkId.value - + ("HEAT".equals (mode) ? ",NeutronId = " + neutronNetworkId.value : "")); + logger.debug("Network {} found({}), ID = {}{}", networkNameOrId, mode, networkId.value, + ("HEAT".equals(mode) ? ",NeutronId = " + neutronNetworkId.value : "")); } else { // Not found. Populate the status fields, leave the rest null networkExists.value = Boolean.FALSE; @@ -1416,23 +1252,14 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (vlans != null) vlans.value = new ArrayList<>(); - LOGGER.debug ("Network " + networkNameOrId + " not found"); + logger.debug("Network {} not found", networkNameOrId); } } catch (MsoException me) { me.addContext ("QueryNetwork"); - String error = "Query Network (neutron): " + networkNameOrId - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryNetwork", null); - LOGGER.error (MessageEnum.RA_QUERY_NETWORK_EXC, networkNameOrId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - Query Network (neutron)", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + logger.error("{} {} Exception - Query Network (neutron): {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC, + MsoLogger.ErrorCode.DataError.getValue(), networkNameOrId, cloudSiteId, tenantId, me); throw new NetworkException (me); } - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully queried network"); return; } @@ -1464,11 +1291,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Holder <Boolean> networkDeleted) throws NetworkException { MsoLogger.setLogContext (msoRequest); MsoLogger.setServiceName ("DeleteNetwork"); - LOGGER.debug ("*** DELETE Network adapter with Network: " + networkId - + " in " - + cloudSiteId - + "/" - + tenantId); + logger.debug("*** DELETE Network adapter with Network: {} in {}/{}", networkId, cloudSiteId, tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); @@ -1478,8 +1301,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { || commonUtils.isNullOrEmpty(tenantId) || commonUtils.isNullOrEmpty(networkId)) { String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId"; - LOGGER.error (MessageEnum.RA_MISSING_PARAM, "cloudSiteId or tenantId or networkId", "Openstack", "", MsoLogger.ErrorCode.DataError, "Missing mandatory parameter cloudSiteId, tenantId or networkId"); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error); + logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error); throw new NetworkException (error, MsoExceptionCategory.USERDATA); } @@ -1499,7 +1321,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String mode = ""; if (networkResource != null) { - LOGGER.debug ("Got Network definition from Catalog: " + networkResource.toString ()); + logger.debug("Got Network definition from Catalog: {}", networkResource.toString()); mode = networkResource.getOrchestrationMode (); } @@ -1512,20 +1334,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // The deleteNetwork function in MsoNeutronUtils returns success if the network // was not found. So don't bother to query first. boolean deleted = neutron.deleteNetwork (networkId, tenantId, cloudSiteId); - LOGGER.recordMetricEvent (deleteNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteNetwork", null); networkDeleted.value = deleted; } catch (MsoException me) { me.addContext ("DeleteNetwork"); - String error = "Delete Network (neutron): " + networkId - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.recordMetricEvent (deleteNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteNetwork", null); - LOGGER.error (MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Delete Network (neutron)", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + logger.error("{} {} Delete Network (neutron): {} in {}/{} ", MessageEnum.RA_DELETE_NETWORK_EXC, + MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me); throw new NetworkException (me); } } else { // DEFAULT to ("HEAT".equals (mode)) @@ -1539,7 +1352,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) { heat.deleteStack (tenantId, cloudSiteId, networkId, true); - LOGGER.recordMetricEvent (deleteStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteStack", null); networkDeleted.value = true; } else @@ -1548,23 +1360,14 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } } catch (MsoException me) { me.addContext ("DeleteNetwork"); - String error = "Delete Network (heat): " + networkId - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.recordMetricEvent (deleteStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteStack", null); - LOGGER.error (MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Delete Network (heat)", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + logger.error("{} {} Delete Network (heat): {} in {}/{} ", MessageEnum.RA_DELETE_NETWORK_EXC, + MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me); throw new NetworkException (me); } } // On success, nothing is returned. - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully deleted network"); return; } @@ -1584,8 +1387,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { long startTime = System.currentTimeMillis (); if (rollback == null) { - LOGGER.error (MessageEnum.RA_ROLLBACK_NULL, "Openstack", "", MsoLogger.ErrorCode.DataError, "rollback is null"); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "No action to perform"); + logger + .error("{} {} rollback is null", MessageEnum.RA_ROLLBACK_NULL, MsoLogger.ErrorCode.DataError.getValue()); return; } @@ -1598,9 +1401,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String networkType = rollback.getNetworkType (); String modelCustomizationUuid = rollback.getModelCustomizationUuid(); - LOGGER.debug ("*** ROLLBACK Network " + networkId + " in " + cloudSiteId + "/" + tenantId); + logger.debug("*** ROLLBACK Network {} in {}/{}", networkId, cloudSiteId, tenantId); - // Retrieve the Network Resource definition NetworkResource networkResource = null; @@ -1612,7 +1414,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String mode = ""; if (networkResource != null) { - LOGGER.debug ("Got Network definition from Catalog: " + networkResource.toString ()); + logger.debug("Got Network definition from Catalog: {}", networkResource.toString()); mode = networkResource.getOrchestrationMode (); } @@ -1626,19 +1428,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // The deleteNetwork function in MsoNeutronUtils returns success if the network // was not found. So don't bother to query first. neutron.deleteNetwork (networkId, tenantId, cloudSiteId); - LOGGER.recordMetricEvent (deleteNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteNetwork", null); } catch (MsoException me) { me.addContext ("RollbackNetwork"); - String error = "Rollback Network (neutron): " + networkId - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.recordMetricEvent (deleteNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteNetwork", null); - LOGGER.error (MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Rollback Network (neutron)", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + logger.error("{} {} Exception - Rollback Network (neutron): {} in {}/{} ", + MessageEnum.RA_DELETE_NETWORK_EXC, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + networkId, cloudSiteId, tenantId, me); throw new NetworkException (me); } } else { // DEFAULT to if ("HEAT".equals (mode)) @@ -1647,25 +1441,16 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // The deleteStack function in MsoHeatUtils returns success if the stack // was not found. So don't bother to query first. heat.deleteStack (tenantId, cloudSiteId, networkId, true); - LOGGER.recordMetricEvent (deleteStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteStack", null); } catch (MsoException me) { me.addContext ("RollbackNetwork"); - String error = "Rollback Network (heat): " + networkId - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.recordMetricEvent (deleteStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteStack", null); - LOGGER.error (MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Rollback Network (heat)", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + logger.error("{} {} Exception - Rollback Network (heat): {} in {}/{} ", + MessageEnum.RA_DELETE_NETWORK_EXC, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + networkId, cloudSiteId, tenantId, me); throw new NetworkException (me); } } } - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully rolled back network"); return; } @@ -1740,7 +1525,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { { String routeTarget = rt.getRouteTarget(); String routeTargetRole = rt.getRouteTargetRole(); - LOGGER.debug("Checking for an actually null route target: " + rt.toString()); + logger.debug("Checking for an actually null route target: {}", rt); if (routeTarget == null || routeTarget.equals("") || routeTarget.equalsIgnoreCase("null")) rtIsNull = true; if (routeTargetRole == null || routeTargetRole.equals("") || routeTargetRole.equalsIgnoreCase("null")) @@ -1749,7 +1534,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { rtIsNull = true; } if (!rtIsNull) { - LOGGER.debug("Input RT:" + rt.toString()); + logger.debug("Input RT:{}", rt); String role = rt.getRouteTargetRole(); String rtValue = rt.getRouteTarget(); @@ -1827,7 +1612,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { ContrailPolicyRefSeq refSeq = new ContrailPolicyRefSeq(String.valueOf(index), "0"); pr.setSeq(refSeq); index++; - LOGGER.debug("Contrail PolicyRefs Data:" + pr.toString()); + logger.debug("Contrail PolicyRefs Data:{}", pr); prlist.add(pr); } } @@ -1838,12 +1623,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { ObjectMapper mapper = new ObjectMapper(); node = mapper.convertValue(prlist, JsonNode.class); String jsonString = mapper.writeValueAsString(prlist); - LOGGER.debug("Json PolicyRefs Data:" + jsonString); + logger.debug("Json PolicyRefs Data:{}", jsonString); } catch (Exception e) { String error = "Error creating JsonNode for policyRefs Data"; - LOGGER.error (MessageEnum.RA_MARSHING_ERROR, error, "Openstack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception creating JsonNode for policyRefs Data", e); + logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + error, e); throw new MsoAdapterException (error); } //update parameters @@ -1863,7 +1649,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { stackParams.put ("policy_refsdata", node); } - LOGGER.debug ("StackParams updated with policy refs"); + logger.debug("StackParams updated with policy refs"); return; } @@ -1885,7 +1671,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { stackParams.put ("route_table_refs", csl); } - LOGGER.debug ("StackParams updated with route_table refs"); + logger.debug("StackParams updated with route_table refs"); return; } @@ -1948,9 +1734,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { //Resource Property List<ContrailSubnet> cslist = new ArrayList <> (); for (Subnet subnet : subnets) { - LOGGER.debug("Input Subnet:" + subnet.toString()); + logger.debug("Input Subnet:{}", subnet.toString()); ContrailSubnet cs = new ContrailSubnetMapper(subnet).map(); - LOGGER.debug("Contrail Subnet:" + cs.toString()); + logger.debug("Contrail Subnet:{}", cs.toString()); cslist.add(cs); } @@ -1960,12 +1746,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { ObjectMapper mapper = new ObjectMapper(); node = mapper.convertValue(cslist, JsonNode.class); String jsonString = mapper.writeValueAsString(cslist); - LOGGER.debug("Json Subnet List:" + jsonString); + logger.debug("Json Subnet List:{}", jsonString); } catch (Exception e) { String error = "Error creating JsonNode from input subnets"; - LOGGER.error (MessageEnum.RA_MARSHING_ERROR, error, "", "", MsoLogger.ErrorCode.DataError, "Exception creating JsonNode from input subnets", e); + logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, MsoLogger.ErrorCode.DataError.getValue(), error, e); throw new MsoAdapterException (error); } //update parameters @@ -1980,7 +1766,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // append outputs in heatTemplate int outputsIdx = heatTemplate.indexOf ("outputs:"); heatTemplate = insertStr (heatTemplate, outputTempl, outputsIdx + 8); - LOGGER.debug ("Template updated with all AIC3.0 subnets:" + heatTemplate); + logger.debug("Template updated with all AIC3.0 subnets:{}", heatTemplate); return heatTemplate; } @@ -2018,7 +1804,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { curR = curR.replace ("%subnetId%", subnet.getSubnetId ()); } else { String error = "Missing Required AAI SubnetId for subnet in HEAT Template"; - LOGGER.error (MessageEnum.RA_MISSING_PARAM, error, "Openstack", "", MsoLogger.ErrorCode.DataError, "Missing Required AAI ID for subnet in HEAT Template"); + logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error); throw new MsoAdapterException (error); } @@ -2032,7 +1818,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { curR = curR.replace ("%cidr%", subnet.getCidr ()); } else { String error = "Missing Required cidr for subnet in HEAT Template"; - LOGGER.error (MessageEnum.RA_MISSING_PARAM, error, "Openstack", "", MsoLogger.ErrorCode.DataError, "Missing Required cidr for subnet in HEAT Template"); + logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error); throw new MsoAdapterException (error); } @@ -2067,13 +1853,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } // append resources and outputs in heatTemplate - LOGGER.debug ("Tempate initial:" + heatTemplate); + logger.debug("Tempate initial:{}", heatTemplate); int outputsIdx = heatTemplate.indexOf ("outputs:"); heatTemplate = insertStr (heatTemplate, outputsBuf.toString (), outputsIdx + 8); int resourcesIdx = heatTemplate.indexOf ("resources:"); heatTemplate = insertStr (heatTemplate, resourcesBuf.toString (), resourcesIdx + 10); - LOGGER.debug ("Template updated with all subnets:" + heatTemplate); + logger.debug("Template updated with all subnets:{}", heatTemplate); return heatTemplate; } @@ -2085,12 +1871,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Object obj = outputs.get(key); ObjectMapper mapper = new ObjectMapper(); String jStr = mapper.writeValueAsString(obj); - LOGGER.debug ("Subnet_Ipam Output JSON String:" + obj.getClass() + " " + jStr); + logger.debug("Subnet_Ipam Output JSON String:{} {}", obj.getClass(), jStr); JsonNode rootNode = mapper.readTree(jStr); for (JsonNode sNode : rootNode.path("ipam_subnets")) { - LOGGER.debug("Output Subnet Node" + sNode.toString()); + logger.debug("Output Subnet Node {}", sNode.toString()); String name = sNode.path("subnet_name").textValue(); String uuid = sNode.path("subnet_uuid").textValue(); String aaiId = name; // default @@ -2114,10 +1900,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (Exception e) { - LOGGER.error (MessageEnum.RA_MARSHING_ERROR, "error getting subnet-uuids", "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception getting subnet-uuids", e); + logger.error("{} {} Exception getting subnet-uuids ", MessageEnum.RA_MARSHING_ERROR, + MsoLogger.ErrorCode.DataError.getValue(), e); } - LOGGER.debug ("Return sMap" + sMap.toString()); + logger.debug("Return sMap {}", sMap.toString()); return sMap; } @@ -2125,14 +1912,14 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String updatedTemplate; - LOGGER.debug ("Index:" + index + " Snippet:" + snippet); + logger.debug("Index:{} Snippet:{}", index, snippet); String templateBeg = template.substring (0, index); String templateEnd = template.substring (index); updatedTemplate = templateBeg + "\n" + snippet + templateEnd; - LOGGER.debug ("Template updated with a subnet:" + updatedTemplate); + logger.debug("Template updated with a subnet:{}", updatedTemplate); return updatedTemplate; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java index fd658244ee..8f9152a86d 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -22,10 +24,14 @@ package org.onap.so.adapters.network; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import java.util.HashMap; import java.util.List; import java.util.Map; - import javax.inject.Provider; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -40,7 +46,6 @@ import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.xml.ws.Holder; - import org.apache.http.HttpStatus; import org.onap.so.adapters.network.exceptions.NetworkException; import org.onap.so.adapters.nwrest.ContrailNetwork; @@ -67,31 +72,25 @@ import org.onap.so.openstack.beans.NetworkRollback; import org.onap.so.openstack.beans.NetworkStatus; import org.onap.so.openstack.beans.RouteTarget; import org.onap.so.openstack.exceptions.MsoExceptionCategory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - @Path("/v1/networks") @Api(value = "/v1/networks", description = "root of network adapters restful web service") @Component @Transactional public class NetworkAdapterRest { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,NetworkAdapterRest.class); + + private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterRest.class); private static final String TESTING_KEYWORD = "___TESTING___"; - private String APPEND_RESPONSE = ", resp="; private String EXCEPTION = "Exception:"; @Autowired private MsoNetworkAdapterImpl adapter; @Autowired - @Qualifier("NetworkBpel") private Provider<BpelRestClient> bpelRestClientProvider; @@ -109,7 +108,7 @@ public class NetworkAdapterRest { public Response createNetwork( @ApiParam(value = "details of network being created", required = true) CreateNetworkRequest req) { - LOGGER.debug("createNetwork enter: " + req.toJsonString()); + logger.debug("createNetwork enter: {}", req.toJsonString()); CreateNetworkTask task = new CreateNetworkTask(req); if (req.isSynchronous()) { // This is a synchronous request @@ -125,11 +124,12 @@ public class NetworkAdapterRest { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception while create network", e); + logger.error("{} {} Exception while create network ", MessageEnum.RA_CREATE_NETWORK_EXC, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller - LOGGER.debug ("createNetwork exit"); + logger.debug("createNetwork exit"); return Response.status(HttpStatus.SC_ACCEPTED).build(); } } @@ -161,7 +161,7 @@ public class NetworkAdapterRest { } @Override public void run() { - LOGGER.debug ("CreateNetworkTask start"); + logger.debug("CreateNetworkTask start"); try { // Synchronous Web Service Outputs Holder<String> networkId = new Holder<>(); @@ -269,7 +269,7 @@ public class NetworkAdapterRest { rollback.value, req.getMessageId()); } catch (NetworkException e) { - LOGGER.debug (EXCEPTION, e); + logger.debug(EXCEPTION, e); eresp = new CreateNetworkError( e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } @@ -278,7 +278,7 @@ public class NetworkAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug ("CreateNetworkTask exit: code=" + getStatusCode() + APPEND_RESPONSE+ getResponse()); + logger.debug("CreateNetworkTask exit: code={}, resp={}", getStatusCode(), getResponse()); } } @@ -299,7 +299,7 @@ public class NetworkAdapterRest { @ApiParam(value = "details of network being deleted", required = true) DeleteNetworkRequest req) { - LOGGER.debug("deleteNetwork enter: " + req.toJsonString()); + logger.debug("deleteNetwork enter: {}", req.toJsonString()); if (aaiNetworkId == null || !aaiNetworkId.equals(req.getNetworkId())) { return Response .status(HttpStatus.SC_BAD_REQUEST) @@ -322,11 +322,12 @@ public class NetworkAdapterRest { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - LOGGER.error (MessageEnum.RA_DELETE_NETWORK_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception while delete network", e); + logger.error("{} {} Exception while delete network ", MessageEnum.RA_DELETE_NETWORK_EXC, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller - LOGGER.debug ("deleteNetwork exit"); + logger.debug("deleteNetwork exit"); return Response.status(HttpStatus.SC_ACCEPTED).build(); } } @@ -358,7 +359,7 @@ public class NetworkAdapterRest { } @Override public void run() { - LOGGER.debug("DeleteNetworkTask start"); + logger.debug("DeleteNetworkTask start"); try { Holder<Boolean> networkDeleted = new Holder<>(); if (req.getCloudSiteId().equals(TESTING_KEYWORD)) { @@ -375,7 +376,7 @@ public class NetworkAdapterRest { } response = new DeleteNetworkResponse(req.getNetworkId(), networkDeleted.value, req.getMessageId()); } catch (NetworkException e) { - LOGGER.debug (EXCEPTION, e); + logger.debug(EXCEPTION, e); eresp = new DeleteNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { @@ -383,7 +384,7 @@ public class NetworkAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("DeleteNetworkTask exit: code=" + getStatusCode() + APPEND_RESPONSE+ getResponse()); + logger.debug("DeleteNetworkTask exit: code={}, resp={}", getStatusCode(), getResponse()); } } @@ -413,7 +414,7 @@ public class NetworkAdapterRest { @PathParam("aaiNetworkId") String aaiNetworkId) { //This request responds synchronously only - LOGGER.debug ("Query network enter:" + aaiNetworkId); + logger.debug("Query network enter:{}" + aaiNetworkId); MsoRequest msoRequest = new MsoRequest(requestId, serviceInstanceId); try { @@ -430,10 +431,10 @@ public class NetworkAdapterRest { networkExists, networkId, neutronNetworkId, status, routeTargets, subnetIdMap); if (!networkExists.value) { - LOGGER.debug ("network not found"); + logger.debug("network not found"); respStatus = HttpStatus.SC_NOT_FOUND; } else { - LOGGER.debug ("network found" + networkId.value + ", status=" + status.value); + logger.debug("network found {}, status={}", networkId.value, status.value); resp.setNetworkExists(networkExists.value); resp.setNetworkId(networkId.value); resp.setNeutronNetworkId(neutronNetworkId.value); @@ -441,13 +442,14 @@ public class NetworkAdapterRest { resp.setRouteTargets(routeTargets.value); resp.setSubnetIdMap(subnetIdMap.value); } - LOGGER.debug ("Query network exit"); + logger.debug("Query network exit"); return Response .status(respStatus) .entity(new GenericEntity<QueryNetworkResponse>(resp) {}) .build(); } catch (NetworkException e) { - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, aaiNetworkId, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception when query VNF", e); + logger.error("{} {} Exception when query VNF ", MessageEnum.RA_QUERY_VNF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); QueryNetworkError err = new QueryNetworkError(); err.setMessage(e.getMessage()); err.setCategory(MsoExceptionCategory.INTERNAL); @@ -473,7 +475,7 @@ public class NetworkAdapterRest { @ApiParam(value = "RollbackNetworkRequest in JSON format", required = true) RollbackNetworkRequest req) { - LOGGER.debug("rollbackNetwork enter: " + req.toJsonString()); + logger.debug("rollbackNetwork enter: {}", req.toJsonString()); RollbackNetworkTask task = new RollbackNetworkTask(req); if (req.isSynchronous()) { // This is a synchronous request @@ -489,11 +491,12 @@ public class NetworkAdapterRest { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - LOGGER.error (MessageEnum.RA_ROLLBACK_NULL, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in rollbackNetwork", e); + logger.error("{} {} Exception in rollbackNetwork ", MessageEnum.RA_ROLLBACK_NULL, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller - LOGGER.debug("rollbackNetwork exit"); + logger.debug("rollbackNetwork exit"); return Response.status(HttpStatus.SC_ACCEPTED).build(); } } @@ -525,13 +528,13 @@ public class NetworkAdapterRest { } @Override public void run() { - LOGGER.debug("RollbackNetworkTask start"); + logger.debug("RollbackNetworkTask start"); try { NetworkRollback nwr = req.getNetworkRollback(); adapter.rollbackNetwork(nwr); response = new RollbackNetworkResponse(true, req.getMessageId()); } catch (NetworkException e) { - LOGGER.debug (EXCEPTION, e); + logger.debug(EXCEPTION, e); eresp = new RollbackNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { @@ -539,7 +542,7 @@ public class NetworkAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("RollbackNetworkTask exit: code=" + getStatusCode() + APPEND_RESPONSE+ getResponse()); + logger.debug("RollbackNetworkTask exit: code={}, resp={}", getStatusCode(), getResponse()); } } @@ -560,7 +563,7 @@ public class NetworkAdapterRest { @ApiParam(value = "UpdateNetworkRequest in JSON format", required = true) UpdateNetworkRequest req) { - LOGGER.debug("updateNetwork enter: " + req.toJsonString()); + logger.debug("updateNetwork enter: {}", req.toJsonString()); if (aaiNetworkId == null || !aaiNetworkId.equals(req.getNetworkId())) { return Response .status(HttpStatus.SC_BAD_REQUEST) @@ -583,11 +586,12 @@ public class NetworkAdapterRest { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - LOGGER.error (MessageEnum.RA_UPDATE_NETWORK_ERR, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in updateNetwork", e); + logger.error("{} {} Exception in updateNetwork ", MessageEnum.RA_UPDATE_NETWORK_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller - LOGGER.debug ("updateNetwork exit"); + logger.debug("updateNetwork exit"); return Response.status(HttpStatus.SC_ACCEPTED).build(); } } @@ -619,7 +623,7 @@ public class NetworkAdapterRest { } @Override public void run() { - LOGGER.debug("UpdateNetworkTask start"); + logger.debug("UpdateNetworkTask start"); try { Holder<Map<String, String>> subnetIdMap = new Holder<>(); Holder<NetworkRollback> rollback = new Holder<> (); @@ -709,7 +713,7 @@ public class NetworkAdapterRest { subnetIdMap.value, req.getMessageId()); } catch (NetworkException e) { - LOGGER.debug (EXCEPTION, e); + logger.debug(EXCEPTION, e); eresp = new UpdateNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { @@ -717,7 +721,7 @@ public class NetworkAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("UpdateNetworkTask exit: code=" + getStatusCode() + APPEND_RESPONSE+ getResponse()); + logger.debug("UpdateNetworkTask exit: code={}, resp={}", getStatusCode(), getResponse()); } } 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 b86681ebfc..db9226bb19 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 @@ -5,6 +5,7 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2018 IBM. + * Modifications Copyright (c) 2019 Samsung * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,12 +25,10 @@ package org.onap.so.adapters.tenant; import java.util.Map; - import javax.annotation.Resource; import javax.jws.WebService; import javax.xml.ws.Holder; import javax.xml.ws.WebServiceContext; - import org.onap.so.adapters.tenant.exceptions.TenantAlreadyExists; import org.onap.so.adapters.tenant.exceptions.TenantException; import org.onap.so.adapters.tenantrest.TenantRollback; @@ -41,6 +40,8 @@ import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.utils.MsoTenantUtils; import org.onap.so.openstack.utils.MsoTenantUtilsFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -52,14 +53,13 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { public static final String QUERY_TENANT = "QueryTenant"; public static final String DELETE_TENANT = "DeleteTenant"; public static final String ROLLBACK_TENANT = "RollbackTenant"; - private static final String SUCCESS_RESPONSE_OPENSTACK="Successfully received response from Open Stack"; - private static final String OPENSTACK_COMMUNICATE_EXCEPTION_MSG="Exception while communicate with Open Stack"; + private static final String OPENSTACK_COMMUNICATE_EXCEPTION_MSG = "{} {} Exception while communicate with Open Stack "; @Resource private WebServiceContext wsContext; @Autowired private MsoTenantUtilsFactory tFactory; - private static MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoTenantAdapterImpl.class); + private static Logger logger = LoggerFactory.getLogger(MsoTenantAdapterImpl.class); /** * Health Check web method. Does nothing but return to show the adapter is deployed. */ @@ -91,12 +91,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { MsoLogger.setLogContext (msoRequest); MsoLogger.setServiceName (CREATE_TENANT); - logger.debug ("Call to MSO createTenant adapter. Creating Tenant: " + tenantName - + "in " - + cloudSiteId); - - // Will capture total time for metrics - long startTime = System.currentTimeMillis (); + logger.debug("Call to MSO createTenant adapter. Creating Tenant: {} in {}", tenantName, cloudSiteId); // Start building up rollback object TenantRollback tenantRollback = new TenantRollback (); @@ -107,57 +102,47 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { try { tUtils = tFactory.getTenantUtils (cloudSiteId); } catch (MsoCloudSiteNotFound me) { - logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, CREATE_TENANT, MsoLogger.ErrorCode.DataError, "no implementation found for " + cloudSiteId, me); + logger.error("{} {} no implementation found for {}: ", MessageEnum.RA_CREATE_TENANT_ERR, + MsoLogger.ErrorCode.DataError.getValue(), cloudSiteId, me); throw new TenantException (me); } MsoTenant newTenant = null; String newTenantId; - long queryTenantStartTime = System.currentTimeMillis (); try { newTenant = tUtils.queryTenantByName (tenantName, cloudSiteId); - logger.recordMetricEvent (queryTenantStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_RESPONSE_OPENSTACK, OPENSTACK, QUERY_TENANT, null); } catch (MsoException me) { - logger.recordMetricEvent (queryTenantStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, OPENSTACK_COMMUNICATE_EXCEPTION_MSG, OPENSTACK, QUERY_TENANT, null); - String error = "Create Tenant " + tenantName + ": " + me; - logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, CREATE_TENANT, MsoLogger.ErrorCode.DataError, OPENSTACK_COMMUNICATE_EXCEPTION_MSG, me); - logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + logger.error(OPENSTACK_COMMUNICATE_EXCEPTION_MSG, MessageEnum.RA_CREATE_TENANT_ERR, + MsoLogger.ErrorCode.DataError.getValue(), me); throw new TenantException (me); } if (newTenant == null) { if (backout == null) backout = true; - long createTenantStartTime = System.currentTimeMillis (); try { newTenantId = tUtils.createTenant (tenantName, cloudSiteId, metadata, backout.booleanValue ()); - logger.recordMetricEvent (createTenantStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_RESPONSE_OPENSTACK, OPENSTACK, CREATE_TENANT, null); } catch (MsoException me) { - logger.recordMetricEvent (createTenantStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, OPENSTACK_COMMUNICATE_EXCEPTION_MSG, OPENSTACK, CREATE_TENANT, null); - String error = "Create Tenant " + tenantName + ": " + me; - logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, CREATE_TENANT, MsoLogger.ErrorCode.DataError, OPENSTACK_COMMUNICATE_EXCEPTION_MSG, me); - logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + logger.error (OPENSTACK_COMMUNICATE_EXCEPTION_MSG, MessageEnum.RA_CREATE_TENANT_ERR, MsoLogger.ErrorCode.DataError.getValue(), me); throw new TenantException (me); } tenantRollback.setTenantId (newTenantId); tenantRollback.setTenantCreated (true); - logger.debug ("Tenant " + tenantName + " successfully created with ID " + newTenantId); + logger.debug ("Tenant {} successfully created with ID {}", tenantName, newTenantId); } else { if (failIfExists != null && failIfExists) { - String error = CREATE_TENANT + ": Tenant " + tenantName + " already exists in " + cloudSiteId; - logger.error (MessageEnum.RA_TENANT_ALREADY_EXIST, tenantName, cloudSiteId, OPENSTACK, "", MsoLogger.ErrorCode.DataError, CREATE_TENANT + ", Tenant already exists"); - logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error); + logger.error("{} {} CreateTenant: Tenant {} already exists in {} ", MessageEnum.RA_TENANT_ALREADY_EXIST, + MsoLogger.ErrorCode.DataError.getValue(), tenantName, cloudSiteId); throw new TenantAlreadyExists (tenantName, cloudSiteId, newTenant.getTenantId ()); } newTenantId = newTenant.getTenantId (); tenantRollback.setTenantCreated (false); - logger.debug ("Tenant " + tenantName + " already exists with ID " + newTenantId); + logger.debug("Tenant {} already exists with ID {}", tenantName, newTenantId); } tenantId.value = newTenantId; rollback.value = tenantRollback; - logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create tenant"); return; } @@ -170,48 +155,41 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { Holder <Map <String, String>> metadata) throws TenantException { MsoLogger.setLogContext (msoRequest); MsoLogger.setServiceName (QUERY_TENANT); - logger.debug ("Querying Tenant " + tenantNameOrId + " in " + cloudSiteId); - - // Will capture execution time for metrics - long startTime = System.currentTimeMillis (); + logger.debug ("Querying Tenant {} in {}", tenantNameOrId, cloudSiteId); MsoTenantUtils tUtils; try { tUtils = tFactory.getTenantUtils (cloudSiteId); } catch (MsoCloudSiteNotFound me) { - logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, CREATE_TENANT, MsoLogger.ErrorCode.DataError, "no implementation found for " + cloudSiteId, me); + logger.error("{} {} no implementation found for {}: ", MessageEnum.RA_CREATE_TENANT_ERR, + MsoLogger.ErrorCode.DataError.getValue(), cloudSiteId, me); throw new TenantException (me); } MsoTenant qTenant = null; - long subStartTime = System.currentTimeMillis (); try { qTenant = tUtils.queryTenant (tenantNameOrId, cloudSiteId); - logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_RESPONSE_OPENSTACK, OPENSTACK, QUERY_TENANT, null); if (qTenant == null) { // Not found by ID, Try by name. qTenant = tUtils.queryTenantByName (tenantNameOrId, cloudSiteId); } if (qTenant == null) { - logger.debug ("QueryTenant: Tenant " + tenantNameOrId + " not found"); + logger.debug ("QueryTenant: Tenant {} not found", tenantNameOrId); tenantId.value = null; tenantName.value = null; metadata.value = null; } else { - logger.debug ("QueryTenant: Tenant " + tenantNameOrId + " found with ID " + qTenant.getTenantId ()); + logger.debug("QueryTenant: Tenant {} found with ID {}", tenantNameOrId, qTenant.getTenantId()); tenantId.value = qTenant.getTenantId (); tenantName.value = qTenant.getTenantName (); metadata.value = qTenant.getMetadata (); } } catch (MsoException me) { - String error = "Query Tenant " + tenantNameOrId + ": " + me; - logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, OPENSTACK, QUERY_TENANT, null); - logger.error (MessageEnum.RA_GENERAL_EXCEPTION, me.getMessage(), OPENSTACK, "", MsoLogger.ErrorCode.DataError, "Exception in queryTenant", me); - logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + logger.error("Exception in queryTenant for {}: ", MessageEnum.RA_GENERAL_EXCEPTION, + MsoLogger.ErrorCode.DataError.getValue(), tenantNameOrId, me); throw new TenantException (me); } - logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully query tenant"); return; } @@ -223,29 +201,21 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { MsoLogger.setLogContext (msoRequest); MsoLogger.setServiceName (DELETE_TENANT); - logger.debug ("Deleting Tenant " + tenantId + " in " + cloudSiteId); - - // Will capture execution time for metrics - long startTime = System.currentTimeMillis (); + logger.debug ("Deleting Tenant {} in {}", tenantId, cloudSiteId); // Delete the Tenant. - long subStartTime = System.currentTimeMillis (); try { MsoTenantUtils tUtils = tFactory.getTenantUtils (cloudSiteId); boolean deleted = tUtils.deleteTenant (tenantId, cloudSiteId); tenantDeleted.value = deleted; - logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully communicate with Open Stack", OPENSTACK, DELETE_TENANT, null); } catch (MsoException me) { - String error = "Delete Tenant " + tenantId + ": " + me; - logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, OPENSTACK, DELETE_TENANT, null); - logger.error (MessageEnum.RA_DELETE_TEMAMT_ERR, me.getMessage(), OPENSTACK, "", MsoLogger.ErrorCode.DataError, "Exception - DeleteTenant", me); - logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + logger.error("{} {} Exception - DeleteTenant {}: ", MessageEnum.RA_DELETE_TEMAMT_ERR, + MsoLogger.ErrorCode.DataError.getValue(), tenantId, me); throw new TenantException (me); } // On success, nothing is returned. - logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully delete tenant"); return; } @@ -260,11 +230,11 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { */ @Override public void rollbackTenant (TenantRollback rollback) throws TenantException { - long startTime = System.currentTimeMillis (); MsoLogger.setServiceName (ROLLBACK_TENANT); // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { - logger.warn (MessageEnum.RA_ROLLBACK_NULL, OPENSTACK, "rollbackTenant", MsoLogger.ErrorCode.DataError, "rollbackTenant, rollback is null"); + logger.warn("{} {} rollbackTenant, rollback is null", MessageEnum.RA_ROLLBACK_NULL, + MsoLogger.ErrorCode.DataError.getValue()); return; } @@ -273,26 +243,21 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter { String tenantId = rollback.getTenantId (); MsoLogger.setLogContext (rollback.getMsoRequest ()); - logger.debug ("Rolling Back Tenant " + rollback.getTenantId () + " in " + cloudSiteId); + logger.debug("Rolling Back Tenant {} in {}", rollback.getTenantId(), cloudSiteId); - long subStartTime = System.currentTimeMillis (); if (rollback.getTenantCreated ()) { try { MsoTenantUtils tUtils = tFactory.getTenantUtils (cloudSiteId); tUtils.deleteTenant (tenantId, cloudSiteId); - logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully communicate with Open Stack", OPENSTACK, ROLLBACK_TENANT, null); } catch (MsoException me) { me.addContext (ROLLBACK_TENANT); // Failed to delete the tenant. - String error = "Rollback Tenant " + tenantId + ": " + me; - logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, OPENSTACK, ROLLBACK_TENANT, null); - logger.error (MessageEnum.RA_ROLLBACK_TENANT_ERR, me.getMessage(), OPENSTACK, "rollbackTenant", MsoLogger.ErrorCode.DataError, "Exception - rollbackTenant", me); - logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + logger.error("{} {} Exception - rollbackTenant {}: ", MessageEnum.RA_ROLLBACK_TENANT_ERR, + MsoLogger.ErrorCode.DataError.getValue(), tenantId, me); throw new TenantException (me); } } - logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully roll back tenant"); return; } } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java index 41544c8104..11051df34e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java @@ -6,6 +6,7 @@ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2018 IBM. + * Modifications Copyright (c) 2019 Samsung * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +25,12 @@ package org.onap.so.adapters.tenant; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import java.util.Map; - import javax.servlet.http.HttpServletResponse; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -38,7 +43,6 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.xml.ws.Holder; - import org.onap.so.adapters.tenant.exceptions.TenantAlreadyExists; import org.onap.so.adapters.tenant.exceptions.TenantException; import org.onap.so.adapters.tenantrest.CreateTenantError; @@ -53,18 +57,13 @@ import org.onap.so.adapters.tenantrest.RollbackTenantError; import org.onap.so.adapters.tenantrest.RollbackTenantRequest; import org.onap.so.adapters.tenantrest.RollbackTenantResponse; import org.onap.so.adapters.tenantrest.TenantRollback; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.MsoTenant; import org.onap.so.openstack.exceptions.MsoExceptionCategory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - /** * This class services calls to the REST interface for Tenants (http://host:port/vnfs/rest/v1/tenants) * Both XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default. @@ -73,7 +72,8 @@ import io.swagger.annotations.ApiResponses; @Api(value = "/v1/tenants", description = "root of tenant adapters restful web service") @Component public class TenantAdapterRest { - private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, TenantAdapterRest.class); + + private static Logger logger = LoggerFactory.getLogger(TenantAdapterRest.class); private static final String EXCEPTION= "Exception :"; //RAA? No logging in wrappers @Autowired @@ -122,7 +122,7 @@ public class TenantAdapterRest { public Response createTenant( @ApiParam(value = "details of tenant being created", required = true) CreateTenantRequest req) { - LOGGER.debug("createTenant enter: " + req.toJsonString()); + logger.debug("createTenant enter: {}", req.toJsonString()); String newTenantId = null; TenantRollback tenantRollback = new TenantRollback (); @@ -145,17 +145,17 @@ public class TenantAdapterRest { } catch (TenantAlreadyExists tae) { - LOGGER.debug(EXCEPTION,tae); + logger.debug(EXCEPTION, tae); CreateTenantError exc = new CreateTenantError(tae.getMessage(), tae.getFaultInfo().getCategory(), Boolean.TRUE); return Response.status(HttpServletResponse.SC_NOT_IMPLEMENTED).entity(exc).build(); } catch (TenantException te) { - LOGGER.debug(EXCEPTION,te); + logger.debug(EXCEPTION, te); CreateTenantError exc = new CreateTenantError(te.getFaultInfo().getMessage(), te.getFaultInfo().getCategory(), Boolean.TRUE); return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build(); } catch (Exception e) { - LOGGER.debug(EXCEPTION,e); + logger.debug(EXCEPTION, e); CreateTenantError exc = new CreateTenantError(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE); return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build(); } @@ -208,12 +208,12 @@ public class TenantAdapterRest { tenantDeleted = deleted.value; } catch (TenantException te) { - LOGGER.debug(EXCEPTION,te); + logger.debug(EXCEPTION, te); DeleteTenantError exc = new DeleteTenantError(te.getFaultInfo().getMessage(), te.getFaultInfo().getCategory(), Boolean.TRUE); return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build(); } catch (Exception e) { - LOGGER.debug(EXCEPTION,e); + logger.debug(EXCEPTION, e); DeleteTenantError exc = new DeleteTenantError(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE); return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build(); } @@ -272,12 +272,12 @@ public class TenantAdapterRest { } catch (TenantException te) { - LOGGER.debug(EXCEPTION,te); + logger.debug(EXCEPTION, te); QueryTenantError exc = new QueryTenantError(te.getFaultInfo().getMessage(), te.getFaultInfo().getCategory()); return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build(); } catch (Exception e) { - LOGGER.debug(EXCEPTION,e); + logger.debug(EXCEPTION, e); QueryTenantError exc = new QueryTenantError(e.getMessage(), MsoExceptionCategory.INTERNAL); return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build(); } @@ -321,12 +321,12 @@ public class TenantAdapterRest { impl.rollbackTenant(req.getTenantRollback()); } catch (TenantException te) { - LOGGER.debug(EXCEPTION,te); + logger.debug(EXCEPTION, te); RollbackTenantError exc = new RollbackTenantError(te.getFaultInfo().getMessage(), te.getFaultInfo().getCategory(), Boolean.TRUE); return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build(); } catch (Exception e) { - LOGGER.debug(EXCEPTION,e); + logger.debug(EXCEPTION, e); RollbackTenantError exc = new RollbackTenantError(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE); return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build(); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java index 4b02b73786..7265a59397 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -24,10 +26,8 @@ package org.onap.so.adapters.vnf; import java.security.GeneralSecurityException; import java.util.Set; import java.util.TreeSet; - import javax.annotation.PostConstruct; import javax.xml.bind.DatatypeConverter; - import org.apache.http.HttpEntity; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; @@ -40,6 +40,8 @@ import org.apache.http.util.EntityUtils; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.CryptoUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.core.env.Environment; @@ -69,7 +71,7 @@ public class BpelRestClient { private static final String RETRY_INTERVAL_PROPERTY = PROPERTY_DOMAIN+".retryinterval"; private static final String RETRY_LIST_PROPERTY = PROPERTY_DOMAIN+".retrylist"; private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, BpelRestClient.class); + private static final Logger logger = LoggerFactory.getLogger(BpelRestClient.class); /** Default socket timeout (in seconds) */ public static final int DEFAULT_SOCKET_TIMEOUT = 5; @@ -218,7 +220,8 @@ public class BpelRestClient { } if (totalretries >= retryCount) { debug("Retried " + totalretries + " times, giving up."); - LOGGER.error(MessageEnum.RA_SEND_VNF_NOTIF_ERR, "Could not deliver response to BPEL after "+totalretries+" tries: "+toBpelStr, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, "Could not deliver response to BPEL"); + logger.error("{} {} Could not deliver response to BPEL after {} tries: {}", MessageEnum.RA_SEND_VNF_NOTIF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), totalretries, toBpelStr); return false; } totalretries++; @@ -232,26 +235,26 @@ public class BpelRestClient { try { Thread.sleep(sleepinterval * 1000L); } catch (InterruptedException e) { - LOGGER.debug("Exception while Thread sleep", e); + logger.debug("Exception while Thread sleep", e); Thread.currentThread().interrupt(); } } } private void debug(String m) { - LOGGER.debug(m); + logger.debug(m); } private void sendOne(final String toBpelStr, final String bpelUrl, final boolean isxml) { - LOGGER.debug("Sending to BPEL server: "+bpelUrl); - LOGGER.debug("Content is: "+toBpelStr); + logger.debug("Sending to BPEL server: {}", bpelUrl); + logger.debug("Content is: {}", toBpelStr); //POST HttpPost post = new HttpPost(bpelUrl); if (credentials != null && !credentials.isEmpty()) post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(credentials.getBytes())); - LOGGER.debug("HTTPPost Headers: " + post.getAllHeaders()); - - //ContentType + logger.debug("HTTPPost Headers: {}", post.getAllHeaders()); + + //ContentType ContentType ctype = isxml ? ContentType.APPLICATION_XML : ContentType.APPLICATION_JSON; post.setEntity(new StringEntity(toBpelStr, ctype)); @@ -274,14 +277,14 @@ public class BpelRestClient { lastResponse = ""; } } catch (Exception e) { - String error = "Error sending Bpel notification:" + toBpelStr; - LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, error, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Error sending Bpel notification", e); + logger.error("{} {} Exception - Error sending Bpel notification: {} ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), toBpelStr, e); lastResponseCode = 900; lastResponse = ""; } - LOGGER.debug("Response code from BPEL server: "+lastResponseCode); - LOGGER.debug("Response body is: "+lastResponse); + logger.debug("Response code from BPEL server: {}", lastResponseCode); + logger.debug("Response body is: {}", lastResponse); } private String getEncryptedProperty(String key, String defaultValue, String encryptionKey) { @@ -289,7 +292,7 @@ public class BpelRestClient { try { return CryptoUtils.decrypt(env.getProperty(key), env.getProperty(encryptionKey)); } catch (GeneralSecurityException e) { - LOGGER.debug("Exception while decrypting property: " + env.getProperty(key), e); + logger.debug("Exception while decrypting property: {} ", env.getProperty(key), e); } } return defaultValue; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java index 7c49c9f948..c54b067a78 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java @@ -50,7 +50,7 @@ public interface MsoVnfAdapter @WebParam(name="vnfName") @XmlElement(required=true) String vnfName, @WebParam(name="requestType") @XmlElement(required=false) String requestType, @WebParam(name="volumeGroupHeatStackId") @XmlElement(required=false) String volumeGroupHeatStackId, - @WebParam(name="inputs") Map<String,String> inputs, + @WebParam(name="inputs") Map<String,Object> inputs, @WebParam(name="failIfExists") Boolean failIfExists, @WebParam(name="backout") Boolean backout, @WebParam(name="enableBridge") Boolean enableBridge, @@ -68,7 +68,7 @@ public interface MsoVnfAdapter @WebParam(name="vnfName") @XmlElement(required=true) String vnfName, @WebParam(name="requestType") @XmlElement(required=false) String requestType, @WebParam(name="volumeGroupHeatStackId") @XmlElement(required=false) String volumeGroupHeatStackId, - @WebParam(name="inputs") Map<String,String> inputs, + @WebParam(name="inputs") Map<String,Object> inputs, @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="outputs", mode=Mode.OUT) Holder<Map<String,String>> outputs, @WebParam(name="rollback", mode=Mode.OUT) Holder<VnfRollback> rollback ) @@ -109,7 +109,7 @@ public interface MsoVnfAdapter @WebParam(name="volumeGroupHeatStackId") @XmlElement(required=false) String volumeGroupHeatStackId, @WebParam(name="baseVfHeatStackId") @XmlElement(required=false) String baseVfHeatStackId, @WebParam(name = "modelCustomizationUuid") @XmlElement(required = false) String modelCustomizationUuid, - @WebParam(name="inputs") Map<String,String> inputs, + @WebParam(name="inputs") Map<String,Object> inputs, @WebParam(name="failIfExists") Boolean failIfExists, @WebParam(name="backout") Boolean backout, @WebParam(name="enableBridge") Boolean enableBridge, @@ -138,7 +138,7 @@ public interface MsoVnfAdapter @WebParam(name="baseVfHeatStackId") @XmlElement(required=false) String baseVfHeatStackId, @WebParam(name="vfModuleStackId") @XmlElement(required=false) String vfModuleStackId, @WebParam(name = "modelCustomizationUuid") @XmlElement(required = false) String modelCustomizationUuid, - @WebParam(name="inputs") Map<String,String> inputs, + @WebParam(name="inputs") Map<String,Object> inputs, @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="outputs", mode=Mode.OUT) Holder<Map<String,String>> outputs, @WebParam(name="rollback", mode=Mode.OUT) Holder<VnfRollback> rollback ) diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java index b67a412c3e..6f61f0292c 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java @@ -53,7 +53,7 @@ public interface MsoVnfAdapterAsync @WebParam(name="vnfName") @XmlElement(required=true) String vnfName, @WebParam(name="requestType") @XmlElement(required=false) String requestType, @WebParam(name="volumeGroupHeatStackId") @XmlElement(required=false) String volumeGroupHeatStackId, - @WebParam(name="inputs") Map<String,String> inputs, + @WebParam(name="inputs") Map<String,Object> inputs, @WebParam(name="failIfExists") Boolean failIfExists, @WebParam(name="backout") Boolean backout, @WebParam(name="enableBridge") Boolean enableBridge, @@ -70,7 +70,7 @@ public interface MsoVnfAdapterAsync @WebParam(name="vnfName") @XmlElement(required=true) String vnfName, @WebParam(name="requestType") @XmlElement(required=false) String requestType, @WebParam(name="volumeGroupHeatStackId") @XmlElement(required=false) String volumeGroupHeatStackId, - @WebParam(name="inputs") Map<String,String> inputs, + @WebParam(name="inputs") Map<String,Object> inputs, @WebParam(name="messageId") @XmlElement(required=true) String messageId, @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="notificationUrl") @XmlElement(required=true) String notificationUrl ); 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 21b7ea4142..2c9d3776a7 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 @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -29,14 +31,12 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; - import javax.jws.WebService; import javax.xml.bind.DatatypeConverter; import javax.xml.namespace.QName; import javax.xml.ws.BindingProvider; import javax.xml.ws.Holder; import javax.xml.ws.handler.MessageContext; - import org.onap.so.adapters.vnf.async.client.CreateVnfNotification; import org.onap.so.adapters.vnf.async.client.QueryVnfNotification; import org.onap.so.adapters.vnf.async.client.UpdateVnfNotification; @@ -45,11 +45,12 @@ import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify_Service; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; - import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; import org.onap.so.utils.CryptoUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @@ -58,8 +59,7 @@ import org.springframework.stereotype.Component; @Component public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { - public static final String MSO_PROP_VNF_ADAPTER="MSO_PROP_VNF_ADAPTER"; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoVnfAdapterAsyncImpl.class); + private static final Logger logger = LoggerFactory.getLogger(MsoVnfAdapterAsyncImpl.class); private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.vnf.bpelauth"; private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; @@ -75,7 +75,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { */ @Override public void healthCheckA () { - LOGGER.debug ("Health check call in VNF Adapter"); + logger.debug ("Health check call in VNF Adapter"); } /** @@ -125,7 +125,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String vnfName, String requestType, String volumeGroupHeatStackId, - Map <String, String> inputs, + Map <String, Object> inputs, Boolean failIfExists, Boolean backout, Boolean enableBridge, @@ -136,7 +136,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String serviceName = "CreateVnfA"; MsoLogger.setLogContext (msoRequest); MsoLogger.setServiceName (serviceName); - LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF, vnfName, vnfType, cloudSiteId, tenantId, "createVnfA"); + logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF); // Use the synchronous method to perform the actual Create MsoVnfAdapter vnfAdapter = vnfImpl; // Synchronous Web Service Outputs @@ -163,7 +163,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { MsoLogger.setServiceName (serviceName); } catch (VnfException e) { MsoLogger.setServiceName (serviceName); - LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "VnfException in createVnfA", e); + logger.error("{} {} VnfException in createVnfA ", MessageEnum.RA_CREATE_VNF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; String eMsg = null; try { @@ -172,21 +173,21 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { .getCategory () .name ()); } catch (Exception e1) { - LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Fault info", e1); + logger.error("{} {} Exception - Fault info ", MessageEnum.RA_FAULT_INFO_EXC, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); } // Build and send Asynchronous error response try { VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.createVnfNotification (messageId, false, exCat, eMsg, null, null, null); } catch (Exception e1) { - error = "Error sending createVnf notification " + e1.getMessage (); - LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending createVnf notification", e1); - + logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); } - LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE, "", "createVnfA", ""); + logger.info("{}", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE); return; } - LOGGER.debug ("Async Create VNF: " + vnfName + " VnfId:" + vnfId.value); + logger.debug("Async Create VNF: {} VnfId:{}", vnfName, vnfId.value); // Build and send Asynchronous response try { VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl); @@ -198,11 +199,10 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { copyCreateOutputs (outputs), copyVrb (vnfRollback)); } catch (Exception e) { - error = "Error sending createVnf notification " + e.getMessage (); - LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending createVnf notification", e); - + logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); } - LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE, "", "","createVnfA"); + logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE); return; } @@ -214,7 +214,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String vnfName, String requestType, String volumeGroupHeatStackId, - Map <String, String> inputs, + Map <String, Object> inputs, String messageId, MsoRequest msoRequest, String notificationUrl) { @@ -222,7 +222,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String serviceName = "UpdateVnfA"; MsoLogger.setServiceName (serviceName); MsoLogger.setLogContext (msoRequest); - LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF, vnfName, vnfType, cloudSiteId, tenantId, "UpdateVnfA"); + logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF); // Use the synchronous method to perform the actual Create MsoVnfAdapter vnfAdapter = vnfImpl; @@ -237,7 +237,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { MsoLogger.setServiceName (serviceName); } catch (VnfException e) { MsoLogger.setServiceName (serviceName); - LOGGER.error (MessageEnum.RA_UPDATE_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e); + logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_UPDATE_VNF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; String eMsg = null; try { @@ -246,21 +247,21 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { .getCategory () .name ()); } catch (Exception e1) { - LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1); + logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); } // Build and send Asynchronous error response try { VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.updateVnfNotification (messageId, false, exCat, eMsg, null, null); } catch (Exception e1) { - error = "Error sending updateVnf notification " + e1.getMessage (); - LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e1); - + logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); } - LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE,"","","UpdateVnfA"); + logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE); return; } - LOGGER.debug ("Async Update VNF: " + vnfName + " VnfId:" + vnfId.value); + logger.debug("Async Update VNF: {} VnfId:{}", vnfName, vnfId.value); // Build and send Asynchronous response try { VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl); @@ -271,11 +272,10 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { copyUpdateOutputs (outputs), copyVrb (vnfRollback)); } catch (Exception e) { - error = "Error sending updateVnf notification " + e.getMessage (); - LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e); - + logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); } - LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE, "", "","UpdateVnfA"); + logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE); return; } @@ -303,7 +303,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String serviceName = "QueryVnfA"; MsoLogger.setServiceName (serviceName); MsoLogger.setLogContext (msoRequest); - LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF, vnfName, cloudSiteId, tenantId); + logger.info("{}", MessageEnum.RA_ASYNC_QUERY_VNF); // Use the synchronous method to perform the actual query MsoVnfAdapter vnfAdapter = vnfImpl; @@ -319,7 +319,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { MsoLogger.setServiceName (serviceName); } catch (VnfException e) { MsoLogger.setServiceName (serviceName); - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnfA notification", e); + logger.error("{} {} Exception sending queryVnfA notification ", MessageEnum.RA_QUERY_VNF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; String eMsg = null; try { @@ -328,25 +329,25 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { .getCategory () .name ()); } catch (Exception e1) { - LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1); + logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); } // Build and send Asynchronous error response try { VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.queryVnfNotification (messageId, false, exCat, eMsg, null, null, null, null); } catch (Exception e1) { - error = "Error sending queryVnf notification " + e1.getMessage (); - LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnf notification", e1); - + logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); } - LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE, "","", "queryVnfA"); + logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE); return; } if (!vnfExists.value) { - LOGGER.debug ("Async Query, VNF not found"); + logger.debug ("Async Query, VNF not found"); } else { - LOGGER.debug ("Async Query, VNF=" + vnfId.value + ", status=" + status.value); + logger.debug("Async Query, VNF={}, status={}", vnfId.value, status.value); } // Build and send Asynchronous response try { @@ -361,12 +362,11 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { vnfS, copyQueryOutputs (outputs)); } catch (Exception e) { - error = "Error sending queryVnf notification " + e.getMessage (); - LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnf notification", e); - + logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); } - LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE, "","", "queryVnfA"); + logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE); return; } @@ -393,7 +393,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String serviceName = "DeleteVnfA"; MsoLogger.setServiceName (serviceName); MsoLogger.setLogContext (msoRequest); - LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF, vnfName, cloudSiteId, tenantId); + logger.info("{}", MessageEnum.RA_ASYNC_DELETE_VNF); // Use the synchronous method to perform the actual delete MsoVnfAdapter vnfAdapter = vnfImpl; @@ -403,7 +403,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { MsoLogger.setServiceName (serviceName); } catch (VnfException e) { MsoLogger.setServiceName (serviceName); - LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e); + logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_DELETE_VNF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; String eMsg = null; try { @@ -412,34 +413,33 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { .getCategory () .name ()); } catch (Exception e1) { - LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1); + logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); } // Build and send Asynchronous error response try { VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.deleteVnfNotification (messageId, false, exCat, eMsg); } catch (Exception e1) { - error = "Error sending deleteVnf notification " + e1.getMessage (); - LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e1); - + logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); } - LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE, "","", "deleteVnfA"); + logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE); return; } - LOGGER.debug ("Async Delete VNF: " + vnfName); + logger.debug("Async Delete VNF: {}", vnfName); // Build and send Asynchronous response try { VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.deleteVnfNotification (messageId, true, null, null); } catch (Exception e) { - error = "Error sending deleteVnf notification " + e.getMessage (); - LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e); - + logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); } - LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE, "", "","deleteVnfA"); + logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE); return; } @@ -456,14 +456,12 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { String error; // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { - error = "Empty Rollback: No action to perform"; - LOGGER.info (MessageEnum.RA_ROLLBACK_NULL, "","", "rollbackVnfA"); - + logger.info("{} rollbackVnfA: Empty Rollback: No action to perform", MessageEnum.RA_ROLLBACK_NULL); return; } MsoLogger.setLogContext (rollback.getMsoRequest ()); - LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF, "", "","rollbackVnfA"); + logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF); // Use the synchronous method to perform the actual rollback MsoVnfAdapter vnfAdapter = vnfImpl; @@ -473,7 +471,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { MsoLogger.setServiceName (serviceName); } catch (VnfException e) { MsoLogger.setServiceName (serviceName); - LOGGER.error (MessageEnum.RA_ROLLBACK_VNF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e); + logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_ROLLBACK_VNF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; String eMsg = null; try { @@ -482,33 +481,32 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { .getCategory () .name ()); } catch (Exception e1) { - LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1); + logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); } // Build and send Asynchronous error response try { VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.rollbackVnfNotification (messageId, false, exCat, eMsg); } catch (Exception e1) { - error = "Error sending rollbackVnf notification " + e1.getMessage (); - LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e1); - + logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); } - LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE, "","", "rollbackVnfA"); + logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE); return; } - LOGGER.debug ("Async Rollback VNF:" + rollback.getVnfId ()); + logger.debug ("Async Rollback VNF:" + rollback.getVnfId ()); // Build and send Asynchronous response try { VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.rollbackVnfNotification (messageId, true, null, null); } catch (Exception e) { - error = "Error sending rollbackVnf notification " + e.getMessage (); - LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e); - + logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); } - LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE, "", "","rollbackVnfA"); + logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE); return; } @@ -600,15 +598,18 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { try { warWsdlLoc = Thread.currentThread ().getContextClassLoader ().getResource ("VnfAdapterNotify.wsdl"); } catch (Exception e) { - LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "VnfAdapterNotify.wsdl", "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - WSDL not found", e); + logger.error("{} {} Exception - WSDL not found ", MessageEnum.RA_WSDL_NOT_FOUND, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); } if (warWsdlLoc == null) { - LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "VnfAdapterNotify.wsdl", "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "WSDL not found"); + logger.error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND, + MsoLogger.ErrorCode.BusinessProcesssError.getValue()); } else { try { - LOGGER.debug ("VnfAdpaterNotify.wsdl location:" + warWsdlLoc.toURI ().toString ()); + logger.debug("VnfAdpaterNotify.wsdl location:{}", warWsdlLoc.toURI().toString()); } catch (Exception e) { - LOGGER.error (MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "VnfAdapterNotify.wsdl", "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - WSDL URL convention", e); + logger.error("{} {} Exception - WSDL URL convention ", MessageEnum.RA_WSDL_URL_CONVENTION_EXC, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); } } @@ -624,15 +625,16 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { try { epUrl = new URL (notificationUrl); } catch (MalformedURLException e1) { - LOGGER.error (MessageEnum.RA_INIT_NOTIF_EXC, "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "MalformedURLException", e1); + logger.error("{} {} MalformedURLException ", MessageEnum.RA_INIT_NOTIF_EXC, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1); } if(null != epUrl) { - LOGGER.debug ("Notification Endpoint URL: " + epUrl.toExternalForm ()); + logger.debug("Notification Endpoint URL: {}", epUrl.toExternalForm()); bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ()); } else { - LOGGER.debug ("epUrl is NULL:"); + logger.debug ("epUrl is NULL:"); } // authentication @@ -646,8 +648,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { reqCtx.put (MessageContext.HTTP_REQUEST_HEADERS, headers); headers.put ("Authorization", Collections.singletonList (basicAuth)); } catch (Exception e) { - LOGGER.error (MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Unable to set authorization in callback request", e); - + logger.error("{} {} Exception - Unable to set authorization in callback request ", + MessageEnum.RA_SET_CALLBACK_AUTH_EXC, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); } return notifyPort; @@ -657,7 +659,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { try { return CryptoUtils.decrypt(this.environment.getProperty(key), this.environment.getProperty(encryptionKey)); } catch (GeneralSecurityException e) { - LOGGER.debug("Exception while decrypting property: " + this.environment.getProperty(key), e); + logger.debug("Exception while decrypting property: {} ", this.environment.getProperty(key), e); } return defaultValue; 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 94434cd781..96160760fd 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 @@ -180,7 +180,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String vnfName, String requestType, String volumeGroupHeatStackId, - Map <String, String> inputs, + Map <String, Object> inputs, Boolean failIfExists, Boolean backout, Boolean enableBridge, @@ -265,7 +265,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String vnfName, String requestType, String volumeGroupHeatStackId, - Map <String, String> inputs, + Map <String, Object> inputs, MsoRequest msoRequest, Holder <Map <String, String>> outputs, Holder <VnfRollback> rollback) throws VnfException { @@ -474,7 +474,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { return stringOutputs; } - private Map <String, Object> copyStringInputs (Map <String, String> stringInputs) { + private Map <String, Object> copyStringInputs (Map <String, Object> stringInputs) { return new HashMap <> (stringInputs); } @@ -579,7 +579,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String volumeGroupHeatStackId, String baseVfHeatStackId, String modelCustomizationUuid, - Map <String, String> inputs, + Map <String, Object> inputs, Boolean failIfExists, Boolean backout, Boolean enableBridge, @@ -1343,7 +1343,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String baseVfHeatStackId, String vfModuleStackId, String modelCustomizationUuid, - Map <String, String> inputs, + Map <String, Object> inputs, MsoRequest msoRequest, Holder <Map <String, String>> outputs, Holder <VnfRollback> rollback) throws VnfException { @@ -1794,8 +1794,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { hasJson = true; String jsonString = null; try { - jsonString = inputs.get(parm.getParamName()); - jsonNode = new ObjectMapper().readTree(jsonString); + jsonString = JSON_MAPPER.writeValueAsString(inputs.get(parm.getParamName())); + jsonNode = JSON_MAPPER.readTree(jsonString); } catch (JsonParseException jpe) { //TODO - what to do here? //for now - send the error to debug, but just leave it as a String @@ -1816,8 +1816,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { hasJson = true; String jsonString = null; try { - jsonString = inputs.get(parm.getParamAlias()); - jsonNode = new ObjectMapper().readTree(jsonString); + jsonString = (String)inputs.get(parm.getParamAlias()); + jsonNode = JSON_MAPPER.readTree(jsonString); } catch (JsonParseException jpe) { //TODO - what to do here? //for now - send the error to debug, but just leave it as a String @@ -1847,7 +1847,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // They've submitted using an alias name. Remove that from inputs, and add back using real name. String realParamName = parm.getParamName (); String alias = parm.getParamAlias (); - String value = inputs.get (alias); + Object value = inputs.get (alias); LOGGER.debug ("*Found an Alias: paramName=" + realParamName + ",alias=" + alias @@ -1911,9 +1911,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { Map<String, Object> inputsTwo = null; if (hasJson && jsonParams.size() > 0) { inputsTwo = new HashMap<>(); - for (Map.Entry<String, String> entry : inputs.entrySet()) { + for (Map.Entry<String, Object> entry : inputs.entrySet()) { String keyParamName = entry.getKey(); - String value = entry.getValue(); + Object value = entry.getValue(); if (jsonParams.containsKey(keyParamName)) { inputsTwo.put(keyParamName, jsonParams.get(keyParamName)); } else { @@ -2085,7 +2085,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { */ private boolean valetCreateRequest(String cloudSiteId, String tenantId, Map<String, Object> heatFilesObjects, Map<String, Object> nestedTemplatesChecked, String vfModuleName, boolean backout, HeatTemplate heatTemplate, String newEnvironmentString, Map<String, Object> goldenInputs, - MsoRequest msoRequest, Map<String, String> inputs, boolean failRequestOnValetFailure, Holder<Map<String, Object>> valetModifiedParamsHolder) throws VnfException { + MsoRequest msoRequest, Map<String, Object> inputs, boolean failRequestOnValetFailure, Holder<Map<String, Object>> valetModifiedParamsHolder) throws VnfException { boolean valetSucceeded = false; String valetErrorMessage = "more detail not available"; try { @@ -2095,8 +2095,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { HeatRequest heatRequest = new HeatRequest(vfModuleName, backout, heatTemplate.getTimeoutMinutes(), heatTemplate.getTemplateBody(), newEnvironmentString, files, goldenInputs); GenericValetResponse<ValetCreateResponse> createReq = this.vci.callValetCreateRequest(msoRequest.getRequestId(), - cloudSiteId, tenantId, msoRequest.getServiceInstanceId(), inputs.get("vnf_id"), - inputs.get("vnf_name"), inputs.get("vf_module_id"), inputs.get("vf_module_name"), keystoneUrl, + cloudSiteId, tenantId, msoRequest.getServiceInstanceId(), (String)inputs.get("vnf_id"), + (String)inputs.get("vnf_name"), (String)inputs.get("vf_module_id"), (String)inputs.get("vf_module_name"), keystoneUrl, heatRequest); ValetCreateResponse vcr = createReq.getReturnObject(); if (vcr != null && createReq.getStatusCode() == 200) { @@ -2145,7 +2145,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { private boolean valetUpdateRequest(String cloudSiteId, String tenantId, Map<String, Object> heatFilesObjects, Map<String, Object> nestedTemplatesChecked, String vfModuleName, boolean backout, HeatTemplate heatTemplate, String newEnvironmentString, - Map<String, Object> goldenInputs, MsoRequest msoRequest, Map<String, String> inputs, + Map<String, Object> goldenInputs, MsoRequest msoRequest, Map<String, Object> inputs, boolean failRequestOnValetFailure, Holder<Map<String, Object>> valetModifiedParamsHolder) throws VnfException { boolean valetSucceeded = false; @@ -2158,8 +2158,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { heatTemplate.getTemplateBody(), newEnvironmentString, files, goldenInputs); // vnf name is not sent to MSO on update requests - so we will set it to the vf module name for now GenericValetResponse<ValetUpdateResponse> updateReq = this.vci.callValetUpdateRequest(msoRequest.getRequestId(), - cloudSiteId, tenantId, msoRequest.getServiceInstanceId(), inputs.get("vnf_id"), - vfModuleName, inputs.get("vf_module_id"), vfModuleName, keystoneUrl, + cloudSiteId, tenantId, msoRequest.getServiceInstanceId(), (String)inputs.get("vnf_id"), + vfModuleName, (String)inputs.get("vf_module_id"), vfModuleName, keystoneUrl, heatRequest); ValetUpdateResponse vur = updateReq.getReturnObject(); if (vur != null && updateReq.getStatusCode() == 200) { 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 00e72373dd..f34a79491e 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 @@ -132,7 +132,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String vnfName, String requestType, String volumeGroupHeatStackId, - Map <String, String> inputs, + Map <String, Object> inputs, Boolean failIfExists, Boolean backout, Boolean enableBridge, @@ -160,7 +160,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String vnfName, String requestType, String volumeGroupHeatStackId, - Map <String, String> inputs, + Map <String, Object> inputs, MsoRequest msoRequest, Holder <Map <String, String>> outputs, Holder <VnfRollback> rollback) @@ -428,7 +428,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { return; } - private void sendMapToDebug(Map<String, String> inputs) { + private void sendMapToDebug(Map<String, Object> inputs) { int i = 0; StringBuilder sb = new StringBuilder("inputs:"); if (inputs == null) { @@ -567,7 +567,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String volumeGroupId, String baseVfModuleId, String modelCustomizationUuid, - Map <String, String> inputs, + Map <String, Object> inputs, Boolean failIfExists, Boolean backout, Boolean enableBridge, @@ -605,7 +605,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (inputs == null) { // Create an empty set of inputs - inputs = new HashMap<String,String>(); + inputs = new HashMap<>(); LOGGER.debug("inputs == null - setting to empty"); } else { this.sendMapToDebug(inputs); @@ -1212,7 +1212,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String baseVfHeatStackId, String vfModuleStackId, String modelCustomizationUuid, - Map <String, String> inputs, + Map <String, Object> inputs, MsoRequest msoRequest, Holder <Map <String, String>> outputs, Holder <VnfRollback> rollback) throws VnfException 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 09ee0cde04..13212be74a 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 @@ -155,7 +155,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String vnfName, String requestType, String volumeGroupHeatStackId, - Map <String, String> inputs, + Map <String, Object> inputs, Boolean failIfExists, Boolean backout, Boolean enableBridge, @@ -183,7 +183,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String vnfName, String requestType, String volumeGroupHeatStackId, - Map <String, String> inputs, + Map <String, Object> inputs, MsoRequest msoRequest, Holder <Map <String, String>> outputs, Holder <VnfRollback> rollback) @@ -379,14 +379,14 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { * Normalize an input value to an Object, based on the target parameter type. * If the type is not recognized, it will just be returned unchanged (as a string). */ - private Object convertInputValue (String inputValue, HeatTemplateParam templateParam) + private Object convertInputValue (Object inputValue, HeatTemplateParam templateParam) { String type = templateParam.getParamType(); LOGGER.debug("Parameter: " + templateParam.getParamName() + " is of type " + type); if (type.equalsIgnoreCase("number")) { try { - return Integer.valueOf(inputValue); + return Integer.valueOf(inputValue.toString()); } catch (Exception e) { LOGGER.debug("Unable to convert " + inputValue + " to an integer!" , e); @@ -394,7 +394,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } } else if (type.equalsIgnoreCase("json")) { try { - JsonNode jsonNode = new ObjectMapper().readTree(inputValue); + JsonNode jsonNode = JSON_MAPPER.readTree(JSON_MAPPER.writeValueAsString(inputValue)); return jsonNode; } catch (Exception e) { @@ -402,7 +402,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { return null; } } else if (type.equalsIgnoreCase("boolean")) { - return new Boolean(inputValue); + return new Boolean(inputValue.toString()); } // Nothing else matched. Return the original string @@ -471,7 +471,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { return; } - private void sendMapToDebug(Map<String, String> inputs) { + private void sendMapToDebug(Map<String, Object> inputs) { int i = 0; StringBuilder sb = new StringBuilder("inputs:"); if (inputs == null) { @@ -608,7 +608,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String volumeGroupId, String baseVfModuleId, String modelCustomizationUuid, - Map <String, String> inputs, + Map <String, Object> inputs, Boolean failIfExists, Boolean backout, Boolean enableBridge, @@ -1212,7 +1212,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String baseVfHeatStackId, String vfModuleStackId, String modelCustomizationUuid, - Map <String, String> inputs, + Map <String, Object> inputs, MsoRequest msoRequest, Holder <Map <String, String>> outputs, Holder <VnfRollback> rollback) throws VnfException diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java index b4adc1ade9..ef2073839a 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java @@ -61,7 +61,6 @@ import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; import org.onap.so.openstack.exceptions.MsoExceptionCategory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -91,7 +90,6 @@ public class VnfAdapterRest { //TODO Logging, SkipAAI, CREATED flags, Integrate with BPEL, Auth, @Autowired - @Qualifier("VnfBpel") private Provider<BpelRestClient> bpelRestClientProvider; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java index 2c189fa8e8..a3d7c597de 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java @@ -60,7 +60,6 @@ import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; import org.onap.so.openstack.exceptions.MsoExceptionCategory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; import io.swagger.annotations.Api; @@ -90,7 +89,6 @@ public class VnfAdapterRestV2 { private VnfAdapterRestUtils vnfAdapterRestUtils; @Autowired - @Qualifier("VnfBpel") private Provider<BpelRestClient> bpelRestClientProvider; /* diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java index 7913a6d827..dc1ff12570 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java @@ -68,7 +68,6 @@ import org.onap.so.openstack.exceptions.MsoExceptionCategory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; /** @@ -91,7 +90,6 @@ public class VolumeAdapterRest { private MsoVnfAdapterImpl vnfAdapter; @Autowired - @Qualifier("VnfBpel") private Provider<BpelRestClient> bpelRestClientProvider; @POST diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java index 3dc223f5c7..1dcf586346 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java @@ -67,7 +67,6 @@ import org.onap.so.openstack.exceptions.MsoExceptionCategory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; /** @@ -94,7 +93,6 @@ public class VolumeAdapterRestV2 { private VnfAdapterRestUtils vnfAdapterRestUtils; @Autowired - @Qualifier("VnfBpel") private Provider<BpelRestClient> bpelRestClientProvider; @POST diff --git a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml b/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml index 771aa80081..936bde125a 100644 --- a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml +++ b/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml @@ -49,7 +49,16 @@ ssl-enable: false tomcat: max-threads: 50 mso: + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + auth: 6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436 logPath: logs + workflow: + endpoint: http://bpmn-infra:8081/sobpmnengine + topics: + retryMultiplier: 1000 + config: + cadi: + aafId: test catalog: db: spring: @@ -61,26 +70,8 @@ mso: core-pool-size: 50 max-pool-size: 50 queue-capacity: 500 -# H2 -spring: - datasource: - url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1; - username: sa - password: sa - driver-class-name: org.h2.Driver - intialize: true - h2: - console: - enabled: true - path: /h2 - jpa: - show-sql: true - hibernate: - dialect: org.hibernate.dialect.MySQL5Dialect - ddl-auto: validate - naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy - enable_lazy_load_no_trans: true +spring: security: usercredentials: - diff --git a/adapters/mso-openstack-adapters/src/main/resources/application.yaml b/adapters/mso-openstack-adapters/src/main/resources/application.yaml index a68372f833..4e8d389998 100644 --- a/adapters/mso-openstack-adapters/src/main/resources/application.yaml +++ b/adapters/mso-openstack-adapters/src/main/resources/application.yaml @@ -18,7 +18,7 @@ mso: retryMultiplier: 60000 spring: datasource: - jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb + url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb username: ${DB_USERNAME} password: ${DB_PASSWORD} driver-class-name: org.mariadb.jdbc.Driver diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java index 52b67b8eb9..d7739e56f6 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java @@ -105,7 +105,7 @@ public class AuditStackServiceDataTest extends AuditStackServiceData { doReturn(1).when(mockExternalTask).getRetries(); auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService); Mockito.verify(mockExternalTaskService).handleBpmnError(mockExternalTask, - "AuditAAIInventoryFailure", "Number of Retries Exceeded auditing inventory"); + "AuditAAIInventoryFailure"); } @Test diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java index 4f1c2c8707..3ebaea9c2c 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java @@ -76,7 +76,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"; String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest"; instance.createVnfA("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", - "volumeGroupHeatStackId|1", new HashMap<String, String>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, "messageId", + "volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, "messageId", msoRequest, notificationUrl); verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); @@ -86,7 +86,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { public void createVNFTest_Exception() throws Exception { String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest"; instance.createVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", - "volumeGroupHeatStackId|1", new HashMap<String, String>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, "messageId", + "volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, "messageId", null, notificationUrl); verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); @@ -99,7 +99,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody (containing("messageId")) @@ -116,7 +116,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody (containing("messageId")) diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java index 849c0811b0..be3b54e23f 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java @@ -104,7 +104,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, @@ -124,7 +124,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, @@ -144,7 +144,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, @@ -164,7 +164,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, @@ -181,7 +181,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, @@ -195,7 +195,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { expectedException.expect(VnfException.class); MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, @@ -211,7 +211,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, @@ -230,7 +230,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, @@ -250,7 +250,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, @@ -268,7 +268,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, @@ -300,7 +300,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, @@ -337,7 +337,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "XVFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", null, map, @@ -355,7 +355,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, @@ -375,7 +375,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { expectedException.expect(VnfException.class); MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.updateVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "vfModuleStackId", @@ -388,7 +388,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { expectedException.expect(VnfNotFound.class); MsoRequest msoRequest = getMsoRequest(); mockOpenStackResponseAccess(wireMockPort); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", @@ -405,7 +405,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", @@ -422,7 +422,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withStatus(HttpStatus.SC_NOT_FOUND))); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", @@ -438,7 +438,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { mockOpenStackGetStackVfModule_200(); mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_INTERNAL_SERVER_ERROR,"OpenstackResponse_Stack_Created_VfModule.json"); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", @@ -454,7 +454,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { mockOpenStackGetStackVfModule_200(); mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_NOT_FOUND,"OpenstackResponse_Stack_Created_VfModule.json"); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", @@ -470,7 +470,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { mockOpenStackGetStackVfModule_200(); mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", @@ -489,7 +489,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { VfModuleCustomization vfModuleCustomization = getVfModuleCustomization(); vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>()); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", @@ -509,7 +509,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { VfModuleCustomization vfModuleCustomization = getVfModuleCustomization(); vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>()); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.updateVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java index addc12a5d3..44843900fc 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java @@ -265,7 +265,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); try { instance.createVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", @@ -282,7 +282,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); try { diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java index 1fd3ffc90a..75cea9eafc 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java @@ -66,7 +66,7 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{ @Test public void createVfModule() throws Exception { //expectedException.expect(VnfException.class); - Map<String, String> stackInputs = new HashMap<>(); + Map<String, Object> stackInputs = new HashMap<>(); stackInputs.put("oof_directives", "{}"); stackInputs.put("sdnc_directives", "{}"); stackInputs.put("generic_vnf_id", "genVNFID"); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java index a422680d00..0cd3d1a61d 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java @@ -56,7 +56,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { public void createVfModule_ModelCustUuidIsNull() throws Exception { expectedException.expect(VnfException.class); MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", null, map, @@ -68,7 +68,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { public void createVfModule_ModelCustUuidIsNotFound() throws Exception { expectedException.expect(VnfException.class); MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, @@ -80,7 +80,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { public void createVfModule_VduException() throws Exception { expectedException.expect(VnfException.class); MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, @@ -94,7 +94,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { mockOpenStackGetStackVfModule_200(); MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); msoVnfPluginAdapter.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", null, "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, @@ -107,7 +107,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { expectedException.expect(VnfException.class); mockOpenStackResponseAccess(wireMockPort); MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, @@ -125,7 +125,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json") .withStatus(HttpStatus.SC_OK))); MsoRequest msoRequest = getMsoRequest(); - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java index c502620920..343b6245e6 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java @@ -169,7 +169,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { MsoRequest msoReq = new MsoRequest(); boolean failIfExists = true; Boolean enableBridge = null; - Map<String, String> vfModuleParams = new HashMap<String, String>(); + Map<String, Object> vfModuleParams = new HashMap<>(); vfModuleParams.put("vf_module_id", VF_MODULE_ID); @@ -236,7 +236,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { MsoRequest msoReq = new MsoRequest(); boolean failIfExists = true; boolean enableBridge = false; - Map<String, String> vfModuleParams = new HashMap<String, String>(); + Map<String, Object> vfModuleParams = new HashMap<>(); vfModuleParams.put("vf_module_id", VF_MODULE_ID); vfModuleParams.put("vnf_id", AAI_VNF_ID); @@ -385,7 +385,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { msoRequest.setRequestId(MSO_REQUEST_ID); msoRequest.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); - Map<String, String> vfModuleParams = new HashMap<String, String>(); + Map<String, Object> vfModuleParams = new HashMap<>(); vfModuleParams.put("exn_direct_net_fqdn", EXN_DIRECT_NET_FQDN); vfModuleParams.put("exn_hsl_net_fqdn", EXN_HSL_NET_FQDN); @@ -511,7 +511,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { MsoRequest msoReq = new MsoRequest(); boolean failIfExists = true; boolean enableBridge = false; - Map<String, String> vfModuleParams = new HashMap<String, String>(); + Map<String, Object> vfModuleParams = new HashMap<>(); vfModuleParams.put("vf_module_id", VF_MODULE_ID); vfModuleParams.put("vnf_id", AAI_VNF_ID); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java index 68982799f1..d0d06aed6c 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java @@ -56,7 +56,7 @@ public class VolumeGroupAdapterCommon extends BaseRestTestUtils { request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); request.setSkipAAI(true); request.setVolumeGroupStackId(VOUME_GROUP_NAME); - Map<String, String> volumeGroupParams = getVolumeGroupParamsMap(); + Map<String, Object> volumeGroupParams = getVolumeGroupParamsMap(); request.setVolumeGroupParams(volumeGroupParams); MsoRequest msoReq = getMsoRequest(); request.setMsoRequest(msoReq); @@ -104,7 +104,7 @@ public class VolumeGroupAdapterCommon extends BaseRestTestUtils { request.setFailIfExists(true); request.setEnableBridge(false); request.setSuppressBackout(true); - Map<String, String> volumeGroupParams = getVolumeGroupParamsMap(); + Map<String, Object> volumeGroupParams = getVolumeGroupParamsMap(); request.setVolumeGroupParams(volumeGroupParams); MsoRequest msoReq = getMsoRequest(); request.setMsoRequest(msoReq); @@ -112,8 +112,8 @@ public class VolumeGroupAdapterCommon extends BaseRestTestUtils { return request; } - private Map<String, String> getVolumeGroupParamsMap() { - Map<String, String> volumeGroupParams = new HashMap<>(); + private Map<String, Object> getVolumeGroupParamsMap() { + Map<String, Object> volumeGroupParams = new HashMap<>(); volumeGroupParams.put("fsb_volume_type_0","volume_type"); volumeGroupParams.put("fsb_volume_image_name_1","vol_img_1"); volumeGroupParams.put("fsb_volume_image_name_0","vol_img_0"); diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml index 051884d60d..398885cd08 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml +++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml @@ -77,7 +77,7 @@ mso: queue-capacity: 500 spring: datasource: - jdbcUrl: jdbc:mariadb://localhost:3307/catalogdb + url: jdbc:mariadb://localhost:3307/catalogdb username: root password: password driver-class-name: org.mariadb.jdbc.Driver diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java index 62971ecd2b..9e75c7c339 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -22,14 +24,14 @@ package org.onap.so.asdc; import javax.annotation.PreDestroy; -import org.onap.so.asdc.client.ASDCConfiguration; import org.onap.so.asdc.client.ASDCController; import org.onap.so.asdc.client.exceptions.ASDCControllerException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Profile; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; -import org.onap.so.logger.MsoLogger; import java.security.SecureRandom; @@ -40,30 +42,28 @@ public class ASDCControllerSingleton { @Autowired private ASDCController asdcController; - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.ASDC, ASDCControllerSingleton.class); + private static Logger logger = LoggerFactory.getLogger(ASDCControllerSingleton.class); @Scheduled (fixedRate = 50000) public void periodicControllerTask() { - - try { - int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE); - asdcController.setControllerName("mso-controller"+randomNumber); - asdcController.initASDC(); - } catch (ASDCControllerException e) { - msoLogger.error(e); - - } + try { + int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE); + asdcController.setControllerName("mso-controller" + randomNumber); + asdcController.initASDC(); + } catch (ASDCControllerException e) { + logger.error("Exception occurred", e); + } } @PreDestroy private void terminate () { - try { - asdcController.closeASDC (); - } catch (ASDCControllerException e) { - msoLogger.error(e); - } - } + try { + asdcController.closeASDC(); + } catch (ASDCControllerException e) { + logger.error("Exception occurred", e); + } + } } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java index 5710905660..20e7c873e6 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -27,8 +29,9 @@ import java.util.Collections; import java.util.List; import org.onap.sdc.api.consumer.IConfiguration; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.CryptoUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.env.Environment; @@ -40,6 +43,7 @@ public class ASDCConfiguration implements IConfiguration { // SHell command to obtain the same encryption, 128 bits key, key must be HEX // echo -n "This is a test string" | openssl aes-128-ecb -e -K 546573746F736973546573746F736973 -nosalt | xxd + private static Logger logger = LoggerFactory.getLogger(ASDCConfiguration.class); private String asdcControllerName; @@ -72,9 +76,6 @@ public class ASDCConfiguration implements IConfiguration { public static final String TOSCA_CSAR="TOSCA_CSAR"; public static final String WORKFLOWS="Workflows"; public static final String VF_MODULES_METADATA="VF_MODULES_METADATA"; - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.ASDC,ASDCConfiguration.class); - - private static final String[] SUPPORTED_ARTIFACT_TYPES = {HEAT, HEAT_ARTIFACT, @@ -176,7 +177,7 @@ public class ASDCConfiguration implements IConfiguration { try { decryptedKey = CryptoUtils.decrypt(config, this.configKey); } catch (GeneralSecurityException e) { - msoLogger.debug("Exception while decrypting property: " + propertyName, e); + logger.debug("Exception while decrypting property: {}", propertyName, e); return null; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java index a21deee51a..bb70e3c65c 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java @@ -5,6 +5,8 @@ d * ============LICENSE_START=================================================== * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -30,7 +32,6 @@ import java.nio.file.Paths; import java.util.List; import java.util.Optional; -import org.hibernate.StaleObjectStateException; import org.onap.sdc.api.IDistributionClient; import org.onap.sdc.api.consumer.IDistributionStatusMessage; import org.onap.sdc.api.consumer.IFinalDistrStatusMessage; @@ -58,6 +59,8 @@ import org.onap.so.db.request.beans.WatchdogDistributionStatus; import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.orm.ObjectOptimisticLockingFailureException; import org.springframework.stereotype.Component; @@ -71,9 +74,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Component public class ASDCController { - protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ASDCController.class); - - + protected static final Logger logger = LoggerFactory.getLogger(ASDCController.class); protected boolean isAsdcClientAutoManaged = false; @@ -189,7 +190,7 @@ public class ASDCController { public void initASDC () throws ASDCControllerException { String event = "Initialize the ASDC Controller"; MsoLogger.setServiceName ("InitASDC"); - LOGGER.debug (event); + logger.debug(event); if (this.getControllerStatus () != ASDCControllerStatus.STOPPED) { String endEvent = "The controller is already initialized, call the closeASDC method first"; throw new ASDCControllerException (endEvent); @@ -203,36 +204,29 @@ public class ASDCController { distributionClient = DistributionClientFactory.createDistributionClient (); } - long initStartTime = System.currentTimeMillis (); IDistributionClientResult result = this.distributionClient.init (asdcConfig, asdcNotificationCallBack, asdcStatusCallBack); if (!result.getDistributionActionResult ().equals (DistributionActionResultEnum.SUCCESS)) { String endEvent = "ASDC distribution client init failed with reason:" + result.getDistributionMessageResult (); - LOGGER.recordMetricEvent (initStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, "Initialization of the ASDC Controller failed with reason:" + result.getDistributionMessageResult (), "ASDC", "init", null); - LOGGER.debug (endEvent); + logger.debug (endEvent); this.changeControllerStatus (ASDCControllerStatus.STOPPED); throw new ASDCControllerException ("Initialization of the ASDC Controller failed with reason: " + result.getDistributionMessageResult ()); } - LOGGER.recordMetricEvent (initStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully initialize ASDC Controller", "ASDC", "init", null); - long clientstartStartTime = System.currentTimeMillis (); result = this.distributionClient.start (); if (!result.getDistributionActionResult ().equals (DistributionActionResultEnum.SUCCESS)) { String endEvent = "ASDC distribution client start failed with reason:" + result.getDistributionMessageResult (); - LOGGER.recordMetricEvent (clientstartStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, endEvent, "ASDC", "start", null); - LOGGER.debug (endEvent); + logger.debug (endEvent); this.changeControllerStatus (ASDCControllerStatus.STOPPED); throw new ASDCControllerException ("Startup of the ASDC Controller failed with reason: " + result.getDistributionMessageResult ()); } - LOGGER.recordMetricEvent (clientstartStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully start ASDC distribution client", "ASDC", "start", null); - this.changeControllerStatus (ASDCControllerStatus.IDLE); - LOGGER.info (MessageEnum.ASDC_INIT_ASDC_CLIENT_SUC, "ASDC", "changeControllerStatus",""); + logger.info("{} {} {}", MessageEnum.ASDC_INIT_ASDC_CLIENT_SUC.toString(), "ASDC", "changeControllerStatus"); } /** @@ -264,10 +258,10 @@ public class ASDCController { if (toscaInstaller.isResourceAlreadyDeployed (resource)) { - LOGGER.info (MessageEnum.ASDC_ARTIFACT_ALREADY_EXIST, + logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_EXIST.toString(), resource.getResourceInstance().getResourceInstanceName(), resource.getResourceInstance().getResourceUUID(), - resource.getResourceInstance().getResourceName(), "", ""); + resource.getResourceInstance().getResourceName()); this.sendDeployNotificationsForResource(resource,DistributionStatusEnum.ALREADY_DOWNLOADED,null); this.sendDeployNotificationsForResource(resource,DistributionStatusEnum.ALREADY_DEPLOYED,null); @@ -283,7 +277,7 @@ public class ASDCController { protected IDistributionClientDownloadResult downloadTheArtifact (IArtifactInfo artifact, String distributionId) throws ASDCDownloadException { - LOGGER.debug ("Trying to download the artifact : " + artifact.getArtifactURL () + logger.debug("Trying to download the artifact : " + artifact.getArtifactURL () + UUID_PARAM + artifact.getArtifactUUID () + ")"); @@ -293,11 +287,11 @@ public class ASDCController { try { downloadResult = distributionClient.download (artifact); if (null == downloadResult) { - LOGGER.info (MessageEnum.ASDC_ARTIFACT_NULL, artifact.getArtifactUUID (), "", ""); + logger.info ("{} {}", MessageEnum.ASDC_ARTIFACT_NULL.toString(), artifact.getArtifactUUID()); return downloadResult; } } catch (RuntimeException e) { - LOGGER.debug ("Not able to download the artifact due to an exception: " + artifact.getArtifactURL ()); + logger.debug ("Not able to download the artifact due to an exception: " + artifact.getArtifactURL ()); this.sendASDCNotification (NotificationType.DOWNLOAD, artifact.getArtifactURL (), asdcConfig.getConsumerID (), @@ -310,19 +304,14 @@ public class ASDCController { } if (DistributionActionResultEnum.SUCCESS.equals(downloadResult.getDistributionActionResult ())) { - - LOGGER.info (MessageEnum.ASDC_ARTIFACT_DOWNLOAD_SUC, - artifact.getArtifactURL (), - artifact.getArtifactUUID (), - String.valueOf (downloadResult.getArtifactPayload ().length), "", ""); + logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_SUC.toString(), artifact.getArtifactURL(), + artifact.getArtifactUUID(), String.valueOf(downloadResult.getArtifactPayload().length)); } else { - - LOGGER.error (MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL, - artifact.getArtifactName (), - artifact.getArtifactURL (), - artifact.getArtifactUUID (), - downloadResult.getDistributionMessageResult (), "", "", MsoLogger.ErrorCode.DataError, "ASDC artifact download fail"); + logger.error("{} {} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(), + artifact.getArtifactName(), artifact.getArtifactURL(), artifact.getArtifactUUID(), + downloadResult.getDistributionMessageResult(), MsoLogger.ErrorCode.DataError.getValue(), + "ASDC artifact download fail"); this.sendASDCNotification (NotificationType.DOWNLOAD, artifact.getArtifactURL (), @@ -359,11 +348,10 @@ public class ASDCController { private void writeArtifactToFile (IArtifactInfo artifact, IDistributionClientDownloadResult resultArtifact) { - LOGGER.debug ("Trying to write artifact to file : " + artifact.getArtifactURL () - + UUID_PARAM - + artifact.getArtifactUUID () - + ")"); - + logger.debug( + "Trying to write artifact to file : " + artifact.getArtifactURL() + UUID_PARAM + artifact.getArtifactUUID() + + ")"); + String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", artifact.getArtifactVersion(), artifact.getArtifactName()).normalize().toString(); // make parent directory File file = new File(filePath); @@ -373,20 +361,20 @@ public class ASDCController { } byte[] payloadBytes = resultArtifact.getArtifactPayload(); - + try (FileOutputStream outFile = new FileOutputStream(filePath)) { - LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***WRITE FILE ARTIFACT NAME", "ASDC", artifact.getArtifactName()); - outFile.write(payloadBytes, 0, payloadBytes.length); - outFile.close(); - } catch (Exception e) { - LOGGER.debug("Exception :",e); - LOGGER.error(MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL, - artifact.getArtifactName (), - artifact.getArtifactURL (), - artifact.getArtifactUUID (), - resultArtifact.getDistributionMessageResult (), "", "", MsoLogger.ErrorCode.DataError, "ASDC write to file failed"); - } - + logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), "***WRITE FILE ARTIFACT NAME", + "ASDC", artifact.getArtifactName()); + outFile.write(payloadBytes, 0, payloadBytes.length); + outFile.close(); + } catch (Exception e) { + logger.debug("Exception :", e); + logger.error("{} {} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(), + artifact.getArtifactName(), artifact.getArtifactURL(), artifact.getArtifactUUID(), + resultArtifact.getDistributionMessageResult(), MsoLogger.ErrorCode.DataError.getValue(), + "ASDC write to file failed"); + } + } @@ -446,7 +434,9 @@ public class ASDCController { protected void deployResourceStructure (VfResourceStructure resourceStructure, ToscaResourceStructure toscaResourceStructure) throws ArtifactInstallerException { - LOGGER.info (MessageEnum.ASDC_START_DEPLOY_ARTIFACT, resourceStructure.getResourceInstance().getResourceInstanceName(), resourceStructure.getResourceInstance().getResourceUUID(), "ASDC"); + logger.info("{} {} {} {}", MessageEnum.ASDC_START_DEPLOY_ARTIFACT.toString(), + resourceStructure.getResourceInstance().getResourceInstanceName(), + resourceStructure.getResourceInstance().getResourceUUID(), "ASDC"); try { String resourceType = resourceStructure.getResourceInstance().getResourceType(); String category = resourceStructure.getResourceInstance().getCategory(); @@ -456,20 +446,20 @@ public class ASDCController { toscaInstaller.installTheResource(toscaResourceStructure, resourceStructure); } catch (ArtifactInstallerException e) { - LOGGER.info (MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL, - resourceStructure.getResourceInstance().getResourceName(), - resourceStructure.getResourceInstance().getResourceUUID(), - String.valueOf (resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure"); - sendDeployNotificationsForResource(resourceStructure,DistributionStatusEnum.DEPLOY_ERROR,e.getMessage()); - throw e; + logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(), + resourceStructure.getResourceInstance().getResourceName(), + resourceStructure.getResourceInstance().getResourceUUID(), + String.valueOf(resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure"); + sendDeployNotificationsForResource(resourceStructure, DistributionStatusEnum.DEPLOY_ERROR, e.getMessage()); + throw e; } if (resourceStructure.isDeployedSuccessfully() || toscaResourceStructure.isDeployedSuccessfully()) { - LOGGER.info (MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC, - resourceStructure.getResourceInstance().getResourceName(), - resourceStructure.getResourceInstance().getResourceUUID(), - String.valueOf (resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure"); - sendDeployNotificationsForResource(resourceStructure,DistributionStatusEnum.DEPLOY_OK ,null); + logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(), + resourceStructure.getResourceInstance().getResourceName(), + resourceStructure.getResourceInstance().getResourceUUID(), + String.valueOf(resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure"); + sendDeployNotificationsForResource(resourceStructure, DistributionStatusEnum.DEPLOY_OK, null); } } @@ -497,10 +487,10 @@ public class ASDCController { if (errorReason != null) { event=event+"("+errorReason+")"; } - LOGGER.info (MessageEnum.ASDC_SEND_NOTIF_ASDC, notificationType.name (), status.name (), artifactURL, "ASDC", "sendASDCNotification"); - LOGGER.debug (event); + logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC.toString(), notificationType.name(), + status.name(), artifactURL, "ASDC", "sendASDCNotification"); + logger.debug (event); - long subStarttime = System.currentTimeMillis (); String action = ""; try { IDistributionStatusMessage message = new DistributionStatusMessage (artifactURL, @@ -529,10 +519,11 @@ public class ASDCController { default: break; } - } catch (RuntimeException e) { - LOGGER.warn (MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC, "ASDC", "sendASDCNotification", MsoLogger.ErrorCode.SchemaError, "RuntimeException - sendASDCNotification", e); + } catch (RuntimeException e) { + logger.warn("{} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC", + "sendASDCNotification", MsoLogger.ErrorCode.SchemaError.getValue(), + "RuntimeException - sendASDCNotification", e); } - LOGGER.recordMetricEvent (subStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully sent notification to ASDC", "ASDC", action, null); } protected void sendFinalDistributionStatus ( @@ -541,7 +532,8 @@ public class ASDCController { String errorReason) { - LOGGER.debug ("Enter sendFinalDistributionStatus with DistributionID " + distributionID + " and Status of " + status.name() + " and ErrorReason " + errorReason); + logger.debug("Enter sendFinalDistributionStatus with DistributionID " + distributionID + " and Status of " + status + .name() + " and ErrorReason " + errorReason); long subStarttime = System.currentTimeMillis (); try { @@ -556,11 +548,11 @@ public class ASDCController { } - } catch (RuntimeException e) { - LOGGER.debug ("Exception caught in sendFinalDistributionStatus " + e.getMessage()); - LOGGER.warn (MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC, "ASDC", "sendASDCNotification", MsoLogger.ErrorCode.SchemaError, "RuntimeException - sendASDCNotification", e); - } - LOGGER.recordMetricEvent (subStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully sent Final notification to ASDC", "ASDC", null, null); + } catch (RuntimeException e) { + logger.debug("Exception caught in sendFinalDistributionStatus {}", e.getMessage()); + logger.warn("{} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC", "sendASDCNotification", + MsoLogger.ErrorCode.SchemaError.getValue(), "RuntimeException - sendASDCNotification", e); + } } private Optional<String> getNotificationJson(INotificationData iNotif) { @@ -574,7 +566,7 @@ public class ASDCController { try { returnValue = Optional.of(mapper.writeValueAsString(iNotif)); } catch (JsonProcessingException e) { - LOGGER.error("Error converting incoming ASDC notification to JSON" , e); + logger.error("Error converting incoming ASDC notification to JSON" , e); } return returnValue; } @@ -587,15 +579,14 @@ public class ASDCController { for (IResourceInstance resource : iNotif.getResources ()) { noOfArtifacts += resource.getArtifacts ().size (); } - LOGGER.info (MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF, - String.valueOf (noOfArtifacts), - iNotif.getServiceUUID (), "ASDC"); - + logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF.toString(), String.valueOf(noOfArtifacts), + iNotif.getServiceUUID(), "ASDC"); try { - LOGGER.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif)); - LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, iNotif.getServiceUUID(), "ASDC", "treatNotification"); - - this.changeControllerStatus(ASDCControllerStatus.BUSY); + logger.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif)); + logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), iNotif.getServiceUUID(), "ASDC", + "treatNotification"); + + this.changeControllerStatus(ASDCControllerStatus.BUSY); Optional<String> notificationMessage = getNotificationJson(iNotif); toscaInstaller.processWatchdog(iNotif.getDistributionID(), iNotif.getServiceUUID(), notificationMessage, asdcConfig.getConsumerID()); @@ -622,7 +613,7 @@ public class ASDCController { distributionStatus = wd.getOverallDistributionStatus(iNotif.getDistributionID()); Thread.sleep(watchDogTimeout / 10); }catch(Exception e){ - LOGGER.debug ("Exception in Watchdog Loop " + e.getMessage()); + logger.debug ("Exception in Watchdog Loop {}", e.getMessage()); Thread.sleep(watchDogTimeout / 10); } @@ -639,25 +630,25 @@ public class ASDCController { } if(!componentsComplete){ - LOGGER.debug("Timeout of " + watchDogTimeout + " seconds was reached before all components reported status"); + logger.debug("Timeout of {} seconds was reached before all components reported status", watchDogTimeout); watchdogError = "Timeout occurred while waiting for all components to report status"; overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name(); } if(distributionStatus == null){ overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name(); - LOGGER.debug("DistributionStatus is null for DistributionId: " + iNotif.getDistributionID()); + logger.debug("DistributionStatus is null for DistributionId: {}", iNotif.getDistributionID()); } try { wd.executePatchAAI(iNotif.getDistributionID(), iNotif.getServiceInvariantUUID(), overallStatus); - LOGGER.debug ("A&AI Updated succefully with Distribution Status!"); + logger.debug("A&AI Updated succefully with Distribution Status!"); } catch(Exception e) { - LOGGER.debug ("Exception in Watchdog executePatchAAI(): " + e.getMessage()); + logger.debug("Exception in Watchdog executePatchAAI(): {}", e.getMessage()); watchdogError = "Error calling A&AI " + e.getMessage(); if(e.getCause() != null) { - LOGGER.debug ("Exception caused by: " + e.getCause().getMessage()); + logger.debug("Exception caused by: {}", e.getCause().getMessage()); } } @@ -676,27 +667,31 @@ public class ASDCController { } catch(ObjectOptimisticLockingFailureException e) { - - LOGGER.debug ("OptimisticLockingFailure for DistributionId: " + iNotif.getDistributionID() + " Another process has already altered this distribution, so not going to process it on this site."); - LOGGER.error (MessageEnum.ASDC_GENERAL_EXCEPTION_ARG, - "Database concurrency exception: ", "ASDC", "treatNotification", MsoLogger.ErrorCode.BusinessProcesssError, "RuntimeException in treatNotification", - e); - + + logger.debug("OptimisticLockingFailure for DistributionId: {} Another process " + + "has already altered this distribution, so not going to process it on this site.", + iNotif.getDistributionID()); + logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), + "Database concurrency exception: ", "ASDC", "treatNotification", + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "RuntimeException in treatNotification", e); + } catch (Exception e) { - LOGGER.error (MessageEnum.ASDC_GENERAL_EXCEPTION_ARG, - "Unexpected exception caught during the notification processing", "ASDC", "treatNotification", MsoLogger.ErrorCode.SchemaError, "RuntimeException in treatNotification", + logger.error("", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), + "Unexpected exception caught during the notification processing", "ASDC", + "treatNotification", MsoLogger.ErrorCode.SchemaError.getValue(), "RuntimeException in treatNotification", e); - - try { - wd.executePatchAAI(iNotif.getDistributionID(), iNotif.getServiceInvariantUUID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name()); - LOGGER.debug ("A&AI Updated succefully with Distribution Status of " + DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name()); - } - catch(Exception aaiException) { - LOGGER.debug ("Exception in executePatchAAI(): " + aaiException); - if(aaiException.getCause() != null) { - LOGGER.debug ("Exception caused by: " + aaiException.getCause().getMessage()); - } - } + + try { + wd.executePatchAAI(iNotif.getDistributionID(), iNotif.getServiceInvariantUUID(), + DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name()); + logger.debug("A&AI Updated succefully with Distribution Status of {}", + DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name()); + } catch (Exception aaiException) { + logger.debug("Exception in executePatchAAI(): {}", aaiException); + if (aaiException.getCause() != null) { + logger.debug("Exception caused by: {}", aaiException.getCause().getMessage()); + } + } sendFinalDistributionStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR, e.getMessage()); @@ -735,7 +730,8 @@ public class ASDCController { String resourceType = resourceStructure.getResourceInstance().getResourceType(); String category = resourceStructure.getResourceInstance().getCategory(); - LOGGER.debug("Processing Resource Type: " + resourceType + " and Model UUID: " + resourceStructure.getResourceInstance().getResourceUUID()); + logger.debug("Processing Resource Type: " + resourceType + " and Model UUID: " + resourceStructure + .getResourceInstance().getResourceUUID()); if("VF".equals(resourceType) && !"Allotted Resource".equalsIgnoreCase(category)){ @@ -747,15 +743,16 @@ public class ASDCController { if (resultArtifact != null) { if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifact.getArtifactType())) { - LOGGER.debug("VF_MODULE_ARTIFACT: "+new String(resultArtifact.getArtifactPayload(),"UTF-8")); - LOGGER.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(resourceStructure.decodeVfModuleArtifact(resultArtifact.getArtifactPayload()))); + logger.debug("VF_MODULE_ARTIFACT: "+ new String(resultArtifact.getArtifactPayload(),"UTF-8")); + logger.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(resourceStructure.decodeVfModuleArtifact + (resultArtifact.getArtifactPayload()))); } resourceStructure.addArtifactToStructure(distributionClient,artifact, resultArtifact); } } //Deploy VF resource and artifacts - LOGGER.debug("Preparing to deploy Service: " + iNotif.getServiceUUID()); + logger.debug("Preparing to deploy Service: {}", iNotif.getServiceUUID()); try{ this.deployResourceStructure(resourceStructure, toscaResourceStructure); @@ -763,7 +760,7 @@ public class ASDCController { } catch(ArtifactInstallerException e){ deploySuccessful = false; errorMessage = e.getMessage(); - LOGGER.error(e); + logger.error("Exception occurred", e); } } @@ -772,7 +769,7 @@ public class ASDCController { // There are cases where the Service has no VF resources, those are handled here if (!hasVFResource) { - LOGGER.debug("No resources found for Service: " + iNotif.getServiceUUID()); + logger.debug("No resources found for Service: {}", iNotif.getServiceUUID()); try{ resourceStructure = new VfResourceStructure(iNotif,new ResourceInstance()); @@ -782,15 +779,16 @@ public class ASDCController { } catch(ArtifactInstallerException e){ deploySuccessful = false; errorMessage = e.getMessage(); - LOGGER.error(e); + logger.error("Exception occurred", e); } } this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deploySuccessful, errorMessage); } catch (ASDCDownloadException | UnsupportedEncodingException e) { - LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG, - "Exception caught during Installation of artifact", "ASDC", "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processResourceNotification", e); - } + logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), + "Exception caught during Installation of artifact", "ASDC", "processResourceNotification", + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in processResourceNotification", e); + } } protected void processCsarServiceArtifacts (INotificationData iNotif, ToscaResourceStructure toscaResourceStructure) { @@ -812,12 +810,13 @@ public class ASDCController { toscaResourceStructure.setServiceVersion(iNotif.getServiceVersion()); - LOGGER.debug(ASDCNotificationLogging.dumpCSARNotification(iNotif, toscaResourceStructure)); + logger.debug(ASDCNotificationLogging.dumpCSARNotification(iNotif, toscaResourceStructure)); } catch(Exception e){ - LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG, - "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processCsarServiceArtifacts", e); + logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), + "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts", + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in processCsarServiceArtifacts", e); } } else if(artifact.getArtifactType().equals(ASDCConfiguration.WORKFLOWS)){ @@ -830,14 +829,16 @@ public class ASDCController { toscaResourceStructure.setToscaArtifact(artifact); - LOGGER.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif)); + logger.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif)); } catch(Exception e){ - System.out.println("Whats the error " + e.getMessage()); - LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG, - "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processCsarServiceArtifacts", e); - } + logger.info("Whats the error {}", e.getMessage()); + logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), + "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts", + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in processCsarServiceArtifacts", + e); + } } @@ -865,5 +866,4 @@ public class ASDCController { } return UNKNOWN; } - } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCNotificationCallBack.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCNotificationCallBack.java index ab5b7aa39e..876c5e164f 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCNotificationCallBack.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCNotificationCallBack.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -22,8 +24,8 @@ package org.onap.so.asdc.client; import org.onap.sdc.api.consumer.INotificationCallback; import org.onap.sdc.api.notification.INotificationData; -import org.onap.so.logger.MsoLogger; -import org.onap.so.utils.UUIDChecker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -38,7 +40,7 @@ public final class ASDCNotificationCallBack implements INotificationCallback { @Autowired private ASDCController asdcController; - protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ASDCNotificationCallBack.class); + protected static final Logger logger = LoggerFactory.getLogger(ASDCNotificationCallBack.class); /** * This method can be called multiple times at the same moment. @@ -46,13 +48,8 @@ public final class ASDCNotificationCallBack implements INotificationCallback { */ @Override public void activateCallback (INotificationData iNotif) { - long startTime = System.currentTimeMillis (); - UUIDChecker.generateUUID (LOGGER); - MsoLogger.setServiceName ("NotificationHandler"); - MsoLogger.setLogContext (iNotif.getDistributionID (), iNotif.getServiceUUID ()); String event = "Receive a callback notification in ASDC, nb of resources: " + iNotif.getResources ().size (); - LOGGER.debug(event); + logger.debug(event); asdcController.treatNotification (iNotif); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Completed the treatment of the notification"); } } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java index d2ac8e7c2d..612599b2ed 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -27,8 +29,8 @@ import org.onap.so.asdc.client.exceptions.ArtifactInstallerException; import org.onap.so.asdc.installer.heat.ToscaResourceInstaller; import org.onap.so.db.request.beans.WatchdogDistributionStatus; import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository; -import org.onap.so.logger.MsoLogger; -import org.onap.so.utils.UUIDChecker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -38,18 +40,13 @@ public final class ASDCStatusCallBack implements IStatusCallback { @Autowired private ToscaResourceInstaller toscaInstaller; - protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ASDCStatusCallBack.class); + protected static final Logger logger = LoggerFactory.getLogger(ASDCStatusCallBack.class); @Autowired private WatchdogDistributionStatusRepository watchdogDistributionStatusRepository; @Override public void activateCallback (IStatusData iStatus) { - - long startTime = System.currentTimeMillis (); - UUIDChecker.generateUUID (LOGGER); - MsoLogger.setServiceName ("ASDCStatusCallBack"); - MsoLogger.setLogContext (iStatus.getDistributionID (), iStatus.getComponentName()); String event = "Receive a callback componentStatus in ASDC, for componentName: " + iStatus.getComponentName() + " and status of " + iStatus.getStatus() + " distributionID of " + iStatus.getDistributionID(); try{ @@ -63,15 +60,14 @@ public final class ASDCStatusCallBack implements IStatusCallback { watchdogDistributionStatus.setDistributionId(iStatus.getDistributionID ()); watchdogDistributionStatusRepository.save(watchdogDistributionStatus); } - LOGGER.debug(event); + logger.debug(event); toscaInstaller.installTheComponentStatus(iStatus); } } }catch(ArtifactInstallerException e){ - LOGGER.error("Error in ASDCStatusCallback " + e.getMessage(),e); - LOGGER.debug("Error in ASDCStatusCallback " + e.getMessage()); + logger.error("Error in ASDCStatusCallback {}", e.getMessage(), e); + logger.debug("Error in ASDCStatusCallback {}", e.getMessage()); } - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Completed the treatment of the notification"); - } -}
\ No newline at end of file + } +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulator.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulator.java index 596ad16d34..ffb7f7a7f4 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulator.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulator.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -27,7 +29,6 @@ import java.util.LinkedList; import java.util.List; import org.onap.so.asdc.installer.IVfModuleData; -import org.onap.so.logger.MsoLogger; import org.onap.sdc.api.IDistributionClient; import org.onap.sdc.api.consumer.IComponentDoneStatusMessage; import org.onap.sdc.api.consumer.IConfiguration; @@ -42,6 +43,8 @@ import org.onap.sdc.api.results.IDistributionClientResult; import org.onap.sdc.impl.DistributionClientDownloadResultImpl; import org.onap.sdc.impl.DistributionClientResultImpl; import org.onap.sdc.utils.DistributionActionResultEnum; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class DistributionClientEmulator implements IDistributionClient { @@ -52,7 +55,7 @@ public class DistributionClientEmulator implements IDistributionClient { private List<IDistributionStatusMessage> distributionMessageReceived = new LinkedList<>(); - private static final MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,DistributionClientEmulator.class ); + private static final Logger logger = LoggerFactory.getLogger(DistributionClientEmulator.class ); public DistributionClientEmulator() { } @@ -90,9 +93,8 @@ public class DistributionClientEmulator implements IDistributionClient { byte[] inputStream=null; try { inputStream = getData(filename); - } catch (IOException e) { - - logger.error("IOException in DistributionClientEmulator.download() method :",e); + } catch (IOException e) { + logger.error("IOException in DistributionClientEmulator.download() method", e); } return new DistributionClientDownloadResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name(),arg0.getArtifactName(),inputStream); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java index e86fac72a6..329c139ec3 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -40,6 +42,8 @@ import org.onap.so.asdc.client.test.emulators.JsonStatusData; import org.onap.so.asdc.installer.heat.ToscaResourceInstaller; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; @@ -65,7 +69,7 @@ public class ASDCRestInterface { private static JsonStatusData statusData; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ASDCRestInterface.class ); + private static final Logger logger = LoggerFactory.getLogger(ASDCRestInterface.class ); @Autowired private ASDCController asdcController; @@ -100,21 +104,18 @@ public class ASDCRestInterface { statusData = JsonStatusData.instantiateNotifFromJsonFile("resource-examples/"); ASDCController asdcController = new ASDCController("asdc-controller1", distributionClientEmulator); - //LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "initASDC()"); asdcController.initASDC(); - //LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "treatNotification()"); toscaInstaller.installTheComponentStatus(statusData); - //asdcController.treatNotification(notifDataWithoutModuleInfo); - //LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "closeASDC()"); asdcController.closeASDC(); }catch(Exception e){ - System.out.println("Error caught " + e.getMessage()); - LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION, - "Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in invokeASDCService", e); + logger.info("Error caught " + e.getMessage()); + logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION.toString(), + "Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService", + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in invokeASDCService", e); } - System.out.println("ASDC Updates are complete"); - LOGGER.info(MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC, statusData.getDistributionID(), "ASDC", "ASDC Updates Are Complete"); - + logger.info("ASDC Updates are complete"); + logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(), statusData.getDistributionID(), "ASDC", + "ASDC Updates Are Complete"); return null; } } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java index 6ddc2a8bdd..700a5b16bb 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -50,6 +52,8 @@ import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ToscaResourceStructure { @@ -94,9 +98,7 @@ public class ToscaResourceStructure { private VfModule vfModule; private VfModuleCustomization vfModuleCustomization; - - //private VnfResource vnfResource; - + private VnfResourceCustomization vnfResourceCustomization; private AllottedResource allottedResource; @@ -109,7 +111,7 @@ public class ToscaResourceStructure { private ToscaCsar toscaCsar; - protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC, ToscaResourceStructure.class); + protected static final Logger logger = LoggerFactory.getLogger(ToscaResourceStructure.class); public ToscaResourceStructure(){ @@ -122,22 +124,24 @@ public class ToscaResourceStructure { SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();//Autoclosable - LOGGER.debug("MSO config path is: " + System.getProperty("mso.config.path")); + logger.debug("MSO config path is: " + System.getProperty("mso.config.path")); String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", artifact.getArtifactVersion(), artifact.getArtifactName()).normalize().toString(); File spoolFile = new File(filePath); - - LOGGER.debug("ASDC File path is: " + spoolFile.getAbsolutePath()); - LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***PATH", "ASDC", spoolFile.getAbsolutePath()); - + + logger.debug("ASDC File path is: {}", spoolFile.getAbsolutePath()); + logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), "***PATH", "ASDC", + spoolFile.getAbsolutePath()); sdcCsarHelper = factory.getSdcCsarHelper(spoolFile.getAbsolutePath(),false); }catch(Exception e){ - System.out.println("System out " + e.getMessage()); - LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG, - "Exception caught during parser *****LOOK********* " + artifact.getArtifactName(), "ASDC", "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processResourceNotification", e); + logger.info("System out {}", e.getMessage()); + logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), + "Exception caught during parser *****LOOK********* " + artifact.getArtifactName(), "ASDC", + "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + "Exception in " + "processResourceNotification", e); throw new ASDCDownloadException ("Exception caught when passing the csar file to the parser ", e); } @@ -474,10 +478,6 @@ public class ToscaResourceStructure { this.toscaCsar = toscaCsar; } - public static MsoLogger getLogger() { - return LOGGER; - } - public boolean isDeployedSuccessfully() { return isDeployedSuccessfully; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java index f5e45115fd..5b24dc56a1 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -33,7 +35,6 @@ import org.onap.so.db.catalog.beans.AllottedResourceCustomization; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VnfResource; -import org.onap.so.logger.MsoLogger; import org.onap.sdc.api.IDistributionClient; import org.onap.sdc.api.notification.IArtifactInfo; import org.onap.sdc.api.notification.INotificationData; @@ -44,6 +45,9 @@ import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * This structure exists to avoid having issues if the order of the vfResource/vfmodule artifact is not good (tree structure). * @@ -52,7 +56,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; public class VfResourceStructure { - protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC, VfResourceStructure.class); + protected static final Logger logger = LoggerFactory.getLogger(VfResourceStructure.class); private boolean isDeployedSuccessfully=false; /** @@ -134,8 +138,9 @@ public class VfResourceStructure { //for vender tosca VNF there is no VFModule in VF if (vfModulesMetadataList == null) { - LOGGER.info(MessageEnum.ASDC_GENERAL_INFO,"There is no VF mudules in the VF.", "ASDC", "createVfModuleStructures"); - return; + logger.info("{} {} {} {}", MessageEnum.ASDC_GENERAL_INFO.toString(), "There is no VF mudules in the VF.", "ASDC", + "createVfModuleStructures"); + return; } for (IVfModuleData vfModuleMeta:vfModulesMetadataList) { vfModulesStructureList.add(new VfModuleStructure(this,vfModuleMeta)); @@ -218,11 +223,11 @@ public class VfResourceStructure { return listVFModuleMetaData; } catch (JsonParseException e) { - LOGGER.debug("JsonParseException : ",e); + logger.debug("JsonParseException : ",e); } catch (JsonMappingException e) { - LOGGER.debug("JsonMappingException : ",e); + logger.debug("JsonMappingException : ",e); } catch (IOException e) { - LOGGER.debug("IOException : ",e); + logger.debug("IOException : ",e); } return null; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java index 59030e6c22..7e3f5dfef6 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java @@ -47,13 +47,15 @@ import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.HttpClientBuilder; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @Component public class BpmnInstaller { - protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,BpmnInstaller.class); + protected static final Logger logger = LoggerFactory.getLogger(BpmnInstaller.class); private static final String BPMN_SUFFIX = ".bpmn"; private static final String CAMUNDA_URL = "mso.camundaURL"; private static final String CREATE_DEPLOYMENT_PATH = "/sobpmnengine/deployment/create"; @@ -62,7 +64,7 @@ public class BpmnInstaller { private Environment env; public void installBpmn(String csarFilePath) { - LOGGER.info("Deploying BPMN files from " + csarFilePath); + logger.info("Deploying BPMN files from {}", csarFilePath); try { ZipInputStream csarFile = new ZipInputStream(new FileInputStream(Paths.get(csarFilePath).normalize().toString())); ZipEntry entry = csarFile.getNextEntry(); @@ -70,45 +72,39 @@ public class BpmnInstaller { while (entry != null) { String name = entry.getName(); if (name.endsWith(BPMN_SUFFIX)) { - LOGGER.debug("Attempting to deploy BPMN file: " + name); + logger.debug("Attempting to deploy BPMN file: {}", name); try { Path p = Paths.get(name); String fileName = p.getFileName().toString(); extractBpmnFileFromCsar(csarFile, fileName); HttpResponse response = sendDeploymentRequest(fileName); - LOGGER.debug("Response status line: " + response.getStatusLine()); - LOGGER.debug("Response entity: " + response.getEntity().toString()); + logger.debug("Response status line: {}", response.getStatusLine()); + logger.debug("Response entity: {}", response.getEntity().toString()); if (response.getStatusLine().getStatusCode() != 200) { - LOGGER.debug("Failed deploying BPMN " + name); - LOGGER.error(MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL, - name, - fileName, - "", - Integer.toString(response.getStatusLine().getStatusCode()), "", "", MsoLogger.ErrorCode.DataError, "ASDC BPMN deploy failed"); + logger.debug("Failed deploying BPMN {}", name); + logger + .error("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), name, fileName, + Integer.toString(response.getStatusLine().getStatusCode()), MsoLogger.ErrorCode.DataError.getValue(), + "ASDC BPMN deploy failed"); } else { - LOGGER.debug("Successfully deployed to Camunda: " + name); + logger.debug("Successfully deployed to Camunda: {}", name); } } catch (Exception e) { - LOGGER.debug("Exception :",e); - LOGGER.error(MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL, - name, - "", - "", - e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "ASDC BPMN deploy failed"); + logger.debug("Exception :", e); + logger + .error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), name, e.getMessage(), + MsoLogger.ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed"); } } entry = csarFile.getNextEntry(); } csarFile.close(); } catch (IOException ex) { - LOGGER.debug("Exception :",ex); - LOGGER.error(MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL, - csarFilePath, - "", - "", - ex.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "ASDC reading CSAR with workflows failed"); + logger.debug("Exception :", ex); + logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), csarFilePath, + ex.getMessage(), MsoLogger.ErrorCode.DataError.getValue(), "ASDC reading CSAR with workflows failed"); } return; } @@ -125,12 +121,10 @@ public class BpmnInstaller { } } } catch (Exception e) { - LOGGER.debug("Exception :", e); - LOGGER.error(MessageEnum.ASDC_ARTIFACT_CHECK_EXC, - csarFilePath,"","", - e.getMessage(), "", "", - MsoLogger.ErrorCode.DataError, "ASDC Unable to check CSAR entries"); - } + logger.debug("Exception :", e); + logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), csarFilePath, e.getMessage(), + MsoLogger.ErrorCode.DataError.getValue(), "ASDC Unable to check CSAR entries"); + } return workflowsInCsar; } @@ -194,7 +188,7 @@ public class BpmnInstaller { } /* outputStream.close(); */ } catch (IOException e) { - LOGGER.error("Unable to open file.", e); + logger.error("Unable to open file.", e); } } } 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 60d5d7e061..56784ba475 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 @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -34,7 +36,6 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; -import org.hibernate.StaleObjectStateException; import org.hibernate.exception.ConstraintViolationException; import org.hibernate.exception.LockAcquisitionException; import org.onap.sdc.api.notification.IArtifactInfo; @@ -124,6 +125,8 @@ import org.onap.so.db.request.data.repository.WatchdogDistributionStatusReposito import org.onap.so.db.request.data.repository.WatchdogServiceModVerIdLookupRepository; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.orm.ObjectOptimisticLockingFailureException; import org.springframework.stereotype.Component; @@ -222,7 +225,7 @@ public class ToscaResourceInstaller { @Autowired protected ExternalServiceToInternalServiceRepository externalServiceToInternalServiceRepository; - protected static final MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ToscaResourceInstaller.class); + protected static final Logger logger = LoggerFactory.getLogger(ToscaResourceInstaller.class); public boolean isResourceAlreadyDeployed(VfResourceStructure vfResourceStruct) throws ArtifactInstallerException { boolean status = false; @@ -258,15 +261,16 @@ public class ToscaResourceInstaller { } return status; } catch (Exception e) { - logger.error(MessageEnum.ASDC_ARTIFACT_CHECK_EXC, "", "", MsoLogger.ErrorCode.SchemaError, + logger + .error("{} {} {}", MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), MsoLogger.ErrorCode.SchemaError.getValue(), "Exception - isResourceAlreadyDeployed"); throw new ArtifactInstallerException("Exception caught during checking existence of the VNF Resource.", e); } } public void installTheComponentStatus(IStatusData iStatus) throws ArtifactInstallerException { - logger.debug("Entering installTheComponentStatus for distributionId " + iStatus.getDistributionID() - + " and ComponentName " + iStatus.getComponentName()); + logger.debug("Entering installTheComponentStatus for distributionId {} and ComponentName {}", + iStatus.getDistributionID(), iStatus.getComponentName()); try { WatchdogComponentDistributionStatus cdStatus = new WatchdogComponentDistributionStatus(iStatus.getDistributionID(), @@ -275,7 +279,7 @@ public class ToscaResourceInstaller { watchdogCDStatusRepository.save(cdStatus); } catch (Exception e) { - logger.debug("Exception caught in installTheComponentStatus " + e.getMessage()); + logger.debug("Exception caught in installTheComponentStatus {}", e.getMessage()); throw new ArtifactInstallerException("Exception caught in installTheComponentStatus " + e.getMessage()); } } @@ -293,18 +297,6 @@ public class ToscaResourceInstaller { createToscaCsar(toscaResourceStruct); createService(toscaResourceStruct, vfResourceStruct); Service service = toscaResourceStruct.getCatalogService(); - List<NodeTemplate> vfNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceVfList(); - - - for (NodeTemplate nodeTemplate : vfNodeTemplatesList) { - - Metadata metadata = nodeTemplate.getMetaData(); - String serviceType = toscaResourceStruct.getCatalogService().getServiceType(); - String vfCustomizationCategory = toscaResourceStruct.getSdcCsarHelper() - .getMetadataPropertyValue(metadata, SdcPropertyNames.PROPERTY_NAME_CATEGORY); - processVfModules(toscaResourceStruct, vfResourceStructure, service, nodeTemplate, metadata, - vfCustomizationCategory); - } processResourceSequence(toscaResourceStruct, service); processVFResources(toscaResourceStruct, service, vfResourceStructure); @@ -338,18 +330,18 @@ public class ToscaResourceInstaller { if (dbExceptionToCapture instanceof ConstraintViolationException || dbExceptionToCapture instanceof LockAcquisitionException) { - logger.warn(MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED, - vfResourceStructure.getResourceInstance().getResourceName(), - vfResourceStructure.getNotification().getServiceVersion(), "", MsoLogger.ErrorCode.DataError, "Exception - ASCDC Artifact already deployed", e); + logger.warn("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED.toString(), + vfResourceStructure.getResourceInstance().getResourceName(), + vfResourceStructure.getNotification().getServiceVersion(), MsoLogger.ErrorCode.DataError.getValue(), + "Exception - ASCDC Artifact already deployed", e); } else { String elementToLog = (!artifactListForLogging.isEmpty() ? artifactListForLogging.get(artifactListForLogging.size() - 1).toString() : "No element listed"); - logger.error(MessageEnum.ASDC_ARTIFACT_INSTALL_EXC, elementToLog, "", "", MsoLogger.ErrorCode.DataError, - "Exception caught during installation of " - + vfResourceStructure.getResourceInstance().getResourceName() - + ". Transaction rollback", - e); + logger.error("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_INSTALL_EXC.toString(), elementToLog, + MsoLogger.ErrorCode.DataError.getValue(), + "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + + ". Transaction rollback", e); throw new ArtifactInstallerException("Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback.", e); } @@ -739,10 +731,9 @@ public class ToscaResourceInstaller { break; case ASDCConfiguration.HEAT_NET: case ASDCConfiguration.OTHER: - logger.warn(MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT, - vfModuleArtifact.getArtifactInfo().getArtifactType() + "(Artifact Name:" - + vfModuleArtifact.getArtifactInfo().getArtifactName() + ")", - "", "", MsoLogger.ErrorCode.DataError, "Artifact type not supported"); + logger.warn("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT.toString(), + vfModuleArtifact.getArtifactInfo().getArtifactType() + "(Artifact Name:" + vfModuleArtifact.getArtifactInfo() + .getArtifactName() + ")", MsoLogger.ErrorCode.DataError.getValue(), "Artifact type not supported"); break; default: break; diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java index 8c9fb62f31..c95d701cb2 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -36,7 +38,8 @@ import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup; import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository; import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository; import org.onap.so.db.request.data.repository.WatchdogServiceModVerIdLookupRepository; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @@ -44,7 +47,7 @@ import org.springframework.stereotype.Component; @Component public class WatchdogDistribution { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,WatchdogDistribution.class); + private static final Logger logger = LoggerFactory.getLogger(WatchdogDistribution.class); private AAIResourcesClient aaiClient; @@ -64,7 +67,7 @@ public class WatchdogDistribution { private String[] componentNames; public String getOverallDistributionStatus(String distributionId) throws Exception { - LOGGER.debug("Entered getOverallDistributionStatus method for distrubutionId: " + distributionId); + logger.debug("Entered getOverallDistributionStatus method for distrubutionId: {}", distributionId); String status = null; try { @@ -78,11 +81,13 @@ public class WatchdogDistribution { String distributionStatus = watchdogDistributionStatus.getDistributionIdStatus(); if(DistributionStatus.TIMEOUT.name().equalsIgnoreCase(distributionStatus)) { - LOGGER.debug("Ignoring to update WatchdogDistributionStatus as distributionId: " + distributionId + " status is set to: " + distributionStatus); + logger.debug("Ignoring to update WatchdogDistributionStatus as distributionId: {} status is set to: {}", + distributionId, distributionStatus); return DistributionStatus.TIMEOUT.name(); } else { List<WatchdogComponentDistributionStatus> results = watchdogCDStatusRepository.findByDistributionId(distributionId); - LOGGER.debug("Executed RequestDB getWatchdogComponentDistributionStatus for distrubutionId: " + distributionId); + logger.debug("Executed RequestDB getWatchdogComponentDistributionStatus for distrubutionId: {}", + distributionId); //************************************************************************************************************************************************* //**** Compare config values verse DB watchdog component names to see if every component has reported status before returning final result back to ASDC @@ -98,13 +103,13 @@ public class WatchdogDistribution { for(WatchdogComponentDistributionStatus cdStatus: cdStatuses){ if(name.equals(cdStatus.getComponentName())){ - LOGGER.debug("Found componentName " + name + " in the WatchDog Component DB"); + logger.debug("Found componentName {} in the WatchDog Component DB", name); match = true; break; } } if(!match){ - LOGGER.debug(name + " has not be updated in the the WatchDog Component DB yet, so ending the loop"); + logger.debug("{} has not be updated in the the WatchDog Component DB yet, so ending the loop", name); allComponentsComplete = false; break; } @@ -112,11 +117,12 @@ public class WatchdogDistribution { if(allComponentsComplete) { - LOGGER.debug("Components Size matched with the WatchdogComponentDistributionStatus results."); + logger.debug("Components Size matched with the WatchdogComponentDistributionStatus results."); for(WatchdogComponentDistributionStatus componentDist : results) { String componentDistributionStatus = componentDist.getComponentDistributionStatus(); - LOGGER.debug("Component status: " + componentDistributionStatus + " on componentName: " + componentDist.getComponentName()); + logger.debug("Component status: {} on componentName: ", componentDistributionStatus, componentDist + .getComponentName()); if(componentDistributionStatus.equalsIgnoreCase("COMPONENT_DONE_ERROR")) { status = DistributionStatus.FAILURE.name(); break; @@ -127,27 +133,28 @@ public class WatchdogDistribution { } } - LOGGER.debug("Updating overall DistributionStatus to: " + status + " for distributionId: " + distributionId); + logger.debug("Updating overall DistributionStatus to: {} for distributionId: ", status, distributionId); watchdogDistributionStatus.setDistributionIdStatus(status); watchdogDistributionStatusRepository.save(watchdogDistributionStatus); } else { - LOGGER.debug("Components Size Didn't match with the WatchdogComponentDistributionStatus results."); + logger.debug("Components Size Didn't match with the WatchdogComponentDistributionStatus results."); status = DistributionStatus.INCOMPLETE.name(); return status; } } }catch (Exception e) { - LOGGER.debug("Exception occurred on getOverallDistributionStatus : " + e.getMessage()); - LOGGER.error(e); + logger.debug("Exception occurred on getOverallDistributionStatus : {}", e.getMessage()); + logger.error("Exception occurred", e); throw new Exception(e); } - LOGGER.debug("Exiting getOverallDistributionStatus method in WatchdogDistribution"); + logger.debug("Exiting getOverallDistributionStatus method in WatchdogDistribution"); return status; } public void executePatchAAI(String distributionId, String serviceModelInvariantUUID, String distributionStatus) throws Exception { - LOGGER.debug("Entered executePatchAAI method with distrubutionId: " + distributionId + " and distributionStatus: " + distributionStatus); + logger.debug("Entered executePatchAAI method with distrubutionId: {} and distributionStatus: ", distributionId, + distributionStatus); try { WatchdogServiceModVerIdLookup lookup = watchdogModVerIdLookupRepository.findOneByDistributionId(distributionId); @@ -156,28 +163,29 @@ public class WatchdogDistribution { if(lookup != null) { serviceModelVersionId = lookup.getServiceModelVersionId(); } - - LOGGER.debug("Executed RequestDB getWatchdogServiceModVerIdLookup with distributionId: " + distributionId + " and serviceModelVersionId: " + serviceModelVersionId); - LOGGER.debug("ASDC Notification ServiceModelInvariantUUID : " + serviceModelInvariantUUID); + + logger.debug("Executed RequestDB getWatchdogServiceModVerIdLookup with distributionId: {} " + + "and serviceModelVersionId: {}", distributionId, serviceModelVersionId); + logger.debug("ASDC Notification ServiceModelInvariantUUID : {}", serviceModelInvariantUUID); if(serviceModelInvariantUUID == null || "".equals(serviceModelVersionId)) { String error = "No Service found with serviceModelInvariantUUID: " + serviceModelInvariantUUID; - LOGGER.debug(error); + logger.debug(error); throw new Exception(error); } AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.MODEL_VER, serviceModelInvariantUUID, serviceModelVersionId); aaiUri.depth(Depth.ZERO); //Do not return relationships if any - LOGGER.debug("Target A&AI Resource URI: " + aaiUri.build().toString()); + logger.debug("Target A&AI Resource URI: {}", aaiUri.build().toString()); Map<String, String> payload = new HashMap<>(); payload.put("distribution-status", distributionStatus); getAaiClient().update(aaiUri, payload); - - LOGGER.debug("A&AI UPDATE MODEL Version is success!"); + + logger.debug("A&AI UPDATE MODEL Version is success!"); } catch (Exception e) { - LOGGER.debug("Exception occurred on executePatchAAI : " + e.getMessage()); - LOGGER.error(e); + logger.debug("Exception occurred on executePatchAAI : {}", e.getMessage()); + logger.error("Exception occurred", e); throw new Exception(e); } } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/NotificationLogging.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/NotificationLogging.java index 965f8b7d49..fae1da374a 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/util/NotificationLogging.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/NotificationLogging.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -34,15 +36,16 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.onap.so.logger.MsoLogger; import org.onap.sdc.api.notification.INotificationData; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class NotificationLogging implements InvocationHandler { private static Map<Object, List<Method>> objectMethodsToLog = new HashMap<>(); - protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC, NotificationLogging.class); + protected static final Logger logger = LoggerFactory.getLogger(NotificationLogging.class); private static InvocationHandler handler = (arg0, arg1, arg2) -> { List<Method> methods = objectMethodsToLog.get(arg0); @@ -93,7 +96,7 @@ public class NotificationLogging implements InvocationHandler { buffer.append(testNull(m.invoke(iNotif, (Object[])null))); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - LOGGER.debug("Exception :"+e); + logger.debug("Exception", e); buffer.append("UNREADABLE"); } buffer.append(System.lineSeparator()); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java index 1157750312..2dbf2feaf7 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -36,6 +38,8 @@ import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.CryptoUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @@ -53,6 +57,8 @@ import org.springframework.stereotype.Component; @Component public class BpmnRestClient { + private static Logger logger = LoggerFactory.getLogger(BpmnRestClient.class); + public static final String DEFAULT_BPEL_AUTH = "admin:admin"; public static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; @@ -64,7 +70,6 @@ public class BpmnRestClient { private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; @Autowired private UrnPropertiesReader urnPropertiesReader; - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BpmnRestClient.class); private static boolean noProperties = true; @@ -101,7 +106,7 @@ public class BpmnRestClient { RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(recipeTimeout).setConnectTimeout(recipeTimeout).setConnectionRequestTimeout(recipeTimeout).build(); post.setConfig(requestConfig); - msoLogger.debug("call the bpmn, url:" + recipeUri); + logger.debug("call the bpmn, url: {}", recipeUri); String jsonReq = wrapResourceRequest(requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, requestDetails, recipeParamXsd); StringEntity input = new StringEntity(jsonReq); @@ -177,10 +182,10 @@ public class BpmnRestClient { recipeRequest.setResourceInput(resourceInput); recipeRequest.setRecipeTimeout(recipeTimeoutInput); jsonReq = recipeRequest.toString(); - msoLogger.trace("request body is " + jsonReq); + logger.trace("request body is {}", jsonReq); } catch(Exception e) { - msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapVIDRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request", - e); + logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest", + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); } return jsonReq; } @@ -198,7 +203,7 @@ public class BpmnRestClient { try { return CryptoUtils.decrypt(prop, urnPropertiesReader.getVariable(encryptionKey)); } catch(GeneralSecurityException e) { - msoLogger.debug("Security exception", e); + logger.debug("Security exception", e); } return defaultValue; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java index f574288a67..2119b2dfa8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -20,7 +22,6 @@ package org.onap.so.bpmn.common.recipe; import org.onap.so.bpmn.core.domain.ModelInfo; -import org.onap.so.logger.MsoLogger; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -28,6 +29,8 @@ import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * the inputs for the resource recipe @@ -42,7 +45,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; @JsonRootName("variables") public class ResourceInput { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, ResourceInput.class); + private static Logger logger = LoggerFactory.getLogger(ResourceInput.class); @JsonProperty("resourceInstanceName") private String resourceInstanceName; @@ -307,8 +310,8 @@ public class ResourceInput { String jsonStr = ""; try { jsonStr = mapper.writeValueAsString(this); - } catch(JsonProcessingException e) { - msoLogger.error("JsonProcessingException", e); + } catch (JsonProcessingException e) { + logger.error("JsonProcessingException", e); } return jsonStr; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java index 4c6edfa099..d1e26582a3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -20,14 +22,14 @@ package org.onap.so.bpmn.common.recipe; -import org.onap.so.logger.MsoLogger; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * java object of the resource recipe , it @@ -37,7 +39,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; @JsonRootName("variables") public class ResourceRecipeRequest { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, ResourceRecipeRequest.class); + private static Logger logger = LoggerFactory.getLogger(ResourceRecipeRequest.class); @JsonProperty("resourceInput") private BpmnParam resourceInput; @@ -145,15 +147,14 @@ public class ResourceRecipeRequest { @Override public String toString() { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - String jsonStr = "ResourceRecipeRequest"; - try { - jsonStr = mapper.writeValueAsString(this); - } catch(JsonProcessingException e) { - msoLogger.error("JsonProcessingException", e); - } + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + String jsonStr = "ResourceRecipeRequest"; + try { + jsonStr = mapper.writeValueAsString(this); + } catch (JsonProcessingException e) { + logger.error("JsonProcessingException", e); + } return jsonStr; } - } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java index 750f25532c..03f56b31f6 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -38,7 +38,6 @@ import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import com.fasterxml.jackson.core.JsonProcessingException; @@ -46,6 +45,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ResourceRequestBuilder { @@ -53,7 +54,7 @@ public class ResourceRequestBuilder { private static String SERVICE_URL_SERVICE_INSTANCE = "/v2/serviceResources"; - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ResourceRequestBuilder.class); + private static Logger logger = LoggerFactory.getLogger(ResourceRequestBuilder.class); static JsonUtils jsonUtil = new JsonUtils(); @@ -74,7 +75,7 @@ public class ResourceRequestBuilder { } } } catch (Exception e) { - LOGGER.error("not able to retrieve service order."); + logger.error("not able to retrieve service order."); } return resourceSequence; } @@ -161,7 +162,7 @@ public class ResourceRequestBuilder { } } catch (Exception e) { - LOGGER.error("not able to retrieve service instance"); + logger.error("not able to retrieve service instance"); } return new HashMap(); } @@ -227,8 +228,8 @@ public class ResourceRequestBuilder { mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); try { return mapper.readValue(jsonstr, type); - } catch(IOException e) { - LOGGER.error("fail to unMarshal json" + e.getMessage ()); + } catch (IOException e) { + logger.error("fail to unMarshal json {}", e.getMessage()); } return null; } @@ -239,8 +240,8 @@ public class ResourceRequestBuilder { String jsonStr = null; try { jsonStr = mapper.writeValueAsString(srcObj); - } catch(JsonProcessingException e) { - LOGGER.error("SdcToscaParserException", e); + } catch (JsonProcessingException e) { + logger.error("SdcToscaParserException", e); } return jsonStr; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java index 093dac39c3..0fd0d9297d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -25,10 +27,11 @@ import java.security.GeneralSecurityException; import java.util.Properties; import org.onap.so.utils.CryptoUtils; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class CryptoHandler implements ICryptoHandler { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CryptoHandler.class); + private static final Logger logger = LoggerFactory.getLogger(CryptoHandler.class); private static final String GENERAL_SECURITY_EXCEPTION_PREFIX = "GeneralSecurityException :"; private static final String MSO_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; private static final String PROPERTY_KEY = "mso.AaiEncrypted.Pwd"; @@ -40,7 +43,7 @@ public class CryptoHandler implements ICryptoHandler { keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("urn.properties")); return CryptoUtils.decrypt((String) keyProp.get(PROPERTY_KEY), MSO_KEY); } catch (GeneralSecurityException | IOException e) { - LOGGER.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); + logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); return null; } } @@ -51,7 +54,7 @@ public class CryptoHandler implements ICryptoHandler { try { return CryptoUtils.encrypt(plainMsoPwd, MSO_KEY); } catch (GeneralSecurityException e) { - LOGGER.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); + logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); return null; } } @@ -61,7 +64,7 @@ public class CryptoHandler implements ICryptoHandler { try { return CryptoUtils.decrypt(encryptedPwd, MSO_KEY); } catch (GeneralSecurityException e) { - LOGGER.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); + logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); return null; } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java index df7b57f3a3..6b178bd215 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018. Intel Corp. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -24,16 +26,14 @@ import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.HomingInstance; import org.onap.so.db.catalog.client.CatalogDbClient; -import org.onap.so.logger.MsoLogger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import java.util.Arrays; import java.util.Optional; public class OofInfraUtils { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, OofInfraUtils.class); + private static final Logger logger = LoggerFactory.getLogger(OofInfraUtils.class); /** * This method creates a cloudsite in catalog database. @@ -53,16 +53,16 @@ public class OofInfraUtils { getCloudsite = Optional.ofNullable(client.getCloudSite(cloudSite.getId(), endpoint + "/cloudSite/")).orElse(new CloudSite()); if (!cloudSite.getId().equals(getCloudsite.getId())) { client.postCloudSite(cloudSite); - LOGGER.debug("Did not findd cloudsite : " + cloudSite.getId()); - LOGGER.debug("Will create cloudSite: " + cloudSite.toString()); + logger.debug("Did not findd cloudsite : {}", cloudSite.getId()); + logger.debug("Will create cloudSite: {}", cloudSite.toString()); } else { - LOGGER.debug("Found cloudsite : " + cloudSite.getId()); - LOGGER.debug("Will not create cloudSite: " + cloudSite.toString()); + logger.debug("Found cloudsite : {}", cloudSite.getId()); + logger.debug("Will not create cloudSite: {}", cloudSite.toString()); } } catch (Exception e) { - LOGGER.debug("Error looking up or creating cloudsite : " + cloudSite.getId()); - LOGGER.debug("CloudSite Lookup/Creation Error: " + e); + logger.debug("Error looking up or creating cloudsite : {}", cloudSite.getId()); + logger.debug("CloudSite Lookup/Creation Error: " + e); } @@ -83,8 +83,8 @@ public class OofInfraUtils { try { client.postHomingInstance(homingInstance); } catch (Exception exception) { - LOGGER.debug("Could not create HomingInstance : " + homingInstance.getServiceInstanceId()); - LOGGER.debug("HomingInstance Creation Error: " + exception); + logger.debug("Could not create HomingInstance : {}", homingInstance.getServiceInstanceId()); + logger.debug("HomingInstance Creation Error: {}", exception); } } @@ -104,8 +104,8 @@ public class OofInfraUtils { try { return client.getHomingInstance(serviceInstanceId, endpoint + "/homingInstance/"); } catch (Exception exception) { - LOGGER.debug("Could not get HomingInstance for serviceInstanceId : " + serviceInstanceId); - LOGGER.debug("Get HomingInstance Error: " + exception); + logger.debug("Could not get HomingInstance for serviceInstanceId : {}", serviceInstanceId); + logger.debug("Get HomingInstance Error: {}", exception); } return null; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java index 636c8e32cf..5352fc2fe0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java @@ -122,7 +122,7 @@ public abstract class FlowValidatorRunner<S extends FlowValidator, E extends Flo protected List<FlowValidator> filterValidators(List<? extends FlowValidator> validators, String bbName) { return validators.stream() .filter(item -> { - return item.shouldRunFor(bbName); + return !item.getClass().isAnnotationPresent(Skip.class) && item.shouldRunFor(bbName); }) .sorted(Comparator.comparing(item -> { Priority p = Optional.ofNullable(item.getClass().getAnnotation(Priority.class)).orElse(new Priority() { 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 new file mode 100644 index 0000000000..0148e8f10c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/Skip.java @@ -0,0 +1,9 @@ +package org.onap.so.bpmn.common.validation; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +public @interface Skip { + +} 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 eb7290b685..db7f1da10f 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 @@ -5,6 +5,8 @@ package org.onap.so.bpmn.common.workflow.context; * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -26,6 +28,8 @@ import java.util.concurrent.TimeUnit; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; /** @@ -37,7 +41,7 @@ import org.springframework.stereotype.Component; @Component public class WorkflowContextHolder { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,WorkflowContextHolder.class); + private static Logger logger = LoggerFactory.getLogger(WorkflowContextHolder.class); private static final String logMarker = "[WORKFLOW-CONTEXT-HOLDER]"; private static WorkflowContextHolder instance = null; @@ -67,14 +71,12 @@ public class WorkflowContextHolder { } public void put(WorkflowContext context) { - msoLogger.debug(logMarker + " Adding context to the queue: " - + context.getRequestId()); + logger.debug("{} Adding context to the queue: {}", logMarker, context.getRequestId()); responseQueue.put(context); } public void remove(WorkflowContext context) { - msoLogger.debug(logMarker + " Removing context from the queue: " - + context.getRequestId()); + logger.debug("{} Removing context from the queue: {}", logMarker, context.getRequestId()); responseQueue.remove(context); } @@ -120,18 +122,20 @@ public class WorkflowContextHolder { try { WorkflowContext requestObject = responseQueue.take(); MsoLogger.setLogContext(requestObject.getRequestId(), null); - msoLogger.debug("Time remaining for request id: " + requestObject.getRequestId() + ":" + requestObject.getDelay(TimeUnit.MILLISECONDS)); - msoLogger.debug("Preparing timeout response for " + requestObject.getProcessKey() + ":" + ":" + requestObject.getRequestId()); + logger.debug("Time remaining for request id: {}:{}", requestObject.getRequestId(), requestObject + .getDelay + (TimeUnit.MILLISECONDS)); + logger.debug("Preparing timeout response for {}:{}", requestObject.getProcessKey(), requestObject + .getRequestId()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (Exception e) { - msoLogger.debug("WorkflowContextHolder timeout thread caught exception: " + e); - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, "Error in WorkflowContextHolder timeout thread"); - + logger.debug("WorkflowContextHolder timeout thread caught exception: ", e); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Error in WorkflowContextHolder timeout thread"); } } - msoLogger.debug("WorkflowContextHolder timeout thread interrupted, quitting"); + logger.debug("WorkflowContextHolder timeout thread interrupted, quitting"); } } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java index d37c8d13f3..cd66e512a5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java @@ -43,7 +43,7 @@ public class RequestContext implements Serializable{ @JsonProperty("subscription-service-type") private String subscriptionServiceType; @JsonProperty("user-params") - private HashMap<String, String> userParams; + private Map<String, Object> userParams = new HashMap<>(); @JsonProperty("action") private String action; @JsonProperty("callback-url") @@ -87,10 +87,10 @@ public class RequestContext implements Serializable{ public void setSubscriptionServiceType(String subscriptionServiceType) { this.subscriptionServiceType = subscriptionServiceType; } - public HashMap<String, String> getUserParams() { + public Map<String, Object> getUserParams() { return userParams; } - public void setUserParams(HashMap<String, String> userParams) { + public void setUserParams(Map<String, Object> userParams) { this.userParams = userParams; } public String getAction() { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java index 1e390701df..3761d26d0b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -25,20 +27,20 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import org.onap.so.logger.MsoLogger; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @JsonRootName(value = "requestParameters") @JsonInclude(Include.NON_DEFAULT) public class RequestParameters implements Serializable { - private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, RequestParameters.class); + private static final Logger logger = LoggerFactory.getLogger(RequestParameters.class); private static final long serialVersionUID = -5979049912538894930L; @JsonProperty("subscriptionServiceType") @@ -122,7 +124,7 @@ public class RequestParameters implements Serializable { try{ json = ow.writeValueAsString(this); }catch (Exception e){ - log.error("Unable to convert Sniro Manager Request to string", e); + logger.error("Unable to convert Sniro Manager Request to string", e); } return json; } @@ -133,4 +135,4 @@ public class RequestParameters implements Serializable { + subscriptionServiceType + ", userParams=" + userParams + ", aLaCarte=" + aLaCarte + "]"; } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index fbff0620a3..fb3094665e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -75,7 +77,6 @@ import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.request.beans.InfraActiveRequests; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; @@ -87,17 +88,18 @@ import org.onap.so.serviceinstancebeans.RequestParameters; import org.onap.so.serviceinstancebeans.Resources; import org.onap.so.serviceinstancebeans.VfModules; import org.onap.so.serviceinstancebeans.Vnfs; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @Component("BBInputSetup") public class BBInputSetup implements JavaDelegate { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BBInputSetup.class); + private static final Logger logger = LoggerFactory.getLogger(BBInputSetup.class); private static final String FLOW_VAR_NAME = "flowToBeCalled"; private static final String LOOKUP_KEY_MAP_VAR_NAME = "lookupKeyMap"; private static final String GBB_INPUT_VAR_NAME = "gBBInput"; @@ -157,7 +159,7 @@ public class BBInputSetup implements JavaDelegate { outputBB = this.getGBB(executeBB, lookupKeyMap, requestAction, aLaCarte, resourceId, vnfType); ObjectMapper mapper = new ObjectMapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); - msoLogger.debug("GeneralBB: " + mapper.writeValueAsString(outputBB)); + logger.debug("GeneralBB: " + mapper.writeValueAsString(outputBB)); setHomingFlag(outputBB, homing, lookupKeyMap); @@ -170,7 +172,7 @@ public class BBInputSetup implements JavaDelegate { execution.setVariable("RetryCount", 1); execution.setVariable("handlingCode", "Success"); } catch (Exception e) { - msoLogger.error(e); + logger.error("Exception occurred", e); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e.getMessage()); } } @@ -244,8 +246,8 @@ public class BBInputSetup implements JavaDelegate { resourceId, vnfType); return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); } else { - msoLogger.debug("Related Service Instance from AAI: " + aaiServiceInstance); - msoLogger.debug("Related Service Instance Model Info from AAI: " + service); + logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance); + logger.debug("Related Service Instance Model Info from AAI: {}", service); throw new Exception("Could not find relevant information for related Service Instance"); } } @@ -419,7 +421,7 @@ public class BBInputSetup implements JavaDelegate { mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); } } else { - msoLogger.debug("Related VNF instance Id not found: " + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + logger.debug("Related VNF instance Id not found: {}", lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); throw new Exception("Could not find relevant information for related VNF"); } } @@ -526,7 +528,7 @@ public class BBInputSetup implements JavaDelegate { mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); } } else { - msoLogger.debug("Related VNF instance Id not found: " + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + logger.debug("Related VNF instance Id not found: {}", lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); throw new Exception("Could not find relevant information for related VNF"); } } @@ -968,10 +970,10 @@ public class BBInputSetup implements JavaDelegate { this.populateL3Network(null, networkModelInfo, service, bbName, serviceInstance, lookupKeyMap, networkId, null); } else { - msoLogger.debug("Could not find a network customization with key: " + key); + logger.debug("Could not find a network customization with key: {}", key); } } else { - msoLogger.debug("Orchestrating on Collection Network Resource Customization"); + logger.debug("Orchestrating on Collection Network Resource Customization"); CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key); L3Network l3Network = getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId, collectionNetworkResourceCust, serviceInstance); NetworkResourceCustomization networkResourceCustomization = @@ -1039,8 +1041,8 @@ public class BBInputSetup implements JavaDelegate { serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service)); gBB = populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); } else { - msoLogger.debug("Related Service Instance from AAI: " + aaiServiceInstance); - msoLogger.debug("Related Service Instance Model Info from AAI: " + service); + logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance); + logger.debug("Related Service Instance Model Info from AAI: {}", service); throw new Exception("Could not find relevant information for related Service Instance"); } ServiceInstance serviceInstance = gBB.getServiceInstance(); @@ -1212,7 +1214,7 @@ public class BBInputSetup implements JavaDelegate { if(configurationCust != null) { this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys()); } else { - msoLogger.debug("Could not find a configuration customization with key: " + key); + logger.debug("Could not find a configuration customization with key: {}", key); } } return gBB; @@ -1276,7 +1278,7 @@ public class BBInputSetup implements JavaDelegate { org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration); return mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion); } else { - msoLogger.debug("Could not find any cloud configuration for this request."); + logger.debug("Could not find any cloud configuration for this request."); return null; } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 641f7f557c..108fd66488 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -78,9 +80,10 @@ import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.RequestDetails; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Component("BBInputSetupMapperLayer") @@ -88,8 +91,7 @@ public class BBInputSetupMapperLayer { private static final String USER_PARAM_NAME_KEY = "name"; private static final String USER_PARAM_VALUE_KEY = "value"; - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - BBInputSetupMapperLayer.class); + private static final Logger logger = LoggerFactory.getLogger(BBInputSetupMapperLayer.class); private ModelMapper modelMapper = new ModelMapper(); @@ -353,14 +355,14 @@ public class BBInputSetupMapperLayer { return requestParams; } - protected HashMap<String,String> mapNameValueUserParams(org.onap.so.serviceinstancebeans.RequestParameters requestParameters) { - HashMap<String,String> userParamsResult = new HashMap<String,String>(); + protected Map<String,Object> mapNameValueUserParams(org.onap.so.serviceinstancebeans.RequestParameters requestParameters) { + Map<String,Object> userParamsResult = new HashMap<String,Object>(); if (requestParameters.getUserParams() != null) { List<Map<String, Object>> userParams = requestParameters.getUserParams(); for (Map<String, Object> userParamsMap : userParams) { if ( userParamsMap.containsKey(USER_PARAM_NAME_KEY) && (userParamsMap.get(USER_PARAM_NAME_KEY) instanceof String) - && userParamsMap.containsKey(USER_PARAM_VALUE_KEY) && (userParamsMap.get(USER_PARAM_VALUE_KEY) instanceof String)) { - userParamsResult.put((String) userParamsMap.get(USER_PARAM_NAME_KEY), (String) userParamsMap.get(USER_PARAM_VALUE_KEY)); + && userParamsMap.containsKey(USER_PARAM_VALUE_KEY)) { + userParamsResult.put((String) userParamsMap.get(USER_PARAM_NAME_KEY), userParamsMap.get(USER_PARAM_VALUE_KEY)); } } } @@ -490,4 +492,4 @@ public class BBInputSetupMapperLayer { CollectionNetworkResourceCustomization collectionNetworkResourceCust) { return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class); } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java index 4617fc4710..b3b4559f1d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -55,9 +57,10 @@ import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.RequestDetails; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -68,7 +71,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; @Component("BBInputSetupUtils") public class BBInputSetupUtils { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BBInputSetupUtils.class); + private static final Logger logger = LoggerFactory.getLogger(BBInputSetupUtils.class); private ObjectMapper objectMapper = new ObjectMapper(); private static final String REQUEST_ERROR = "Could not find request."; @@ -86,7 +89,7 @@ public class BBInputSetupUtils { request.setVnfId(vnfId); this.requestsDbClient.updateInfraActiveRequests(request); } else { - msoLogger.debug(REQUEST_ERROR); + logger.debug(REQUEST_ERROR); } } @@ -95,7 +98,7 @@ public class BBInputSetupUtils { request.setVfModuleId(vfModuleId); this.requestsDbClient.updateInfraActiveRequests(request); } else { - msoLogger.debug(REQUEST_ERROR); + logger.debug(REQUEST_ERROR); } } @@ -104,7 +107,7 @@ public class BBInputSetupUtils { request.setVolumeGroupId(volumeGroupId); this.requestsDbClient.updateInfraActiveRequests(request); } else { - msoLogger.debug(REQUEST_ERROR); + logger.debug(REQUEST_ERROR); } } @@ -113,7 +116,7 @@ public class BBInputSetupUtils { request.setNetworkId(networkId); this.requestsDbClient.updateInfraActiveRequests(request); } else { - msoLogger.debug(REQUEST_ERROR); + logger.debug(REQUEST_ERROR); } } @@ -226,7 +229,7 @@ public class BBInputSetupUtils { customer.getServiceSubscription().getServiceType()) .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO)) .orElseGet(() -> { - msoLogger.debug("No Service Instance matched by name"); + logger.debug("No Service Instance matched by name"); return null; }); } @@ -254,7 +257,7 @@ public class BBInputSetupUtils { AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, globalCustomerId, serviceType) .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO)) .orElseGet(() -> { - msoLogger.debug("No Service Instance matched by name"); + logger.debug("No Service Instance matched by name"); return null; }); } @@ -299,7 +302,7 @@ public class BBInputSetupUtils { return this.injectionHelper.getAaiClient().get(Configuration.class, AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId).depth(Depth.ONE)) .orElseGet(() -> { - msoLogger.debug("No Configuration matched by id"); + logger.debug("No Configuration matched by id"); return null; }); } @@ -309,7 +312,7 @@ public class BBInputSetupUtils { return this.injectionHelper.getAaiClient().get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)) .orElseGet(() -> { - msoLogger.debug("No Generic Vnf matched by id"); + logger.debug("No Generic Vnf matched by id"); return null; }); } @@ -318,7 +321,7 @@ public class BBInputSetupUtils { return this.injectionHelper.getAaiClient().get(VolumeGroup.class, AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwnerId, cloudRegionId, volumeGroupId).depth(Depth.ONE)) .orElseGet(() -> { - msoLogger.debug("No Generic Vnf matched by id"); + logger.debug("No Generic Vnf matched by id"); return null; }); } @@ -327,7 +330,7 @@ public class BBInputSetupUtils { return this.injectionHelper.getAaiClient().get(VfModule.class, AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId).depth(Depth.ONE)) .orElseGet(() -> { - msoLogger.debug("No Generic Vnf matched by id"); + logger.debug("No Generic Vnf matched by id"); return null; }); } @@ -337,7 +340,7 @@ public class BBInputSetupUtils { return this.injectionHelper.getAaiClient().get(L3Network.class, AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE)) .orElseGet(() -> { - msoLogger.debug("No Generic Vnf matched by id"); + logger.debug("No Generic Vnf matched by id"); return null; }); @@ -349,7 +352,7 @@ public class BBInputSetupUtils { Optional<L3Networks> networks = injectionHelper.getAaiClient().get(L3Networks.class, uri); L3Network network = null; if (!networks.isPresent()) { - msoLogger.debug("No Networks matched by name"); + logger.debug("No Networks matched by name"); return Optional.empty(); } else { if (networks.get().getL3Network().size() > 1) { @@ -367,7 +370,7 @@ public class BBInputSetupUtils { Optional<GenericVnfs> vnfs = injectionHelper.getAaiClient().get(GenericVnfs.class, uri); GenericVnf vnf = null; if (!vnfs.isPresent()) { - msoLogger.debug("No Vnfs matched by name"); + logger.debug("No Vnfs matched by name"); return Optional.empty(); } else { if (vnfs.get().getGenericVnf().size() > 1) { @@ -385,7 +388,7 @@ public class BBInputSetupUtils { Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri); VolumeGroup volumeGroup = null; if (!volumeGroups.isPresent()) { - msoLogger.debug("No VolumeGroups matched by name"); + logger.debug("No VolumeGroups matched by name"); return Optional.empty(); } else { if (volumeGroups.get().getVolumeGroup().size() > 1) { @@ -403,7 +406,7 @@ public class BBInputSetupUtils { Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri); VolumeGroup volumeGroup = null; if (!volumeGroups.isPresent()) { - msoLogger.debug("No VolumeGroups matched by name"); + logger.debug("No VolumeGroups matched by name"); return Optional.empty(); } else { if (volumeGroups.get().getVolumeGroup().size() > 1) { @@ -414,4 +417,4 @@ public class BBInputSetupUtils { return Optional.of(volumeGroup); } } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java index d7d1fecd1a..7fcc613913 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -31,7 +33,8 @@ import org.onap.so.client.aai.AAICommonObjectMapperProvider; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -40,7 +43,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; @Component public class CloudInfoFromAAI { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CloudInfoFromAAI.class); + private static final Logger logger = LoggerFactory.getLogger(CloudInfoFromAAI.class); @Autowired private BBInputSetupUtils bbInputSetupUtils; @@ -63,13 +66,13 @@ public class CloudInfoFromAAI { new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiL3Network)); relationshipsOp = getRelationshipsFromWrapper(networkWrapper); } else { - msoLogger.debug("BBInputSetup could not find a cloud region or tenant, since there are no resources under the SI."); + logger.debug("BBInputSetup could not find a cloud region or tenant, since there are no resources under the SI."); return Optional.empty(); } if (relationshipsOp.isPresent()) { return getRelatedCloudRegionAndTenant(relationshipsOp.get()); } else { - msoLogger.debug("BBInputSetup could not find a cloud region or tenant"); + logger.debug("BBInputSetup could not find a cloud region or tenant"); return Optional.empty(); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java index ee7999f995..aa992d6153 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -33,7 +35,8 @@ import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @@ -41,8 +44,7 @@ import org.springframework.stereotype.Component; @Component public class ExecuteBuildingBlockRainyDay { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - ExecuteBuildingBlockRainyDay.class); + private static final Logger logger = LoggerFactory.getLogger(ExecuteBuildingBlockRainyDay.class); public static final String HANDLING_CODE = "handlingCode"; @Autowired @@ -65,7 +67,7 @@ public class ExecuteBuildingBlockRainyDay { String RetryDuration = "PT" + retryTimeToWait + "S"; execution.setVariable("RetryDuration", RetryDuration); } catch (Exception e) { - msoLogger.error(e); + logger.error("Exception occurred", e); throw new BpmnError("Unknown error incrementing retry counter"); } } @@ -81,6 +83,15 @@ public class ExecuteBuildingBlockRainyDay { boolean aLaCarte = (boolean) execution.getVariable("aLaCarte"); boolean suppressRollback = (boolean) execution.getVariable("suppressRollback"); String handlingCode = ""; + + WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException"); + try { + // Extract error data to be returned to WorkflowAction + execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage()); + } catch (Exception e) { + logger.error("No WorkflowException Found",e); + } + if (suppressRollback) { handlingCode = "Abort"; } else { @@ -101,7 +112,7 @@ public class ExecuteBuildingBlockRainyDay { } catch (Exception ex) { // keep default vnfType value } - WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException"); + String errorCode = ASTERISK; try { errorCode = "" + workflowException.getErrorCode(); @@ -121,12 +132,6 @@ public class ExecuteBuildingBlockRainyDay { // keep default workStep value } - try { - // Extract error data to be returned to WorkflowAction - execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage()); - } catch (Exception e) { - msoLogger.error("No WorkflowException Found",e); - } RainyDayHandlerStatus rainyDayHandlerStatus; rainyDayHandlerStatus = catalogDbClient .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName, @@ -163,25 +168,25 @@ public class ExecuteBuildingBlockRainyDay { request.setRetryStatusMessage("Retries have been exhausted."); requestDbclient.updateInfraActiveRequests(request); } catch (Exception ex) { - msoLogger.error("Failed to update Request Db Infra Active Requests with Retry Status",ex); + logger.error("Failed to update Request Db Infra Active Requests with Retry Status",ex); } } if (handlingCode.equals("RollbackToAssigned") && !aLaCarte) { handlingCode = "Rollback"; } } - msoLogger.debug("RainyDayHandler Status Code is: " + handlingCode); + logger.debug("RainyDayHandler Status Code is: {}", handlingCode); execution.setVariable(HANDLING_CODE, handlingCode); } catch (Exception e) { String code = this.environment.getProperty(defaultCode); - msoLogger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = "+ code, e); + logger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = {}", code, e); execution.setVariable(HANDLING_CODE, code); } try{ int envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries)); execution.setVariable("maxRetries", envMaxRetries); } catch (Exception ex) { - msoLogger.error("Could not read maxRetries from config file. Setting max to 5 retries"); + logger.error("Could not read maxRetries from config file. Setting max to 5 retries"); execution.setVariable("maxRetries", 5); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java index a212668fec..79f4a07974 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -33,7 +35,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.client.exception.BBObjectNotFoundException; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import com.google.common.base.CaseFormat; @@ -41,7 +44,7 @@ import com.google.common.base.CaseFormat; @Component public class ExtractPojosForBB { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExtractPojosForBB.class); + private static final Logger logger = LoggerFactory.getLogger(ExtractPojosForBB.class); public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value) throws BBObjectNotFoundException { @@ -93,7 +96,8 @@ public class ExtractPojosForBB { } catch (BBObjectNotFoundException e) { // re-throw parent object not found throw e; } catch (Exception e) { // convert all other exceptions to object not found - msoLogger.warnSimple("BBObjectNotFoundException in ExtractPojosForBB", "BBObject " + key + " was not found in gBBInput using reference value: " + value); + logger.warn("BBObjectNotFoundException in ExtractPojosForBB", "BBObject " + key + " was not found in " + + "gBBInput using reference value: " + value); throw new BBObjectNotFoundException(key, value); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java index af7c608fee..cbedefe7eb 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -27,7 +29,8 @@ import org.onap.so.client.avpn.dmaap.beans.AsyncRequestStatus; import org.onap.so.client.avpn.dmaap.beans.InstanceReferences; import org.onap.so.client.avpn.dmaap.beans.RequestStatus; import org.onap.so.client.exception.MapperException; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -37,7 +40,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Component public class DmaapPropertiesClient { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DmaapPropertiesClient.class); + private static final Logger logger = LoggerFactory.getLogger(DmaapPropertiesClient.class); @Autowired private Provider<GlobalDmaapPublisher> dmaapPublisher; @@ -62,7 +65,7 @@ public class DmaapPropertiesClient { try { return new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(dmaapBean); } catch (JsonProcessingException e) { - msoLogger.error(e); + logger.error("Exception occurred", e); throw new MapperException(e.getMessage()); } } 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 459ef66e5b..d43218c584 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 @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -27,16 +29,18 @@ import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Component public class ExceptionBuilder { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExceptionBuilder.class); + private static final Logger logger = LoggerFactory.getLogger(ExceptionBuilder.class); public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception) { String msg = "Exception in %s.%s "; try{ - msoLogger.error(exception); + logger.error("Exception occurred", exception); String errorVariable = "Error%s%s"; @@ -50,11 +54,12 @@ public class ExceptionBuilder { } } - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, msg.toString()); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString()); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex){ //log trace, allow process to complete gracefully - msoLogger.error(ex); + logger.error("Exception occurred", ex); } if (exception.getMessage() != null) @@ -65,7 +70,7 @@ public class ExceptionBuilder { public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception) { String msg = "Exception in %s.%s "; try{ - msoLogger.error(exception); + logger.error("Exception occurred", exception); String errorVariable = "Error%s%s"; @@ -78,11 +83,12 @@ public class ExceptionBuilder { break; } } - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, msg.toString()); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString()); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex){ //log trace, allow process to complete gracefully - msoLogger.error(ex); + logger.error("Exception occurred", ex); } if (exception.getMessage() != null) @@ -98,13 +104,13 @@ public class ExceptionBuilder { public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) { String processKey = getProcessKey(execution); - msoLogger.info("Building a WorkflowException for Subflow"); + logger.info("Building a WorkflowException for Subflow"); WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage); execution.setVariable("WorkflowException", exception); execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); - msoLogger.info("Outgoing WorkflowException is " + exception); - msoLogger.info("Throwing MSOWorkflowException"); + logger.info("Outgoing WorkflowException is {}", exception); + logger.info("Throwing MSOWorkflowException"); throw new BpmnError("MSOWorkflowException"); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java index a513acc952..63e5ccbbf3 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -27,7 +29,8 @@ import org.camunda.bpm.application.PostDeploy; import org.camunda.bpm.application.PreUndeploy; import org.camunda.bpm.application.ProcessApplicationInfo; import org.camunda.bpm.engine.ProcessEngine; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -49,8 +52,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)}) public class MSOCommonApplication { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - MSOCommonApplication.class); + private static final Logger logger = LoggerFactory.getLogger(MSOCommonApplication.class); @Value("${mso.async.core-pool-size}") private int corePoolSize; @@ -78,20 +80,11 @@ public class MSOCommonApplication { @PostDeploy public void postDeploy(ProcessEngine processEngineInstance) { - long startTime = System.currentTimeMillis(); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Post deployment complete..."); } @PreUndeploy public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo, List<ProcessEngine> processEngines) { - long startTime = System.currentTimeMillis(); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Pre Undeploy complete..."); - } @Bean @@ -105,4 +98,4 @@ public class MSOCommonApplication { executor.initialize(); return executor; } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyDisabledValidator.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyDisabledValidator.java new file mode 100644 index 0000000000..78e4791b1c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyDisabledValidator.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.util.Collections; +import java.util.Optional; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.springframework.stereotype.Component; + +@Component +@Skip +public class MyDisabledValidator implements PreBuildingBlockValidator { + + @Override + public boolean shouldRunFor(String bbName) { + + return Collections.singleton("test").contains(bbName); + } + + @Override + public Optional<String> validate(BuildingBlockExecution exeuction) { + return Optional.of("my-disabled-validator"); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/FileUtil.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/FileUtil.java index b6acdf7adb..6a3668b175 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/FileUtil.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/FileUtil.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -22,7 +24,8 @@ package org.onap.so.bpmn.mock; import java.io.IOException; import java.io.InputStream; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -35,7 +38,7 @@ import org.onap.so.logger.MsoLogger; */ public class FileUtil { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, FileUtil.class); + private static final Logger logger = LoggerFactory.getLogger(FileUtil.class); /** * Read the specified resource file and return the contents as a String. @@ -58,7 +61,7 @@ public class FileUtil { return ""; } } catch (IOException e) { - LOGGER.debug("Exception:", e); + logger.debug("Exception:", e); return ""; } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java index f129164b4c..11788be76e 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -24,7 +26,6 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -33,6 +34,8 @@ import com.github.tomakehurst.wiremock.extension.Parameters; import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -41,7 +44,7 @@ import com.github.tomakehurst.wiremock.http.ResponseDefinition; */ public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterMockTransformer.class); + private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterMockTransformer.class); private String callbackResponse; private String requestId; @@ -74,7 +77,7 @@ public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer { String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>")); callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - System.out.println("callbackResponse:" + callbackResponse); + logger.info("callbackResponse:" + callbackResponse); if (this.requestId != null) { callbackResponse = callbackResponse.replace(this.requestId, requestId); @@ -90,7 +93,7 @@ public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer { } //Kick off callback thread - System.out.println("callback Url:" + callbackUrl + ":delay:" + delay); + logger.info("callback Url:" + callbackUrl + ":delay:" + delay); CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay); calbackResponseThread.start(); @@ -128,16 +131,16 @@ public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer { //Delay sending callback response sleep(delay); } catch (InterruptedException e1) { - LOGGER.debug("Exception :",e1); + logger.debug("Exception :", e1); } - LOGGER.debug("Sending callback response:" + callbackUrl); + logger.debug("Sending callback response:" + callbackUrl); try { HttpClient client = new HttpClientFactory().newTextXmlClient( UriBuilder.fromUri(callbackUrl).build().toURL(), TargetEntity.SDNC_ADAPTER); client.post(payLoad); } catch (Exception e) { - LOGGER.debug("Exception :",e); + logger.debug("Exception :", e); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java index 832caae803..344c3b521d 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -25,7 +27,6 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -34,10 +35,12 @@ import com.github.tomakehurst.wiremock.extension.Parameters; import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterNetworkTopologyMockTransformer.class); + private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterNetworkTopologyMockTransformer.class); private String callbackResponse; private String requestId; @@ -61,22 +64,22 @@ public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitio String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>")); String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>")); - System.out.println("request callbackUrl : " + callbackUrl); - System.out.println("request requestId : " + requestId); - - System.out.println("file path/name : " + responseDefinition.getBodyFileName()); + logger.info("request callbackUrl : " + callbackUrl); + logger.info("request requestId : " + requestId); + + logger.info("file path/name : " + responseDefinition.getBodyFileName()); callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); // extract Response responseRequestId String responseRequestId = callbackResponse.substring(callbackResponse.indexOf("<RequestId>")+11, callbackResponse.indexOf("</RequestId>")); - System.out.println("response requestId: " + responseRequestId); - System.out.println("callbackResponse (before): " + callbackResponse); + logger.info("response requestId: " + responseRequestId); + logger.info("callbackResponse (before): " + callbackResponse); callbackResponse = callbackResponse.replace(responseRequestId, requestId); if (this.requestId != null) { callbackResponse = callbackResponse.replace(this.requestId, requestId); } else { callbackResponse = callbackResponse.replace(responseRequestId, requestId); } - System.out.println("callbackResponse (after):" + callbackResponse); + logger.info("callbackResponse (after):" + callbackResponse); Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay"); int delay = 300; @@ -85,7 +88,7 @@ public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitio } //Kick off callback thread - System.out.println("(NetworkTopologyMockTransformer) callback Url:" + callbackUrl + ":delay:" + delay); + logger.info("(NetworkTopologyMockTransformer) callback Url:" + callbackUrl + ":delay:" + delay); CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay); calbackResponseThread.start(); @@ -119,19 +122,18 @@ public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitio sleep(delay); } catch (InterruptedException e1) { // TODO Auto-generated catch block - LOGGER.debug("Exception :",e1); + logger.debug("Exception :", e1); } - LOGGER.debug("Sending callback response to url: " + callbackUrl); + logger.debug("Sending callback response to url: {}", callbackUrl); try { - HttpClient client = new HttpClientFactory().newTextXmlClient( - UriBuilder.fromUri(callbackUrl).build().toURL(), - TargetEntity.SDNC_ADAPTER); + HttpClient client = new HttpClientFactory() + .newTextXmlClient(UriBuilder.fromUri(callbackUrl).build().toURL(), TargetEntity.SDNC_ADAPTER); Response response = client.post(payLoad); - LOGGER.debug("Successfully posted callback? Status: " + response.getStatus()); + logger.debug("Successfully posted callback? Status: {}", response.getStatus()); } catch (Exception e) { // TODO Auto-generated catch block - LOGGER.debug("catch error in - request.post() "); - LOGGER.debug("Exception :",e); + logger.debug("catch error in - request.post() "); + logger.debug("Exception :", e); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java index 107a70d1d0..362d9508d3 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -25,7 +27,6 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -34,6 +35,8 @@ import com.github.tomakehurst.wiremock.extension.Parameters; import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Please describe the VnfAdapterCreateMockTransformer.java class @@ -41,7 +44,7 @@ import com.github.tomakehurst.wiremock.http.ResponseDefinition; */ public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterCreateMockTransformer.class); + private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateMockTransformer.class); private String notifyCallbackResponse; private String ackResponse; @@ -74,17 +77,17 @@ public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransform responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>")); updatedResponse = ackResponse.replace(responseMessageId, messageId); } catch (Exception ex) { - LOGGER.debug("Exception :",ex); + logger.debug("Exception :",ex); System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfCreateSimResponse.xml'"); responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>")); updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); } - System.out.println("response (mock) messageId : " + responseMessageId); - System.out.println("request (replacement) messageId: " + messageId); + logger.info("response (mock) messageId : {}", responseMessageId); + logger.info("request (replacement) messageId: {}", messageId); - System.out.println("vnf Response (before):" + notifyCallbackResponse); - System.out.println("vnf Response (after):" + updatedResponse); + logger.info("vnf Response (before): {}", notifyCallbackResponse); + logger.info("vnf Response (after): {}", updatedResponse); Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); int delay = 300; @@ -93,7 +96,7 @@ public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransform } //Kick off callback thread - System.out.println("VnfAdapterCreateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + logger.info("VnfAdapterCreateMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay); CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); callbackResponseThread.start(); @@ -128,20 +131,19 @@ public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransform sleep(delay); } catch (InterruptedException e1) { // TODO Auto-generated catch block - LOGGER.debug("Exception :",e1); + logger.debug("Exception :",e1); } - LOGGER.debug("Sending callback response to url: " + callbackUrl); + logger.debug("Sending callback response to url: {}", callbackUrl); try { HttpClient client = new HttpClientFactory().newTextXmlClient( UriBuilder.fromUri(callbackUrl).build().toURL(), TargetEntity.VNF_ADAPTER); Response response = client.post(payLoad); - LOGGER.debug("Successfully posted callback? Status: " + response.getStatus()); - //System.err.println("Successfully posted callback:" + result.getStatus()); + logger.debug("Successfully posted callback? Status: {}", response.getStatus()); } catch (Exception e) { // TODO Auto-generated catch block - LOGGER.debug("catch error in - request.post() "); - LOGGER.debug("Exception :",e); + logger.debug("catch error in - request.post() "); + logger.debug("Exception :", e); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java index cf0f966414..b67f3dcedd 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -24,7 +26,6 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -33,6 +34,8 @@ import com.github.tomakehurst.wiremock.extension.Parameters; import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Please describe the VnfAdapterCreateMockTransformer.java class @@ -40,7 +43,7 @@ import com.github.tomakehurst.wiremock.http.ResponseDefinition; */ public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterDeleteMockTransformer.class); + private static final Logger logger = LoggerFactory.getLogger(VnfAdapterDeleteMockTransformer.class); private String notifyCallbackResponse; private String ackResponse; @@ -58,8 +61,6 @@ public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransform public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, FileSource fileSource, Parameters parameters) { - // System.err.println("notifyCallbackResponse:" + notifyCallbackResponse); - String requestBody = request.getBodyAsString(); String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>")); @@ -69,23 +70,23 @@ public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransform try { // try supplied response file (if any) - System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName()); ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); notifyCallbackResponse = ackResponse; responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>")); updatedResponse = ackResponse.replace(responseMessageId, messageId); } catch (Exception ex) { - LOGGER.debug("Exception :",ex); - System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'"); + logger.debug("Exception :",ex); + logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'"); responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>")); updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); } - System.out.println("response (mock) messageId : " + responseMessageId); - System.out.println("request (replacement) messageId: " + messageId); + logger.info("response (mock) messageId : {}", responseMessageId); + logger.info("request (replacement) messageId: {}", messageId); - System.out.println("vnf Response (before):" + notifyCallbackResponse); - System.out.println("vnf Response (after):" + updatedResponse); + logger.info("vnf Response (before):{}", notifyCallbackResponse); + logger.info("vnf Response (after):{}", updatedResponse); Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); int delay = 300; @@ -94,7 +95,7 @@ public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransform } //Kick off callback thread - System.out.println("VnfAdapterDeleteMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + logger.info("VnfAdapterDeleteMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay); CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); callbackResponseThread.start(); @@ -129,7 +130,7 @@ public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransform sleep(delay); } catch (InterruptedException e1) { // TODO Auto-generated catch block - LOGGER.debug("Exception :",e1); + logger.debug("Exception :",e1); } try { @@ -139,8 +140,8 @@ public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransform client.post(payLoad); } catch (Exception e) { // TODO Auto-generated catch block - System.out.println("catch error in - request.post() "); - LOGGER.debug("Exception :",e); + logger.info("catch error in - request.post() "); + logger.debug("Exception :",e); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java index 5eaa4e75b0..48ced35810 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -25,7 +27,6 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -34,6 +35,8 @@ import com.github.tomakehurst.wiremock.extension.Parameters; import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Please describe the VnfAdapterQueryMockTransformer.java class @@ -43,7 +46,8 @@ import com.github.tomakehurst.wiremock.http.ResponseDefinition; public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransformer{ - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterQueryMockTransformer.class); + private static final Logger logger = LoggerFactory.getLogger(VnfAdapterQueryMockTransformer + .class); private String notifyCallbackResponse; private String ackResponse; @@ -70,36 +74,29 @@ public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransforme String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>")); String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>")); - // String updatedResponse = notifyCallbackResponse.replace("b1a82ce6-7f5c-45fd-9273-acaf88fc2137", messageId); - + String responseMessageId = ""; String updatedResponse = ""; - - // if (ackResponse == null) { - //System.err.println("file:" + responseDefinition.getBodyFileName()); - // ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - //} - try { // try supplied response file (if any) - System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName()); ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); notifyCallbackResponse = ackResponse; responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>")); updatedResponse = ackResponse.replace(responseMessageId, messageId); } catch (Exception ex) { - LOGGER.debug("Exception :",ex); - System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'"); + logger.debug("Exception :",ex); + logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'"); responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>")); updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); } - - System.out.println("response (mock) messageId : " + responseMessageId); - System.out.println("request (replacement) messageId: " + messageId); - - System.out.println("vnf Response (before):" + notifyCallbackResponse); - System.out.println("vnf Response (after):" + updatedResponse); + + logger.info("response (mock) messageId : {}", responseMessageId); + logger.info("request (replacement) messageId: {}", messageId); + + logger.info("vnf Response (before):{}", notifyCallbackResponse); + logger.info("vnf Response (after):{}", updatedResponse); Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); @@ -109,12 +106,9 @@ public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransforme } //Kick off callback thread - - //System.out.println("notficationUrl" + notficationUrl); - //System.out.println("updatedResponse" + updatedResponse); - System.out.println("VnfAdapterQueryMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + logger.info("VnfAdapterQueryMockTransformer notficationUrl: {}:delay: {}", notficationUrl, delay); CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); - System.out.println("Inside Callback" ); + logger.info("Inside Callback" ); callbackResponseThread.start(); return ResponseDefinitionBuilder @@ -145,7 +139,7 @@ public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransforme //Delay sending callback response sleep(delay); } catch (InterruptedException e1) { - LOGGER.debug("Exception :",e1); + logger.debug("Exception :",e1); } try { @@ -154,7 +148,7 @@ public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransforme TargetEntity.VNF_ADAPTER); client.post(payLoad); } catch (Exception e) { - LOGGER.debug("Exception :",e); + logger.debug("Exception :",e); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java index 06f2fb7d5f..edf05422d1 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -24,7 +26,6 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -33,6 +34,8 @@ import com.github.tomakehurst.wiremock.extension.Parameters; import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Please describe the VnfAdapterCreateMockTransformer.java class @@ -40,7 +43,7 @@ import com.github.tomakehurst.wiremock.http.ResponseDefinition; */ public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterRollbackMockTransformer.class); + private static final Logger logger = LoggerFactory.getLogger(VnfAdapterRollbackMockTransformer.class); private String notifyCallbackResponse; private String ackResponse; @@ -72,23 +75,23 @@ public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransfo try { // try supplied response file (if any) - System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName()); ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); notifyCallbackResponse = ackResponse; responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>")); updatedResponse = ackResponse.replace(responseMessageId, messageId); } catch (Exception ex) { - LOGGER.debug("Exception :",ex); - System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'"); + logger.debug("Exception :",ex); + logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'"); responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>")); updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); } - - System.out.println("response (mock) messageId : " + responseMessageId); - System.out.println("request (replacement) messageId: " + messageId); - - System.out.println("vnf Response (before):" + notifyCallbackResponse); - System.out.println("vnf Response (after):" + updatedResponse); + + logger.info("response (mock) messageId : {}", responseMessageId); + logger.info("request (replacement) messageId: {}", messageId); + + logger.info("vnf Response (before):{}", notifyCallbackResponse); + logger.info("vnf Response (after):{}", updatedResponse); Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); int delay = 300; @@ -97,7 +100,7 @@ public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransfo } //Kick off callback thread - System.out.println("VnfAdapterRollbackMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + logger.info("VnfAdapterRollbackMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay); CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); callbackResponseThread.start(); @@ -130,7 +133,7 @@ public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransfo //Delay sending callback response sleep(delay); } catch (InterruptedException e1) { - LOGGER.debug("Exception :",e1); + logger.debug("Exception :",e1); } try { @@ -139,8 +142,8 @@ public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransfo TargetEntity.VNF_ADAPTER); client.post(payLoad); } catch (Exception e) { - System.out.println("catch error in - request.post() "); - LOGGER.debug("Exception :",e); + logger.info("catch error in - request.post() "); + logger.debug("Exception :", e); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java index 9e60e87644..5693877574 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -24,7 +26,6 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -33,6 +34,8 @@ import com.github.tomakehurst.wiremock.extension.Parameters; import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Please describe the VnfAdapterUpdateMockTransformer.java class @@ -40,7 +43,7 @@ import com.github.tomakehurst.wiremock.http.ResponseDefinition; */ public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterUpdateMockTransformer.class); + private static final Logger logger = LoggerFactory.getLogger(VnfAdapterUpdateMockTransformer.class); private String notifyCallbackResponse; private String requestId; @@ -72,23 +75,23 @@ public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransform try { // try supplied response file (if any) - System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName()); ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); notifyCallbackResponse = ackResponse; responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>")); updatedResponse = ackResponse.replace(responseMessageId, messageId); } catch (Exception ex) { - LOGGER.debug("Exception :",ex); - System.out.println(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'"); + logger.debug("Exception :",ex); + logger.info(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'"); responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>")); updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); } - - System.out.println("response (mock) messageId : " + responseMessageId); - System.out.println("request (replacement) messageId: " + messageId); - - System.out.println("vnf Response (before):" + notifyCallbackResponse); - System.out.println("vnf Response (after):" + updatedResponse); + + logger.info("response (mock) messageId : {}", responseMessageId); + logger.info("request (replacement) messageId: {}", messageId); + + logger.info("vnf Response (before):{}", notifyCallbackResponse); + logger.info("vnf Response (after):{}", updatedResponse); Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); int delay = 300; @@ -97,7 +100,7 @@ public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransform } //Kick off callback thread - System.out.println("VnfAdapterUpdateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + logger.info("VnfAdapterUpdateMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay); CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); callbackResponseThread.start(); @@ -130,7 +133,7 @@ public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransform //Delay sending callback response sleep(delay); } catch (InterruptedException e1) { - LOGGER.debug("Exception :", e1); + logger.debug("Exception :", e1); } try { @@ -139,8 +142,8 @@ public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransform TargetEntity.VNF_ADAPTER); client.post(payLoad); } catch (Exception e) { - System.out.println("catch error in - request.post() "); - LOGGER.debug("Exception :",e); + logger.info("catch error in - request.post() "); + logger.debug("Exception :", e); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java index 7e76e52959..3cb7b241dc 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java @@ -643,14 +643,16 @@ public class BBInputSetupMapperLayerTest { @Test public void testMapNameValueUserParams() throws IOException { RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class); - HashMap<String,String> actual = bbInputSetupMapperLayer.mapNameValueUserParams(requestDetails.getRequestParameters()); + Map<String,Object> actual = bbInputSetupMapperLayer.mapNameValueUserParams(requestDetails.getRequestParameters()); + assertTrue(actual.containsKey("mns_vfw_protected_route_prefixes")); + assertTrue(actual.get("mns_vfw_protected_route_prefixes").toString().contains("interface_route_table_routes_route")); + assertTrue(actual.get("mns_vfw_protected_route_prefixes").toString().contains("1.1.1.1/32")); + assertTrue(actual.get("mns_vfw_protected_route_prefixes").toString().contains("0::1/128")); assertTrue(actual.containsKey("name1")); assertTrue(actual.containsValue("value1")); assertTrue(actual.get("name1").equals("value1")); - assertTrue(actual.containsKey("name2")); - assertTrue(actual.containsValue("value2")); - assertTrue(actual.get("name2").equals("value2")); + assertFalse(actual.containsKey("ignore")); assertFalse(actual.containsValue("ignore")); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index 56875d315b..cea8fc3cc2 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -776,7 +776,7 @@ public class BBInputSetupTest { @Test public void testPopulateGBBWithSIAndAdditionalInfo() throws Exception { - GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpectedWUserParamsInfo.json"), GeneralBuildingBlock.class); ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpectedWUserParamsInfo.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpectedWUserParamsInfo.json new file mode 100644 index 0000000000..5ac07c6546 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpectedWUserParamsInfo.json @@ -0,0 +1,132 @@ +{ + "requestContext": { + "product-family-id": "productFamilyId", + "source": "source", + "requestor-id": "requestorId", + "mso-request-id": "requestId", + "subscription-service-type": "subscriptionServiceType", + "user-params": { + + "mns_vfw_protected_route_prefixes": [ { + "interface_route_table_routes_route" : "1.1.1.1/32" + }, { + "interface_route_table_routes_route" : "0::1/128" + } ], + "name1": "value1" + }, + "action": "createInstance", + "callback-url": "callbackURL", + "requestParameters": { + "subscriptionServiceType": "subscriptionServiceType", + "userParams": [ + + { + "name" : "mns_vfw_protected_route_prefixes", + "value" : [ { + "interface_route_table_routes_route" : "1.1.1.1/32" + }, { + "interface_route_table_routes_route" : "0::1/128" + } ] + }, + { + "name": "name1", + "value": "value1" + }, + { + "ignore": "false", + "skip": "ignore" + } + ] + }, + "configurationParameters": [ + { + "availability-zone":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]", + "xtz-123":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]" + } + ] + }, + "orchContext": { + "is-rollback-enabled": false + }, + "cloudRegion": { + "lcp-cloud-region-id": "lcpCloudRegionId", + "cloud-owner": "test-owner-name", + "tenant-id": "tenantId", + "complex": "complexName" + }, + "userInput": null, + "customer": { + "global-customer-id": "globalCustomerId", + "subscriber-name": "subscriberName", + "subscriber-type": "subscriberType", + "service-subscription": { + "service-type": "subscriptionServiceType", + "service-instances": [ + { + "service-instance-id": "3655a595-05d1-433c-93c0-3afd6b572545", + "service-instance-name": "serviceInstanceName", + "orchestration-status": "PRECREATED", + "owning-entity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "project": { + "project-name": "projectName" + }, + "vnfs": [], + "allotted-resources": [], + "networks": [], + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "configurations": [], + "model-info-service-instance": { + "description": "description", + "created": null, + "model-name": "modelName", + "model-uuid": "modelUUID", + "model-invariant-uuid": "modelInvariantUUID", + "model-version": "modelVersion", + "service-type": "serviceType", + "service-role": "serviceRole", + "environment-context": "environmentContext", + "workload-context": "workloadContext" + } + } + ] + } + }, + "serviceInstance": { + "service-instance-id": "3655a595-05d1-433c-93c0-3afd6b572545", + "service-instance-name": "serviceInstanceName", + "orchestration-status": "PRECREATED", + "owning-entity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "project": { + "project-name": "projectName" + }, + "vnfs": [], + "allotted-resources": [], + "networks": [], + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "configurations": [], + "model-info-service-instance": { + "description": "description", + "created": null, + "model-name": "modelName", + "model-uuid": "modelUUID", + "model-invariant-uuid": "modelInvariantUUID", + "model-version": "modelVersion", + "service-type": "serviceType", + "service-role": "serviceRole", + "environment-context": "environmentContext", + "workload-context": "workloadContext" + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json index 906903e0b2..06b219df38 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json @@ -6,21 +6,31 @@ "action": null, "callback-url": "callbackURL", "user-params": { - "name1": "value1", - "name2": "value2" + + "mns_vfw_protected_route_prefixes": [ { + "interface_route_table_routes_route" : "1.1.1.1/32" + }, { + "interface_route_table_routes_route" : "0::1/128" + } ], + "name1": "value1" }, "requestParameters": { "subscriptionServiceType": "subscriptionServiceType", "userParams": [ + { + "name" : "mns_vfw_protected_route_prefixes", + "value" : [ { + "interface_route_table_routes_route" : "1.1.1.1/32" + }, { + "interface_route_table_routes_route" : "0::1/128" + } ] + }, + { "name": "name1", "value": "value1" }, { - "name": "name2", - "value": "value2" - }, - { "ignore": "false", "skip": "ignore" } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json index 9afbdd9150..7e28b44abd 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json @@ -9,20 +9,22 @@ "requestParameters": { "subscriptionServiceType": "subscriptionServiceType", "userParams": [ - { - "name": "name1", - "value": "value1" - }, - { - "name": "name2", - "value": "value2" - }, - { - "ignore": "false", - "skip": "ignore" - } - ] - + { + "name" : "mns_vfw_protected_route_prefixes", + "value" : [ { + "interface_route_table_routes_route" : "1.1.1.1/32" + }, { + "interface_route_table_routes_route" : "0::1/128" + } ] + }, + { + "name": "name1", + "value": "value1" + }, + { + "ignore": "false", + "skip": "ignore" + }] }, "configurationParameters": [ { diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java index 49bf95fab0..6c8070f9bd 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -21,7 +23,6 @@ package org.onap.so.bpmn.core.xml; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -50,9 +51,9 @@ import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.apache.commons.lang3.StringEscapeUtils; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; -import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; @@ -64,7 +65,7 @@ import org.xml.sax.SAXException; public final class XmlTool { private static final Map<String, Integer> ENTITIES = new HashMap<>(); - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.BPEL, XmlTool.class); + private static final Logger logger = LoggerFactory.getLogger(XmlTool.class); static { ENTITIES.put("amp", 38); ENTITIES.put("quot", 34); @@ -165,7 +166,7 @@ public final class XmlTool { */ public static String removeNamespaces(Object xml) { if (xml == null) { - LOGGER.debug("removeNamespaces input object is null , returning null"); + logger.debug("removeNamespaces input object is null , returning null"); return null; } @@ -204,7 +205,7 @@ public final class XmlTool { } return out.toString(); } catch (Exception e) { - LOGGER.debug("Exception at readResourceFile stream: " + e); + logger.debug("Exception at readResourceFile stream: " + e); return null; } } @@ -242,7 +243,7 @@ public final class XmlTool { //System.out.println("Did not find element tag " + elementTag + " in XML"); return Optional.empty(); } else { - modNode.setTextContent(newValue); + modNode.setTextContent(newValue); } TransformerFactory transformerFactory = TransformerFactory.newInstance(); diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/utils/CamundaDBSetup.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/utils/CamundaDBSetup.java index f3cc094873..15f6fbe008 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/utils/CamundaDBSetup.java +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/utils/CamundaDBSetup.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -21,18 +23,18 @@ package org.onap.so.bpmn.core.utils; import java.sql.Connection; -import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Sets up the unit test (H2) database for Camunda. */ public class CamundaDBSetup { private static boolean isDBConfigured = false; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CamundaDBSetup.class); + private static final Logger logger = LoggerFactory.getLogger(CamundaDBSetup.class); private CamundaDBSetup() { } @@ -42,7 +44,7 @@ public class CamundaDBSetup { return; } - LOGGER.debug ("Configuring the Camunda H2 database for MSO"); + logger.debug ("Configuring the Camunda H2 database for MSO"); Connection connection = null; PreparedStatement stmt = null; @@ -57,7 +59,7 @@ public class CamundaDBSetup { try { stmt.close(); } catch (Exception e) { - LOGGER.debug("Exception :",e); + logger.debug("Exception :",e); } } @@ -65,9 +67,9 @@ public class CamundaDBSetup { try { connection.close(); } catch (Exception e) { - LOGGER.debug("Exception :",e); + logger.debug("Exception :",e); } } } } -}
\ No newline at end of file +} 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 02164ccec1..920cb11e4c 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 @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -33,6 +35,8 @@ import org.camunda.bpm.engine.runtime.MessageCorrelationResult; import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -47,7 +51,7 @@ public class CallbackHandlerService { public static final long FAST_POLL_INT_MS = 100; public static final long SLOW_POLL_INT_MS = 1000; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CallbackHandlerService.class); + private static final Logger logger = LoggerFactory.getLogger(CallbackHandlerService.class); @Autowired RuntimeService runtimeService; @@ -75,7 +79,7 @@ public class CallbackHandlerService { long startTime = System.currentTimeMillis(); - LOGGER.debug(logMarker + " " + method + " received message: " + logger.debug(logMarker + " " + method + " received message: " + (message == null ? "" : System.lineSeparator()) + message); try { @@ -101,7 +105,7 @@ public class CallbackHandlerService { logCallbackSuccess(method, startTime); return new CallbackSuccess(); } catch (Exception e) { - LOGGER.debug("Exception :",e); + logger.debug("Exception :",e); String msg = "Caught " + e.getClass().getSimpleName() + " processing " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "'"; @@ -133,7 +137,7 @@ public class CallbackHandlerService { protected boolean correlate(String messageEventName, String correlationVariable, String correlationValue, Map<String, Object> variables, String logMarker) { try{ - LOGGER.debug(logMarker + " Attempting to find process waiting" + logger.debug(logMarker + " Attempting to find process waiting" + " for " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "'"); @@ -200,7 +204,7 @@ public class CallbackHandlerService { execInfoList.add(new ExecInfo(execution)); } - LOGGER.debug(logMarker + " Found " + count + " process(es) waiting" + logger.debug(logMarker + " Found " + count + " process(es) waiting" + " for " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "': " + execInfoList); @@ -211,9 +215,9 @@ public class CallbackHandlerService { + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "'; last exception was:" + queryException; - LOGGER.debug(msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, queryException); + logger.debug(msg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), msg, queryException); } return false; @@ -234,7 +238,7 @@ public class CallbackHandlerService { // acknowledged the notification associated with request #1. try { - LOGGER.debug(logMarker + " Running " + execInfoList.get(0) + " to receive " + logger.debug(logMarker + " Running " + execInfoList.get(0) + " to receive " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "'"); @@ -254,9 +258,9 @@ public class CallbackHandlerService { String msg = "Caught " + ole.getClass().getSimpleName() + " after receiving " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "': " + ole; - LOGGER.debug(msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, ole); + logger.debug(msg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg, ole); //Retry for OptimisticLocking Exceptions int retryCount = 0; @@ -269,7 +273,7 @@ public class CallbackHandlerService { } } - LOGGER.debug("Retry correlate for OptimisticLockingException, retryCount:" + retryCount); + logger.debug("Retry correlate for OptimisticLockingException, retryCount:{}", retryCount); for (; retryCount >0 ; retryCount--) { @@ -283,20 +287,20 @@ public class CallbackHandlerService { .processInstanceVariableEquals(correlationVariable, correlationValue) .correlateWithResult(); retryCount = 0; - LOGGER.debug("OptimisticLockingException retry was successful, seting retryCount: " + retryCount); + logger.debug("OptimisticLockingException retry was successful, seting retryCount: {}", retryCount); } catch (OptimisticLockingException olex) { //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, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, strMsg, olex); + logger.debug(strMsg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + 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, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, strMsg, excep); + logger.debug(strMsg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), strMsg, excep); } } @@ -308,9 +312,9 @@ public class CallbackHandlerService { + execInfoList.get(0) + " after receiving " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "': " + e; - LOGGER.debug(msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, e); + logger.debug(msg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), msg, e); } } catch (Exception e) { // This must be an exception from the flow itself. Log it, but don't @@ -318,9 +322,9 @@ public class CallbackHandlerService { String msg = "Caught " + e.getClass().getSimpleName() + " after receiving " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "': " + e; - LOGGER.debug(msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, e); + logger.debug(msg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg, e); } return true; @@ -332,12 +336,6 @@ public class CallbackHandlerService { * @param startTime the request start time */ protected void logCallbackSuccess(String method, long startTime) { - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, - MsoLogger.ResponseCode.Suc, "Completed " + method); - - LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, - MsoLogger.ResponseCode.Suc, "Completed " + method, - "BPMN", MsoLogger.getServiceName(), null); } /** @@ -361,19 +359,12 @@ public class CallbackHandlerService { */ protected void logCallbackError(String method, long startTime, String msg, Exception e) { if (e == null) { - LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), msg); } else { - LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, e); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), msg, e); } - - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, - MsoLogger.ResponseCode.InternalError, "Completed " + method); - - LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, - MsoLogger.ResponseCode.InternalError, "Completed " + method, - "BPMN", MsoLogger.getServiceName(), null); } /** diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java index 014b06deff..f9f06447a7 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -39,8 +41,9 @@ import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.bpmn.common.workflow.context.WorkflowContext; import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder; import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; -import org.onap.so.logger.MsoLogger; import org.openecomp.mso.bpmn.common.workflow.service.WorkflowProcessorException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -79,7 +82,7 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService { this.processor = processor; } - protected static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,WorkflowAsyncResource.class); + protected static final Logger logger = LoggerFactory.getLogger(WorkflowAsyncResource.class); protected static final long DEFAULT_WAIT_TIME = 60000; //default wait time /** 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 02cda8009f..8b35f0e6d6 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 @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -36,6 +38,8 @@ import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackE import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -54,7 +58,7 @@ import io.swagger.annotations.ApiOperation; @Api(description = "Provides a generic service to inject messages into a waiting BPMN Proccess") @Component public class WorkflowMessageResource{ - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowMessageResource.class); + private static final Logger logger = LoggerFactory.getLogger(WorkflowMessageResource.class); private static final String LOGMARKER = "[WORKFLOW-MESSAGE]"; @Autowired @@ -78,7 +82,7 @@ public class WorkflowMessageResource{ MsoLogger.setServiceName("MSO." + method); MsoLogger.setLogContext(correlator, "N/A"); - LOGGER.debug(LOGMARKER + " Received workflow message" + logger.debug(LOGMARKER + " Received workflow message" + " type='" + messageType + "'" + " correlator='" + correlator + "'" + (contentType == null ? "" : " contentType='" + contentType + "'") @@ -86,17 +90,17 @@ public class WorkflowMessageResource{ if (messageType == null || messageType.isEmpty()) { String msg = "Missing message type"; - LOGGER.debug(LOGMARKER + " " + msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg); + logger.debug(LOGMARKER + " " + msg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); return Response.status(400).entity(msg).build(); } if (correlator == null || correlator.isEmpty()) { String msg = "Missing correlator"; - LOGGER.debug(LOGMARKER + " " + msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg); + logger.debug(LOGMARKER + " " + msg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); return Response.status(400).entity(msg).build(); } @@ -121,4 +125,4 @@ public class WorkflowMessageResource{ return Response.status(204).build(); } } -}
\ No newline at end of file +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java index 5afd7e00e8..b1062962a6 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -29,15 +31,16 @@ import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.camunda.bpm.engine.variable.impl.VariableMapImpl; import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; -import org.onap.so.logger.MsoLogger; import org.openecomp.mso.bpmn.common.workflow.service.WorkflowProcessorException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @Service public class WorkflowProcessor extends ProcessEngineAwareService { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowProcessor.class); + private static final Logger logger = LoggerFactory.getLogger(WorkflowProcessor.class); protected static final String logMarker = "[WRKFLOW-RESOURCE]"; @Async @@ -55,21 +58,17 @@ public class WorkflowProcessor extends ProcessEngineAwareService { // Note: this creates a random businessKey if it wasn't specified. String businessKey = getBusinessKey(inputVariables); - msoLogger.debug("***Received MSO startProcessInstanceByKey with processKey: " + processKey - + " and variables: " + inputVariables); + logger.debug("***Received MSO startProcessInstanceByKey with processKey: {} and variables: {}", processKey, + inputVariables); RuntimeService runtimeService = getProcessEngineServices().getRuntimeService(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processKey, businessKey, inputVariables); processInstanceId = processInstance.getId(); - msoLogger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " " + logger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " " + (processInstance.isEnded() ? "ENDED" : "RUNNING")); } catch (Exception e) { - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, - logMarker + "Error in starting the process: " + e.getMessage()); - WorkflowResponse workflowResponse = new WorkflowResponse(); workflowResponse.setResponse("Error occurred while executing the process: " + e); workflowResponse.setProcessInstanceID(processInstanceId); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java index c2a7f41140..92f1b7a816 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -50,6 +52,8 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.slf4j.MDC; import org.springframework.stereotype.Component; @@ -61,7 +65,7 @@ import io.swagger.annotations.ApiOperation; @Component public class WorkflowResource extends ProcessEngineAwareService { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowResource.class); + private static final Logger logger = LoggerFactory.getLogger(WorkflowResource.class); private static final String LOGMARKER = "[WRKFLOW-RESOURCE]"; private static final int DEFAULT_WAIT_TIME = 30000; @@ -99,7 +103,7 @@ public class WorkflowResource extends ProcessEngineAwareService { try { //Kickoff the process - ProcessThread thread = new ProcessThread(inputVariables,processKey,msoLogger); + ProcessThread thread = new ProcessThread(inputVariables,processKey); thread.start(); Map<String, Object> responseMap = null; @@ -141,7 +145,7 @@ public class WorkflowResource extends ProcessEngineAwareService { processInstance = thread.getProcessInstance(); if (processInstance == null) { - msoLogger.debug(LOGMARKER + processKey + " process has not been created yet"); + logger.debug("{} process has not been created yet", LOGMARKER + processKey ); continue; } @@ -151,7 +155,7 @@ public class WorkflowResource extends ProcessEngineAwareService { responseMap = getResponseMap(processInstance, processKey, timeProcessEnded); if (responseMap == null) { - msoLogger.debug(LOGMARKER + processKey + " has not produced a response yet"); + logger.debug("{} has not produced a response yet", LOGMARKER + processKey); if (timeProcessEnded.longValue() != 0) { long elapsedSinceEnded = System.currentTimeMillis() - timeProcessEnded.longValue(); @@ -192,14 +196,15 @@ public class WorkflowResource extends ProcessEngineAwareService { workflowResponse.setMessageCode(500); return Response.status(500).entity(workflowResponse).build(); } catch (Exception ex) { - msoLogger.debug(LOGMARKER + "Exception in startProcessInstance by key",ex); + logger.debug(LOGMARKER + "Exception in startProcessInstance by key",ex); workflowResponse.setMessage("Fail" ); workflowResponse.setResponse("Error occurred while executing the process: " + ex.getMessage()); if (processInstance != null) workflowResponse.setProcessInstanceID(processInstance.getId()); - - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), - MsoLogger.ErrorCode.UnknownError, LOGMARKER + workflowResponse.getMessage() - + " for processKey: " + processKey + " with response: " + workflowResponse.getResponse()); + + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey), + MsoLogger.ErrorCode.UnknownError.getValue(), + LOGMARKER + workflowResponse.getMessage() + " for processKey: " + processKey + " with response: " + + workflowResponse.getResponse()); workflowResponse.setMessageCode(500); recordEvents(processKey, workflowResponse, startTime); @@ -222,21 +227,13 @@ public class WorkflowResource extends ProcessEngineAwareService { try { return Integer.parseInt(timeout)*1000; } catch (NumberFormatException nex) { - msoLogger.debug("Invalid input for mso-service-request-timeout"); + logger.debug("Invalid input for mso-service-request-timeout"); } } return DEFAULT_WAIT_TIME; } private void recordEvents(String processKey, WorkflowResponse response, long startTime) { - - msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - LOGMARKER + response.getMessage() + " for processKey: " - + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - LOGMARKER + response.getMessage() + " for processKey: " - + processKey + " with response: " + response.getResponse()); } private void setLogContext(String processKey, Map<String, Object> inputVariables) { @@ -266,7 +263,7 @@ public class WorkflowResource extends ProcessEngineAwareService { try { return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null ? true : false ; } catch (Exception e) { - msoLogger.debug("Exception :",e); + logger.debug("Exception :",e); return true; } } @@ -287,7 +284,7 @@ public class WorkflowResource extends ProcessEngineAwareService { try { workflowResponse.setMessageCode(Integer.parseInt(responseCode)); } catch(NumberFormatException nex) { - msoLogger.debug(LOGMARKER + "Failed to parse ResponseCode: " + responseCode); + logger.debug(LOGMARKER + "Failed to parse ResponseCode: " + responseCode); workflowResponse.setMessageCode(-1); } @@ -298,7 +295,7 @@ public class WorkflowResource extends ProcessEngineAwareService { } else if ("Fail".equalsIgnoreCase(String.valueOf(status))) { workflowResponse.setMessage("Fail"); } else { - msoLogger.debug(LOGMARKER + "Unrecognized Status: " + responseCode); + logger.debug(LOGMARKER + "Unrecognized Status: " + responseCode); workflowResponse.setMessage("Fail"); } } @@ -310,15 +307,13 @@ public class WorkflowResource extends ProcessEngineAwareService { private class ProcessThread extends Thread { private final Map<String,Object> inputVariables; private final String processKey; - private final MsoLogger msoLogger; private final String businessKey; private ProcessInstance processInstance = null; private Exception exception = null; - public ProcessThread(Map<String, Object> inputVariables, String processKey, MsoLogger msoLogger) { + public ProcessThread(Map<String, Object> inputVariables, String processKey) { this.inputVariables = inputVariables; this.processKey = processKey; - this.msoLogger = msoLogger; this.businessKey = UUID.randomUUID().toString(); } @@ -352,14 +347,6 @@ public class WorkflowResource extends ProcessEngineAwareService { long startTime = System.currentTimeMillis(); try { - msoLogger.debug(LOGMARKER + "***Received MSO startProcessInstanceByKey with processKey:" - + processKey + " and variables: " + inputVariables); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER - + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with" - + " processKey:" + processKey - + " businessKey:" + businessKey - + " variables: " + inputVariables); RuntimeService runtimeService = getProcessEngineServices().getRuntimeService(); @@ -370,7 +357,7 @@ public class WorkflowResource extends ProcessEngineAwareService { processKey, inputVariables); } catch (Exception e) { - msoLogger.debug(LOGMARKER + "ProcessThread caught an exception executing " + logger.debug(LOGMARKER + "ProcessThread caught an exception executing " + processKey + ": " + e); setException(e); } @@ -441,7 +428,7 @@ public class WorkflowResource extends ProcessEngineAwareService { responseMapVariable); if (responseMap != null) { - msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable + logger.debug(LOGMARKER + "Obtained " + responseMapVariable + " from process " + processInstanceId + " history"); return responseMap; } @@ -455,12 +442,12 @@ public class WorkflowResource extends ProcessEngineAwareService { // Check for 'WorkflowResponse' variable Object workflowResponseObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowResponse"); String workflowResponse = workflowResponseObject == null ? null : String.valueOf(workflowResponseObject); - msoLogger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse); + logger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse); if (workflowResponse != null) { Object responseCodeObject = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); String responseCode = responseCodeObject == null ? null : String.valueOf(responseCodeObject); - msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); + logger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); responseMap = new HashMap<>(); responseMap.put("WorkflowResponse", workflowResponse); responseMap.put("ResponseCode", responseCode); @@ -496,17 +483,17 @@ public class WorkflowResource extends ProcessEngineAwareService { } } - msoLogger.debug(LOGMARKER + "WorkflowException: " + workflowExceptionText); + logger.debug(LOGMARKER + "WorkflowException: " + workflowExceptionText); // BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE Object object = getVariableFromHistory(historyService, processInstanceId, processKey + "Response"); String response = object == null ? null : String.valueOf(object); - msoLogger.debug(LOGMARKER + processKey + "Response: " + response); + logger.debug(LOGMARKER + processKey + "Response: " + response); if (response != null) { object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); String responseCode = object == null ? null : String.valueOf(object); - msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); + logger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); responseMap = new HashMap<>(); responseMap.put("Response", response); responseMap.put("ResponseCode", responseCode); @@ -516,12 +503,12 @@ public class WorkflowResource extends ProcessEngineAwareService { object = getVariableFromHistory(historyService, processInstanceId, prefix + "ErrorResponse"); String errorResponse = object == null ? null : String.valueOf(object); - msoLogger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse); + logger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse); if (errorResponse != null) { object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); String responseCode = object == null ? null : String.valueOf(object); - msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); + logger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); responseMap = new HashMap<>(); responseMap.put("Response", errorResponse); responseMap.put("ResponseCode", responseCode); @@ -545,7 +532,7 @@ public class WorkflowResource extends ProcessEngineAwareService { return runtimeService.getVariable(executionId, variableName); } catch (ProcessEngineException e) { // Most likely cause is that the execution no longer exists. - msoLogger.debug("Error retrieving execution " + executionId + logger.debug("Error retrieving execution " + executionId + " variable " + variableName + ": " + e); return null; } @@ -562,8 +549,8 @@ public class WorkflowResource extends ProcessEngineAwareService { .processInstanceId(processInstanceId).variableName(variableName).singleResult(); return v == null ? null : v.getValue(); } catch (Exception e) { - msoLogger.debug("Error retrieving process " + processInstanceId - + " variable " + variableName + " from history: " + e); + logger.debug("Error retrieving process {} variable {} from history: ", processInstanceId, + variableName, e); return null; } } @@ -589,42 +576,27 @@ public class WorkflowResource extends ProcessEngineAwareService { variablesMap.put(variableInstance.getName(), variableInstance.getValue().toString()); } - msoLogger.debug(LOGMARKER + "***Received MSO getProcessVariables with processKey:" + processKey + " and variables: " + variablesMap.toString()); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER - + "Call to MSO workflow/services in Camunda. Received MSO getProcessVariables with processKey:" - + processKey + " and variables: " - + variablesMap.toString()); - + logger.debug(LOGMARKER + "***Received MSO getProcessVariables with processKey:" + processKey + " and variables: " + + variablesMap.toString()); response.setVariables(variablesMap); response.setMessage("Success"); response.setResponse("Successfully retrieved the variables"); response.setProcessInstanceID(processInstanceId); - msoLogger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response.getResponse()); + logger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response + .getResponse()); } catch (Exception ex) { response.setMessage("Fail"); response.setResponse("Failed to retrieve the variables," + ex.getMessage()); response.setProcessInstanceID(processInstanceId); - - msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), MsoLogger.ErrorCode.UnknownError, LOGMARKER - + response.getMessage() - + " for processKey: " - + processKey - + " with response: " - + response.getResponse()); - msoLogger.debug("Exception :",ex); + + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey), + MsoLogger.ErrorCode.UnknownError.getValue(), + LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response + .getResponse()); + logger.debug("Exception :",ex); } - - msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - LOGMARKER + response.getMessage() + " for processKey: " - + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - LOGMARKER + response.getMessage() + " for processKey: " - + processKey + " with response: " + response.getResponse()); - return response; } } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java index 5435194f39..62aad7e345 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -56,7 +58,8 @@ import org.onap.so.bpmn.core.BPMNLogger; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; -import org.slf4j.MDC; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.AbstractEnvironment; import org.springframework.core.env.Environment; @@ -279,7 +282,7 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { * Logs details about the current activity. */ public class LoggingExecutionListener implements ExecutionListener { - private final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,LoggingExecutionListener.class); + private final Logger logger = LoggerFactory.getLogger(LoggingExecutionListener.class); private String event; @@ -317,7 +320,7 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { MsoLogger.setLogContext(requestId, svcid); } } catch(Exception e) { - logger.error(e); + logger.error("Exception occurred", e); } } } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java index 62be1330b1..cb20ded8de 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -36,10 +38,11 @@ import org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify; import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource; import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource; import org.onap.so.bpmn.common.workflow.service.WorkflowResource; -import org.onap.so.logger.MsoLogger; import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor; import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor; import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -52,7 +55,7 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; @Configuration public class CXFConfiguration { - private static final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CXFConfiguration.class); + private static final Logger logger = LoggerFactory.getLogger(CXFConfiguration.class); @Autowired private Bus bus; diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java index 7956ecc363..af9ab2899e 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -28,8 +30,9 @@ import org.camunda.bpm.application.PreUndeploy; import org.camunda.bpm.application.ProcessApplicationInfo; import org.camunda.bpm.engine.ProcessEngine; import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; -import org.onap.so.logger.MsoLogger; import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -52,8 +55,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class) }) public class MSOInfrastructureApplication { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - MSOInfrastructureApplication.class); + private static final Logger logger = LoggerFactory.getLogger(MSOInfrastructureApplication.class); @Value("${mso.async.core-pool-size}") private int corePoolSize; @@ -81,20 +83,11 @@ public class MSOInfrastructureApplication { @PostDeploy public void postDeploy(ProcessEngine processEngineInstance) { - long startTime = System.currentTimeMillis(); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Post deployment complete..."); } @PreUndeploy public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo, List<ProcessEngine> processEngines) { - long startTime = System.currentTimeMillis(); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Pre Undeploy complete..."); - } @Bean @@ -109,4 +102,4 @@ public class MSOInfrastructureApplication { executor.initialize(); return executor; } -}
\ No newline at end of file +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml index ccea9483a8..d7effb093f 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml @@ -14,8 +14,6 @@ camunda: job-execution: max-pool-size: 30 core-pool-size: 3 -entitymanager: - packagesToScan: com pnf: dmaap: host: message-router @@ -34,7 +32,10 @@ mso: core-pool-size: 50 max-pool-size: 50 queue-capacity: 500 - adapters: + adapters: + requestDb: + endpoint: http://request-db-adapter:8083 + auth: Basic bTA0NzY4QG5vbi1wcm9kLm1zby5lY29tcC5hdHQuY29tOkF0dG0wNDc2OExpZmUhQA== completemsoprocess: endpoint: http://localhost:30253/CompleteMsoProcess db: @@ -224,20 +225,8 @@ appc: secret: lgjXraD1HutKxv8jEN6tVouu service: ueb poolMembers: localhost:3904 -server: - port: 8080 - tomcat: - max-threads: 50 -spring: - h2: - console: - enabled: true - path: /h2 - datasource: - url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE - username: sa - password: sa - driverClassName: org.h2.Driver + +spring: security: usercredentials: - @@ -264,23 +253,5 @@ spring: username: mso_admin password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa' role: ACTUATOR -request: - datasource: - url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE - username: sa - password: sa - driver-class-name: org.h2.Driver - intialize: true - -# Hibernate -hibernate: - dialect: org.hibernate.dialect.MySQL5Dialect - show_sql: true - hbm2ddl: - auto: create - -#Actuator -management: - context-path: /manage diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml index 18b94e725a..a91cb9d88d 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml @@ -8,7 +8,7 @@ mso: spring: datasource: driver-class-name: org.mariadb.jdbc.Driver - jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/camundabpmn + url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/camundabpmn username: ${DB_ADMIN_USERNAME} password: ${DB_ADMIN_PASSWORD} http: diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java index fd38ff024d..f6284f3535 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java @@ -3,7 +3,9 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -31,14 +33,12 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.test.Deployment; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.core.WorkflowException; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit test for CreateAAIVfModule.bpmn. @@ -46,7 +46,7 @@ import org.onap.so.logger.MsoLogger; public class CreateAAIVfModuleIT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class); + Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class); @Test public void TestCreateGenericVnfSuccess_200() { @@ -264,4 +264,4 @@ public class CreateAAIVfModuleIT extends BaseIntegrationTest { .withStatus(200))); } -}
\ No newline at end of file +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java index 6af705fd54..f72ca79dc6 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -34,7 +36,8 @@ import org.junit.Assert; import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit tests for CreateAAIVfModuleVolumeGroup.bpmn. @@ -42,7 +45,7 @@ import org.onap.so.logger.MsoLogger; public class CreateAAIVfModuleVolumeGroupIT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleVolumeGroupIT.class); + Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleVolumeGroupIT.class); /** * Test the happy path through the flow. @@ -66,8 +69,8 @@ public class CreateAAIVfModuleVolumeGroupIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(200, responseCode.intValue()); logEnd(); @@ -93,8 +96,8 @@ public class CreateAAIVfModuleVolumeGroupIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(404, responseCode.intValue()); logEnd(); @@ -122,8 +125,8 @@ public class CreateAAIVfModuleVolumeGroupIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(404, responseCode.intValue()); logEnd(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java index 27b39aec64..f98e4477aa 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java @@ -33,11 +33,11 @@ import java.util.UUID; import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.test.Deployment; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.core.WorkflowException; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit test for DeleteAAIVfModule.bpmn. @@ -46,7 +46,7 @@ import org.onap.so.logger.MsoLogger; public class DeleteAAIVfModuleIT extends BaseIntegrationTest { private static final String EOL = "\n"; - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,DeleteAAIVfModuleIT.class); + Logger logger = LoggerFactory.getLogger(DeleteAAIVfModuleIT.class); @Test public void TestDeleteGenericVnfSuccess_200() { diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java index a6d26540dc..f477926f99 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java @@ -3,7 +3,9 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -33,7 +35,8 @@ import java.util.UUID; import org.junit.Assert; import org.junit.Test; import org.onap.so.BaseIntegrationTest; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit test for FalloutHandler.bpmn. @@ -41,7 +44,7 @@ import org.onap.so.logger.MsoLogger; public class FalloutHandlerIT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,FalloutHandlerIT.class); + Logger logger = LoggerFactory.getLogger(FalloutHandlerIT.class); private void setupMocks() { @@ -147,7 +150,7 @@ public class FalloutHandlerIT extends BaseIntegrationTest { public void msoFalloutHandlerWithNotificationurlNoRequestId() throws Exception{ String method = getClass().getSimpleName() + "." + new Object() { }.getClass().getEnclosingMethod().getName(); - logger.debug("STARTED TEST: " + method); + logger.debug("STARTED TEST: {}", method); //Setup Mocks setupMocks(); //Execute Flow @@ -186,7 +189,7 @@ public class FalloutHandlerIT extends BaseIntegrationTest { public void msoFalloutHandlerWithNoNotificationurlNoRequestId() throws Exception{ String method = getClass().getSimpleName() + "." + new Object() { }.getClass().getEnclosingMethod().getName(); - logger.debug("STARTED TEST: " + method); + logger.debug("STARTED TEST: {}", method); //Setup Mocks setupMocks(); //Execute Flow diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java index 744ef9bea5..67ae7de928 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -33,13 +35,14 @@ import org.camunda.bpm.engine.task.TaskQuery; import org.junit.Assert; import org.junit.Test; import org.onap.so.BaseIntegrationTest; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit test for RainyDayHandler.bpmn. */ public class ManualHandlingIT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,ManualHandlingIT.class); + Logger logger = LoggerFactory.getLogger(ManualHandlingIT.class); @Test public void TestManualHandlingSuccess() { @@ -76,8 +79,8 @@ public class ManualHandlingIT extends BaseIntegrationTest { List<Task> tasks = q.orderByTaskCreateTime().asc().list(); for (Task task : tasks) { - logger.debug("TASK ID: " + task.getId()); - logger.debug("TASK NAME: " + task.getName()); + logger.debug("TASK ID: {}", task.getId()); + logger.debug("TASK NAME: {}", task.getName()); try { logger.debug("Completing the task"); @@ -85,7 +88,7 @@ public class ManualHandlingIT extends BaseIntegrationTest { completeVariables.put("responseValue", "skip"); taskService.complete(task.getId(), completeVariables); } catch(Exception e) { - logger.debug("GOT EXCEPTION: " + e.getMessage()); + logger.debug("GOT EXCEPTION: {}", e.getMessage()); } } @@ -93,4 +96,4 @@ public class ManualHandlingIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); } -}
\ No newline at end of file +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java index 398efb972f..b370e6c48f 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -34,7 +36,8 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition; import org.onap.so.bpmn.core.domain.ServiceInstance; import org.onap.so.bpmn.core.domain.VnfResource; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.ArrayList; @@ -56,7 +59,7 @@ import static org.onap.so.bpmn.mock.StubResponseOof.mockOof_500; @Ignore public class OofHomingTestIT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class); + Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class); ServiceDecomposition serviceDecomposition = new ServiceDecomposition(); String subscriber = ""; @@ -261,7 +264,7 @@ public class OofHomingTestIT extends BaseIntegrationTest { vnfModel.setModelType("testModelTypeVNF"); vnf.setModelInfo(vnfModel); vnfList.add(vnf); - logger.debug("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString()); + logger.debug("SERVICE DECOMP: {}", serviceDecomposition.getServiceResourcesJsonString()); serviceDecomposition.setModelInfo(sModel); serviceDecomposition.setAllottedResources(arList); serviceDecomposition.setVnfResources(vnfList); @@ -416,9 +419,8 @@ public class OofHomingTestIT extends BaseIntegrationTest { ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition"); - logger.debug("In testHoming_success_vnfResourceList, ServiceDecomposition = " + sd); + logger.debug("In testHoming_success_vnfResourceList, ServiceDecomposition = {}", sd); List<VnfResource> vnfResourceList = sd.getVnfResources(); -//logger.debug(" vnfResourceList = " + vnfResourceList); vnfResourceList.get(0).setResourceId("test-resource-id-000"); // Invoke Homing @@ -454,29 +456,27 @@ public class OofHomingTestIT extends BaseIntegrationTest { "WorkflowException"); ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition"); - logger.debug("serviceDecompositionExp is: " + serviceDecompositionExp); + logger.debug("serviceDecompositionExp is: {}", serviceDecompositionExp); Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000"); - logger.debug("resourceVnf is: " + resourceVnf); + logger.debug("resourceVnf is: {}", resourceVnf); HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution(); String resourceVnfHomingString = resourceVnfHoming.toString(); - logger.debug("resourceVnfHomingString is: " + resourceVnfHomingString); + logger.debug("resourceVnfHomingString is: {}", resourceVnfHomingString); resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " "); - logger.debug("Now resourceVnfHomingString is: " + resourceVnfHomingString); + logger.debug("Now resourceVnfHomingString is: {}", resourceVnfHomingString); assertNull(workflowException); //Verify request String oofRequest = (String) getVariableFromHistory(businessKey, "oofRequest"); - logger.debug("oofRequest is: " + oofRequest); + logger.debug("oofRequest is: {}", oofRequest); assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf"). replaceAll("\n", "").replaceAll("\r", ""). replaceAll("\t", ""), oofRequest.replaceAll("\n", ""). replaceAll("\r", "").replaceAll("\t", "")); - //logger.debug("resourceVnfHoming.getVnf().getResourceId() is: " + resourceVnfHoming.getVnf().getResourceId()); - assertEquals(homingSolutionService("service", "service-instance-01234", "MDTNJ01", "test-resource-id-000","CloudOwner", "mtmnj1a", @@ -539,7 +539,6 @@ public class OofHomingTestIT extends BaseIntegrationTest { } @Test - public void testHoming_error_inputVariable() throws Exception { String businessKey = UUID.randomUUID().toString(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java index b8ae341361..8b8abab6b2 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java @@ -3,7 +3,9 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -33,12 +35,12 @@ import java.util.UUID; import org.camunda.bpm.engine.test.Deployment; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit tests for PrepareUpdateAAIVfModule.bpmn. @@ -46,7 +48,7 @@ import org.onap.so.logger.MsoLogger; public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,PrepareUpdateAAIVfModuleIT.class); + Logger logger = LoggerFactory.getLogger(PrepareUpdateAAIVfModuleIT.class); /** * Test the happy path through the flow. @@ -73,11 +75,11 @@ public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(200, responseCode.intValue()); String heatStackId = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_heatStackId"); - logger.debug("Ouput heat-stack-id:" + heatStackId); + logger.debug("Ouput heat-stack-id:{}", heatStackId); Assert.assertEquals("slowburn", heatStackId); logEnd(); @@ -106,11 +108,11 @@ public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponseCode"); WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(404, responseCode.intValue()); Assert.assertNotNull(workflowException); - logger.debug("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage()); logEnd(); } @@ -137,7 +139,7 @@ public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); Assert.assertNotNull(workflowException); - logger.debug("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage()); Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: Orchestration")); logEnd(); @@ -165,7 +167,7 @@ public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); Assert.assertNotNull(workflowException); - logger.debug("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage()); Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: VF Module")); logEnd(); @@ -196,11 +198,11 @@ public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode"); WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(404, responseCode.intValue()); Assert.assertNotNull(workflowException); - logger.debug("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage()); logEnd(); } diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java index baf41d120b..12e12dc7d6 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -35,7 +37,8 @@ import org.junit.Ignore; import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit tests for SDNCAdapterRestV2.bpmn. @@ -48,7 +51,7 @@ public class SDNCAdapterRestV2IT extends BaseIntegrationTest { private final CallbackSet callbacks = new CallbackSet(); - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,SDNCAdapterRestV2IT.class); + Logger logger = LoggerFactory.getLogger(SDNCAdapterRestV2IT.class); /** diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java index f3f950746c..2205d01cca 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -38,7 +40,8 @@ import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.core.domain.*; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -47,7 +50,7 @@ import org.onap.so.logger.MsoLogger; @Ignore public class SniroHomingV1IT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,SniroHomingV1IT.class); + Logger logger = LoggerFactory.getLogger(SniroHomingV1IT.class); ServiceDecomposition serviceDecomposition = new ServiceDecomposition(); @@ -121,7 +124,7 @@ public class SniroHomingV1IT extends BaseIntegrationTest { vnfModel.setModelType("testModelTypeVNF"); vnf.setModelInfo(vnfModel); vnfList.add(vnf); - logger.debug("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString()); + logger.debug("SERVICE DECOMP: {}", serviceDecomposition.getServiceResourcesJsonString()); serviceDecomposition.setModelInfo(sModel); serviceDecomposition.setAllottedResources(arList); serviceDecomposition.setVnfResources(vnfList); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java index e1a265b274..48790708f0 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java @@ -3,7 +3,9 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -39,7 +41,8 @@ import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit tests for UpdateAAIGenericVnf bpmn. @@ -47,7 +50,7 @@ import org.onap.so.logger.MsoLogger; public class UpdateAAIGenericVnfIT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class); + Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class); /** @@ -73,8 +76,8 @@ public class UpdateAAIGenericVnfIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(200, responseCode.intValue()); logEnd(); @@ -103,7 +106,7 @@ public class UpdateAAIGenericVnfIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - logger.debug("Workflow Exception: " + workflowException); + logger.debug("Workflow Exception: {}", workflowException); Assert.assertNotNull(workflowException); logEnd(); @@ -132,8 +135,8 @@ public class UpdateAAIGenericVnfIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(404, responseCode.intValue()); logEnd(); @@ -164,8 +167,8 @@ public class UpdateAAIGenericVnfIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(404, responseCode.intValue()); logEnd(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java index 3ff2657193..3dd2ac957c 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java @@ -3,7 +3,9 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -39,6 +41,8 @@ import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.mock.FileUtil; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit tests for UpdateAAIVfModuleTest.bpmn. @@ -46,7 +50,7 @@ import org.onap.so.logger.MsoLogger; public class UpdateAAIVfModuleIT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class); + Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class); /** @@ -72,8 +76,8 @@ public class UpdateAAIVfModuleIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(200, responseCode.intValue()); logEnd(); @@ -101,8 +105,8 @@ public class UpdateAAIVfModuleIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(404, responseCode.intValue()); logEnd(); @@ -132,8 +136,8 @@ public class UpdateAAIVfModuleIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(404, responseCode.intValue()); logEnd(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java index fc15e92bca..ad08f8b2bb 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java @@ -1,9 +1,11 @@ /*- - * ============LICENSE_START======================================================= + * ============LICENSE_START======================================================= * ONAP - SO - * ================================================================================ + * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -38,7 +40,8 @@ import org.junit.Ignore; import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.core.WorkflowException; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit tests for VnfAdapterRestV1. @@ -46,7 +49,7 @@ import org.onap.so.logger.MsoLogger; public class VnfAdapterRestV1IT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,VnfAdapterRestV1IT.class); + Logger logger = LoggerFactory.getLogger(VnfAdapterRestV1IT.class); private static final String EOL = "\n"; @@ -256,7 +259,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { waitForProcessEnd(businessKey, 10000); String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); - logger.debug("Response:\n" + response); + logger.debug("Response:\n{}", response); assertTrue(response!=null && response.contains("<createVfModuleResponse>")); assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); @@ -285,7 +288,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { waitForProcessEnd(businessKey, 10000); String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); - logger.debug("Response:\n" + response); + logger.debug("Response:\n{}", response); assertTrue(response.contains("<updateVfModuleResponse>")); assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); @@ -314,7 +317,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { waitForProcessEnd(businessKey, 10000); String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); - logger.debug("Response:\n" + response); + logger.debug("Response:\n{}", response); assertTrue(response.contains("<deleteVfModuleResponse>")); assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); @@ -343,7 +346,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { waitForProcessEnd(businessKey, 10000); String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); - logger.debug("Response:\n" + response); + logger.debug("Response:\n{}", response); assertTrue(response.contains("<rollbackVfModuleResponse>")); assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); @@ -376,7 +379,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { logger.debug(wfe.toString()); String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse"); - logger.debug("Response:\n" + response); + logger.debug("Response:\n{}", response); assertTrue(response.contains("<vfModuleException>")); assertFalse((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java index d24e953196..117d3b213a 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -81,7 +83,8 @@ import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource; import org.onap.so.bpmn.common.workflow.service.WorkflowResource; import org.onap.so.bpmn.core.domain.Resource; import org.onap.so.bpmn.core.domain.ServiceDecomposition; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -106,7 +109,7 @@ import org.xml.sax.SAXException; public abstract class WorkflowTest { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowTest.class); + private static final Logger logger = LoggerFactory.getLogger(WorkflowTest.class); //TODO this is not used anymore, can maybe be removed @Rule @@ -165,14 +168,14 @@ public abstract class WorkflowTest { * Logs a test start method. */ protected void logStart() { - msoLogger.debug("STARTED TEST"); + logger.debug("STARTED TEST"); } /** * Logs a test end method. */ protected void logEnd() { - msoLogger.debug("ENDED TEST"); + logger.debug("ENDED TEST"); } /** @@ -184,14 +187,14 @@ public abstract class WorkflowTest { protected void invokeSubProcess(String processKey, String businessKey, Map<String, Object> injectedVariables) { RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); List<String> arguments = runtimeMxBean.getInputArguments(); - msoLogger.debug("JVM args = " + arguments); + logger.debug("JVM args = {}", arguments); msoRequestId = (String) injectedVariables.get("mso-request-id"); String requestId = (String) injectedVariables.get("msoRequestId"); if (msoRequestId == null && requestId == null) { String msg = "mso-request-id variable was not provided"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -205,14 +208,14 @@ public abstract class WorkflowTest { protected String invokeSubProcess(String processKey, Map<String, Object> injectedVariables) { RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); List<String> arguments = runtimeMxBean.getInputArguments(); - msoLogger.debug("JVM args = " + arguments); + logger.debug("JVM args = {}", arguments); msoRequestId = (String) injectedVariables.get("mso-request-id"); String requestId = (String) injectedVariables.get("msoRequestId"); if (msoRequestId == null && requestId == null) { String msg = "mso-request-id variable was not provided"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -256,13 +259,13 @@ public abstract class WorkflowTest { RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); List<String> arguments = runtimeMxBean.getInputArguments(); - msoLogger.debug("JVM args = " + arguments); + logger.debug("JVM args = {}", arguments); Map<String, Object> variables = createVariables(schemaVersion, businessKey, request, injectedVariables, false); VariableMapImpl variableMapImpl = createVariableMapImpl(variables); - msoLogger.debug("Sending " + request + " to " + processKey + " process"); + logger.debug("Sending {} to {} process", request, processKey); TestAsyncResponse asyncResponse = new TestAsyncResponse(); @@ -290,13 +293,13 @@ public abstract class WorkflowTest { RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); List<String> arguments = runtimeMxBean.getInputArguments(); - msoLogger.debug("JVM args = " + arguments); + logger.debug("JVM args = {}", arguments); Map<String, Object> variables = createVariables(schemaVersion, businessKey, request, injectedVariables, serviceInstantiationModel); VariableMapImpl variableMapImpl = createVariableMapImpl(variables); - msoLogger.debug("Sending " + request + " to " + processKey + " process"); + logger.debug("Sending {} to {} process", request, processKey); return workflowResource.startProcessInstanceByKey( processKey, variableMapImpl); @@ -337,7 +340,7 @@ public abstract class WorkflowTest { for (String var : notAllowed) { if (var.equals(key)) { String msg = "Cannot specify " + var + " in injected variables"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } } @@ -367,11 +370,11 @@ public abstract class WorkflowTest { catch(Exception e) { } if (msoRequestId == null || msoRequestId.trim().equals("")) { - msoLogger.debug("No requestId element in injectedVariables"); + logger.debug("No requestId element in injectedVariables"); variables.put("mso-request-id", UUID.randomUUID().toString()); } if (msoServiceInstanceId == null || msoServiceInstanceId.trim().equals("")) { - msoLogger.debug("No seviceInstanceId element in injectedVariables"); + logger.debug("No seviceInstanceId element in injectedVariables"); variables.put("mso-service-instance-id", UUID.randomUUID().toString()); } @@ -387,7 +390,7 @@ public abstract class WorkflowTest { } if (msoRequestId == null || msoRequestId.trim().equals("")) { String msg = "No request-id element in " + request; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } } @@ -446,8 +449,7 @@ public abstract class WorkflowTest { */ protected WorkflowResponse receiveResponse(String businessKey, TestAsyncResponse asyncResponse, long timeout) { - msoLogger.debug("Waiting " + timeout + "ms for process with business key " + businessKey - + " to send a response"); + logger.debug("Waiting {}ms for process with business key {} to send a response", timeout, businessKey); long now = System.currentTimeMillis() + timeout; long endTime = now + timeout; @@ -456,7 +458,7 @@ public abstract class WorkflowTest { Response response = asyncResponse.getResponse(); if (response != null) { - msoLogger.debug("Received a response from process with business key " + businessKey); + logger.debug("Received a response from process with business key {}", businessKey); Object entity = response.getEntity(); @@ -464,7 +466,7 @@ public abstract class WorkflowTest { String msg = "Response entity is " + (entity == null ? "null" : entity.getClass().getName()) + ", expected WorkflowResponse"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); return null; // unreachable } @@ -477,7 +479,7 @@ public abstract class WorkflowTest { } catch (InterruptedException e) { String msg = "Interrupted waiting for a response from process with business key " + businessKey; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); return null; // unreachable } @@ -487,7 +489,7 @@ public abstract class WorkflowTest { String msg = "No response received from process with business key " + businessKey + " within " + timeout + "ms"; - msoLogger.debug(msg); + logger.debug(msg); fail("Process with business key " + businessKey + " did not end within 10000ms"); return null; // unreachable } @@ -525,7 +527,7 @@ public abstract class WorkflowTest { if (callbackData == null) { String msg = "No callback defined for '" + action + "' SDNC request"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -536,7 +538,7 @@ public abstract class WorkflowTest { contentType = JSON; } else { String msg = "Invalid SDNC program modifier: '" + modifier + "'"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -625,7 +627,7 @@ public abstract class WorkflowTest { if (callbackData == null) { String msg = "No callback defined for '" + action + "' SDNC request"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -637,7 +639,7 @@ public abstract class WorkflowTest { if (callbackData == null) { String msg = "No callback defined for '" + action + "' SDNC request"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -650,7 +652,7 @@ public abstract class WorkflowTest { respMsg = "SERVER ERROR"; } else { String msg = "Invalid SDNC program modifier: '" + modifier + "'"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -699,7 +701,7 @@ public abstract class WorkflowTest { if (callbackData == null) { String msg = "No callback defined for '" + action + "' VNF REST request"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -710,7 +712,7 @@ public abstract class WorkflowTest { contentType = "text/plain"; } else { String msg = "Invalid VNF REST program modifier: '" + modifier + "'"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -763,18 +765,18 @@ public abstract class WorkflowTest { if (callbackData == null) { String msg = "No callback defined for '" + action + "' VNF request"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } content = callbackData.getContent(); } else if ("ERR".equals(modifier)) { String msg = "Currently unsupported VNF program modifier: '" + modifier + "'"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } else { String msg = "Invalid VNF program modifier: '" + modifier + "'"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -790,7 +792,7 @@ public abstract class WorkflowTest { if (!injected) { String msg = "Failed to inject VNF '" + action + "' callback"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -810,8 +812,7 @@ public abstract class WorkflowTest { * @param timeout the timeout in milliseconds */ protected void waitForRunningProcessCount(String processKey, int count, long timeout) { - msoLogger.debug("Waiting " + timeout + "ms for there to be " + count + " " - + processKey + " instances"); + logger.debug("Waiting {}ms for there to be {} {} instances", timeout, count, processKey); long now = System.currentTimeMillis() + timeout; long endTime = now + timeout; @@ -824,8 +825,7 @@ public abstract class WorkflowTest { .list().size(); if (actual != last) { - msoLogger.debug("There are now " + actual + " " - + processKey + " instances"); + logger.debug("There are now {} {} instances", actual, processKey); last = actual; } @@ -838,7 +838,7 @@ public abstract class WorkflowTest { } catch (InterruptedException e) { String msg = "Interrupted waiting for there to be " + count + " " + processKey + " instances"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -847,7 +847,7 @@ public abstract class WorkflowTest { String msg = "Timed out waiting for there to be " + count + " " + processKey + " instances"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -862,8 +862,7 @@ public abstract class WorkflowTest { protected Object getProcessVariable(String processKey, String variable, long timeout) { - msoLogger.debug("Waiting " + timeout + "ms for " - + processKey + "." + variable + " to be set"); + logger.debug("Waiting " + timeout + "ms for " + processKey + "." + variable + " to be set"); long now = System.currentTimeMillis() + timeout; long endTime = now + timeout; @@ -874,10 +873,10 @@ public abstract class WorkflowTest { while (value == null) { if (now > endTime) { if (processInstance == null) { - msoLogger.debug("Timed out waiting for " + logger.debug("Timed out waiting for " + processKey + " to start"); } else { - msoLogger.debug("Timed out waiting for " + logger.debug("Timed out waiting for " + processKey + "[" + processInstance.getId() + "]." + variable + " to be set"); } @@ -896,7 +895,8 @@ public abstract class WorkflowTest { processInstance = processInstanceQuery.singleResult(); }else{ //TODO There shouldnt be more than one in the list but seems to be happening, need to figure out why happening and best way to get correct one from list - msoLogger.debug("Process Instance Query returned " + processInstanceQuery.count() + " instance. Getting the last instance in the list"); + logger.debug("Process Instance Query returned {} instance. Getting the last instance in the list", + processInstanceQuery.count()); List<ProcessInstance> processList = processInstanceQuery.list(); processInstance = processList.get((processList.size() - 1)); } @@ -910,15 +910,14 @@ public abstract class WorkflowTest { try { Thread.sleep(200); } catch (InterruptedException e) { - msoLogger.debug("Interrupted waiting for " - + processKey + "." + variable + " to be set"); + logger.debug("Interrupted waiting for {}.{} to be set", processKey, variable); return null; } now = System.currentTimeMillis(); } - msoLogger.debug(processKey + "[" + logger.debug(processKey + "[" + processInstance.getId() + "]." + variable + "=" + value); @@ -952,10 +951,10 @@ public abstract class WorkflowTest { // Deprecated usage. All test code should switch to the (( ... )) syntax. content = content.replace("{{REQUEST-ID}}", sdncRequestId); - msoLogger.debug("Injecting SDNC adapter callback"); + logger.debug("Injecting SDNC adapter callback"); Response response = workflowMessageResource.deliver(contentType, "SDNCAResponse", sdncRequestId, content); - msoLogger.debug("Workflow response to SDNC adapter callback: " + response); + logger.debug("Workflow response to SDNC adapter callback: " + response); return true; } @@ -987,7 +986,7 @@ public abstract class WorkflowTest { // TODO this needs to be fixed. It is causing double tags and content // Need to parse content before setting below since content includes not just RequestData or modify callback files to only contain RequestData contents. - msoLogger.debug("Injecting SDNC adapter callback"); + logger.debug("Injecting SDNC adapter callback"); CallbackHeader callbackHeader = new CallbackHeader(); callbackHeader.setRequestId(sdncRequestId); callbackHeader.setResponseCode(String.valueOf(respCode)); @@ -996,7 +995,7 @@ public abstract class WorkflowTest { sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); sdncAdapterCallbackRequest.setRequestData(content); SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); - msoLogger.debug("Workflow response to SDNC adapter callback: " + sdncAdapterResponse); + logger.debug("Workflow response to SDNC adapter callback: " + sdncAdapterResponse); return true; } @@ -1023,10 +1022,10 @@ public abstract class WorkflowTest { // Deprecated usage. All test code should switch to the (( ... )) syntax. content = content.replace("{{MESSAGE-ID}}", messageId); - msoLogger.debug("Injecting VNF adapter callback"); + logger.debug("Injecting VNF adapter callback"); Response response = workflowMessageResource.deliver(contentType, "VNFAResponse", messageId, content); - msoLogger.debug("Workflow response to VNF adapter callback: " + response); + logger.debug("Workflow response to VNF adapter callback: {}", response); return true; } @@ -1059,7 +1058,7 @@ public abstract class WorkflowTest { content = content.replace("{{REQUEST-ID}}", msoRequestId); } - msoLogger.debug("Injecting VNF adapter callback"); + logger.debug("Injecting VNF adapter callback"); // Is it possible to unmarshal this with JAXB? I couldn't. @@ -1132,8 +1131,8 @@ public abstract class WorkflowTest { createVnfNotification.setRollback(rollback); } catch (Exception e) { - msoLogger.debug("Failed to unmarshal VNF callback content:"); - msoLogger.debug(content); + logger.debug("Failed to unmarshal VNF callback content:"); + logger.debug(content); return false; } @@ -1175,7 +1174,7 @@ public abstract class WorkflowTest { // Deprecated usage. All test code should switch to the (( ... )) syntax. content = content.replace("{{MESSAGE-ID}}", messageId); - msoLogger.debug("Injecting VNF adapter delete callback"); + logger.debug("Injecting VNF adapter delete callback"); // Is it possible to unmarshal this with JAXB? I couldn't. @@ -1195,8 +1194,8 @@ public abstract class WorkflowTest { } } catch (Exception e) { - msoLogger.debug("Failed to unmarshal VNF Delete callback content:"); - msoLogger.debug(content); + logger.debug("Failed to unmarshal VNF Delete callback content:"); + logger.debug(content); return false; } @@ -1239,7 +1238,7 @@ public abstract class WorkflowTest { // Deprecated usage. All test code should switch to the (( ... )) syntax. content = content.replace("{{REQUEST-ID}}", msoRequestId); - msoLogger.debug("Injecting VNF adapter callback"); + logger.debug("Injecting VNF adapter callback"); // Is it possible to unmarshal this with JAXB? I couldn't. @@ -1308,8 +1307,8 @@ public abstract class WorkflowTest { updateVnfNotification.setRollback(rollback); } catch (Exception e) { - msoLogger.debug("Failed to unmarshal VNF callback content:"); - msoLogger.debug(content); + logger.debug("Failed to unmarshal VNF callback content:"); + logger.debug(content); return false; } @@ -1362,7 +1361,7 @@ public abstract class WorkflowTest { if (callbackData == null) { String msg = "No '" + action + "' workflow message callback is defined"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1370,7 +1369,7 @@ public abstract class WorkflowTest { if (messageType == null || messageType.trim().equals("")) { String msg = "No workflow message type is defined in the '" + action + "' callback"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1378,7 +1377,7 @@ public abstract class WorkflowTest { contentType = callbackData.getContentType(); } else { String msg = "Invalid workflow message program modifier: '" + modifier + "'"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1416,10 +1415,10 @@ public abstract class WorkflowTest { content = content.replace("((CORRELATOR))", correlator); } - msoLogger.debug("Injecting " + messageType + " message"); + logger.debug("Injecting " + messageType + " message"); Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content); - msoLogger.debug("Workflow response to " + messageType + " message: " + response); + logger.debug("Workflow response to {} message: {}", messageType, response); return true; } @@ -1458,7 +1457,7 @@ public abstract class WorkflowTest { if (callbackData == null) { String msg = "No '" + action + "' workflow message callback is defined"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1466,7 +1465,7 @@ public abstract class WorkflowTest { if (messageType == null || messageType.trim().equals("")) { String msg = "No workflow message type is defined in the '" + action + "' callback"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1474,7 +1473,7 @@ public abstract class WorkflowTest { contentType = callbackData.getContentType(); } else { String msg = "Invalid workflow message program modifier: '" + modifier + "'"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1588,10 +1587,10 @@ public abstract class WorkflowTest { } } } - msoLogger.debug("Injecting " + messageType + " message"); + logger.debug("Injecting " + messageType + " message"); Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content); - msoLogger.debug("Workflow response to " + messageType + " message: " + response); + logger.debug("Workflow response to {} message: {}", messageType, response); return true; } @@ -1602,15 +1601,14 @@ public abstract class WorkflowTest { * @param timeout the amount of time to wait, in milliseconds */ protected void waitForProcessEnd(String businessKey, long timeout) { - msoLogger.debug("Waiting " + timeout + "ms for process with business key " + - businessKey + " to end"); + logger.debug("Waiting {}ms for process with business key {} to end", timeout, businessKey); long now = System.currentTimeMillis() + timeout; long endTime = now + timeout; while (now <= endTime) { if (isProcessEnded(businessKey)) { - msoLogger.debug("Process with business key " + businessKey + " has ended"); + logger.debug("Process with business key {} has ended", businessKey); return; } @@ -1619,7 +1617,7 @@ public abstract class WorkflowTest { } catch (InterruptedException e) { String msg = "Interrupted waiting for process with business key " + businessKey + " to end"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1628,7 +1626,7 @@ public abstract class WorkflowTest { String msg = "Process with business key " + businessKey + " did not end within " + timeout + "ms"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1643,15 +1641,14 @@ public abstract class WorkflowTest { * @author cb645j */ protected void waitForProcessEnd(String businessKey, String processName, long timeout) { - msoLogger.debug("Waiting " + timeout + "ms for process with business key " + - businessKey + " to end"); + logger.debug("Waiting {}ms for process with business key {} to end", timeout, businessKey); long now = System.currentTimeMillis() + timeout; long endTime = now + timeout; while (now <= endTime) { if (isProcessEnded(businessKey, processName)) { - msoLogger.debug("Process with business key " + businessKey + " has ended"); + logger.debug("Process with business key {} has ended", businessKey); return; } @@ -1660,7 +1657,7 @@ public abstract class WorkflowTest { } catch (InterruptedException e) { String msg = "Interrupted waiting for process with business key " + businessKey + " to end"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1669,7 +1666,7 @@ public abstract class WorkflowTest { String msg = "Process with business key " + businessKey + " did not end within " + timeout + "ms"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1747,8 +1744,8 @@ public abstract class WorkflowTest { .variableName(variableName).singleResult(); return v == null ? null : v.getValue(); } catch (Exception e) { - msoLogger.debug("Error retrieving variable " + variableName + - " from historical process with business key " + businessKey + ": " + e); + logger.debug("Error retrieving variable {} from historical process with business key {}: ", variableName, businessKey, + e); return null; } } @@ -1777,10 +1774,12 @@ public abstract class WorkflowTest { return variable == null ? null : variable.getValue(); }catch(ProcessEngineException e){ - msoLogger.debug("Multiple proccess instances exist with process name " + processName + " and business key " + businessKey + ". Must pass instance index as a parameter."); + logger.debug("Multiple proccess instances exist with process name {} and business key {}. Must pass instance " + + "index as a parameter.", processName, businessKey); return null; }catch(Exception e){ - msoLogger.debug("Error retrieving variable " + variableName + " from historical process for process " + processName + " with business key " + businessKey + ": " + e); + logger.debug("Error retrieving variable {} from historical process for process {} with business key {}: ", + variableName, processName, businessKey, e); return null; } } @@ -1814,7 +1813,8 @@ public abstract class WorkflowTest { return variable == null ? null : variable.getValue(); }catch(Exception e) { - msoLogger.debug("Error retrieving variable " + variableName + " from historical process for process " + processName + " with business key " + businessKey + ": " + e); + logger.debug("Error retrieving variable {} from historical process for process {} with business key {}: ", + variableName, processName, businessKey, e); return null; } } @@ -1851,8 +1851,7 @@ public abstract class WorkflowTest { .variableName(variableName).singleResult(); return v == null ? null : v.getValue(); } catch (Exception e) { - msoLogger.debug("Error retrieving variable " + variableName + - " from sub flow: " + subflowName + ", Exception is: " + e); + logger.debug("Error retrieving variable {} from sub flow: {}, Exception is: ", variableName, subflowName, e); return null; } } @@ -1886,8 +1885,8 @@ public abstract class WorkflowTest { .variableName(variableName).singleResult(); return v == null ? null : v.getValue(); } catch (Exception e) { - msoLogger.debug("Error retrieving variable " + variableName + - " from " + subflowInstanceIndex + " instance index of sub flow: " + subflowName + ", Exception is: " + e); + logger.debug("Error retrieving variable {} from {} instance index of sub flow: {}, Exception is: ", variableName, + subflowInstanceIndex, subflowName, e); return null; } } diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java index 13fe61f704..5cc0281407 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java @@ -23,7 +23,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import java.util.HashMap; @@ -62,7 +62,7 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest { @Test public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenAaiEntryExists() { // given - variables.put(CORRELATION_ID, PnfManagementTestImpl.ID_WITH_ENTRY); + variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITH_ENTRY); // when ProcessInstance instance = runtimeService .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables); @@ -73,7 +73,7 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest { assertThat(instance).isEnded().hasPassedInOrder( "CreateAndActivatePnf_StartEvent", "CheckInputs", - "CheckAiiForCorrelationId", + "CheckAiiForPnfCorrelationId", "DoesAaiContainInfoAboutPnf", "AaiEntryExists", "InformDmaapClient", @@ -88,7 +88,7 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest { @Test public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntryExists() { // given - variables.put(CORRELATION_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY); + variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY); // when ProcessInstance instance = runtimeService .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables); @@ -99,7 +99,7 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest { assertThat(instance).isEnded().hasPassedInOrder( "CreateAndActivatePnf_StartEvent", "CheckInputs", - "CheckAiiForCorrelationId", + "CheckAiiForPnfCorrelationId", "DoesAaiContainInfoAboutPnf", "CreatePnfEntryInAai", "AaiEntryExists", diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java index 146e07b820..6a5f9fac74 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java @@ -30,19 +30,19 @@ import org.springframework.stereotype.Component; @Primary public class DmaapClientTestImpl implements DmaapClient { - private String correlationId; + private String pnfCorrelationId; private Runnable informConsumer; @Override - public void registerForUpdate(String correlationId, Runnable informConsumer) { - this.correlationId = correlationId; + public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) { + this.pnfCorrelationId = pnfCorrelationId; this.informConsumer = informConsumer; } @Override - public Runnable unregister(String correlationId) { - if (Objects.equals(this.correlationId, correlationId)) { - this.correlationId = null; + public Runnable unregister(String pnfCorrelationId) { + if (Objects.equals(this.pnfCorrelationId, pnfCorrelationId)) { + this.pnfCorrelationId = null; Runnable informConsumer = this.informConsumer; this.informConsumer = null; return informConsumer; @@ -50,8 +50,8 @@ public class DmaapClientTestImpl implements DmaapClient { return null; } - public String getCorrelationId() { - return correlationId; + public String getPnfCorrelationId() { + return pnfCorrelationId; } public Runnable getInformConsumer() { @@ -63,6 +63,6 @@ public class DmaapClientTestImpl implements DmaapClient { } public boolean haveRegisteredConsumer() { - return correlationId != null; + return pnfCorrelationId != null; } } diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java index 84c983619b..f9db93e3f7 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java @@ -40,8 +40,8 @@ public class PnfManagementTestImpl implements PnfManagement { private Map<String, String> serviceAndPnfRelationMap = new HashMap<>(); @Override - public Optional<Pnf> getEntryFor(String correlationId) { - if (Objects.equals(correlationId, ID_WITH_ENTRY)) { + public Optional<Pnf> getEntryFor(String pnfCorrelationId) { + if (Objects.equals(pnfCorrelationId, ID_WITH_ENTRY)) { return Optional.of(new Pnf()); } else { return Optional.empty(); @@ -49,8 +49,8 @@ public class PnfManagementTestImpl implements PnfManagement { } @Override - public void createEntry(String correlationId, Pnf entry) { - created.put(correlationId, entry); + public void createEntry(String pnfCorrelationId, Pnf entry) { + created.put(pnfCorrelationId, entry); } @Override diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml b/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml index 21ad485fdb..56a92cbd01 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml +++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml @@ -157,7 +157,7 @@ sniro: headers.latestVersion: 2 spring: datasource: - jdbcUrl: jdbc:mariadb://localhost:3307/camundabpmn + url: jdbc:mariadb://localhost:3307/camundabpmn username: root password: password driver-class-name: org.mariadb.jdbc.Driver diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn index 1109e9cd9d..228eaefdb9 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVfModuleBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> <bpmn:process id="AssignVfModuleBB" name="AssignVfModuleBB" isExecutable="true"> <bpmn:startEvent id="AssignVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_1xr6chl</bpmn:outgoing> @@ -18,7 +18,7 @@ <bpmn:incoming>SequenceFlow_14xl505</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_14xl505" sourceRef="UpdateVfModuleStatus" targetRef="AssignVfModuleBB_End" /> - <bpmn:serviceTask id="UpdateVfModuleStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="UpdateVfModuleStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1dttbxh</bpmn:incoming> <bpmn:outgoing>SequenceFlow_14xl505</bpmn:outgoing> </bpmn:serviceTask> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn index 1cfb9a3860..1235469b42 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn @@ -1,19 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="UpdateNetworkBB" name="UpdateNetworkBB" isExecutable="true"> <bpmn2:startEvent id="UpdateNetworkBB_Start" name="Start"> <bpmn2:outgoing>SequenceFlow_074w2et</bpmn2:outgoing> </bpmn2:startEvent> <bpmn2:serviceTask id="SDNCChangeAssignNetwork" name="SDNC ChangeAssign Network" camunda:expression="${SDNCChangeAssignTasks.changeAssignNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_074w2et</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_04yezm3</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_0rvstwt</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:sequenceFlow id="SequenceFlow_074w2et" sourceRef="UpdateNetworkBB_Start" targetRef="SDNCChangeAssignNetwork" /> <bpmn2:intermediateThrowEvent id="SDNC_End" name="To AAI"> - <bpmn2:incoming>SequenceFlow_04yezm3</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1eacnem</bpmn2:incoming> <bpmn2:linkEventDefinition name="SDNC_to_AAI" /> </bpmn2:intermediateThrowEvent> - <bpmn2:sequenceFlow id="SequenceFlow_04yezm3" sourceRef="SDNCChangeAssignNetwork" targetRef="SDNC_End" /> <bpmn2:intermediateCatchEvent id="AAI_Start" name="To AAI"> <bpmn2:outgoing>SequenceFlow_1trqq6d</bpmn2:outgoing> <bpmn2:linkEventDefinition name="SDNC_to_AAI" /> @@ -38,24 +37,51 @@ <bpmn2:linkEventDefinition name="AAI_to_AIC" /> </bpmn2:intermediateThrowEvent> <bpmn2:sequenceFlow id="SequenceFlow_00xbxe7" sourceRef="QueryNetworkTableRefAAI" targetRef="AAI_End" /> - <bpmn2:intermediateCatchEvent id="AIC_Start" name="To AIC"> - <bpmn2:outgoing>SequenceFlow_196cgux</bpmn2:outgoing> + <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_0y5f10a" name="To AIC"> + <bpmn2:outgoing>SequenceFlow_0qrtpcy</bpmn2:outgoing> <bpmn2:linkEventDefinition name="AAI_to_AIC" /> </bpmn2:intermediateCatchEvent> - <bpmn2:sequenceFlow id="SequenceFlow_196cgux" sourceRef="AIC_Start" targetRef="UpdateNetworkAdapter" /> - <bpmn2:serviceTask id="UpdateNetworkAdapter" name="Update Network (Network Adapter)" camunda:expression="${NetworkAdapterUpdateTasks.updateNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn2:incoming>SequenceFlow_196cgux</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0hsvgje</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_0hsvgje" sourceRef="UpdateNetworkAdapter" targetRef="UpdateNetworkAAI" /> - <bpmn2:serviceTask id="UpdateNetworkAAI" name="Update Network (AAI)" camunda:expression="${AAIUpdateTasks.updateObjectNetwork(execution.getVariable(""))}"> - <bpmn2:incoming>SequenceFlow_0hsvgje</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0fhfitm</bpmn2:outgoing> + <bpmn2:serviceTask id="Update_Network_AAI_ServiceTask" name="Update Network (AAI)" camunda:expression="${AAIUpdateTasks.updateNetworkUpdated(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:incoming>SequenceFlow_001ursg</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_06ei0em</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:endEvent id="UpdateNetworkBB_End" name="End"> - <bpmn2:incoming>SequenceFlow_0fhfitm</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_06ei0em</bpmn2:incoming> </bpmn2:endEvent> - <bpmn2:sequenceFlow id="SequenceFlow_0fhfitm" sourceRef="UpdateNetworkAAI" targetRef="UpdateNetworkBB_End" /> + <bpmn2:callActivity id="CallActivity_NetworkAdapterRestV1" name="Call NetworkAdapterRestV1" calledElement="NetworkAdapterRestV1"> + <bpmn2:extensionElements> + <camunda:in source="networkAdapterRequest" target="networkAdapterRequest" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="updateNetworkResponse" target="updateNetworkResponse" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_07hq1eg</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_183ph5i</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:serviceTask id="ServiceTask_ProcessResponse" name="Process Response From Openstack" camunda:expression="${NetworkAdapterUpdateTasks.processResponseFromOpenstack(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:incoming>SequenceFlow_183ph5i</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_001ursg</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:serviceTask id="Create_Network_ServiceTask" name=" AIC Update (network) " camunda:expression="${NetworkAdapterUpdateTasks.updateNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:incoming>SequenceFlow_0qrtpcy</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_07hq1eg</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:sequenceFlow id="SequenceFlow_0qrtpcy" sourceRef="IntermediateCatchEvent_0y5f10a" targetRef="Create_Network_ServiceTask" /> + <bpmn2:sequenceFlow id="SequenceFlow_001ursg" sourceRef="ServiceTask_ProcessResponse" targetRef="Update_Network_AAI_ServiceTask" /> + <bpmn2:sequenceFlow id="SequenceFlow_06ei0em" sourceRef="Update_Network_AAI_ServiceTask" targetRef="UpdateNetworkBB_End" /> + <bpmn2:sequenceFlow id="SequenceFlow_07hq1eg" sourceRef="Create_Network_ServiceTask" targetRef="CallActivity_NetworkAdapterRestV1" /> + <bpmn2:sequenceFlow id="SequenceFlow_183ph5i" sourceRef="CallActivity_NetworkAdapterRestV1" targetRef="ServiceTask_ProcessResponse" /> + <bpmn2:callActivity id="CallActivity_sdncHandlerCallChangeAssign" name="SDNC Change Assign (network)" calledElement="SDNCHandler"> + <bpmn2:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_0rvstwt</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1eacnem</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_0rvstwt" sourceRef="SDNCChangeAssignNetwork" targetRef="CallActivity_sdncHandlerCallChangeAssign" /> + <bpmn2:sequenceFlow id="SequenceFlow_1eacnem" sourceRef="CallActivity_sdncHandlerCallChangeAssign" targetRef="SDNC_End" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -79,18 +105,11 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_0pce3rm_di" bpmnElement="SDNC_End"> - <dc:Bounds x="487" y="77" width="36" height="36" /> + <dc:Bounds x="665" y="77" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="490" y="117" width="33" height="12" /> + <dc:Bounds x="669" y="117" width="32" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_04yezm3_di" bpmnElement="SequenceFlow_04yezm3"> - <di:waypoint xsi:type="dc:Point" x="378" y="95" /> - <di:waypoint xsi:type="dc:Point" x="487" y="95" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="432.5" y="74" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_1hbb3j8_di" bpmnElement="AAI_Start"> <dc:Bounds x="144" y="215" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -140,43 +159,82 @@ <dc:Bounds x="755" y="212" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="IntermediateCatchEvent_0sx0nb6_di" bpmnElement="AIC_Start"> - <dc:Bounds x="144" y="332" width="36" height="36" /> + <bpmndi:BPMNShape id="IntermediateCatchEvent_0y5f10a_di" bpmnElement="IntermediateCatchEvent_0y5f10a"> + <dc:Bounds x="144" y="384" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="146" y="372" width="34" height="12" /> + <dc:Bounds x="147" y="424" width="33" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_196cgux_di" bpmnElement="SequenceFlow_196cgux"> - <di:waypoint xsi:type="dc:Point" x="180" y="350" /> - <di:waypoint xsi:type="dc:Point" x="248" y="350" /> + <bpmndi:BPMNShape id="ServiceTask_1ltcf7v_di" bpmnElement="Update_Network_AAI_ServiceTask"> + <dc:Bounds x="806" y="362" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1nhzcte_di" bpmnElement="UpdateNetworkBB_End"> + <dc:Bounds x="983" y="384" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="169" y="329" width="90" height="12" /> + <dc:Bounds x="992" y="424" width="19" height="12" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_0i66n9g_di" bpmnElement="UpdateNetworkAdapter"> - <dc:Bounds x="248" y="310" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0hsvgje_di" bpmnElement="SequenceFlow_0hsvgje"> - <di:waypoint xsi:type="dc:Point" x="348" y="350" /> - <di:waypoint xsi:type="dc:Point" x="422" y="350" /> + <bpmndi:BPMNShape id="CallActivity_1jpfzuh_di" bpmnElement="CallActivity_NetworkAdapterRestV1"> + <dc:Bounds x="445" y="362" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1kgckv9_di" bpmnElement="ServiceTask_ProcessResponse"> + <dc:Bounds x="625" y="362" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_03ywm5v_di" bpmnElement="Create_Network_ServiceTask"> + <dc:Bounds x="278" y="362" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0qrtpcy_di" bpmnElement="SequenceFlow_0qrtpcy"> + <di:waypoint xsi:type="dc:Point" x="180" y="402" /> + <di:waypoint xsi:type="dc:Point" x="229" y="402" /> + <di:waypoint xsi:type="dc:Point" x="229" y="402" /> + <di:waypoint xsi:type="dc:Point" x="278" y="402" /> <bpmndi:BPMNLabel> - <dc:Bounds x="340" y="329" width="90" height="12" /> + <dc:Bounds x="199" y="396" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_1ydm5u9_di" bpmnElement="UpdateNetworkAAI"> - <dc:Bounds x="422" y="310" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_0fsts2w_di" bpmnElement="UpdateNetworkBB_End"> - <dc:Bounds x="637" y="332" width="36" height="36" /> + <bpmndi:BPMNEdge id="SequenceFlow_001ursg_di" bpmnElement="SequenceFlow_001ursg"> + <di:waypoint xsi:type="dc:Point" x="725" y="402" /> + <di:waypoint xsi:type="dc:Point" x="806" y="402" /> <bpmndi:BPMNLabel> - <dc:Bounds x="646" y="372" width="19" height="12" /> + <dc:Bounds x="720.5" y="381" width="0" height="12" /> </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_06ei0em_di" bpmnElement="SequenceFlow_06ei0em"> + <di:waypoint xsi:type="dc:Point" x="906" y="402" /> + <di:waypoint xsi:type="dc:Point" x="983" y="402" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="899.5" y="381" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_07hq1eg_di" bpmnElement="SequenceFlow_07hq1eg"> + <di:waypoint xsi:type="dc:Point" x="378" y="402" /> + <di:waypoint xsi:type="dc:Point" x="445" y="402" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="411.5" y="381" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_183ph5i_di" bpmnElement="SequenceFlow_183ph5i"> + <di:waypoint xsi:type="dc:Point" x="545" y="402" /> + <di:waypoint xsi:type="dc:Point" x="625" y="402" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="585" y="381" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1da6ys0_di" bpmnElement="CallActivity_sdncHandlerCallChangeAssign"> + <dc:Bounds x="455" y="55" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0fhfitm_di" bpmnElement="SequenceFlow_0fhfitm"> - <di:waypoint xsi:type="dc:Point" x="522" y="350" /> - <di:waypoint xsi:type="dc:Point" x="637" y="350" /> + <bpmndi:BPMNEdge id="SequenceFlow_0rvstwt_di" bpmnElement="SequenceFlow_0rvstwt"> + <di:waypoint xsi:type="dc:Point" x="378" y="95" /> + <di:waypoint xsi:type="dc:Point" x="455" y="95" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="416.5" y="74" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1eacnem_di" bpmnElement="SequenceFlow_1eacnem"> + <di:waypoint xsi:type="dc:Point" x="555" y="95" /> + <di:waypoint xsi:type="dc:Point" x="665" y="95" /> <bpmndi:BPMNLabel> - <dc:Bounds x="535" y="329" width="90" height="12" /> + <dc:Bounds x="610" y="74" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java index 98e049f440..1bb065ae06 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java @@ -33,22 +33,24 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class UpdateNetworkBBTest extends BaseBPMNTest { @Test public void updateNetworkBBTest() throws InterruptedException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("UpdateNetworkBB", variables); assertThat(processInstance).isNotNull(); assertThat(processInstance).isStarted().hasPassedInOrder( - "UpdateNetworkBB_Start", "SDNCChangeAssignNetwork", + "UpdateNetworkBB_Start", "SDNCChangeAssignNetwork", "CallActivity_sdncHandlerCallChangeAssign", "QueryVpnBindingAAI", "QueryNetworkPolicyAAI", "QueryNetworkTableRefAAI", - "UpdateNetworkAdapter", "UpdateNetworkAAI", "UpdateNetworkBB_End"); + "Create_Network_ServiceTask", "CallActivity_NetworkAdapterRestV1", "ServiceTask_ProcessResponse", "Update_Network_AAI_ServiceTask", "UpdateNetworkBB_End"); assertThat(processInstance).isEnded(); } @Test public void updateNetworkBBExceptionTest() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiQueryTasks).queryNetworkVpnBinding(any(BuildingBlockExecution.class)); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("UpdateNetworkBB", variables); assertThat(processInstance).isStarted().hasPassedInOrder( - "UpdateNetworkBB_Start", "SDNCChangeAssignNetwork", + "UpdateNetworkBB_Start", "SDNCChangeAssignNetwork", "CallActivity_sdncHandlerCallChangeAssign", "QueryVpnBindingAAI") .hasNotPassed("QueryNetworkPolicyAAI", "QueryNetworkTableRefAAI", "UpdateNetworkAdapter", "UpdateNetworkAAI", "UpdateNetworkBB_End"); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy index 4237a8d6a4..32fc46a84f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy @@ -264,24 +264,8 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { execution.setVariable("vmIdList", vmidsArray.toString()) execution.setVariable("vserverIdList", vserveridsArray.toString()) } - } - - if (cloudRegionId != null) { - AAIUri cloudRegionUri = AAIUriFactory.createResourceUri(AAIObjectType.DEFAULT_CLOUD_REGION, cloudRegionId) - // Check if this client region exists - if (!client.exists(cloudRegionUri)) { - msoLogger.debug("Cloud Region with cloudRegionId " + cloudRegionId + " does not exist in A&AI") - exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Cloud Region with cloudRegionId " + cloudRegionId + " does not exist in A&AI") - } - - AAIResultWrapper aaiRWCloud = client.get(cloudRegionUri) + } - Map<String, Object> resultCloud = aaiRWCloud.asMap() - - String aicIdentity = resultCloud.get("identity-url") - msoLogger.debug("aicIdentity from A&AI is: " + aicIdentity) - execution.setVariable("aicIdentity", aicIdentity) - } // preserve relationships if exist Optional<Relationships> relationships = aaiRW.getRelationships() @@ -825,7 +809,5 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { } msoLogger.trace("Exit postProcessRollback ") } - - } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java index 6062129a71..0c519ef29f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -24,23 +26,19 @@ import java.util.HashMap; import java.util.Map; import java.util.Optional; -import javax.ws.rs.NotFoundException; - -import org.onap.aai.domain.yang.ServiceInstance; -import org.onap.aai.domain.yang.ServiceInstances; import org.onap.aai.domain.yang.OwningEntities; import org.onap.aai.domain.yang.OwningEntity; -import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class AAICreateResources { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAICreateResources.class); + private static final Logger logger = LoggerFactory.getLogger(AAICreateResources.class); public void createAAIProject (String projectName, String serviceInstance){ AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); @@ -73,7 +71,7 @@ public class AAICreateResources { .createResourceUri(AAIObjectPlurals.OWNING_ENTITY) .queryParam("owning-entity-name", owningEntityName)) .orElseGet(() -> { - msoLogger.debug("No Owning Entity matched by name"); + logger.debug("No Owning Entity matched by name"); return null; }); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java index 05109abc84..439591a295 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java @@ -33,8 +33,8 @@ public class CancelDmaapSubscription implements JavaDelegate { @Override public void execute(DelegateExecution execution) { - String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID); - dmaapClient.unregister(correlationId); + String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID); + dmaapClient.unregister(pnfCorrelationId); } @Autowired diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java index a8fb21540a..e0fa41b7a1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java @@ -21,7 +21,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; import java.io.IOException; @@ -35,16 +35,16 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** - * Implementation of "Check AAI for correlation_id" task in CreateAndActivatePnfResource.bpmn + * Implementation of "Check AAI for pnf_correlation_id" task in CreateAndActivatePnfResource.bpmn * - * Inputs: - correlationId - String + * Inputs: - pnfCorrelationId - String * * Outputs: - aaiContainsInfoAboutPnf - local Boolean */ @Component -public class CheckAaiForCorrelationIdDelegate implements JavaDelegate { +public class CheckAaiForPnfCorrelationIdDelegate implements JavaDelegate { - private static final Logger logger = LoggerFactory.getLogger(CheckAaiForCorrelationIdDelegate.class); + private static final Logger logger = LoggerFactory.getLogger(CheckAaiForPnfCorrelationIdDelegate.class); private PnfManagement pnfManagement; @@ -55,13 +55,13 @@ public class CheckAaiForCorrelationIdDelegate implements JavaDelegate { @Override public void execute(DelegateExecution execution) { - String correlationId = (String) execution.getVariable(CORRELATION_ID); - if (correlationId == null) { - new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, CORRELATION_ID + " is not set"); + String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID); + if (pnfCorrelationId == null) { + new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, PNF_CORRELATION_ID + " is not set"); } try { - boolean isEntry = pnfManagement.getEntryFor(correlationId).isPresent(); - logger.debug("AAI entry is found for pnf correlation id {}: {}", CORRELATION_ID, isEntry); + boolean isEntry = pnfManagement.getEntryFor(pnfCorrelationId).isPresent(); + logger.debug("AAI entry is found for pnf correlation id {}: {}", PNF_CORRELATION_ID, isEntry); execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, isEntry); } catch (IOException e) { new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, e.getMessage()); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java index c31041fbf7..e56cb83119 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java @@ -22,7 +22,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -38,7 +38,7 @@ import org.springframework.stereotype.Component; * Implementation of "Create Pnf entry in AAI" task in CreateAndActivatePnfResource.bpmn * * Inputs: - * - correlationId - String + * - pnfCorrelationId - String * - pnfUuid - String */ @Component @@ -54,12 +54,12 @@ public class CreatePnfEntryInAaiDelegate implements JavaDelegate { @Override public void execute(DelegateExecution execution) throws Exception { - String correlationId = (String) execution.getVariable(CORRELATION_ID); + String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID); String pnfUuid = (String) execution.getVariable(PNF_UUID); Pnf pnf = new Pnf(); pnf.setPnfId(pnfUuid); - pnf.setPnfName(correlationId); - pnfManagement.createEntry(correlationId, pnf); - logger.debug("AAI entry is created for pnf correlation id: {}, pnf uuid: {}", correlationId, pnfUuid); + pnf.setPnfName(pnfCorrelationId); + pnfManagement.createEntry(pnfCorrelationId, pnf); + logger.debug("AAI entry is created for pnf correlation id: {}, pnf uuid: {}", pnfCorrelationId, pnfUuid); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java index 7b6706f820..a367bada02 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java @@ -44,7 +44,7 @@ public class CreateRelation implements JavaDelegate { @Override public void execute(DelegateExecution delegateExecution) { String serviceInstanceId = (String) delegateExecution.getVariable("serviceInstanceId"); - String pnfName = (String) delegateExecution.getVariable("correlationId"); + String pnfName = (String) delegateExecution.getVariable("pnfCorrelationId"); try { pnfManagementImpl.createRelation(serviceInstanceId, pnfName); } catch (Exception e) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java index c5caea5f2f..7d449e72a8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java @@ -27,7 +27,7 @@ public class ExecutionVariableNames { private ExecutionVariableNames() {} - public final static String CORRELATION_ID = "correlationId"; + public final static String PNF_CORRELATION_ID = "pnfCorrelationId"; public final static String AAI_CONTAINS_INFO_ABOUT_PNF = "aaiContainsInfoAboutPnf"; public final static String AAI_CONTAINS_INFO_ABOUT_IP = "aaiContainsInfoAboutIp"; public final static String DMAAP_MESSAGE = "dmaapMessage"; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java index 1a75b0998c..96455acb84 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java @@ -34,9 +34,9 @@ public class InformDmaapClient implements JavaDelegate { @Override public void execute(DelegateExecution execution) { - String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID); + String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID); RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService(); - dmaapClient.registerForUpdate(correlationId, () -> + dmaapClient.registerForUpdate(pnfCorrelationId, () -> runtimeService .createMessageCorrelation("WorkflowMessage") .processInstanceBusinessKey(execution.getProcessBusinessKey()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java index 1b185f7c03..1caadea0de 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java @@ -22,7 +22,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION; @@ -49,16 +49,16 @@ public class PnfCheckInputs implements JavaDelegate { @Override public void execute(DelegateExecution execution) { - validateCorrelationId(execution); + validatePnfCorrelationId(execution); validatePnfUuid(execution); validateTimeout(execution); validateServiceInstanceId(execution); } - private void validateCorrelationId(DelegateExecution execution) { - String correlationId = (String) execution.getVariable(CORRELATION_ID); - if (Strings.isNullOrEmpty(correlationId)) { - new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "correlationId variable not defined"); + private void validatePnfCorrelationId(DelegateExecution execution) { + String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID); + if (Strings.isNullOrEmpty(pnfCorrelationId)) { + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfCorrelationId variable not defined"); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java index c7e7c7848c..fbf86cc411 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java @@ -22,7 +22,7 @@ package org.onap.so.bpmn.infrastructure.pnf.dmaap; public interface DmaapClient { - void registerForUpdate(String correlationId, Runnable informConsumer); + void registerForUpdate(String pnfCorrelationId, Runnable informConsumer); - Runnable unregister(String correlationId); + Runnable unregister(String pnfCorrelationId); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java index 159298b4ad..53f6b78d69 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java @@ -31,19 +31,19 @@ import java.util.List; import java.util.Optional; import java.util.Spliterator; -public final class JsonUtilForCorrelationId { +public final class JsonUtilForPnfCorrelationId { - private static final String JSON_CORRELATION_ID_FIELD_NAME = "correlationId"; + private static final String JSON_PNF_CORRELATION_ID_FIELD_NAME = "pnfCorrelationId"; - static List<String> parseJsonToGelAllCorrelationId(String json) { + static List<String> parseJsonToGelAllPnfCorrelationId(String json) { JsonElement je = new JsonParser().parse(json); JsonArray array = je.getAsJsonArray(); List<String> list = new ArrayList<>(); Spliterator<JsonElement> spliterator = array.spliterator(); spliterator.forEachRemaining(jsonElement -> { handleEscapedCharacters(jsonElement) - .ifPresent(jsonObject -> getCorrelationId(jsonObject) - .ifPresent(correlationId -> list.add(correlationId))); + .ifPresent(jsonObject -> getPnfCorrelationId(jsonObject) + .ifPresent(pnfCorrelationId -> list.add(pnfCorrelationId))); }); return list; } @@ -55,9 +55,9 @@ public final class JsonUtilForCorrelationId { return Optional.ofNullable(new JsonParser().parse(jsonElement.getAsString()).getAsJsonObject()); } - private static Optional<String> getCorrelationId(JsonObject jsonObject) { - if (jsonObject.has(JSON_CORRELATION_ID_FIELD_NAME)) { - return Optional.ofNullable(jsonObject.get(JSON_CORRELATION_ID_FIELD_NAME).getAsString()); + private static Optional<String> getPnfCorrelationId(JsonObject jsonObject) { + if (jsonObject.has(JSON_PNF_CORRELATION_ID_FIELD_NAME)) { + return Optional.ofNullable(jsonObject.get(JSON_PNF_CORRELATION_ID_FIELD_NAME).getAsString()); } return Optional.empty(); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java index 52f879b0ad..1b7a69eec8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java @@ -69,18 +69,18 @@ public class PnfEventReadyDmaapClient implements DmaapClient { } @Override - public synchronized void registerForUpdate(String correlationId, Runnable informConsumer) { - logger.debug("registering for pnf ready dmaap event for correlation id: {}", correlationId); - pnfCorrelationIdToThreadMap.put(correlationId, informConsumer); + public synchronized void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) { + logger.debug("registering for pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId); + pnfCorrelationIdToThreadMap.put(pnfCorrelationId, informConsumer); if (!dmaapThreadListenerIsRunning) { startDmaapThreadListener(); } } @Override - public synchronized Runnable unregister(String correlationId) { - logger.debug("unregistering from pnf ready dmaap event for correlation id: {}", correlationId); - Runnable runnable = pnfCorrelationIdToThreadMap.remove(correlationId); + public synchronized Runnable unregister(String pnfCorrelationId) { + logger.debug("unregistering from pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId); + Runnable runnable = pnfCorrelationIdToThreadMap.remove(pnfCorrelationId); if (pnfCorrelationIdToThreadMap.isEmpty()) { stopDmaapThreadListener(); } @@ -113,7 +113,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient { try { logger.debug("dmaap listener starts listening pnf ready dmaap topic"); HttpResponse response = httpClient.execute(getRequest); - getCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfCorrelationIdFound); + getPnfCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound); } catch (IOException e) { logger.error("Exception caught during sending rest request to dmaap for listening event topic", e); } @@ -122,20 +122,20 @@ public class PnfEventReadyDmaapClient implements DmaapClient { } } - private List<String> getCorrelationIdListFromResponse(HttpResponse response) throws IOException { + private List<String> getPnfCorrelationIdListFromResponse(HttpResponse response) throws IOException { if (response.getStatusLine().getStatusCode() == 200) { String responseString = EntityUtils.toString(response.getEntity(), "UTF-8"); if (responseString != null) { - return JsonUtilForCorrelationId.parseJsonToGelAllCorrelationId(responseString); + return JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(responseString); } } return Collections.emptyList(); } - private void informAboutPnfReadyIfCorrelationIdFound(String correlationId) { - Runnable runnable = unregister(correlationId); + private void informAboutPnfReadyIfPnfCorrelationIdFound(String pnfCorrelationId) { + Runnable runnable = unregister(pnfCorrelationId); if (runnable != null) { - logger.debug("dmaap listener gets pnf ready event for correlationId: {}", correlationId); + logger.debug("dmaap listener gets pnf ready event for pnfCorrelationId: {}", pnfCorrelationId); runnable.run(); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java index b66bb5f61b..9e720fe0a4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java @@ -26,9 +26,9 @@ import org.onap.aai.domain.yang.Pnf; public interface PnfManagement { - Optional<Pnf> getEntryFor(String correlationId) throws IOException; + Optional<Pnf> getEntryFor(String pnfCorrelationId) throws IOException; - void createEntry(String correlationId, Pnf entry) throws IOException; + void createEntry(String pnfCorrelationId, Pnf entry) throws IOException; void createRelation(String serviceInstanceId, String pnfName) throws IOException; } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java index 3d8da2a106..32ea357817 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java @@ -33,15 +33,15 @@ import org.springframework.stereotype.Component; public class PnfManagementImpl implements PnfManagement { @Override - public Optional<Pnf> getEntryFor(String correlationId) { + public Optional<Pnf> getEntryFor(String pnfCorrelationId) { AAIRestClientImpl restClient = new AAIRestClientImpl(); - return restClient.getPnfByName(correlationId); + return restClient.getPnfByName(pnfCorrelationId); } @Override - public void createEntry(String correlationId, Pnf entry) { + public void createEntry(String pnfCorrelationId, Pnf entry) { AAIRestClientImpl restClient = new AAIRestClientImpl(); - restClient.createPnf(correlationId, entry); + restClient.createPnf(pnfCorrelationId, entry); } @Override diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java index 477dc34dbd..1f837eb444 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java @@ -64,6 +64,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.web.util.UriUtils; import com.fasterxml.jackson.core.JsonProcessingException; @@ -83,7 +85,7 @@ public class ServicePluginFactory { static JsonUtils jsonUtil = new JsonUtils(); - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ServicePluginFactory.class); + private static Logger logger = LoggerFactory.getLogger(ServicePluginFactory.class); private static ServicePluginFactory instance; @@ -227,7 +229,7 @@ public class ServicePluginFactory { break; } } - LOGGER.debug("Get Terminal TP from InventoryOSS"); + logger.debug("Get Terminal TP from InventoryOSS"); return tpInfoMap; } @@ -685,8 +687,8 @@ public class ServicePluginFactory { try { return mapper.readValue(jsonstr, type); } catch (IOException e) { - LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError, - "fail to unMarshal json", e); + logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(), + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); } return null; } @@ -698,7 +700,7 @@ public class ServicePluginFactory { try { jsonStr = mapper.writeValueAsString(srcObj); } catch (JsonProcessingException e) { - LOGGER.debug("SdcToscaParserException", e); + logger.debug("SdcToscaParserException", e); } return jsonStr; } @@ -745,9 +747,9 @@ public class ServicePluginFactory { try { responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); } catch (ParseException e) { - LOGGER.debug("ParseException in sendrequest", e); + logger.debug("ParseException in sendrequest", e); } catch (IOException e) { - LOGGER.debug("IOException in sendrequest", e); + logger.debug("IOException in sendrequest", e); } } if (null != method) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java index 3108adaa53..4f02fe2ec0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -58,8 +60,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; public abstract class AbstractSdncOperationTask extends BaseTask { private static final Logger logger = LoggerFactory.getLogger(AbstractSdncOperationTask.class); - protected static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, AbstractSdncOperationTask.class); - + @Autowired private Environment env; private static final String DEFAULT_MSB_IP = "127.0.0.1"; @@ -282,7 +283,9 @@ public abstract class AbstractSdncOperationTask extends BaseTask { } catch (Exception exception) { logger.info("exception: AbstractSdncOperationTask.updateProgress fail!"); logger.error("exception: AbstractSdncOperationTask.updateProgress fail:", exception); - msoLogger.error(MessageEnum.GENERAL_EXCEPTION, " updateProgress catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, exception.getClass().toString()); + logger.error("{} {} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), + " updateProgress catch exception: ", this.getTaskName(), + MsoLogger.ErrorCode.UnknownError.getValue(), exception.getClass().toString()); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java index 3ef1410425..a5c609dc2a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -41,7 +43,7 @@ import org.springframework.stereotype.Component; @Component public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask { - private static final Logger sdncLogger = LoggerFactory.getLogger(SdncNetworkTopologyOperationTask.class); + private static final Logger logger = LoggerFactory.getLogger(SdncNetworkTopologyOperationTask.class); private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation"; @@ -50,7 +52,7 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask public void sendRestrequestAndHandleResponse(DelegateExecution execution, Map<String, String> inputs, GenericResourceApi genericResourceApiClient) throws Exception { - sdncLogger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); + logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "40", "sendRestrequestAndHandleResponse begin!"); NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder(); RpcNetworkTopologyOperationInputEntity inputEntity = builder.build(execution, inputs); @@ -65,25 +67,25 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); } updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); - sdncLogger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse end!"); + logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse end!"); } private void send2SdncDirectly(String defaulAuth, RpcNetworkTopologyOperationInputEntity inputEntity) throws RouteException { - sdncLogger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly begin!"); + logger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly begin!"); String url = "http://" + getSdncIp() + ":" + getSdncPort() + URL; HttpPost httpPost = new HttpPost(url); httpPost.addHeader("Authorization", defaulAuth); httpPost.addHeader("Content-type", "application/json"); String postBody = getPostbody(inputEntity); - msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC", ""); + logger.info("{} {} {}", MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC"); httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); httpPost(url, httpPost); - sdncLogger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly end!"); + logger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly end!"); } private void saveOutput(DelegateExecution execution, RpcNetworkTopologyOperationOutputEntity output) throws RouteException { - sdncLogger.info("SdncNetworkTopologyOperationTask.saveOutput begin!"); + logger.info("SdncNetworkTopologyOperationTask.saveOutput begin!"); String responseCode = output.getOutput().getResponseCode(); if (!"200".equals(responseCode)) { String processKey = getProcessKey(execution); @@ -92,11 +94,11 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage); execution.setVariable("SDNCA_SuccessIndicator", workflowException); updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), "100", errorMessage); - sdncLogger.info("exception: SdncNetworkTopologyOperationTask.saveOutput fail!"); + logger.info("exception: SdncNetworkTopologyOperationTask.saveOutput fail!"); throw new RouteException(); } - sdncLogger.info("SdncNetworkTopologyOperationTask.saveOutput end!"); + logger.info("SdncNetworkTopologyOperationTask.saveOutput end!"); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java index dc625d35c3..2fd550dbb8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -42,7 +44,7 @@ import org.springframework.stereotype.Component; @Component public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask { - private static final Logger sdncLogger = LoggerFactory.getLogger(SdncServiceTopologyOperationTask.class); + private static final Logger logger = LoggerFactory.getLogger(SdncServiceTopologyOperationTask.class); private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation"; @@ -51,7 +53,7 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask public void sendRestrequestAndHandleResponse(DelegateExecution execution, Map<String, String> inputs, GenericResourceApi genericResourceApiClient) throws Exception { - sdncLogger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); + logger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!"); ServiceRpcInputEntityBuilder builder = new ServiceRpcInputEntityBuilder(); RpcServiceTopologyOperationInputEntity inputEntity = builder.build(execution, inputs); @@ -65,26 +67,26 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask } else { send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); } - sdncLogger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse end!"); + logger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse end!"); } private void send2SdncDirectly(String defaulAuth, RpcServiceTopologyOperationInputEntity inputEntity) throws RouteException { - sdncLogger.info("SdncServiceTopologyOperationTask.send2SdncDirectly begin!"); + logger.info("SdncServiceTopologyOperationTask.send2SdncDirectly begin!"); String url = getSdncHost() + URL; HttpPost httpPost = new HttpPost(url); httpPost.addHeader("Authorization", defaulAuth); httpPost.addHeader("Content-type", "application/json"); String postBody = getPostbody(inputEntity); - msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC", ""); + logger.info("{} {} {}", MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC"); httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); httpPost(url, httpPost); - sdncLogger.info("SdncServiceTopologyOperationTask.send2SdncDirectly end!"); + logger.info("SdncServiceTopologyOperationTask.send2SdncDirectly end!"); } private void saveOutput(DelegateExecution execution, RpcServiceTopologyOperationOutputEntity output) throws Exception { - sdncLogger.info("SdncServiceTopologyOperationTask.saveOutput begin!"); + logger.info("SdncServiceTopologyOperationTask.saveOutput begin!"); String responseCode = output.getOutput().getResponseCode(); if (!"200".equals(responseCode)) { String processKey = getProcessKey(execution); @@ -93,9 +95,9 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage); execution.setVariable("SDNCA_SuccessIndicator", workflowException); updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage); - sdncLogger.info("exception: SdncServiceTopologyOperationTask.saveOutput fail!"); + logger.info("exception: SdncServiceTopologyOperationTask.saveOutput fail!"); throw new RouteException(); } - sdncLogger.info("SdncServiceTopologyOperationTask.saveOutput end!"); + logger.info("SdncServiceTopologyOperationTask.saveOutput end!"); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java index b13d7fc419..f54d6692d6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -31,8 +33,9 @@ import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.Netwo import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity; import org.onap.so.db.request.beans.ResourceOperationStatus; import org.onap.so.db.request.beans.ResourceOperationStatusId; -import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDbConstant; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Component @@ -41,7 +44,7 @@ public class SdncUnderlayVpnOperationClient { private static final String DEFAULT_MSB_IP = "127.0.0.1"; private static final int DEFAULT_MSB_PORT = 10081; - private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, SdncUnderlayVpnOperationClient.class); + private static Logger logger = LoggerFactory.getLogger(SdncUnderlayVpnOperationClient.class); public boolean excute(String msbIp, int msbPort, diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java index 8507d9c092..b0ff82e3aa 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java @@ -37,9 +37,9 @@ public class CancelDmaapSubscriptionTest { DmaapClientTestImpl dmaapClientTest = new DmaapClientTestImpl(); delegate.setDmaapClient(dmaapClientTest); DelegateExecution delegateExecution = mock(DelegateExecution.class); - when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId"); + when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))).thenReturn("testPnfCorrelationId"); when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey"); - dmaapClientTest.registerForUpdate("testCorrelationId", () -> { + dmaapClientTest.registerForUpdate("testPnfCorrelationId", () -> { }); // when delegate.execute(delegateExecution); diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java index 4b47ed6407..6a0aaf776e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java @@ -28,7 +28,7 @@ import static org.mockito.Mockito.when; import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl.ID_WITHOUT_ENTRY; import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl.ID_WITH_ENTRY; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -41,26 +41,26 @@ import org.junit.runner.RunWith; import org.onap.so.bpmn.core.WorkflowException; @RunWith(Enclosed.class) -public class CheckAaiForCorrelationIdDelegateTest { +public class CheckAaiForPnfCorrelationIdDelegateTest { public static class ConnectionOkTests { - private CheckAaiForCorrelationIdDelegate delegate; + private CheckAaiForPnfCorrelationIdDelegate delegate; @Rule public ExpectedException expectedException = ExpectedException.none(); @Before public void setUp() { - delegate = new CheckAaiForCorrelationIdDelegate(); + delegate = new CheckAaiForPnfCorrelationIdDelegate(); delegate.setPnfManagement(new PnfManagementTestImpl()); } @Test - public void shouldThrowExceptionWhenCorrelationIdIsNotSet() throws Exception { + public void shouldThrowExceptionWhenPnfCorrelationIdIsNotSet() throws Exception { // given DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(CORRELATION_ID)).thenReturn(null); + when(execution.getVariable(PNF_CORRELATION_ID)).thenReturn(null); when(execution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue"); // when, then expectedException.expect(BpmnError.class); @@ -72,7 +72,7 @@ public class CheckAaiForCorrelationIdDelegateTest { public void shouldSetCorrectVariablesWhenAaiDoesNotContainInfoAboutPnf() throws Exception { // given DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITHOUT_ENTRY); + when(execution.getVariable(PNF_CORRELATION_ID)).thenReturn(ID_WITHOUT_ENTRY); // when delegate.execute(execution); // then @@ -83,7 +83,7 @@ public class CheckAaiForCorrelationIdDelegateTest { public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithoutIp() throws Exception { // given DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY); + when(execution.getVariable(PNF_CORRELATION_ID)).thenReturn(ID_WITH_ENTRY); // when delegate.execute(execution); // then @@ -93,14 +93,14 @@ public class CheckAaiForCorrelationIdDelegateTest { public static class NoConnectionTests { - private CheckAaiForCorrelationIdDelegate delegate; + private CheckAaiForPnfCorrelationIdDelegate delegate; @Rule public ExpectedException expectedException = ExpectedException.none(); @Before public void setUp() { - delegate = new CheckAaiForCorrelationIdDelegate(); + delegate = new CheckAaiForPnfCorrelationIdDelegate(); delegate.setPnfManagement(new PnfManagementThrowingException()); } @@ -108,7 +108,7 @@ public class CheckAaiForCorrelationIdDelegateTest { public void shouldThrowExceptionWhenIoExceptionOnConnectionToAai() throws Exception { // given DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY); + when(execution.getVariable(PNF_CORRELATION_ID)).thenReturn(ID_WITH_ENTRY); when(execution.getVariable("testProcessKey")).thenReturn("testProcessKey"); // when, then expectedException.expect(BpmnError.class); diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java index 9c5f8f3fc4..986edfeecf 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java @@ -25,7 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import java.util.UUID; @@ -43,14 +43,14 @@ public class CreatePnfEntryInAaiDelegateTest { PnfManagementTestImpl pnfManagementTest = new PnfManagementTestImpl(); delegate.setPnfManagement(pnfManagementTest); DelegateExecution execution = mock(DelegateExecution.class); - given(execution.getVariable(eq(CORRELATION_ID))).willReturn("testCorrelationId"); + given(execution.getVariable(eq(PNF_CORRELATION_ID))).willReturn("testPnfCorrelationId"); given(execution.getVariable(eq(PNF_UUID))).willReturn(pnfUuid); // when delegate.execute(execution); // then - Pnf createdEntry = pnfManagementTest.getCreated().get("testCorrelationId"); + Pnf createdEntry = pnfManagementTest.getCreated().get("testPnfCorrelationId"); assertThat(createdEntry.getPnfId()).isEqualTo(pnfUuid); - assertThat(createdEntry.getPnfName()).isEqualTo("testCorrelationId"); + assertThat(createdEntry.getPnfName()).isEqualTo("testPnfCorrelationId"); assertThat(createdEntry.isInMaint()).isNull(); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java index 2a78337e34..c743ee7018 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java @@ -42,7 +42,7 @@ public class CreateRelationTest { public void setUp() { executionFake = new DelegateExecutionFake(); executionFake.setVariable("serviceInstanceId", SERVICE_INSTANCE_ID); - executionFake.setVariable("correlationId", PNF_NAME); + executionFake.setVariable("pnfCorrelationId", PNF_NAME); } @Test diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java index f2a4205ebd..19ba18f6de 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java @@ -25,19 +25,19 @@ import java.util.Objects; public class DmaapClientTestImpl implements DmaapClient { - private String correlationId; + private String pnfCorrelationId; private Runnable informConsumer; @Override - public void registerForUpdate(String correlationId, Runnable informConsumer) { - this.correlationId = correlationId; + public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) { + this.pnfCorrelationId = pnfCorrelationId; this.informConsumer = informConsumer; } @Override - public Runnable unregister(String correlationId) { - if (Objects.equals(this.correlationId, correlationId)) { - this.correlationId = null; + public Runnable unregister(String pnfCorrelationId) { + if (Objects.equals(this.pnfCorrelationId, pnfCorrelationId)) { + this.pnfCorrelationId = null; Runnable informConsumer = this.informConsumer; this.informConsumer = null; return informConsumer; @@ -45,8 +45,8 @@ public class DmaapClientTestImpl implements DmaapClient { return null; } - public String getCorrelationId() { - return correlationId; + public String getPnfCorrelationId() { + return pnfCorrelationId; } public Runnable getInformConsumer() { @@ -58,6 +58,6 @@ public class DmaapClientTestImpl implements DmaapClient { } public boolean haveRegisteredConsumer() { - return correlationId != null; + return pnfCorrelationId != null; } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java index 23c82229fe..eb9f657d4f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java @@ -55,7 +55,7 @@ public class InformDmaapClientTest { // when informDmaapClient.execute(delegateExecution); // then - assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId"); + assertThat(dmaapClientTest.getPnfCorrelationId()).isEqualTo("testPnfCorrelationId"); assertThat(dmaapClientTest.getInformConsumer()).isNotNull(); verifyZeroInteractions(messageCorrelationBuilder); } @@ -66,7 +66,7 @@ public class InformDmaapClientTest { informDmaapClient.execute(delegateExecution); dmaapClientTest.getInformConsumer().run(); // then - assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId"); + assertThat(dmaapClientTest.getPnfCorrelationId()).isEqualTo("testPnfCorrelationId"); InOrder inOrder = inOrder(messageCorrelationBuilder); inOrder.verify(messageCorrelationBuilder).processInstanceBusinessKey("testBusinessKey"); inOrder.verify(messageCorrelationBuilder).correlateWithResult(); @@ -74,7 +74,7 @@ public class InformDmaapClientTest { private DelegateExecution mockDelegateExecution() { DelegateExecution delegateExecution = mock(DelegateExecution.class); - when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId"); + when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))).thenReturn("testPnfCorrelationId"); when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey"); ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class); when(delegateExecution.getProcessEngineServices()).thenReturn(processEngineServices); diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java index 80693d7ce6..001815b206 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java @@ -21,7 +21,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID; @@ -39,7 +39,7 @@ public class PnfCheckInputsTest { private static final String VALID_UUID = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString(); private static final String RESERVED_UUID = new UUID(0, 0).toString(); private static final String DEFAULT_SERVICE_INSTANCE_ID = "da7d07d9-b71c-4128-809d-2ec01c807169"; - private static final String DEFAULT_CORRELATION_ID = "testCorrelationId"; + private static final String DEFAULT_PNF_CORRELATION_ID = "testPnfCorrelationId"; private DelegateExecutionBuilder delegateExecutionBuilder; @@ -49,9 +49,9 @@ public class PnfCheckInputsTest { } @Test - public void shouldThrowException_whenCorrelationIdNotSet() { + public void shouldThrowException_whenPnfCorrelationIdNotSet() { PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT); - DelegateExecution execution = delegateExecutionBuilder.setCorrelationId(null).setPnfUuid(VALID_UUID).build(); + DelegateExecution execution = delegateExecutionBuilder.setPnfCorrelationId(null).setPnfUuid(VALID_UUID).build(); assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class); } @@ -98,12 +98,12 @@ public class PnfCheckInputsTest { } private static class DelegateExecutionBuilder { - private String correlationId = DEFAULT_CORRELATION_ID; + private String pnfCorrelationId = DEFAULT_PNF_CORRELATION_ID; private String pnfUuid = VALID_UUID; private String serviceInstanceId = DEFAULT_SERVICE_INSTANCE_ID; - public DelegateExecutionBuilder setCorrelationId(String correlationId) { - this.correlationId = correlationId; + public DelegateExecutionBuilder setPnfCorrelationId(String pnfCorrelationId) { + this.pnfCorrelationId = pnfCorrelationId; return this; } @@ -120,7 +120,7 @@ public class PnfCheckInputsTest { public DelegateExecution build() { DelegateExecution execution = new DelegateExecutionFake(); execution.setVariable("testProcessKey", "testProcessKeyValue"); - execution.setVariable(CORRELATION_ID, this.correlationId); + execution.setVariable(PNF_CORRELATION_ID, this.pnfCorrelationId); execution.setVariable(PNF_UUID, this.pnfUuid); execution.setVariable(SERVICE_INSTANCE_ID, this.serviceInstanceId); return execution; diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java index 1377c8295f..3a9d6d0055 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java @@ -37,8 +37,8 @@ public class PnfManagementTestImpl implements PnfManagement { private Map<String, Pnf> created = new HashMap<>(); @Override - public Optional<Pnf> getEntryFor(String correlationId) { - if (Objects.equals(correlationId, ID_WITH_ENTRY)) { + public Optional<Pnf> getEntryFor(String pnfCorrelationId) { + if (Objects.equals(pnfCorrelationId, ID_WITH_ENTRY)) { return Optional.of(new Pnf()); } else { return Optional.empty(); @@ -46,8 +46,8 @@ public class PnfManagementTestImpl implements PnfManagement { } @Override - public void createEntry(String correlationId, Pnf entry) throws IOException { - created.put(correlationId, entry); + public void createEntry(String pnfCorrelationId, Pnf entry) throws IOException { + created.put(pnfCorrelationId, entry); } @Override diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java index 43315d3803..f9b467c650 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java @@ -28,12 +28,12 @@ import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement; public class PnfManagementThrowingException implements PnfManagement { @Override - public Optional<Pnf> getEntryFor(String correlationId) throws IOException { + public Optional<Pnf> getEntryFor(String pnfCorrelationId) throws IOException { throw new IOException(); } @Override - public void createEntry(String correlationId, Pnf entry) throws IOException { + public void createEntry(String pnfCorrelationId, Pnf entry) throws IOException { throw new IOException(); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java index fde112b009..02a6f20992 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java @@ -27,40 +27,40 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.List; import org.junit.Test; -public class JsonUtilForCorrelationIdTest { +public class JsonUtilForPnfCorrelationIdTest { - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[{\"correlationId\": \"corrTest1\"," - + "\"key1\":\"value1\"},{\"correlationId\": \"corrTest2\",\"key2\":\"value2\"}]"; + private static final String JSON_EXAMPLE_WITH_PNF_CORRELATION_ID = "[{\"pnfCorrelationId\": \"corrTest1\"," + + "\"key1\":\"value1\"},{\"pnfCorrelationId\": \"corrTest2\",\"key2\":\"value2\"}]"; - private static final String JSON_WITH_ONE_CORRELATION_ID = "[{\"correlationId\":\"corrTest3\"}]"; + private static final String JSON_WITH_ONE_PNF_CORRELATION_ID = "[{\"pnfCorrelationId\":\"corrTest3\"}]"; - private static final String JSON_WITH_TWO_CORRELATION_ID_AND_ESCAPED_CHARACTERS = - "[\"{\\\"correlationId\\\":\\\"corrTest4\\\"}\", \"{\\\"correlationId\\\":\\\"corrTest5\\\"}\"]"; + private static final String JSON_WITH_TWO_PNF_CORRELATION_ID_AND_ESCAPED_CHARACTERS = + "[\"{\\\"pnfCorrelationId\\\":\\\"corrTest4\\\"}\", \"{\\\"pnfCorrelationId\\\":\\\"corrTest5\\\"}\"]"; - private static final String JSON_WITH_NO_CORRELATION_ID = "[{\"key1\":\"value1\"}]"; + private static final String JSON_WITH_NO_PNF_CORRELATION_ID = "[{\"key1\":\"value1\"}]"; @Test public void parseJsonSuccessful() { - List<String> expectedResult = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID); + List<String> expectedResult = JsonUtilForPnfCorrelationId + .parseJsonToGelAllPnfCorrelationId(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID); assertThat(expectedResult).containsExactly("corrTest1", "corrTest2"); - List<String> expectedResult2 = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_WITH_ONE_CORRELATION_ID); + List<String> expectedResult2 = JsonUtilForPnfCorrelationId + .parseJsonToGelAllPnfCorrelationId(JSON_WITH_ONE_PNF_CORRELATION_ID); assertThat(expectedResult2).containsExactly("corrTest3"); } @Test public void parseJsonWithEscapeCharacters_Successful() { - List<String> expectedResult = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_WITH_TWO_CORRELATION_ID_AND_ESCAPED_CHARACTERS); + List<String> expectedResult = JsonUtilForPnfCorrelationId + .parseJsonToGelAllPnfCorrelationId(JSON_WITH_TWO_PNF_CORRELATION_ID_AND_ESCAPED_CHARACTERS); assertThat(expectedResult).containsExactly("corrTest4", "corrTest5"); } @Test public void parseJson_emptyListReturnedWhenNothingFound() { - List<String> expectedResult = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_WITH_NO_CORRELATION_ID); + List<String> expectedResult = JsonUtilForPnfCorrelationId + .parseJsonToGelAllPnfCorrelationId(JSON_WITH_NO_PNF_CORRELATION_ID); assertThat(expectedResult).isEmpty(); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java index b30239d9c0..078c2f7784 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java @@ -56,12 +56,12 @@ import org.springframework.core.env.Environment; @RunWith(MockitoJUnitRunner.class) public class PnfEventReadyDmaapClientTest { - private static final String CORRELATION_ID = "corrTestId"; - private static final String CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId"; - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[{\"correlationId\": \"%s\"," - + "\"value\":\"value1\"},{\"correlationId\": \"corr\",\"value\":\"value2\"}]"; + private static final String PNF_CORRELATION_ID = "corrTestId"; + private static final String PNF_CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId"; + private static final String JSON_EXAMPLE_WITH_PNF_CORRELATION_ID = "[{\"pnfCorrelationId\": \"%s\"," + + "\"value\":\"value1\"},{\"pnfCorrelationId\": \"corr\",\"value\":\"value2\"}]"; - private static final String JSON_EXAMPLE_WITH_NO_CORRELATION_ID = "[{\"key1\":\"value1\"}]"; + private static final String JSON_EXAMPLE_WITH_NO_PNF_CORRELATION_ID = "[{\"key1\":\"value1\"}]"; private static final String HOST = "hostTest"; private static final int PORT = 1234; @@ -108,10 +108,10 @@ public class PnfEventReadyDmaapClientTest { * empty) and shutdown the executor because of empty map */ @Test - public void correlationIdIsFoundInHttpResponse_notifyAboutPnfReady() + public void pnfCorrelationIdIsFoundInHttpResponse_notifyAboutPnfReady() throws IOException { when(httpClientMock.execute(any(HttpGet.class))). - thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID))); + thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID))); testedObjectInnerClassThread.run(); ArgumentCaptor<HttpGet> captor1 = ArgumentCaptor.forClass(HttpGet.class); verify(httpClientMock).execute(captor1.capture()); @@ -128,16 +128,16 @@ public class PnfEventReadyDmaapClientTest { /** * Test run method, where the are following conditions: * <p> - DmaapThreadListener is running, flag is set to true - * <p> - map is filled with one entry with the correlationId that does not match to correlationId + * <p> - map is filled with one entry with the pnfCorrelationId that does not match to pnfCorrelationId * taken from http response. run method should not do anything with the map not run any thread to notify camunda * process */ @Test - public void correlationIdIsFoundInHttpResponse_NotFoundInMap() + public void pnfCorrelationIdIsFoundInHttpResponse_NotFoundInMap() throws IOException { when(httpClientMock.execute(any(HttpGet.class))). thenReturn(createResponse( - String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID_NOT_FOUND_IN_MAP))); + String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID_NOT_FOUND_IN_MAP))); testedObjectInnerClassThread.run(); verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock); } @@ -145,13 +145,13 @@ public class PnfEventReadyDmaapClientTest { /** * Test run method, where the are following conditions: * <p> - DmaapThreadListener is running, flag is set to true - * <p> - map is filled with one entry with the correlationId but no correlation id is taken from HttpResponse + * <p> - map is filled with one entry with the pnfCorrelationId but no correlation id is taken from HttpResponse * run method should not do anything with the map and not run any thread to notify camunda process */ @Test - public void correlationIdIsNotFoundInHttpResponse() throws IOException { + public void pnfCorrelationIdIsNotFoundInHttpResponse() throws IOException { when(httpClientMock.execute(any(HttpGet.class))). - thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_CORRELATION_ID)); + thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_PNF_CORRELATION_ID)); testedObjectInnerClassThread.run(); verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock); } @@ -171,7 +171,7 @@ public class PnfEventReadyDmaapClientTest { .getDeclaredField("pnfCorrelationIdToThreadMap"); pnfCorrelationToThreadMapField.setAccessible(true); Map<String, Runnable> pnfCorrelationToThreadMap = new ConcurrentHashMap<>(); - pnfCorrelationToThreadMap.put(CORRELATION_ID, threadMockToNotifyCamundaFlow); + pnfCorrelationToThreadMap.put(PNF_CORRELATION_ID, threadMockToNotifyCamundaFlow); pnfCorrelationToThreadMapField.set(testedObject, pnfCorrelationToThreadMap); Field threadRunFlag = testedObject.getClass().getDeclaredField("dmaapThreadListenerIsRunning"); diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn index 5defe2121b..8ffa32e10d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn @@ -5,8 +5,8 @@ <bpmn:participant id="Participant_0atuyq0" name="AAI" /> <bpmn:participant id="Participant_19w87ws" name="Workflow Message Service (communication with DMAAP) " /> <bpmn:messageFlow id="MessageFlow_1h3xu88" sourceRef="CreatePnfEntryInAai" targetRef="Participant_0atuyq0" /> - <bpmn:messageFlow id="MessageFlow_09ibv5a" sourceRef="CheckAiiForCorrelationId" targetRef="Participant_0atuyq0" /> - <bpmn:messageFlow id="MessageFlow_0vjul4t" sourceRef="Participant_0atuyq0" targetRef="CheckAiiForCorrelationId" /> + <bpmn:messageFlow id="MessageFlow_09ibv5a" sourceRef="CheckAiiForPnfCorrelationId" targetRef="Participant_0atuyq0" /> + <bpmn:messageFlow id="MessageFlow_0vjul4t" sourceRef="Participant_0atuyq0" targetRef="CheckAiiForPnfCorrelationId" /> <bpmn:messageFlow id="MessageFlow_1vrcp2d" sourceRef="Participant_19w87ws" targetRef="WaitForDmaapPnfReadyNotification" /> <bpmn:messageFlow id="MessageFlow_0tg4hw9" sourceRef="InformDmaapClient" targetRef="Participant_19w87ws" /> <bpmn:messageFlow id="MessageFlow_1py54jr" sourceRef="CancelDmaapClientSubscription" targetRef="Participant_19w87ws" /> @@ -20,13 +20,13 @@ <bpmn:sequenceFlow id="SequenceFlow_0p09qgm" sourceRef="WaitForDmaapPnfReadyNotification" targetRef="CreateRelationId" /> <bpmn:sequenceFlow id="SequenceFlow_17s9025" sourceRef="AaiEntryExists" targetRef="InformDmaapClient" /> <bpmn:sequenceFlow id="SequenceFlow_1qr6cmf" sourceRef="CreatePnfEntryInAai" targetRef="AaiEntryExists" /> - <bpmn:sequenceFlow id="SequenceFlow_1j4r3zt" sourceRef="CheckAiiForCorrelationId" targetRef="DoesAaiContainInfoAboutPnf" /> + <bpmn:sequenceFlow id="SequenceFlow_1j4r3zt" sourceRef="CheckAiiForPnfCorrelationId" targetRef="DoesAaiContainInfoAboutPnf" /> <bpmn:sequenceFlow id="SequenceFlow_0j5ksz1" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="CheckInputs" /> <bpmn:sequenceFlow id="SequenceFlow_1miyzfe" sourceRef="CancelDmaapClientSubscription" targetRef="ThrowTimeoutException" /> <bpmn:sequenceFlow id="SequenceFlow_1l1t6ak" name="Yes" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="AaiEntryExists"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{aaiContainsInfoAboutPnf}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0967g8p" sourceRef="CheckInputs" targetRef="CheckAiiForCorrelationId" /> + <bpmn:sequenceFlow id="SequenceFlow_0967g8p" sourceRef="CheckInputs" targetRef="CheckAiiForPnfCorrelationId" /> <bpmn:serviceTask id="CheckInputs" name="Check inputs" camunda:delegateExpression="${PnfCheckInputs}"> <bpmn:incoming>SequenceFlow_0j5ksz1</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0967g8p</bpmn:outgoing> @@ -48,7 +48,7 @@ <bpmn:outgoing>SequenceFlow_1l1t6ak</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_0v5ffpe</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:serviceTask id="CheckAiiForCorrelationId" name="Check AAI for correlation_id" camunda:delegateExpression="${CheckAaiForCorrelationIdDelegate}"> + <bpmn:serviceTask id="CheckAiiForPnfCorrelationId" name="Check AAI for pnf_correlation_id" camunda:delegateExpression="${CheckAaiForPnfCorrelationIdDelegate}"> <bpmn:incoming>SequenceFlow_0967g8p</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1j4r3zt</bpmn:outgoing> </bpmn:serviceTask> @@ -86,7 +86,7 @@ <bpmn:textAnnotation id="TextAnnotation_1eyzes8"> <bpmn:text><![CDATA[Inputs: Â -Â timeoutForPnfEntryNotification - String - - correlationId - String + - pnfCorrelationId - String - uuid - String]]></bpmn:text> </bpmn:textAnnotation> </bpmn:process> @@ -115,7 +115,7 @@ <dc:Bounds x="-80" y="228" width="90" height="20" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0a5uk9o_di" bpmnElement="CheckAiiForCorrelationId"> + <bpmndi:BPMNShape id="ServiceTask_0a5uk9o_di" bpmnElement="CheckAiiForPnfCorrelationId"> <dc:Bounds x="219" y="167" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0iimk5v_di" bpmnElement="CreatePnfEntryInAai"> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn index 2dbf12717c..22b09966a4 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn @@ -586,7 +586,7 @@ CreateVcpeResCustService.validateVnfCreate(execution)]]></bpmn2:script> <bpmn2:callActivity id="Task_14l19kv" name="Create And Activate Pnf Resource" calledElement="CreateAndActivatePnfResource"> <bpmn2:extensionElements> <camunda:in source="timeoutForPnfEntryNotification" target="timeoutForPnfEntryNotification" /> - <camunda:in source="correlationId" target="correlationId" /> + <camunda:in source="pnfCorrelationId" target="pnfCorrelationId" /> <camunda:in businessKey="#{execution.processBusinessKey}" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_0gj4vud</bpmn2:incoming> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn index c8a5cf03cd..9579f770fc 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn @@ -359,7 +359,7 @@ CreateVcpeResCustService.processDecomposition(execution)</bpmn2:script> <bpmn2:callActivity id="Task_14l19kv" name="Create And Activate Pnf Resource" calledElement="CreateAndActivatePnfResource"> <bpmn2:extensionElements> <camunda:in source="timeoutForPnfEntryNotification" target="timeoutForPnfEntryNotification" /> - <camunda:in source="correlationId" target="correlationId" /> + <camunda:in source="pnfCorrelationId" target="pnfCorrelationId" /> <camunda:in businessKey="#{execution.processBusinessKey}" /> <camunda:in source="pnfUuid" target="pnfUuid" /> <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/VnfInPlaceUpdate.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/VnfInPlaceUpdate.bpmn index 3c42320302..3663badb6e 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/VnfInPlaceUpdate.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/VnfInPlaceUpdate.bpmn @@ -131,7 +131,7 @@ uvfm.postProcessRollback(execution)]]></bpmn2:script> </bpmn2:startEvent> <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="StartEvent_1" targetRef="PreProcessRequest" /> <bpmn2:sequenceFlow id="SequenceFlow_3" name="no" sourceRef="ExclusiveGateway_18j1ow5" targetRef="ScriptTask_10" /> - <bpmn2:sequenceFlow id="SequenceFlow_053qjfy" sourceRef="Task_1opcb4j" targetRef="Task_0vy2zge" /> + <bpmn2:sequenceFlow id="SequenceFlow_053qjfy" sourceRef="Task_1opcb4j" targetRef="Task_0op98k0" /> <bpmn2:scriptTask id="Task_1opcb4j" name="Query A&AI for VNF" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0y0jt4l</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_053qjfy</bpmn2:outgoing> @@ -169,8 +169,8 @@ uvfm.setVnfInMaintFlagInAAI(execution, false) ]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="Task_0vy2zge" name="Check If Physical Servers Are Locked in A&AI" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_053qjfy</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_179tyul</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1us5byg</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0usxnlk</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def uvfm = new VnfInPlaceUpdate() @@ -240,7 +240,7 @@ uvfm.checkIfPserversInMaintInAAI(execution) <bpmn2:outgoing>SequenceFlow_1c0vdki</bpmn2:outgoing> <bpmn2:outgoing>SequenceFlow_11o5j55</bpmn2:outgoing> </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_1c0vdki" name="no" sourceRef="ExclusiveGateway_1etgtgi" targetRef="Task_0eae8go" /> + <bpmn2:sequenceFlow id="SequenceFlow_1c0vdki" name="no" sourceRef="ExclusiveGateway_1etgtgi" targetRef="Task_0qa3yfr" /> <bpmn2:exclusiveGateway id="ExclusiveGateway_02tj4dw" name="Error on Upgrade Software?" default="SequenceFlow_162mm0m"> <bpmn2:incoming>SequenceFlow_1uno5rs</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_162mm0m</bpmn2:outgoing> @@ -295,13 +295,15 @@ uvfm.abortProcessing(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_1quapjx</bpmn2:outgoing> <bpmn2:outgoing>SequenceFlow_101n488</bpmn2:outgoing> <bpmn2:outgoing>SequenceFlow_021ah63</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_015qhj5</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1xeh8rb</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_05gpym3" name="Skip" sourceRef="ExclusiveGateway_0xlxgl0" targetRef="ExclusiveGateway_0y82zzx"> <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[execution.getVariable("disposition") == "Skip"]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_19ba94v" sourceRef="Task_0eae8go" targetRef="ExclusiveGateway_19an3h2" /> <bpmn2:sequenceFlow id="SequenceFlow_1nlqlwn" sourceRef="ExclusiveGateway_0y82zzx" targetRef="IntermediateThrowEvent_0ee7wot"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[(execution.getVariable("disposition") == "Skip" && execution.getVariable("workStep") == "QuiesceTraffic") || + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[(execution.getVariable("disposition") == "Skip" && execution.getVariable("workStep") == "Stop") || (execution.getVariable("disposition") == "Retry" && execution.getVariable("workStep") == "Snapshot")]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_1c022sy" sourceRef="ExclusiveGateway_0y82zzx" targetRef="Task_1tg549h" /> @@ -371,15 +373,6 @@ uvfm.checkIfClosedLoopDisabledInAAI(execution) <bpmn2:sequenceFlow id="SequenceFlow_0zzwdwf" sourceRef="IntermediateThrowEvent_1wdxgjm" targetRef="Task_0e313zv" /> <bpmn2:sequenceFlow id="SequenceFlow_06ajc11" name="no" sourceRef="ExclusiveGateway_0ud5uwa" targetRef="Task_0e313zv" /> <bpmn2:sequenceFlow id="SequenceFlow_179z9vl" sourceRef="Task_0n1d5f2" targetRef="ExclusiveGateway_148eo7w" /> - <bpmn2:scriptTask id="Task_0n1d5f2" name="Set VF Is Closed Loop Disabled Flag in A&AI" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_0du9273</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_032tm9y</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_179z9vl</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def uvfm = new VnfInPlaceUpdate() -uvfm.setClosedLoopDisabledInAAI(execution, true) -]]></bpmn2:script> - </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_032tm9y" sourceRef="IntermediateThrowEvent_1552q1o" targetRef="Task_0n1d5f2" /> <bpmn2:intermediateCatchEvent id="IntermediateThrowEvent_1552q1o" name="To set Closed Loop Disabled"> <bpmn2:outgoing>SequenceFlow_032tm9y</bpmn2:outgoing> @@ -434,7 +427,7 @@ uvfm.setClosedLoopDisabledInAAI(execution, true) <bpmn2:outgoing>SequenceFlow_1fuaq5k</bpmn2:outgoing> <bpmn2:outgoing>SequenceFlow_04gth9f</bpmn2:outgoing> </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_1fuaq5k" name="no" sourceRef="ExclusiveGateway_19an3h2" targetRef="Task_1mdr1nd" /> + <bpmn2:sequenceFlow id="SequenceFlow_1fuaq5k" name="no" sourceRef="ExclusiveGateway_19an3h2" targetRef="Task_1j68pc1" /> <bpmn2:intermediateCatchEvent id="IntermediateThrowEvent_0a1s69h" name="To SnapShot"> <bpmn2:outgoing>SequenceFlow_0if6xj4</bpmn2:outgoing> <bpmn2:linkEventDefinition name="To SnapShot" /> @@ -594,11 +587,11 @@ uvfm.setClosedLoopDisabledInAAI(execution, false) (execution.getVariable("disposition") == "Retry" && execution.getVariable("workStep") == "Lock")]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_1ar6ikk" sourceRef="ExclusiveGateway_0y82zzx" targetRef="IntermediateThrowEvent_1p9i2bi"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[(execution.getVariable("disposition") == "Skip" && execution.getVariable("workStep") == "UpgradePreCheck") || -(execution.getVariable("disposition") == "Retry" && execution.getVariable("workStep") == "QuiesceTraffic")]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[(execution.getVariable("disposition") == "Skip" && execution.getVariable("workStep") == "QuiesceTraffic") || +(execution.getVariable("disposition") == "Retry" && execution.getVariable("workStep") == "Stop")]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_171iq7e" sourceRef="ExclusiveGateway_0y82zzx" targetRef="IntermediateThrowEvent_0rp1ax0"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[(execution.getVariable("disposition") == "Skip" && execution.getVariable("workStep") == "Snapshot") || + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[(execution.getVariable("disposition") == "Skip" && execution.getVariable("workStep") == "Start") || (execution.getVariable("disposition") == "Retry" && execution.getVariable("workStep") == "UpgradeBackup")]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_1553o9f" sourceRef="ExclusiveGateway_0y82zzx" targetRef="IntermediateThrowEvent_01ngkx2"> @@ -653,9 +646,9 @@ uvfm.setClosedLoopDisabledInAAI(execution, false) <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[(execution.getVariable("disposition") == "Skip" && execution.getVariable("workStep") == "Lock") || (execution.getVariable("disposition") == "Retry" && execution.getVariable("workStep") == "UpgradePreCheck")]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> - <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_1p9i2bi" name="To Quiesce Traffic"> + <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_1p9i2bi" name="To Stop VNF"> <bpmn2:incoming>SequenceFlow_1ar6ikk</bpmn2:incoming> - <bpmn2:linkEventDefinition name="To Quiesce Traffic" /> + <bpmn2:linkEventDefinition name="To Stop VNF" /> </bpmn2:intermediateThrowEvent> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0ee7wot" name="To SnapShot"> <bpmn2:incoming>SequenceFlow_1nlqlwn</bpmn2:incoming> @@ -718,12 +711,12 @@ uvfm.setClosedLoopDisabledInAAI(execution, false) <camunda:out source="workStep" target="workStep" /> <camunda:out source="failedActivity" target="failedActivity" /> <camunda:in source="vmIdList" target="vmIdList" /> - <camunda:in source="aicIdentity" target="identityUrl" /> + <camunda:in source="identityUrl" target="identityUrl" /> <camunda:in source="controllerType" target="controllerType" /> <camunda:in source="vserverIdList" target="vserverIdList" /> </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_1c0vdki</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_0if6xj4</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_10yw9oj</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_19ba94v</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:callActivity id="Task_1dtbnuy" name="Call APP-C VNF Lock" calledElement="AppCClient"> @@ -888,8 +881,8 @@ execution.getVariable(retryVariableName) < execution.getVariable("maxRetryCount" <camunda:in source="vnfName" target="vnfName" /> <camunda:in source="controllerType" target="controllerType" /> </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_1fuaq5k</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_1v59be9</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0ugaydb</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_04rprct</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:callActivity id="Task_1hdg951" name="Call APP-C Upgrade Software" calledElement="AppCClient"> @@ -934,6 +927,107 @@ execution.getVariable(retryVariableName) < execution.getVariable("maxRetryCount" <bpmn2:outgoing>SequenceFlow_1j81s6b</bpmn2:outgoing> <bpmn2:outgoing>SequenceFlow_0qy68ib</bpmn2:outgoing> </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_10yw9oj" sourceRef="ExclusiveGateway_0bd79on" targetRef="Task_0eae8go" /> + <bpmn2:intermediateCatchEvent id="IntermediateThrowEvent_10hdz40" name="To Stop VNF"> + <bpmn2:outgoing>SequenceFlow_02zphll</bpmn2:outgoing> + <bpmn2:linkEventDefinition name="To Stop VNF" /> + </bpmn2:intermediateCatchEvent> + <bpmn2:sequenceFlow id="SequenceFlow_02zphll" sourceRef="IntermediateThrowEvent_10hdz40" targetRef="Task_0qa3yfr" /> + <bpmn2:exclusiveGateway id="ExclusiveGateway_0bd79on" name="Error on Stop VNF?" default="SequenceFlow_10yw9oj"> + <bpmn2:incoming>SequenceFlow_0ayfzd3</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_10yw9oj</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1qdt3ml</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_0ayfzd3" sourceRef="Task_0qa3yfr" targetRef="ExclusiveGateway_0bd79on" /> + <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0u4t4eb" name="To Rainy Day Handling"> + <bpmn2:incoming>SequenceFlow_1qdt3ml</bpmn2:incoming> + <bpmn2:linkEventDefinition name="To Rainy Day Handling" /> + </bpmn2:intermediateThrowEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1qdt3ml" name="yes" sourceRef="ExclusiveGateway_0bd79on" targetRef="IntermediateThrowEvent_0u4t4eb"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[execution.getVariable("errorCode") != "0"]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:callActivity id="Task_0qa3yfr" name="Call APP-C Stop VNF" calledElement="AppCClient"> + <bpmn2:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="actionStop" target="action" /> + <camunda:in source="vnfId" target="vnfId" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:in source="identityUrl" target="identityUrl" /> + <camunda:in source="controllerType" target="controllerType" /> + <camunda:out source="errorCode" target="errorCode" /> + <camunda:out source="errorText" target="errorText" /> + <camunda:out source="workStep" target="workStep" /> + <camunda:out source="failedActivity" target="failedActivity" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_1c0vdki</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_02zphll</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0ayfzd3</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_015qhj5" sourceRef="ExclusiveGateway_0y82zzx" targetRef="IntermediateThrowEvent_0utxo48"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[(execution.getVariable("disposition") == "Skip" && execution.getVariable("workStep") == "UpgradePreCheck") || +(execution.getVariable("disposition") == "Retry" && execution.getVariable("workStep") == "QuiesceTraffic")]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0utxo48" name="To Quiesce Traffic"> + <bpmn2:incoming>SequenceFlow_015qhj5</bpmn2:incoming> + <bpmn2:linkEventDefinition name="To Quiesce Traffic" /> + </bpmn2:intermediateThrowEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1xeh8rb" sourceRef="ExclusiveGateway_0y82zzx" targetRef="IntermediateThrowEvent_034letx"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[(execution.getVariable("disposition") == "Skip" && execution.getVariable("workStep") == "Snapshot") || +(execution.getVariable("disposition") == "Retry" && execution.getVariable("workStep") == "Start")]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_034letx" name="To Start VNF"> + <bpmn2:incoming>SequenceFlow_1xeh8rb</bpmn2:incoming> + <bpmn2:linkEventDefinition name="To Start VNF" /> + </bpmn2:intermediateThrowEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1c2q423" sourceRef="Task_1j68pc1" targetRef="ExclusiveGateway_1aepvyq" /> + <bpmn2:exclusiveGateway id="ExclusiveGateway_1aepvyq" name="Error on Start VNF?" default="SequenceFlow_0ugaydb"> + <bpmn2:incoming>SequenceFlow_1c2q423</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0ugaydb</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1ouddzv</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_0ugaydb" name="no" sourceRef="ExclusiveGateway_1aepvyq" targetRef="Task_1mdr1nd" /> + <bpmn2:sequenceFlow id="SequenceFlow_12k801c" sourceRef="IntermediateThrowEvent_01xb76a" targetRef="Task_1j68pc1" /> + <bpmn2:sequenceFlow id="SequenceFlow_1ouddzv" name="yes" sourceRef="ExclusiveGateway_1aepvyq" targetRef="IntermediateThrowEvent_0d6k86e"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[execution.getVariable("errorCode") != "0"]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:intermediateCatchEvent id="IntermediateThrowEvent_01xb76a" name="To Start VNF"> + <bpmn2:outgoing>SequenceFlow_12k801c</bpmn2:outgoing> + <bpmn2:linkEventDefinition name="To Start VNF" /> + </bpmn2:intermediateCatchEvent> + <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0d6k86e" name="To Rainy Day Handler"> + <bpmn2:incoming>SequenceFlow_1ouddzv</bpmn2:incoming> + <bpmn2:linkEventDefinition name="To Rainy Day Handling" /> + </bpmn2:intermediateThrowEvent> + <bpmn2:callActivity id="Task_1j68pc1" name="Call APP-C Start VNF" calledElement="AppCClient"> + <bpmn2:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="actionStart" target="action" /> + <camunda:in source="vnfId" target="vnfId" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:in source="identityUrl" target="identityUrl" /> + <camunda:in source="controllerType" target="controllerType" /> + <camunda:out source="errorCode" target="errorCode" /> + <camunda:out source="errorText" target="errorText" /> + <camunda:out source="workStep" target="workStep" /> + <camunda:out source="failedActivity" target="failedActivity" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_1fuaq5k</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_12k801c</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1c2q423</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:scriptTask id="Task_0n1d5f2" name="Set VF Is Closed Loop Disabled Flag in A&AI" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0du9273</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_032tm9y</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_179z9vl</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def uvfm = new VnfInPlaceUpdate() +uvfm.setClosedLoopDisabledInAAI(execution, true)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1us5byg" sourceRef="Task_0op98k0" targetRef="Task_0vy2zge" /> + <bpmn2:serviceTask id="Task_0op98k0" name="Query Catalog DB for IdentityUrl" camunda:expression="${CloudSiteCatalogUtils.getIdentityUrlFromCloudSite(execution)}"> + <bpmn2:incoming>SequenceFlow_053qjfy</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1us5byg</bpmn2:outgoing> + </bpmn2:serviceTask> </bpmn2:process> <bpmn2:error id="Error_1" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -945,9 +1039,9 @@ execution.getVariable(retryVariableName) < execution.getVariable("maxRetryCount" </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_EndEvent_125" bpmnElement="EndEvent_1"> - <dc:Bounds x="569" y="1073" width="36" height="36" /> + <dc:Bounds x="1248" y="1096" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="568" y="1114" width="38" height="12" /> + <dc:Bounds x="1247" y="1137" width="38" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_StartEvent_50" targetElement="_BPMNShape_ScriptTask_124"> @@ -978,30 +1072,30 @@ execution.getVariable(retryVariableName) < execution.getVariable("maxRetryCount" </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_127" bpmnElement="ScriptTask_4"> - <dc:Bounds x="415" y="1051" width="100" height="80" /> + <dc:Bounds x="1094" y="1074" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_127" targetElement="_BPMNShape_EndEvent_125"> - <di:waypoint xsi:type="dc:Point" x="515" y="1091" /> - <di:waypoint xsi:type="dc:Point" x="549" y="1091" /> - <di:waypoint xsi:type="dc:Point" x="549" y="1091" /> - <di:waypoint xsi:type="dc:Point" x="569" y="1091" /> + <di:waypoint xsi:type="dc:Point" x="1194" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="1228" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="1228" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="1248" y="1114" /> <bpmndi:BPMNLabel> - <dc:Bounds x="564" y="1091" width="0" height="0" /> + <dc:Bounds x="1243" y="1114" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_133" bpmnElement="ScriptTask_10"> - <dc:Bounds x="126" y="1051" width="100" height="80" /> + <dc:Bounds x="805" y="1074" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_CallActivity_27" bpmnElement="CallActivity_1"> - <dc:Bounds x="269" y="1051" width="100" height="80" /> + <dc:Bounds x="948" y="1074" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_17" bpmnElement="SequenceFlow_17" sourceElement="_BPMNShape_ScriptTask_133" targetElement="_BPMNShape_CallActivity_27"> - <di:waypoint xsi:type="dc:Point" x="226" y="1091" /> - <di:waypoint xsi:type="dc:Point" x="248" y="1091" /> - <di:waypoint xsi:type="dc:Point" x="248" y="1091" /> - <di:waypoint xsi:type="dc:Point" x="269" y="1091" /> + <di:waypoint xsi:type="dc:Point" x="905" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="927" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="927" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="948" y="1114" /> <bpmndi:BPMNLabel> - <dc:Bounds x="263" y="1091" width="0" height="0" /> + <dc:Bounds x="942" y="1114" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_SubProcess_17" bpmnElement="SubProcess_1" isExpanded="true"> @@ -1059,12 +1153,12 @@ execution.getVariable(retryVariableName) < execution.getVariable("maxRetryCount" <dc:Bounds x="748" y="1446" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_CallActivity_27" targetElement="_BPMNShape_ScriptTask_127"> - <di:waypoint xsi:type="dc:Point" x="369" y="1091" /> - <di:waypoint xsi:type="dc:Point" x="392" y="1091" /> - <di:waypoint xsi:type="dc:Point" x="392" y="1091" /> - <di:waypoint xsi:type="dc:Point" x="415" y="1091" /> + <di:waypoint xsi:type="dc:Point" x="1048" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="1071" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="1071" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="1094" y="1114" /> <bpmndi:BPMNLabel> - <dc:Bounds x="407" y="1091" width="0" height="0" /> + <dc:Bounds x="1086" y="1114" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_19" bpmnElement="SequenceFlow_19" sourceElement="_BPMNShape_CallActivity_28" targetElement="_BPMNShape_EndEvent_126"> @@ -1075,25 +1169,17 @@ execution.getVariable(retryVariableName) < execution.getVariable("maxRetryCount" </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" targetElement="_BPMNShape_ScriptTask_133"> - <di:waypoint xsi:type="dc:Point" x="1459" y="800" /> - <di:waypoint xsi:type="dc:Point" x="1561" y="800" /> - <di:waypoint xsi:type="dc:Point" x="1561" y="989" /> - <di:waypoint xsi:type="dc:Point" x="99" y="989" /> - <di:waypoint xsi:type="dc:Point" x="99" y="1091" /> - <di:waypoint xsi:type="dc:Point" x="126" y="1091" /> + <di:waypoint xsi:type="dc:Point" x="756" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="805" y="1114" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1482" y="772.5275881403734" width="12" height="12" /> + <dc:Bounds x="794" y="1090.1083303171945" width="12" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_053qjfy_di" bpmnElement="SequenceFlow_053qjfy"> <di:waypoint xsi:type="dc:Point" x="671" y="90" /> - <di:waypoint xsi:type="dc:Point" x="982" y="90" /> - <di:waypoint xsi:type="dc:Point" x="982" y="156" /> - <di:waypoint xsi:type="dc:Point" x="103" y="156" /> - <di:waypoint xsi:type="dc:Point" x="103" y="237" /> - <di:waypoint xsi:type="dc:Point" x="131" y="237" /> + <di:waypoint xsi:type="dc:Point" x="750" y="90" /> <bpmndi:BPMNLabel> - <dc:Bounds x="543" y="141" width="0" height="0" /> + <dc:Bounds x="711" y="75" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_08xzuox_di" bpmnElement="Task_1opcb4j"> @@ -1120,7 +1206,7 @@ execution.getVariable(retryVariableName) < execution.getVariable("maxRetryCount" <dc:Bounds x="608" y="197" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0sgm9bu_di" bpmnElement="Task_1drglpt"> - <dc:Bounds x="1058" y="760" width="100" height="80" /> + <dc:Bounds x="355" y="1074" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_16jtt5t_di" bpmnElement="Task_0vy2zge"> <dc:Bounds x="131" y="197" width="100" height="80" /> @@ -1147,24 +1233,24 @@ execution.getVariable(retryVariableName) < execution.getVariable("maxRetryCount" </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1uno5rs_di" bpmnElement="SequenceFlow_1uno5rs"> - <di:waypoint xsi:type="dc:Point" x="223" y="800" /> - <di:waypoint xsi:type="dc:Point" x="266" y="800" /> + <di:waypoint xsi:type="dc:Point" x="683" y="800" /> + <di:waypoint xsi:type="dc:Point" x="726" y="800" /> <bpmndi:BPMNLabel> - <dc:Bounds x="245" y="785" width="0" height="0" /> + <dc:Bounds x="706" y="785" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1c79909_di" bpmnElement="SequenceFlow_1c79909"> - <di:waypoint xsi:type="dc:Point" x="464" y="800" /> - <di:waypoint xsi:type="dc:Point" x="513" y="800" /> + <di:waypoint xsi:type="dc:Point" x="924" y="800" /> + <di:waypoint xsi:type="dc:Point" x="973" y="800" /> <bpmndi:BPMNLabel> - <dc:Bounds x="489" y="785" width="0" height="0" /> + <dc:Bounds x="949" y="785" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1xfbwpi_di" bpmnElement="SequenceFlow_1xfbwpi"> - <di:waypoint xsi:type="dc:Point" x="926" y="800" /> - <di:waypoint xsi:type="dc:Point" x="955" y="800" /> + <di:waypoint xsi:type="dc:Point" x="223" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="252" y="1114" /> <bpmndi:BPMNLabel> - <dc:Bounds x="941" y="785" width="0" height="0" /> + <dc:Bounds x="238" y="1099" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_0q323wc_di" bpmnElement="ExclusiveGateway_0q323wc" isMarkerVisible="true"> @@ -1262,41 +1348,41 @@ execution.getVariable(retryVariableName) < execution.getVariable("maxRetryCount" </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1c0vdki_di" bpmnElement="SequenceFlow_1c0vdki"> <di:waypoint xsi:type="dc:Point" x="785" y="510" /> - <di:waypoint xsi:type="dc:Point" x="826" y="510" /> + <di:waypoint xsi:type="dc:Point" x="824" y="510" /> <bpmndi:BPMNLabel> - <dc:Bounds x="804" y="487" width="12" height="12" /> + <dc:Bounds x="1024" y="485" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_02tj4dw_di" bpmnElement="ExclusiveGateway_02tj4dw" isMarkerVisible="true"> - <dc:Bounds x="266" y="775" width="50" height="50" /> + <dc:Bounds x="726" y="775" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="247" y="735" width="88" height="24" /> + <dc:Bounds x="709" y="735" width="84" height="26" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_162mm0m_di" bpmnElement="SequenceFlow_162mm0m"> - <di:waypoint xsi:type="dc:Point" x="316" y="800" /> - <di:waypoint xsi:type="dc:Point" x="364" y="800" /> + <di:waypoint xsi:type="dc:Point" x="776" y="800" /> + <di:waypoint xsi:type="dc:Point" x="824" y="800" /> <bpmndi:BPMNLabel> - <dc:Bounds x="333" y="780" width="12" height="12" /> + <dc:Bounds x="793" y="780" width="12" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_1gn5lab_di" bpmnElement="ExclusiveGateway_1gn5lab" isMarkerVisible="true"> - <dc:Bounds x="513" y="775" width="50" height="50" /> + <dc:Bounds x="973" y="775" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="502" y="735" width="72" height="24" /> + <dc:Bounds x="962" y="735" width="72" height="26" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0l2z6wc_di" bpmnElement="ExclusiveGateway_0l2z6wc" isMarkerVisible="true"> - <dc:Bounds x="1195" y="775" width="50" height="50" /> + <dc:Bounds x="492" y="1089" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1183" y="728" width="73" height="36" /> + <dc:Bounds x="480" y="1042" width="73" height="36" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_12mfil6_di" bpmnElement="SequenceFlow_12mfil6"> - <di:waypoint xsi:type="dc:Point" x="1158" y="800" /> - <di:waypoint xsi:type="dc:Point" x="1195" y="800" /> + <di:waypoint xsi:type="dc:Point" x="455" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="492" y="1114" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1178" y="785" width="0" height="0" /> + <dc:Bounds x="475" y="1099" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1lb0lk5_di" bpmnElement="Task_1tg549h"> @@ -1322,10 +1408,10 @@ execution.getVariable(retryVariableName) < execution.getVariable("maxRetryCount" </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_19ba94v_di" bpmnElement="SequenceFlow_19ba94v"> - <di:waypoint xsi:type="dc:Point" x="926" y="510" /> - <di:waypoint xsi:type="dc:Point" x="955" y="510" /> + <di:waypoint xsi:type="dc:Point" x="1160" y="510" /> + <di:waypoint xsi:type="dc:Point" x="1193" y="510" /> <bpmndi:BPMNLabel> - <dc:Bounds x="941" y="495" width="0" height="0" /> + <dc:Bounds x="1177" y="495" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1nlqlwn_di" bpmnElement="SequenceFlow_1nlqlwn"> @@ -1488,9 +1574,6 @@ execution.getVariable(retryVariableName) < execution.getVariable("maxRetryCount" <dc:Bounds x="1165" y="222" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1iio503_di" bpmnElement="Task_0n1d5f2"> - <dc:Bounds x="1046" y="197" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_032tm9y_di" bpmnElement="SequenceFlow_032tm9y"> <di:waypoint xsi:type="dc:Point" x="1096" y="308" /> <di:waypoint xsi:type="dc:Point" x="1096" y="277" /> @@ -1602,393 +1685,394 @@ execution.getVariable(retryVariableName) < execution.getVariable("maxRetryCount" </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_19an3h2_di" bpmnElement="ExclusiveGateway_19an3h2" isMarkerVisible="true"> - <dc:Bounds x="955" y="485" width="50" height="50" /> + <dc:Bounds x="1193" y="485" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="953" y="441" width="53" height="24" /> + <dc:Bounds x="1191" y="441" width="54" height="26" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1fuaq5k_di" bpmnElement="SequenceFlow_1fuaq5k"> - <di:waypoint xsi:type="dc:Point" x="1005" y="510" /> - <di:waypoint xsi:type="dc:Point" x="1064" y="510" /> + <di:waypoint xsi:type="dc:Point" x="1243" y="510" /> + <di:waypoint xsi:type="dc:Point" x="1294" y="510" /> + <di:waypoint xsi:type="dc:Point" x="1294" y="681" /> + <di:waypoint xsi:type="dc:Point" x="98" y="681" /> + <di:waypoint xsi:type="dc:Point" x="98" y="800" /> + <di:waypoint xsi:type="dc:Point" x="124" y="800" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1030" y="485" width="12" height="12" /> + <dc:Bounds x="1260" y="484.09433477074754" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_199cotj_di" bpmnElement="IntermediateThrowEvent_0a1s69h"> - <dc:Bounds x="858" y="581" width="36" height="36" /> + <dc:Bounds x="1092" y="581" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="844" y="617" width="63" height="13" /> + <dc:Bounds x="1079" y="617" width="62" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0if6xj4_di" bpmnElement="SequenceFlow_0if6xj4"> - <di:waypoint xsi:type="dc:Point" x="876" y="581" /> - <di:waypoint xsi:type="dc:Point" x="876" y="550" /> + <di:waypoint xsi:type="dc:Point" x="1110" y="581" /> + <di:waypoint xsi:type="dc:Point" x="1110" y="550" /> <bpmndi:BPMNLabel> - <dc:Bounds x="891" y="565.5" width="0" height="0" /> + <dc:Bounds x="1125" y="565.5" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_04gth9f_di" bpmnElement="SequenceFlow_04gth9f"> - <di:waypoint xsi:type="dc:Point" x="980" y="535" /> - <di:waypoint xsi:type="dc:Point" x="980" y="581" /> + <di:waypoint xsi:type="dc:Point" x="1218" y="535" /> + <di:waypoint xsi:type="dc:Point" x="1218" y="581" /> <bpmndi:BPMNLabel> - <dc:Bounds x="986" y="558" width="18" height="12" /> + <dc:Bounds x="1227" y="546.6958260869565" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_1ly7m7x_di" bpmnElement="IntermediateThrowEvent_11vs7u4"> - <dc:Bounds x="962" y="581" width="36" height="36" /> + <dc:Bounds x="1200" y="581" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="945" y="617" width="69" height="24" /> + <dc:Bounds x="1184" y="617" width="68" height="26" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1v59be9_di" bpmnElement="SequenceFlow_1v59be9"> - <di:waypoint xsi:type="dc:Point" x="1114" y="581" /> - <di:waypoint xsi:type="dc:Point" x="1114" y="550" /> + <di:waypoint xsi:type="dc:Point" x="414" y="871" /> + <di:waypoint xsi:type="dc:Point" x="414" y="840" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1129" y="565.5" width="0" height="0" /> + <dc:Bounds x="429" y="856" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_0gvhqjf_di" bpmnElement="IntermediateThrowEvent_162mb2a"> - <dc:Bounds x="1096" y="581" width="36" height="36" /> + <dc:Bounds x="396" y="871" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1084" y="617" width="60" height="25" /> + <dc:Bounds x="385" y="907" width="58" height="26" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0ssvndw_di" bpmnElement="ExclusiveGateway_0ssvndw" isMarkerVisible="true"> - <dc:Bounds x="1195.192" y="485" width="50" height="50" /> + <dc:Bounds x="495" y="775" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1177" y="439" width="85" height="24" /> + <dc:Bounds x="478" y="729" width="84" height="26" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_04rprct_di" bpmnElement="SequenceFlow_04rprct"> - <di:waypoint xsi:type="dc:Point" x="1164" y="510" /> - <di:waypoint xsi:type="dc:Point" x="1195" y="510" /> + <di:waypoint xsi:type="dc:Point" x="464" y="800" /> + <di:waypoint xsi:type="dc:Point" x="495" y="800" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1180" y="495" width="0" height="0" /> + <dc:Bounds x="480" y="785" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_14s9cw9_di" bpmnElement="IntermediateThrowEvent_1yfd3sz"> - <dc:Bounds x="1202" y="581" width="36" height="36" /> + <dc:Bounds x="502" y="871" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1185" y="617" width="69" height="24" /> + <dc:Bounds x="486" y="907" width="68" height="26" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1uceq96_di" bpmnElement="SequenceFlow_1uceq96"> - <di:waypoint xsi:type="dc:Point" x="1220" y="535" /> - <di:waypoint xsi:type="dc:Point" x="1220" y="581" /> + <di:waypoint xsi:type="dc:Point" x="520" y="825" /> + <di:waypoint xsi:type="dc:Point" x="520" y="871" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1226" y="548" width="18" height="12" /> + <dc:Bounds x="526" y="838" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0txgesu_di" bpmnElement="SequenceFlow_0txgesu"> - <di:waypoint xsi:type="dc:Point" x="1245" y="510" /> - <di:waypoint xsi:type="dc:Point" x="1286" y="510" /> - <di:waypoint xsi:type="dc:Point" x="1286" y="676" /> - <di:waypoint xsi:type="dc:Point" x="95" y="676" /> - <di:waypoint xsi:type="dc:Point" x="95" y="800" /> - <di:waypoint xsi:type="dc:Point" x="123" y="800" /> + <di:waypoint xsi:type="dc:Point" x="545" y="800" /> + <di:waypoint xsi:type="dc:Point" x="583" y="800" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1259" y="488" width="12" height="12" /> + <dc:Bounds x="559" y="778" width="12" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0trguug_di" bpmnElement="SequenceFlow_0trguug"> - <di:waypoint xsi:type="dc:Point" x="701" y="800" /> - <di:waypoint xsi:type="dc:Point" x="735" y="800" /> + <di:waypoint xsi:type="dc:Point" x="1161" y="800" /> + <di:waypoint xsi:type="dc:Point" x="1195" y="800" /> <bpmndi:BPMNLabel> - <dc:Bounds x="718" y="785" width="0" height="0" /> + <dc:Bounds x="1178" y="785" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_1ozuicc_di" bpmnElement="ExclusiveGateway_1ozuicc" isMarkerVisible="true"> - <dc:Bounds x="735.304" y="775" width="50" height="50" /> + <dc:Bounds x="1195" y="775" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="716" y="735" width="87" height="24" /> + <dc:Bounds x="1178" y="735" width="84" height="26" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1q3bwlt_di" bpmnElement="SequenceFlow_1q3bwlt"> - <di:waypoint xsi:type="dc:Point" x="785.304" y="800" /> - <di:waypoint xsi:type="dc:Point" x="826" y="800" /> + <di:waypoint xsi:type="dc:Point" x="1245" y="800" /> + <di:waypoint xsi:type="dc:Point" x="1290" y="800" /> + <di:waypoint xsi:type="dc:Point" x="1290" y="969" /> + <di:waypoint xsi:type="dc:Point" x="80" y="969" /> + <di:waypoint xsi:type="dc:Point" x="80" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="123" y="1114" /> <bpmndi:BPMNLabel> - <dc:Bounds x="800" y="775" width="12" height="12" /> + <dc:Bounds x="1260" y="770.0957837465772" width="12" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_123vjyo_di" bpmnElement="ExclusiveGateway_123vjyo" isMarkerVisible="true"> - <dc:Bounds x="955" y="775" width="50" height="50" /> + <dc:Bounds x="252" y="1089" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="946" y="735" width="68" height="24" /> + <dc:Bounds x="243" y="1049" width="68" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1nr9o85_di" bpmnElement="SequenceFlow_1nr9o85"> - <di:waypoint xsi:type="dc:Point" x="1005" y="800" /> - <di:waypoint xsi:type="dc:Point" x="1037" y="800" /> - <di:waypoint xsi:type="dc:Point" x="1037" y="800" /> - <di:waypoint xsi:type="dc:Point" x="1058" y="800" /> + <di:waypoint xsi:type="dc:Point" x="302" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="334" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="334" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="355" y="1114" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1024" y="772" width="12" height="12" /> + <dc:Bounds x="321" y="1086" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_11ot6vh_di" bpmnElement="IntermediateThrowEvent_1nij04n"> - <dc:Bounds x="273" y="886" width="36" height="36" /> + <dc:Bounds x="733" y="871" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="256" y="921.6089999999999" width="69" height="24" /> + <dc:Bounds x="716" y="907" width="69" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1gagrha_di" bpmnElement="SequenceFlow_1gagrha"> - <di:waypoint xsi:type="dc:Point" x="291" y="825" /> - <di:waypoint xsi:type="dc:Point" x="291" y="886" /> + <di:waypoint xsi:type="dc:Point" x="751" y="825" /> + <di:waypoint xsi:type="dc:Point" x="751" y="871" /> <bpmndi:BPMNLabel> - <dc:Bounds x="297" y="845.5" width="18" height="12" /> + <dc:Bounds x="757" y="839.1147540983607" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_16igl7b_di" bpmnElement="SequenceFlow_16igl7b"> - <di:waypoint xsi:type="dc:Point" x="414" y="886" /> - <di:waypoint xsi:type="dc:Point" x="414" y="840" /> + <di:waypoint xsi:type="dc:Point" x="874" y="871" /> + <di:waypoint xsi:type="dc:Point" x="874" y="840" /> <bpmndi:BPMNLabel> - <dc:Bounds x="429" y="863" width="0" height="0" /> + <dc:Bounds x="889" y="855.5" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_174wgan_di" bpmnElement="IntermediateThrowEvent_0fhmhsk"> - <dc:Bounds x="396" y="886" width="36" height="36" /> + <dc:Bounds x="856" y="871" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="384" y="922" width="59" height="24" /> + <dc:Bounds x="844" y="907" width="60" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1urpp94_di" bpmnElement="SequenceFlow_1urpp94"> - <di:waypoint xsi:type="dc:Point" x="538" y="825" /> - <di:waypoint xsi:type="dc:Point" x="538" y="886" /> + <di:waypoint xsi:type="dc:Point" x="998" y="825" /> + <di:waypoint xsi:type="dc:Point" x="998" y="871" /> <bpmndi:BPMNLabel> - <dc:Bounds x="544" y="855.5" width="18" height="12" /> + <dc:Bounds x="1004" y="846.4451837791199" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_1vi3wf9_di" bpmnElement="IntermediateThrowEvent_0vf0a28"> - <dc:Bounds x="520" y="886" width="36" height="36" /> + <dc:Bounds x="980" y="871" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="503" y="922" width="69" height="24" /> + <dc:Bounds x="963" y="907" width="69" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1c2xyhk_di" bpmnElement="SequenceFlow_1c2xyhk"> - <di:waypoint xsi:type="dc:Point" x="563" y="800" /> - <di:waypoint xsi:type="dc:Point" x="601" y="800" /> + <di:waypoint xsi:type="dc:Point" x="1023" y="800" /> + <di:waypoint xsi:type="dc:Point" x="1061" y="800" /> <bpmndi:BPMNLabel> - <dc:Bounds x="577" y="775" width="12" height="12" /> + <dc:Bounds x="1037" y="775" width="12" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_165ve6q_di" bpmnElement="IntermediateThrowEvent_0pxvl24"> - <dc:Bounds x="632" y="886" width="36" height="36" /> + <dc:Bounds x="1093" y="871" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="607" y="922" width="85" height="13" /> + <dc:Bounds x="1066" y="907" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0yja56j_di" bpmnElement="SequenceFlow_0yja56j"> - <di:waypoint xsi:type="dc:Point" x="650" y="886" /> - <di:waypoint xsi:type="dc:Point" x="651" y="840" /> + <di:waypoint xsi:type="dc:Point" x="1111" y="871" /> + <di:waypoint xsi:type="dc:Point" x="1112" y="840" /> <bpmndi:BPMNLabel> - <dc:Bounds x="651" y="848" width="0" height="0" /> + <dc:Bounds x="1112" y="840.5" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1xg6pwh_di" bpmnElement="SequenceFlow_1xg6pwh"> - <di:waypoint xsi:type="dc:Point" x="760" y="825" /> - <di:waypoint xsi:type="dc:Point" x="760" y="886" /> + <di:waypoint xsi:type="dc:Point" x="1220" y="825" /> + <di:waypoint xsi:type="dc:Point" x="1220" y="871" /> <bpmndi:BPMNLabel> - <dc:Bounds x="766" y="855.5" width="18" height="12" /> + <dc:Bounds x="1226" y="846.655737704918" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_0unfhc9_di" bpmnElement="IntermediateThrowEvent_1vjqksl"> - <dc:Bounds x="742" y="886" width="36" height="36" /> + <dc:Bounds x="1202" y="871" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="725" y="922" width="69" height="24" /> + <dc:Bounds x="1185" y="907" width="69" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_1om2udh_di" bpmnElement="IntermediateThrowEvent_1vwqesb"> - <dc:Bounds x="859" y="886" width="36" height="36" /> + <dc:Bounds x="156" y="1200" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="842" y="922" width="70" height="13" /> + <dc:Bounds x="137" y="1236" width="74" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1hwtq9x_di" bpmnElement="SequenceFlow_1hwtq9x"> - <di:waypoint xsi:type="dc:Point" x="877" y="886" /> - <di:waypoint xsi:type="dc:Point" x="876" y="840" /> + <di:waypoint xsi:type="dc:Point" x="174" y="1200" /> + <di:waypoint xsi:type="dc:Point" x="173" y="1154" /> <bpmndi:BPMNLabel> - <dc:Bounds x="877" y="848" width="0" height="0" /> + <dc:Bounds x="174" y="1162" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ttowkv_di" bpmnElement="SequenceFlow_0ttowkv"> - <di:waypoint xsi:type="dc:Point" x="980" y="825" /> - <di:waypoint xsi:type="dc:Point" x="980" y="886" /> + <di:waypoint xsi:type="dc:Point" x="277" y="1139" /> + <di:waypoint xsi:type="dc:Point" x="277" y="1200" /> <bpmndi:BPMNLabel> - <dc:Bounds x="986" y="855.5" width="18" height="12" /> + <dc:Bounds x="283" y="1170" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_1u04oef_di" bpmnElement="IntermediateThrowEvent_0m9jtv2"> - <dc:Bounds x="962" y="886" width="36" height="36" /> + <dc:Bounds x="259" y="1200" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="945" y="922" width="69" height="24" /> + <dc:Bounds x="242" y="1236" width="69" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_1bsxf5o_di" bpmnElement="IntermediateThrowEvent_0pk24h2"> - <dc:Bounds x="155" y="886" width="36" height="36" /> + <dc:Bounds x="615" y="871" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="143" y="922" width="59" height="25" /> + <dc:Bounds x="603" y="907" width="60" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1colra4_di" bpmnElement="SequenceFlow_1colra4"> - <di:waypoint xsi:type="dc:Point" x="173" y="886" /> - <di:waypoint xsi:type="dc:Point" x="173" y="863" /> - <di:waypoint xsi:type="dc:Point" x="173" y="863" /> - <di:waypoint xsi:type="dc:Point" x="173" y="840" /> + <di:waypoint xsi:type="dc:Point" x="633" y="871" /> + <di:waypoint xsi:type="dc:Point" x="633" y="840" /> <bpmndi:BPMNLabel> - <dc:Bounds x="188" y="863" width="0" height="0" /> + <dc:Bounds x="648" y="855.5" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_18j1ow5_di" bpmnElement="ExclusiveGateway_18j1ow5" isMarkerVisible="true"> - <dc:Bounds x="1409.304" y="775" width="50" height="50" /> + <dc:Bounds x="706" y="1089" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1396" y="724" width="75" height="36" /> + <dc:Bounds x="693" y="1038" width="75" height="36" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0u6ho2p_di" bpmnElement="SequenceFlow_0u6ho2p"> - <di:waypoint xsi:type="dc:Point" x="1245" y="800" /> - <di:waypoint xsi:type="dc:Point" x="1275" y="800" /> + <di:waypoint xsi:type="dc:Point" x="542" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="572" y="1114" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1255" y="775" width="12" height="12" /> + <dc:Bounds x="552" y="1089" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_08r89q9_di" bpmnElement="Task_0y1h8go"> - <dc:Bounds x="1275" y="760" width="100" height="80" /> + <dc:Bounds x="572" y="1074" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1tzax6l_di" bpmnElement="SequenceFlow_1tzax6l"> - <di:waypoint xsi:type="dc:Point" x="1375" y="800" /> - <di:waypoint xsi:type="dc:Point" x="1409" y="800" /> + <di:waypoint xsi:type="dc:Point" x="672" y="1114" /> + <di:waypoint xsi:type="dc:Point" x="706" y="1114" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1392" y="775" width="0" height="0" /> + <dc:Bounds x="689" y="1089" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_06j33fe_di" bpmnElement="IntermediateThrowEvent_0pmevcz"> - <dc:Bounds x="1090" y="886" width="36" height="36" /> + <dc:Bounds x="387" y="1200" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1072" y="922" width="72" height="25" /> + <dc:Bounds x="370" y="1236" width="70" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_16ff86u_di" bpmnElement="SequenceFlow_16ff86u"> - <di:waypoint xsi:type="dc:Point" x="1108" y="886" /> - <di:waypoint xsi:type="dc:Point" x="1108" y="840" /> + <di:waypoint xsi:type="dc:Point" x="405" y="1200" /> + <di:waypoint xsi:type="dc:Point" x="405" y="1154" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1123" y="853" width="0" height="0" /> + <dc:Bounds x="420" y="1167" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0k3zxpd_di" bpmnElement="SequenceFlow_0k3zxpd"> - <di:waypoint xsi:type="dc:Point" x="1220" y="825" /> - <di:waypoint xsi:type="dc:Point" x="1220" y="886" /> + <di:waypoint xsi:type="dc:Point" x="517" y="1139" /> + <di:waypoint xsi:type="dc:Point" x="517" y="1200" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1226" y="855.5" width="18" height="12" /> + <dc:Bounds x="523" y="1170" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_105mp22_di" bpmnElement="IntermediateThrowEvent_1awckg7"> - <dc:Bounds x="1202" y="886" width="36" height="36" /> + <dc:Bounds x="499" y="1200" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1185" y="922" width="69" height="24" /> + <dc:Bounds x="482" y="1236" width="69" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_0kglv4e_di" bpmnElement="IntermediateThrowEvent_1b3smly"> - <dc:Bounds x="1307" y="886" width="36" height="36" /> + <dc:Bounds x="604" y="1200" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1285" y="922" width="79" height="25" /> + <dc:Bounds x="581" y="1236" width="82" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_09xxorv_di" bpmnElement="SequenceFlow_09xxorv"> - <di:waypoint xsi:type="dc:Point" x="1325" y="886" /> - <di:waypoint xsi:type="dc:Point" x="1325" y="840" /> + <di:waypoint xsi:type="dc:Point" x="622" y="1200" /> + <di:waypoint xsi:type="dc:Point" x="622" y="1154" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1340" y="853" width="0" height="0" /> + <dc:Bounds x="637" y="1167" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0w8mkkn_di" bpmnElement="SequenceFlow_0w8mkkn"> - <di:waypoint xsi:type="dc:Point" x="1434" y="825" /> - <di:waypoint xsi:type="dc:Point" x="1434" y="886" /> + <di:waypoint xsi:type="dc:Point" x="731" y="1139" /> + <di:waypoint xsi:type="dc:Point" x="731" y="1200" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1440" y="855.5" width="18" height="12" /> + <dc:Bounds x="737" y="1170" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_0jwgx1d_di" bpmnElement="IntermediateThrowEvent_1cw8gsw"> - <dc:Bounds x="1416" y="886" width="36" height="36" /> + <dc:Bounds x="713" y="1200" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1399" y="922" width="69" height="24" /> + <dc:Bounds x="696" y="1236" width="69" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_0zw87jy_di" bpmnElement="IntermediateThrowEvent_0x846wp"> - <dc:Bounds x="158" y="1186" width="36" height="36" /> + <dc:Bounds x="837" y="1200" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="140" y="1221.609" width="72" height="25" /> + <dc:Bounds x="819" y="1236" width="72" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_07uuj2d_di" bpmnElement="SequenceFlow_07uuj2d"> - <di:waypoint xsi:type="dc:Point" x="176" y="1186" /> - <di:waypoint xsi:type="dc:Point" x="176" y="1160" /> - <di:waypoint xsi:type="dc:Point" x="176" y="1160" /> - <di:waypoint xsi:type="dc:Point" x="176" y="1131" /> + <di:waypoint xsi:type="dc:Point" x="855" y="1200" /> + <di:waypoint xsi:type="dc:Point" x="855" y="1154" /> <bpmndi:BPMNLabel> - <dc:Bounds x="191" y="1160" width="0" height="0" /> + <dc:Bounds x="870" y="1177" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ueoglv_di" bpmnElement="SequenceFlow_0ueoglv"> <di:waypoint xsi:type="dc:Point" x="2117" y="490" /> - <di:waypoint xsi:type="dc:Point" x="2173" y="264" /> + <di:waypoint xsi:type="dc:Point" x="2168" y="266" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2145" y="362" width="0" height="0" /> + <dc:Bounds x="2143" y="363" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_15fqlwe_di" bpmnElement="SequenceFlow_15fqlwe"> - <di:waypoint xsi:type="dc:Point" x="2120" y="493" /> - <di:waypoint xsi:type="dc:Point" x="2209" y="290" /> + <di:waypoint xsi:type="dc:Point" x="2119" y="492" /> + <di:waypoint xsi:type="dc:Point" x="2194" y="302" /> + <di:waypoint xsi:type="dc:Point" x="2201" y="283" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2165" y="377" width="0" height="0" /> + <dc:Bounds x="2157" y="382" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0yuj0l5_di" bpmnElement="SequenceFlow_0yuj0l5"> - <di:waypoint xsi:type="dc:Point" x="2122" y="495" /> - <di:waypoint xsi:type="dc:Point" x="2247" y="319" /> + <di:waypoint xsi:type="dc:Point" x="2121" y="494" /> + <di:waypoint xsi:type="dc:Point" x="2234" y="304" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2185" y="392" width="0" height="0" /> + <dc:Bounds x="2178" y="384" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1abb030_di" bpmnElement="SequenceFlow_1abb030"> - <di:waypoint xsi:type="dc:Point" x="2125" y="498" /> - <di:waypoint xsi:type="dc:Point" x="2284" y="348" /> + <di:waypoint xsi:type="dc:Point" x="2123" y="496" /> + <di:waypoint xsi:type="dc:Point" x="2268" y="329" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2205" y="408" width="0" height="0" /> + <dc:Bounds x="2196" y="397.5" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ls3ej5_di" bpmnElement="SequenceFlow_0ls3ej5"> - <di:waypoint xsi:type="dc:Point" x="2127" y="500" /> - <di:waypoint xsi:type="dc:Point" x="2313" y="386" /> + <di:waypoint xsi:type="dc:Point" x="2125" y="498" /> + <di:waypoint xsi:type="dc:Point" x="2293" y="363" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2220" y="428" width="0" height="0" /> + <dc:Bounds x="2209" y="415.5" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1ar6ikk_di" bpmnElement="SequenceFlow_1ar6ikk"> <di:waypoint xsi:type="dc:Point" x="2133" y="506" /> - <di:waypoint xsi:type="dc:Point" x="2372" y="460" /> + <di:waypoint xsi:type="dc:Point" x="2372" y="462" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2253" y="468" width="0" height="0" /> + <dc:Bounds x="2253" y="469" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_171iq7e_di" bpmnElement="SequenceFlow_171iq7e"> - <di:waypoint xsi:type="dc:Point" x="2134" y="513" /> - <di:waypoint xsi:type="dc:Point" x="2372" y="553" /> + <di:waypoint xsi:type="dc:Point" x="2132" y="515" /> + <di:waypoint xsi:type="dc:Point" x="2363" y="585" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2253" y="518" width="0" height="0" /> + <dc:Bounds x="2248" y="535" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1553o9f_di" bpmnElement="SequenceFlow_1553o9f"> - <di:waypoint xsi:type="dc:Point" x="2129" y="518" /> - <di:waypoint xsi:type="dc:Point" x="2353" y="595" /> + <di:waypoint xsi:type="dc:Point" x="2128" y="519" /> + <di:waypoint xsi:type="dc:Point" x="2335" y="623" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2241" y="541.5" width="0" height="0" /> + <dc:Bounds x="2232" y="556" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0dmxwel_di" bpmnElement="SequenceFlow_0dmxwel"> - <di:waypoint xsi:type="dc:Point" x="2125" y="522" /> - <di:waypoint xsi:type="dc:Point" x="2294" y="685" /> + <di:waypoint xsi:type="dc:Point" x="2124" y="523" /> + <di:waypoint xsi:type="dc:Point" x="2281" y="692" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2210" y="588.5" width="0" height="0" /> + <dc:Bounds x="2203" y="592.5" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1id2p8y_di" bpmnElement="SequenceFlow_1id2p8y"> @@ -2020,52 +2104,52 @@ execution.getVariable(retryVariableName) < execution.getVariable("maxRetryCount" </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_17syve1_di" bpmnElement="IntermediateThrowEvent_0rz6jh4"> - <dc:Bounds x="2159" y="229" width="36" height="36" /> + <dc:Bounds x="2150" y="230" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2165" y="189" width="84" height="36" /> + <dc:Bounds x="2156" y="190" width="84" height="36" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_0nv8aic_di" bpmnElement="IntermediateThrowEvent_1wip9vc"> - <dc:Bounds x="2199" y="256" width="36" height="36" /> + <dc:Bounds x="2189" y="249" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2213" y="235" width="89" height="24" /> + <dc:Bounds x="2203" y="228" width="89" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_1g4pmwc_di" bpmnElement="IntermediateThrowEvent_1hki8xj"> - <dc:Bounds x="2240" y="287" width="36" height="36" /> + <dc:Bounds x="2227" y="273" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2280" y="256" width="64" height="36" /> + <dc:Bounds x="2267" y="242" width="64" height="36" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_1ypnogn_di" bpmnElement="IntermediateThrowEvent_1gfnt9b"> - <dc:Bounds x="2279" y="319" width="36" height="36" /> + <dc:Bounds x="2263" y="299" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2325" y="305" width="71" height="24" /> + <dc:Bounds x="2309" y="285" width="71" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_1i9ttzs_di" bpmnElement="IntermediateThrowEvent_1gzhs1a"> - <dc:Bounds x="2311" y="359" width="36" height="36" /> + <dc:Bounds x="2289" y="334" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2357" y="356" width="64" height="12" /> + <dc:Bounds x="2335" y="331" width="64" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_0840e02_di" bpmnElement="IntermediateThrowEvent_0385ons"> - <dc:Bounds x="2343" y="392" width="36" height="36" /> + <dc:Bounds x="2324" y="362" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2393" y="383" width="60" height="24" /> + <dc:Bounds x="2374" y="353" width="60" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1quapjx_di" bpmnElement="SequenceFlow_1quapjx"> - <di:waypoint xsi:type="dc:Point" x="2130" y="503" /> - <di:waypoint xsi:type="dc:Point" x="2345" y="416" /> + <di:waypoint xsi:type="dc:Point" x="2128" y="501" /> + <di:waypoint xsi:type="dc:Point" x="2326" y="389" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2239" y="445" width="0" height="0" /> + <dc:Bounds x="2227" y="430" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_1xq4kx8_di" bpmnElement="IntermediateThrowEvent_1p9i2bi"> - <dc:Bounds x="2371" y="439" width="36" height="36" /> + <dc:Bounds x="2371" y="441" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2412" y="440" width="90" height="12" /> + <dc:Bounds x="2419" y="444" width="62" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_03b4y60_di" bpmnElement="IntermediateThrowEvent_0ee7wot"> @@ -2075,21 +2159,21 @@ execution.getVariable(retryVariableName) < execution.getVariable("maxRetryCount" </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_1ghdnpx_di" bpmnElement="IntermediateThrowEvent_0rp1ax0"> - <dc:Bounds x="2371" y="538" width="36" height="36" /> + <dc:Bounds x="2362" y="572" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2424" y="544" width="60" height="24" /> + <dc:Bounds x="2415" y="578" width="60" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_1nls1oo_di" bpmnElement="IntermediateThrowEvent_01ngkx2"> - <dc:Bounds x="2352" y="582" width="36" height="36" /> + <dc:Bounds x="2333" y="612" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2401" y="587" width="60" height="24" /> + <dc:Bounds x="2382" y="617" width="60" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_0qt249a_di" bpmnElement="IntermediateThrowEvent_0lbd0cs"> - <dc:Bounds x="2289" y="679" width="36" height="36" /> + <dc:Bounds x="2276" y="686" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2337" y="706" width="90" height="12" /> + <dc:Bounds x="2324" y="713" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_0frwxx8_di" bpmnElement="IntermediateThrowEvent_1ycbds3"> @@ -2156,31 +2240,31 @@ execution.getVariable(retryVariableName) < execution.getVariable("maxRetryCount" </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_1y81g09_di" bpmnElement="Task_0eae8go"> - <dc:Bounds x="826" y="470" width="100" height="80" /> + <dc:Bounds x="1060" y="470" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0n20gvh_di" bpmnElement="Task_1dtbnuy"> <dc:Bounds x="126" y="470" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_08wyi5l_di" bpmnElement="Task_1sove95"> - <dc:Bounds x="826" y="760" width="100" height="80" /> + <dc:Bounds x="123" y="1074" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_1a5n5ff_di" bpmnElement="Task_1fj63ov"> <dc:Bounds x="364" y="470" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0mp082m_di" bpmnElement="Task_1ca5ctq"> - <dc:Bounds x="364" y="760" width="100" height="80" /> + <dc:Bounds x="824" y="760" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_07dp1m8_di" bpmnElement="IntermediateThrowEvent_1kbtw2p"> - <dc:Bounds x="2324" y="634" width="36" height="36" /> + <dc:Bounds x="2303" y="648" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2345" y="668" width="60" height="24" /> + <dc:Bounds x="2324" y="682" width="60" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_021ah63_di" bpmnElement="SequenceFlow_021ah63"> - <di:waypoint xsi:type="dc:Point" x="2127" y="520" /> - <di:waypoint xsi:type="dc:Point" x="2327" y="643" /> + <di:waypoint xsi:type="dc:Point" x="2126" y="521" /> + <di:waypoint xsi:type="dc:Point" x="2307" y="655" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2227" y="566.5" width="0" height="0" /> + <dc:Bounds x="2217" y="573" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1qr054i_di" bpmnElement="ScriptTask_1qr054i"> @@ -2253,13 +2337,13 @@ execution.getVariable(retryVariableName) < execution.getVariable("maxRetryCount" <dc:Bounds x="600" y="470" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_1kw9f96_di" bpmnElement="Task_1mdr1nd"> - <dc:Bounds x="1064" y="470" width="100" height="80" /> + <dc:Bounds x="364" y="760" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0d1uai9_di" bpmnElement="Task_1hdg951"> - <dc:Bounds x="123" y="760" width="100" height="80" /> + <dc:Bounds x="583" y="760" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_1onqhy5_di" bpmnElement="Task_0h2nq31"> - <dc:Bounds x="601" y="760" width="100" height="80" /> + <dc:Bounds x="1061" y="760" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1slvyx2_di" bpmnElement="ExclusiveGateway_1slvyx2" isMarkerVisible="true"> <dc:Bounds x="266" y="485" width="50" height="50" /> @@ -2297,6 +2381,147 @@ execution.getVariable(retryVariableName) < execution.getVariable("maxRetryCount" <bpmndi:BPMNShape id="ScriptTask_032b6ij_di" bpmnElement="Task_1mt62gu"> <dc:Bounds x="491" y="1446" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_10yw9oj_di" bpmnElement="SequenceFlow_10yw9oj"> + <di:waypoint xsi:type="dc:Point" x="1006" y="510" /> + <di:waypoint xsi:type="dc:Point" x="1060" y="510" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1033" y="495" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_0mnk8wv_di" bpmnElement="IntermediateThrowEvent_10hdz40"> + <dc:Bounds x="856" y="581" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="843" y="617" width="62" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_02zphll_di" bpmnElement="SequenceFlow_02zphll"> + <di:waypoint xsi:type="dc:Point" x="874" y="581" /> + <di:waypoint xsi:type="dc:Point" x="874" y="550" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="889" y="565.5" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0bd79on_di" bpmnElement="ExclusiveGateway_0bd79on" isMarkerVisible="true"> + <dc:Bounds x="955" y="485" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="946" y="447" width="68" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ayfzd3_di" bpmnElement="SequenceFlow_0ayfzd3"> + <di:waypoint xsi:type="dc:Point" x="924" y="510" /> + <di:waypoint xsi:type="dc:Point" x="955" y="510" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="940" y="495" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_112p1kw_di" bpmnElement="IntermediateThrowEvent_0u4t4eb"> + <dc:Bounds x="962" y="581" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="945" y="617" width="69" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1qdt3ml_di" bpmnElement="SequenceFlow_1qdt3ml"> + <di:waypoint xsi:type="dc:Point" x="980" y="535" /> + <di:waypoint xsi:type="dc:Point" x="980" y="581" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="986" y="548" width="18" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_04cfhj4_di" bpmnElement="Task_0qa3yfr"> + <dc:Bounds x="824" y="470" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_015qhj5_di" bpmnElement="SequenceFlow_015qhj5"> + <di:waypoint xsi:type="dc:Point" x="2130" y="503" /> + <di:waypoint xsi:type="dc:Point" x="2354" y="422" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2242" y="447.5" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1leefua_di" bpmnElement="IntermediateThrowEvent_0utxo48"> + <dc:Bounds x="2352" y="398" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2398" y="400.907" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1xeh8rb_di" bpmnElement="SequenceFlow_1xeh8rb"> + <di:waypoint xsi:type="dc:Point" x="2134" y="513" /> + <di:waypoint xsi:type="dc:Point" x="2386" y="551" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2260" y="517" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_05jik84_di" bpmnElement="IntermediateThrowEvent_034letx"> + <dc:Bounds x="2385" y="536" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2431" y="547.9069999999999" width="63" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1c2q423_di" bpmnElement="SequenceFlow_1c2q423"> + <di:waypoint xsi:type="dc:Point" x="224" y="800" /> + <di:waypoint xsi:type="dc:Point" x="266" y="800" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="245" y="785" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1aepvyq_di" bpmnElement="ExclusiveGateway_1aepvyq" isMarkerVisible="true"> + <dc:Bounds x="266" y="775" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="256" y="733" width="69" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ugaydb_di" bpmnElement="SequenceFlow_0ugaydb"> + <di:waypoint xsi:type="dc:Point" x="316" y="800" /> + <di:waypoint xsi:type="dc:Point" x="364" y="800" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="334" y="775" width="12" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_12k801c_di" bpmnElement="SequenceFlow_12k801c"> + <di:waypoint xsi:type="dc:Point" x="174" y="871" /> + <di:waypoint xsi:type="dc:Point" x="174" y="840" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="189" y="855.5" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ouddzv_di" bpmnElement="SequenceFlow_1ouddzv"> + <di:waypoint xsi:type="dc:Point" x="291" y="825" /> + <di:waypoint xsi:type="dc:Point" x="291" y="871" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="298" y="842" width="18" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_01iotuk_di" bpmnElement="IntermediateThrowEvent_01xb76a"> + <dc:Bounds x="156" y="871" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="142" y="907" width="63" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateThrowEvent_05f5orq_di" bpmnElement="IntermediateThrowEvent_0d6k86e"> + <dc:Bounds x="273" y="871" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="256" y="907" width="69" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1acjd9q_di" bpmnElement="Task_1j68pc1"> + <dc:Bounds x="124" y="760" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_19sq3od_di" bpmnElement="Task_0n1d5f2"> + <dc:Bounds x="1046" y="197" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1us5byg_di" bpmnElement="SequenceFlow_1us5byg"> + <di:waypoint xsi:type="dc:Point" x="850" y="90" /> + <di:waypoint xsi:type="dc:Point" x="982" y="90" /> + <di:waypoint xsi:type="dc:Point" x="982" y="156" /> + <di:waypoint xsi:type="dc:Point" x="103" y="156" /> + <di:waypoint xsi:type="dc:Point" x="103" y="237" /> + <di:waypoint xsi:type="dc:Point" x="131" y="237" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="543" y="141" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1jatgi1_di" bpmnElement="Task_0op98k0"> + <dc:Bounds x="750" y="50" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java index cb893ce950..2e7184b9ff 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -67,7 +69,8 @@ import org.onap.so.client.sniro.beans.ServiceInfo; import org.onap.so.client.sniro.beans.SniroManagerRequest; import org.onap.so.client.sniro.beans.SubscriberInfo; import org.onap.so.db.catalog.beans.OrchestrationStatus; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @@ -84,7 +87,7 @@ import org.springframework.web.util.UriUtils; @Component("SniroHoming") public class SniroHomingV2 { - private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroHomingV2.class); + private static final Logger logger = LoggerFactory.getLogger(SniroHomingV2.class); private JsonUtils jsonUtils = new JsonUtils(); @Autowired private Environment env; @@ -100,7 +103,6 @@ public class SniroHomingV2 { private static final String RESOURCE_MODULE_NAME = "resourceModuleName"; private static final String RESOURCE_MODEL_INFO = "resourceModelInfo"; private static final String IDENTIFIER_TYPE = "identifierType"; - private static final String INVENTORY_TYPE = "inventoryType"; private static final String SOLUTIONS = "solutions"; private static final String RESOURCE_MISSING_DATA = "Resource does not contain: "; private static final String SERVICE_MISSING_DATA = "Service Instance does not contain: "; @@ -114,7 +116,7 @@ public class SniroHomingV2 { * @param execution */ public void callSniro(BuildingBlockExecution execution){ - log.debug("Started Sniro Homing Call Sniro"); + logger.debug("Started Sniro Homing Call Sniro"); try{ GeneralBuildingBlock bb = execution.getGeneralBuildingBlock(); @@ -153,7 +155,7 @@ public class SniroHomingV2 { if(placementDemands.size() > 0 || licenseDemands.size() > 0){ client.postDemands(request); }else{ - log.debug(SERVICE_MISSING_DATA + "resources eligible for homing or licensing"); + logger.debug(SERVICE_MISSING_DATA + "resources eligible for homing or licensing"); throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + "resources eligible for homing or licensing"); } @@ -162,15 +164,15 @@ public class SniroHomingV2 { execution.setVariable("asyncMessageType", "SNIROResponse"); execution.setVariable("asyncTimeout", timeout); - log.trace("Completed Sniro Homing Call Sniro"); + logger.trace("Completed Sniro Homing Call Sniro"); }catch(BpmnError e){ - log.error(e); + logger.error("Exception occurred", e); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage()); }catch(BadResponseException e){ - log.error(e); + logger.error("Exception occurred", e); exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage()); }catch(Exception e){ - log.error(e); + logger.error("Exception occurred", e); exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while preparing sniro request: " + e.getMessage()); } } @@ -183,13 +185,13 @@ public class SniroHomingV2 { * @param asyncResponse */ public void processSolution(BuildingBlockExecution execution, String asyncResponse){ - log.trace("Started Sniro Homing Process Solution"); + logger.trace("Started Sniro Homing Process Solution"); try{ //TODO improve handling multiple solutions but is dependent on sniro enhancing api + work with sniro conductor to improve "inventoryType" representation validateSolution(asyncResponse); ServiceInstance serviceInstance = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0); - log.debug("Processing sniro manager asyncronous response"); + logger.debug("Processing sniro manager asyncronous response"); JSONObject response = new JSONObject(asyncResponse); if(response.has(SOLUTIONS)){ JSONObject allSolutions = response.getJSONObject(SOLUTIONS); @@ -212,15 +214,15 @@ public class SniroHomingV2 { execution.setVariable("generalBuildingBlock", execution.getGeneralBuildingBlock()); - log.trace("Completed Sniro Homing Process Solution"); + logger.trace("Completed Sniro Homing Process Solution"); }catch(BpmnError e){ - log.error(e); + logger.error("Exception occurred", e); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage()); }catch(BadResponseException e){ - log.error(e); + logger.error("Exception occurred", e); exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage()); }catch(Exception e){ - log.error(e); + logger.error("Exception occurred", e); exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage()); } } @@ -231,7 +233,7 @@ public class SniroHomingV2 { * @throws Exception */ private RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception{ - log.trace("Building request information"); + logger.trace("Building request information"); RequestInfo requestInfo = new RequestInfo(); if(requestId != null){ String host = env.getProperty("mso.workflow.message.endpoint"); @@ -256,7 +258,7 @@ public class SniroHomingV2 { * */ private ServiceInfo buildServiceInfo(ServiceInstance serviceInstance){ - log.trace("Building service information"); + logger.trace("Building service information"); ServiceInfo info = new ServiceInfo(); ModelInfoServiceInstance modelInfo = serviceInstance.getModelInfoServiceInstance(); if(isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())){ @@ -281,14 +283,14 @@ public class SniroHomingV2 { private PlacementInfo buildPlacementInfo(Customer customer, RequestParameters requestParams){ PlacementInfo placementInfo = new PlacementInfo(); if(customer != null){ - log.debug("Adding subscriber to placement information"); + logger.debug("Adding subscriber to placement information"); SubscriberInfo subscriber = new SubscriberInfo(); subscriber.setGlobalSubscriberId(customer.getGlobalCustomerId()); subscriber.setSubscriberName(customer.getSubscriberName()); subscriber.setSubscriberCommonSiteId(customer.getSubscriberCommonSiteId()); placementInfo.setSubscriberInfo(subscriber); if(requestParams != null){ - log.debug("Adding request parameters to placement information"); + logger.debug("Adding request parameters to placement information"); placementInfo.setRequestParameters(requestParams.toJsonString()); } }else{ @@ -303,12 +305,12 @@ public class SniroHomingV2 { * */ private List<Demand> buildPlacementDemands(ServiceInstance serviceInstance){ - log.trace("Building placement information demands"); + logger.trace("Building placement information demands"); List<Demand> placementDemands = new ArrayList<Demand>(); List<AllottedResource> allottedResourceList = serviceInstance.getAllottedResources(); if(!allottedResourceList.isEmpty()){ - log.debug("Adding allotted resources to placement demands list"); + logger.debug("Adding allotted resources to placement demands list"); for(AllottedResource ar : allottedResourceList){ if(isBlank(ar.getId())){ ar.setId(UUID.randomUUID().toString()); @@ -320,7 +322,7 @@ public class SniroHomingV2 { } List<VpnBondingLink> vpnBondingLinkList = serviceInstance.getVpnBondingLinks(); if(!vpnBondingLinkList.isEmpty()){ - log.debug("Adding vpn bonding links to placement demands list"); + logger.debug("Adding vpn bonding links to placement demands list"); for(VpnBondingLink vbl:vpnBondingLinkList){ List<ServiceProxy> serviceProxyList = vbl.getServiceProxies(); for(ServiceProxy sp : serviceProxyList){ @@ -341,11 +343,11 @@ public class SniroHomingV2 { * */ private List<Demand> buildLicenseDemands(ServiceInstance serviceInstance){ - log.trace("Building license information"); + logger.trace("Building license information"); List<Demand> licenseDemands = new ArrayList<Demand>(); List<GenericVnf> vnfList = serviceInstance.getVnfs(); if(!vnfList.isEmpty()){ - log.debug("Adding vnfs to license demands list"); + logger.debug("Adding vnfs to license demands list"); for(GenericVnf vnf : vnfList){ Demand demand = buildDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf()); licenseDemands.add(demand); @@ -359,7 +361,7 @@ public class SniroHomingV2 { * */ private Demand buildDemand(String id, ModelInfoMetadata metadata){ - log.debug("Building demand for service or resource: " + id); + logger.debug("Building demand for service or resource: " + id); Demand demand = new Demand(); if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){ demand.setServiceResourceId(id); @@ -431,7 +433,7 @@ public class SniroHomingV2 { private void processLicenseSolution(ServiceInstance serviceInstance, JSONArray licenseSolutions){ List<GenericVnf> vnfs = serviceInstance.getVnfs(); - log.debug("Processing the license solution"); + logger.debug("Processing the license solution"); for(int i = 0; i < licenseSolutions.length(); i++){ JSONObject licenseSolution = licenseSolutions.getJSONObject(i); for(GenericVnf vnf:vnfs){ @@ -460,7 +462,7 @@ public class SniroHomingV2 { List<AllottedResource> allottes = serviceInstance.getAllottedResources(); List<GenericVnf> vnfs = serviceInstance.getVnfs(); - log.debug("Processing placement solution " + i+1); + logger.debug("Processing placement solution " + i+1); for(int p = 0; p < placements.length(); p++){ JSONObject placement = placements.getJSONObject(p); SolutionInfo solutionInfo = new SolutionInfo(); @@ -508,7 +510,7 @@ public class SniroHomingV2 { * */ private ServiceInstance setSolution(SolutionInfo solutionInfo, JSONObject placement){ - log.debug("Mapping placement solution"); + logger.debug("Mapping placement solution"); String invalidMessage = "Sniro Managers Response contains invalid: "; JSONObject solution = placement.getJSONObject("solution"); @@ -519,51 +521,40 @@ public class SniroHomingV2 { JSONArray assignments = placement.getJSONArray("assignmentInfo"); Map<String, String> assignmentsMap = jsonUtils.entryArrayToMap(assignments.toString(), "key", "value"); solutionInfo.setRehome(Boolean.parseBoolean(assignmentsMap.get("isRehome"))); - String type = placement.getString(INVENTORY_TYPE); ServiceInstance si = new ServiceInstance(); CloudRegion cloud = setCloud(assignmentsMap); - if(type.equals("service")){ - if(identifierType.equals(CandidateType.SERVICE_INSTANCE_ID.toString())){ - solutionInfo.setHomed(true); - si.setServiceInstanceId(identifierValue); - si.setOrchestrationStatus(OrchestrationStatus.CREATED); - cloud.setLcpCloudRegionId(assignmentsMap.get("cloudRegionId")); - if(assignmentsMap.containsKey("vnfHostName")){ - log.debug("Resources has been homed to a vnf"); - GenericVnf vnf = setVnf(assignmentsMap); - vnf.setCloudRegion(cloud); - si.getVnfs().add(vnf); - - }else if(assignmentsMap.containsKey("primaryPnfName")){ - log.debug("Resources has been homed to a pnf"); - Pnf priPnf = setPnf(assignmentsMap, "primary"); - priPnf.setCloudRegion(cloud); - si.getPnfs().add(priPnf); - if(assignmentsMap.containsKey("secondaryPnfName")){ - Pnf secPnf = setPnf(assignmentsMap, "secondary"); - secPnf.setCloudRegion(cloud); - si.getPnfs().add(secPnf); - } + if(identifierType.equals(CandidateType.SERVICE_INSTANCE_ID.toString())){ + solutionInfo.setHomed(true); + si.setServiceInstanceId(identifierValue); + si.setOrchestrationStatus(OrchestrationStatus.CREATED); + cloud.setLcpCloudRegionId(assignmentsMap.get("cloudRegionId")); + if(assignmentsMap.containsKey("vnfHostName")){ + logger.debug("Resources has been homed to a vnf"); + GenericVnf vnf = setVnf(assignmentsMap); + vnf.setCloudRegion(cloud); + si.getVnfs().add(vnf); + + }else if(assignmentsMap.containsKey("primaryPnfName")){ + logger.debug("Resources has been homed to a pnf"); + Pnf priPnf = setPnf(assignmentsMap, "primary"); + priPnf.setCloudRegion(cloud); + si.getPnfs().add(priPnf); + if(assignmentsMap.containsKey("secondaryPnfName")){ + Pnf secPnf = setPnf(assignmentsMap, "secondary"); + secPnf.setCloudRegion(cloud); + si.getPnfs().add(secPnf); } - }else{ - log.debug(invalidMessage + IDENTIFIER_TYPE); - throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE); - } - }else if(type.equals("cloud")){ - if(identifierType.equals(CandidateType.CLOUD_REGION_ID.toString())){ - log.debug("Resources has been homed to a cloud region"); - cloud.setLcpCloudRegionId(identifierValue); - solutionInfo.setHomed(false); - solutionInfo.setTargetedCloudRegion(cloud); - si.setOrchestrationStatus(OrchestrationStatus.PRECREATED); - }else{ - log.debug(invalidMessage + IDENTIFIER_TYPE); - throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE); } + }else if(identifierType.equals(CandidateType.CLOUD_REGION_ID.toString())){ + logger.debug("Resources has been homed to a cloud region"); + cloud.setLcpCloudRegionId(identifierValue); + solutionInfo.setHomed(false); + solutionInfo.setTargetedCloudRegion(cloud); + si.setOrchestrationStatus(OrchestrationStatus.PRECREATED); }else{ - log.debug(invalidMessage + INVENTORY_TYPE); - throw new BpmnError(UNPROCESSABLE, invalidMessage + INVENTORY_TYPE); + logger.debug(invalidMessage + IDENTIFIER_TYPE); + throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE); } si.setSolutionInfo(solutionInfo); return si; 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 f47781082d..8711f965fd 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 @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -70,9 +72,7 @@ import org.springframework.stereotype.Component; @Component public class AAICreateTasks { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAICreateTasks.class); - private static final Logger logger = LoggerFactory.getLogger(AAICreateTasks.class.getName()); - + private static final Logger logger = LoggerFactory.getLogger(AAICreateTasks.class); private static final String networkTypeProvider = "PROVIDER"; private static String NETWORK_COLLECTION_NAME = "networkCollectionName"; private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList"; @@ -117,9 +117,9 @@ public class AAICreateTasks { if (null == customer) { String errorMessage = "Exception in creating ServiceSubscription. Customer not present for ServiceInstanceID: " + serviceInstance.getServiceInstanceId(); - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, errorMessage, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, errorMessage); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessage); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), errorMessage); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessage); } aaiSIResources.createServiceSubscription(customer); } catch (BpmnError ex) { @@ -136,7 +136,7 @@ public class AAICreateTasks { Project project = serviceInstance.getProject(); if(project != null) { if (project.getProjectName() == null || "".equals(project.getProjectName())) { - msoLogger.info("ProjectName is null in input. Skipping create project..."); + logger.info("ProjectName is null in input. Skipping create project..."); } else { aaiSIResources.createProjectandConnectServiceInstance(project, serviceInstance); } @@ -162,14 +162,14 @@ public class AAICreateTasks { } else { if (owningEntityName == null || "".equals(owningEntityName)) { String msg = "Exception in AAICreateOwningEntity. Can't create an owningEntity with no owningEntityName."; - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + MsoLogger.getServiceName(), 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)"; - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); }else{ aaiSIResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance); @@ -199,7 +199,7 @@ public class AAICreateTasks { Platform platform = vnf.getPlatform(); if(platform != null) { if (platform.getPlatformName() == null || "".equals(platform.getPlatformName())) { - msoLogger.debug("PlatformName is null in input. Skipping create platform..."); + logger.debug("PlatformName is null in input. Skipping create platform..."); } else { aaiVnfResources.createPlatformandConnectVnf(platform,vnf); } @@ -216,7 +216,7 @@ public class AAICreateTasks { LineOfBusiness lineOfBusiness = vnf.getLineOfBusiness(); if(lineOfBusiness != null) { if (lineOfBusiness.getLineOfBusinessName() == null || "".equals(lineOfBusiness.getLineOfBusinessName())) { - msoLogger.info("lineOfBusiness is null in input. Skipping create lineOfBusiness..."); + logger.info("lineOfBusiness is null in input. Skipping create lineOfBusiness..."); } else { aaiVnfResources.createLineOfBusinessandConnectVnf(lineOfBusiness,vnf); } @@ -269,7 +269,7 @@ public class AAICreateTasks { try{ volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); } catch (BBObjectNotFoundException e){ - msoLogger.info("VolumeGroup not found. Skipping Connect between VfModule and VolumeGroup"); + logger.info("VolumeGroup not found. Skipping Connect between VfModule and VolumeGroup"); } if (volumeGroup != null) { aaiVfModuleResources.connectVfModuleToVolumeGroup(vnf, vfModule, volumeGroup, execution.getGeneralBuildingBlock().getCloudRegion()); @@ -463,9 +463,9 @@ public class AAICreateTasks { uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn); Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = aaiNetworkResources.getNetworkPolicy(uri); if(!oNetPolicy.isPresent()) { - msoLogger.debug("This network policy FQDN is not in AAI yet: " + fqdn); + logger.debug("This network policy FQDN is not in AAI yet: {}", fqdn); String networkPolicyId = UUID.randomUUID().toString(); - msoLogger.debug("Adding network-policy with network-policy-id " + networkPolicyId); + logger.debug("Adding network-policy with network-policy-id {}", networkPolicyId); NetworkPolicy networkPolicy = new NetworkPolicy(); networkPolicy.setNetworkPolicyId(networkPolicyId); networkPolicy.setNetworkPolicyFqdn(fqdn); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java index 0d9aeed1ae..4908cda26a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -46,13 +48,14 @@ import org.onap.so.client.orchestration.AAIServiceInstanceResources; import org.onap.so.client.orchestration.AAIVfModuleResources; import org.onap.so.client.orchestration.AAIVnfResources; import org.onap.so.client.orchestration.AAIVolumeGroupResources; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class AAIDeleteTasks { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIDeleteTasks.class); + private static final Logger logger = LoggerFactory.getLogger(AAIDeleteTasks.class); private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList"; private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn"; @@ -177,7 +180,7 @@ public class AAIDeleteTasks { if (networkPolicyList != null && !networkPolicyList.isEmpty()) { NetworkPolicy networkPolicy = networkPolicyList.get(0); String networkPolicyId = networkPolicy.getNetworkPolicyId(); - msoLogger.debug("Deleting network-policy with network-policy-id " + networkPolicyId); + logger.debug("Deleting network-policy with network-policy-id {}", networkPolicyId); aaiNetworkResources.deleteNetworkPolicy(networkPolicyId); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java index 53d0e0a45c..94529f915b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -25,15 +27,15 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.ExceptionBuilder; -import org.onap.so.client.orchestration.AAIVfModuleResources; import org.onap.so.client.orchestration.AAIVnfResources; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class AAIFlagTasks { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIFlagTasks.class); + private static final Logger logger = LoggerFactory.getLogger(AAIFlagTasks.class); @Autowired private AAIVnfResources aaiVnfResources; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java index 46ff8495f9..e89dffc6d9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -42,14 +44,15 @@ import org.onap.so.client.aai.entities.Relationships; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAINetworkResources; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class AAIQueryTasks { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIQueryTasks.class); + private static final Logger logger = LoggerFactory.getLogger(AAIQueryTasks.class); private static final String ERROR_MSG = "No relationships were returned from AAIResultWrapper.getRelationships()"; @Autowired private ExtractPojosForBB extractPojosForBB; @@ -116,7 +119,7 @@ public class AAIQueryTasks { .getRelatedAAIUris(AAIObjectType.VPN_BINDING); List<org.onap.so.openstack.beans.RouteTarget> routeTargets = new ArrayList<>(); for (AAIResourceUri netBindingUri : netBindingsUriList) { - msoLogger.info("Get Route Targests"); + logger.info("Get Route Targests"); Optional<VpnBinding> oVpnBinding = aaiNetworkResources.getVpnBinding(netBindingUri); if (oVpnBinding.isPresent()) { VpnBinding vpnBinding = oVpnBinding.get(); @@ -247,4 +250,4 @@ public class AAIQueryTasks { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index 5176bee0d6..34598ef00a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -24,6 +26,7 @@ import java.util.List; import java.util.Map; import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.adapters.nwrest.UpdateNetworkResponse; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; @@ -47,13 +50,14 @@ import org.onap.so.client.orchestration.AAIVfModuleResources; import org.onap.so.client.orchestration.AAIVnfResources; import org.onap.so.client.orchestration.AAIVolumeGroupResources; import org.onap.so.db.catalog.beans.OrchestrationStatus; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class AAIUpdateTasks { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIUpdateTasks.class); + private static final Logger logger = LoggerFactory.getLogger(AAIUpdateTasks.class); private static final String ALACARTE = "aLaCarte"; private static final String MULTI_STAGE_DESIGN_OFF = "false"; private static final String MULTI_STAGE_DESIGN_ON = "true"; @@ -335,7 +339,7 @@ public class AAIUpdateTasks { } /** - * BPMN access method to update L3Network after it was created in AIC + * BPMN access method to update L3Network after it was created in cloud * @param execution * @throws Exception */ @@ -376,6 +380,34 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update L3Network after it was updated in cloud + * @param execution + * @throws Exception + */ + public void updateNetworkUpdated(BuildingBlockExecution execution) throws Exception { + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network copiedl3network = l3network.shallowCopyId(); + UpdateNetworkResponse response = execution.getVariable("updateNetworkResponse"); + try { + copiedl3network.setNeutronNetworkId(response.getNeutronNetworkId()); + aaiNetworkResources.updateNetwork(copiedl3network); + + Map<String, String> subnetMap = response.getSubnetMap(); + List<Subnet> subnets = l3network.getSubnets(); + if (subnets != null && subnetMap != null){ + for (Subnet subnet: subnets){ + Subnet copiedSubnet = subnet.shallowCopyId(); + copiedSubnet.setNeutronSubnetId(subnetMap.get(copiedSubnet.getSubnetId())); + copiedSubnet.setOrchestrationStatus(OrchestrationStatus.CREATED); + aaiNetworkResources.updateSubnet(copiedl3network, copiedSubnet); + } + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + public void updateObjectNetwork(BuildingBlockExecution execution) { try { L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); @@ -498,4 +530,4 @@ public class AAIUpdateTasks { } } -}
\ No newline at end of file +} 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 acef0cb354..1402cebfbc 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 @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -38,6 +40,8 @@ import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.RequestDetails; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -46,7 +50,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Component("ExecuteActivity") public class ExecuteActivity implements JavaDelegate { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExecuteActivity.class); + private static final Logger logger = LoggerFactory.getLogger(ExecuteActivity.class); private static final String G_BPMN_REQUEST = "bpmnRequest"; private static final String VNF_TYPE = "vnfType"; private static final String G_ACTION = "requestAction"; @@ -70,12 +74,12 @@ public class ExecuteActivity implements JavaDelegate { try { final String implementationString = execution.getBpmnModelElementInstance().getAttributeValue(SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE); - msoLogger.debug("activity implementation String: " + implementationString); + logger.debug("activity implementation String: {}", implementationString); if (!implementationString.startsWith(ACTIVITY_PREFIX)) { buildAndThrowException(execution, "Implementation attribute has a wrong format"); } String activityName = implementationString.replaceFirst(ACTIVITY_PREFIX, ""); - msoLogger.info("activityName is: " + activityName); + logger.info("activityName is: {}", activityName); BuildingBlock buildingBlock = buildBuildingBlock(activityName); ExecuteBuildingBlock executeBuildingBlock = buildExecuteBuildingBlock(execution, requestId, buildingBlock); @@ -91,7 +95,7 @@ public class ExecuteActivity implements JavaDelegate { WorkflowException workflowException = (WorkflowException) variableMap.get("WorklfowException"); if (workflowException != null) { - msoLogger.error("Workflow exception is: " + workflowException.getErrorMessage()); + logger.error("Workflow exception is: {}", workflowException.getErrorMessage()); } execution.setVariable("WorkflowException", workflowException); } @@ -131,14 +135,14 @@ public class ExecuteActivity implements JavaDelegate { } protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, ex); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg, ex); execution.setVariable("ExecuteActivityErrorMessage", msg); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); } protected void buildAndThrowException(DelegateExecution execution, String msg) { - msoLogger.error(msg); + logger.error(msg); execution.setVariable("ExecuteActuvityErrorMessage", msg); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java index ef2cf86f01..61687081d9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -20,8 +22,7 @@ package org.onap.so.bpmn.infrastructure.adapter.network.tasks; -import java.util.Optional; - +import org.onap.so.adapters.nwrest.UpdateNetworkRequest; import org.onap.so.adapters.nwrest.UpdateNetworkResponse; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; @@ -29,20 +30,22 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.NetworkAdapterResources; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class NetworkAdapterUpdateTasks { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkAdapterUpdateTasks.class); + private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterUpdateTasks.class); @Autowired private ExtractPojosForBB extractPojosForBB; @Autowired - private NetworkAdapterResources networkAdapterResources; + private NetworkAdapterObjectMapper networkAdapterObjectMapper; @Autowired private ExceptionBuilder exceptionUtil; @@ -51,14 +54,23 @@ public class NetworkAdapterUpdateTasks { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); - Optional<UpdateNetworkResponse> oUpdateNetworkResponse = networkAdapterResources.updateNetwork(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, gBBInput.getUserInput(), gBBInput.getCustomer()); - if(oUpdateNetworkResponse.isPresent()) { - UpdateNetworkResponse updateNetworkResponse = oUpdateNetworkResponse.get(); - execution.setVariable("NetworkAdapterUpdateNetworkResponse", updateNetworkResponse); - } + UpdateNetworkRequest updateNetworkRequest = networkAdapterObjectMapper.createNetworkUpdateRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, gBBInput.getUserInput(), gBBInput.getCustomer()); + execution.setVariable("networkAdapterRequest", updateNetworkRequest); + } catch(Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + + public void processResponseFromOpenstack(BuildingBlockExecution execution) { + try { + UpdateNetworkResponse updateNetworkResponse = execution.getVariable("updateNetworkResponse"); + if(updateNetworkResponse == null) { + throw new Exception("No response was sent back from NetworkAdapterRestV1 subflow."); + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java index 3456fa1c56..932558d8ad 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -37,13 +39,14 @@ import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.VnfAdapterVfModuleResources; import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class VnfAdapterCreateTasks { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterCreateTasks.class); + private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateTasks.class); private static final String VNFREST_REQUEST = "VNFREST_Request"; @Autowired diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java index 48b4ebb982..759ec61878 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -33,13 +35,14 @@ import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.VnfAdapterVfModuleResources; import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class VnfAdapterDeleteTasks { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterDeleteTasks.class); + private static final Logger logger = LoggerFactory.getLogger(VnfAdapterDeleteTasks.class); private static final String VNFREST_REQUEST = "VNFREST_Request"; @Autowired diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java index 0851dc9d95..47357d8ef3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -37,6 +39,8 @@ import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.exceptions.MarshallerException; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.xml.sax.InputSource; @@ -55,7 +59,7 @@ import java.util.Map; @Component public class VnfAdapterImpl { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterImpl.class); + private static final Logger logger = LoggerFactory.getLogger(VnfAdapterImpl.class); private static final String CONTRAIL_SERVICE_INSTANCE_FQDN = "contrailServiceInstanceFqdn"; private static final String OAM_MANAGEMENT_V4_ADDRESS = "oamManagementV4Address"; private static final String OAM_MANAGEMENT_V6_ADDRESS = "oamManagementV6Address"; @@ -163,8 +167,9 @@ public class VnfAdapterImpl { SAXSource source = new SAXSource(xmlReader, inputSource); return jaxbUnmarshaller.unmarshal(source); } catch (Exception e) { - msoLogger.error(MessageEnum.GENERAL_EXCEPTION, "", "", "", MsoLogger.ErrorCode.SchemaError, e.getMessage(), e); - throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(), MsoLogger.ErrorCode.SchemaError.getValue(), e); + logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), MsoLogger.ErrorCode.SchemaError.getValue(), + e.getMessage(), e); + throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(), MsoLogger.ErrorCode.SchemaError.getValue(), e); } } @@ -181,24 +186,24 @@ public class VnfAdapterImpl { String key = keys.next(); if (key.equals("contrail-service-instance-fqdn")) { String contrailServiceInstanceFqdn = vfModuleOutputs.get(key); - msoLogger.debug("Obtained contrailServiceInstanceFqdn: " + contrailServiceInstanceFqdn); + logger.debug("Obtained contrailServiceInstanceFqdn: {}", contrailServiceInstanceFqdn); vfModule.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdn); execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, contrailServiceInstanceFqdn); } else if (key.endsWith("contrail_network_policy_fqdn")) { String contrailNetworkPolicyFqdn = vfModuleOutputs.get(key); - msoLogger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn); + logger.debug("Obtained contrailNetworkPolicyFqdn: {}", contrailNetworkPolicyFqdn); contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn); } else if (key.equals("oam_management_v4_address")) { String oamManagementV4Address = vfModuleOutputs.get(key); - msoLogger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address); + logger.debug("Obtained oamManagementV4Address: {}", oamManagementV4Address); genericVnf.setIpv4OamAddress(oamManagementV4Address); execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, oamManagementV4Address); } else if (key.equals("oam_management_v6_address")) { String oamManagementV6Address = vfModuleOutputs.get(key); - msoLogger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address); + logger.debug("Obtained oamManagementV6Address: {}", oamManagementV6Address); genericVnf.setManagementV6Address(oamManagementV6Address); execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, oamManagementV6Address); } 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 e0cbb82484..e0516ce9af 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 @@ -39,12 +39,14 @@ import org.onap.so.db.catalog.beans.ControllerSelectionReference; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class AppcRunTasks { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AppcRunTasks.class); + private static final Logger logger = LoggerFactory.getLogger(AppcRunTasks.class); @Autowired private ExceptionBuilder exceptionUtil; @Autowired @@ -72,7 +74,7 @@ public class AppcRunTasks { } public void runAppcCommand(BuildingBlockExecution execution, Action action) { - msoLogger.trace("Start runAppcCommand "); + logger.trace("Start runAppcCommand "); String appcCode = "1002"; String appcMessage = ""; try { @@ -123,22 +125,24 @@ public class AppcRunTasks { if (pay != null) { payload = Optional.of(pay); } - } - msoLogger.debug("Running APP-C action: " + action.toString()); - msoLogger.debug("VNFID: " + vnfId); + } + logger.debug("Running APP-C action: {}", action.toString()); + logger.debug("VNFID: {}", vnfId); appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); appcCode = appCClient.getErrorCode(); appcMessage = appCClient.getErrorMessage(); mapRollbackVariables(execution, action, appcCode); } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "Caught exception in runAppcCommand", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "APPC Error", e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), + "Caught exception in runAppcCommand", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e); appcMessage = e.getMessage(); } - msoLogger.error("Error Message: " + appcMessage); - msoLogger.error("ERROR CODE: " + appcCode); - msoLogger.trace("End of runAppCommand "); + logger.error("Error Message: {}", appcMessage); + logger.error("ERROR CODE: {}", appcCode); + logger.trace("End of runAppCommand "); if (appcCode != null && !appcCode.equals("0")) { exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java index 7c9e000a44..753a29f208 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -24,15 +26,15 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.db.catalog.beans.OrchestrationStatus; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class AssignNetwork { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - AssignNetwork.class); + private static final Logger logger = LoggerFactory.getLogger(AssignNetwork.class); @Autowired private ExtractPojosForBB extractPojosForBB; @@ -50,7 +52,7 @@ public class AssignNetwork { if (!OrchestrationStatus.PRECREATED.equals(l3network.getOrchestrationStatus())){ networkFound = true; - msoLogger.debug("network found in NOT PRECREATED status"); + logger.debug("network found in NOT PRECREATED status"); } } catch (Exception ex) { // return false if no network present diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java index 6217f87420..df3f5465e6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -27,15 +29,15 @@ import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAINetworkResources; import org.onap.so.client.orchestration.SDNCNetworkResources; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class AssignNetworkBBUtils { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - AssignNetworkBBUtils.class); + private static final Logger logger = LoggerFactory.getLogger(AssignNetworkBBUtils.class); @Autowired private ExceptionBuilder exceptionUtil; @Autowired @@ -85,7 +87,7 @@ public class AssignNetworkBBUtils { */ public void processSilentSuccess(BuildingBlockExecution execution) { String msg = "Silent success processing network assign"; - msoLogger.info(msg); + logger.info(msg); } /** diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtils.java new file mode 100644 index 0000000000..bba883e727 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtils.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.flowspecific.tasks; + +import java.util.Optional; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class CloudSiteCatalogUtils { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CloudSiteCatalogUtils.class); + @Autowired + private ExceptionBuilder exceptionUtil; + + @Autowired + private CatalogDbClient catalogDbClient; + + + public void getIdentityUrlFromCloudSite(DelegateExecution execution) { + String cloudRegionId = (String) execution.getVariable("lcpCloudRegionId"); + + if (cloudRegionId != null) { + Optional<CloudSite> cloudSite = getCloudSite(cloudRegionId); + if (!cloudSite.isPresent()) { + msoLogger.debug("Cloud Region with cloudRegionId " + cloudRegionId + " not found in Catalog DB"); + exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Cloud Region with cloudRegionId " + cloudRegionId + " not found in Catalog DB"); + } + + if (cloudSite.get().getIdentityService() == null) { + msoLogger.debug("No identityService found for Cloud Region with cloudRegionId " + cloudRegionId + " in Catalog DB"); + exceptionUtil.buildAndThrowWorkflowException(execution, 404, "No identityService found for Cloud Region with cloudRegionId " + cloudRegionId + " in Catalog DB"); + } + String identityUrl = cloudSite.get().getIdentityService().getIdentityUrl(); + + msoLogger.debug("identityUrl from Catalog DB is: " + identityUrl); + execution.setVariable("identityUrl", identityUrl); + } + } + + protected Optional<CloudSite> getCloudSite(String id) { + if (id == null) { + return Optional.empty(); + } + CloudSite cloudSite = catalogDbClient.getCloudSite(id); + + if (cloudSite != null) { + return Optional.of(cloudSite); + } else { + return(Optional.of(catalogDbClient.getCloudSiteByClliAndAicVersion(id,"2.5"))); + } + } +}
\ No newline at end of file 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 615b7279dc..ba04b16b14 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 @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -39,6 +41,8 @@ import org.onap.so.db.catalog.beans.ControllerSelectionReference; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -48,7 +52,7 @@ import com.jayway.jsonpath.JsonPath; @Component public class ConfigurationScaleOut { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ConfigurationScaleOut.class); + private static final Logger logger = LoggerFactory.getLogger(ConfigurationScaleOut.class); @Autowired private ExceptionBuilder exceptionUtil; @Autowired @@ -100,7 +104,7 @@ public class ConfigurationScaleOut { configScaleOutParam = JsonPath.parse(sdncVfModuleQueryResponse).read(paramValue); }catch(ClassCastException e){ configScaleOutParam = null; - msoLogger.warnSimple("Incorrect JSON path. Path points to object rather than value causing: ", e); + logger.warn("Incorrect JSON path. Path points to object rather than value causing: ", e); } paramsMap.put(key, configScaleOutParam); } @@ -125,7 +129,7 @@ public class ConfigurationScaleOut { } public void callAppcClient(BuildingBlockExecution execution) { - msoLogger.trace("Start runAppcCommand "); + logger.trace("Start runAppcCommand "); String appcCode = "1002"; String appcMessage = ""; try{ @@ -141,20 +145,22 @@ public class ConfigurationScaleOut { HashMap<String, String> payloadInfo = new HashMap<>(); payloadInfo.put(VNF_NAME, execution.getVariable(VNF_NAME)); payloadInfo.put(VFMODULE_ID,execution.getVariable(VFMODULE_ID)); - msoLogger.debug("Running APP-C action: " + commandAction.toString()); - msoLogger.debug("VNFID: " + vnfId); + logger.debug("Running APP-C action: {}", commandAction.toString()); + logger.debug("VNFID: {}", vnfId); //PayloadInfo contains extra information that adds on to payload before making request to appc appCClient.runAppCCommand(commandAction, msoRequestId, vnfId, payloadString, payloadInfo, controllerType); appcCode = appCClient.getErrorCode(); appcMessage = appCClient.getErrorMessage(); } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "Caught exception in runAppcCommand in ConfigurationScaleOut", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "APPC Error", e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), + "Caught exception in runAppcCommand in ConfigurationScaleOut", "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e); appcMessage = e.getMessage(); } - msoLogger.error("Error Message: " + appcMessage); - msoLogger.error("ERROR CODE: " + appcCode); - msoLogger.trace("End of runAppCommand "); + logger.error("Error Message: " + appcMessage); + logger.error("ERROR CODE: " + appcCode); + logger.trace("End of runAppCommand "); if (appcCode != null && !appcCode.equals("0")) { exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java index 08d5afcc44..962d4fa8c4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -30,14 +32,15 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; import org.onap.so.client.exception.ExceptionBuilder; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class CreateNetwork { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateNetwork.class); + private static final Logger logger = LoggerFactory.getLogger(CreateNetwork.class); @Autowired private ExceptionBuilder exceptionUtil; @Autowired diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java index c8c4d439bd..060775e1d7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -27,13 +29,14 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAINetworkResources; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class CreateNetworkCollection { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateNetworkCollection.class); + private static final Logger logger = LoggerFactory.getLogger(CreateNetworkCollection.class); @Autowired private ExceptionBuilder exceptionUtil; @Autowired 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 4f2e2c98d2..bb33b521d6 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 @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -21,9 +23,6 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; import java.util.HashMap; import java.util.Optional; -import java.net.HttpURLConnection; -import java.net.SocketTimeoutException; -import org.apache.http.conn.ConnectTimeoutException; import org.camunda.bpm.engine.delegate.BpmnError; import org.onap.appc.client.lcm.model.Action; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -37,13 +36,15 @@ import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class GenericVnfHealthCheck { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenericVnfHealthCheck.class); + private static final Logger logger = LoggerFactory.getLogger(GenericVnfHealthCheck.class); @Autowired private ExceptionBuilder exceptionUtil; @Autowired @@ -82,7 +83,7 @@ public class GenericVnfHealthCheck { } public void callAppcClient(BuildingBlockExecution execution) { - msoLogger.trace("Start runAppcCommand "); + logger.trace("Start runAppcCommand "); String appcCode = "1002"; String appcMessage = ""; try { @@ -102,32 +103,38 @@ public class GenericVnfHealthCheck { payloadInfo.put("oamIpAddress",execution.getVariable("oamIpAddress")); payloadInfo.put("vnfHostIpAddress",execution.getVariable("vnfHostIpAddress")); - msoLogger.debug("Running APP-C action: " + action.toString()); - msoLogger.debug("VNFID: " + vnfId); + logger.debug("Running APP-C action: {}", action.toString()); + logger.debug("VNFID: {}", vnfId); //PayloadInfo contains extra information that adds on to payload before making request to appc appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); appcCode = appCClient.getErrorCode(); appcMessage = appCClient.getErrorMessage(); } catch (BpmnError ex) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Caught exception in GenericVnfHealthCheck", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); + logger.error("", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in GenericVnfHealthCheck", "BPMN", + MsoLogger + .getServiceName(), 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. "; - msoLogger.error(MessageEnum.RA_CONNECTION_EXCEPTION, "Caught timedOut exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "APPC Error", e); + logger.error("{} {} {} {} {} {}", MessageEnum.RA_CONNECTION_EXCEPTION.toString(), + "Caught timedOut exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e); throw e; } else { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "APPC Error", e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), + "Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e); appcMessage = e.getMessage(); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } } - msoLogger.error("Error Message: " + appcMessage); - msoLogger.error("ERROR CODE: " + appcCode); - msoLogger.trace("End of runAppCommand "); + logger.error("Error Message: " + appcMessage); + logger.error("ERROR CODE: " + appcCode); + logger.trace("End of runAppCommand "); if (appcCode != null && !appcCode.equals("0")) { exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java index c45a47bc12..c7fd41c77a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -29,14 +31,15 @@ import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAINetworkResources; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class UnassignNetworkBB { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UnassignNetworkBB.class); + private static final Logger logger = LoggerFactory.getLogger(UnassignNetworkBB.class); private static String MESSAGE_CANNOT_PERFORM_UNASSIGN = "Cannot perform Unassign Network. Network is still related to "; private static String MESSAGE_ERROR_ROLLBACK = " Rollback is not possible. Please restore data manually."; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java index 43ee71e676..3793adc5d0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -41,13 +43,14 @@ import org.onap.so.client.orchestration.SDNCVfModuleResources; import org.onap.so.client.orchestration.SDNCVnfResources; import org.onap.so.client.sdnc.beans.SDNCRequest; import org.onap.so.client.sdnc.endpoint.SDNCTopology; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class SDNCActivateTasks { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCActivateTasks.class); + private static final Logger logger = LoggerFactory.getLogger(SDNCActivateTasks.class); @Autowired private SDNCVnfResources sdncVnfResources; @Autowired diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java index 2695a170b4..715322bef3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -44,13 +46,14 @@ import org.onap.so.client.orchestration.SDNCVfModuleResources; import org.onap.so.client.orchestration.SDNCVnfResources; import org.onap.so.client.sdnc.beans.SDNCRequest; import org.onap.so.client.sdnc.endpoint.SDNCTopology; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class SDNCAssignTasks { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAssignTasks.class); + private static final Logger logger = LoggerFactory.getLogger(SDNCAssignTasks.class); @Autowired private SDNCServiceInstanceResources sdncSIResources; @Autowired @@ -109,7 +112,7 @@ public class SDNCAssignTasks { try{ volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); } catch (BBObjectNotFoundException e){ - msoLogger.info("No volume group was found."); + logger.info("No volume group was found."); } Customer customer = gBBInput.getCustomer(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java index eb078e04b4..d7313ad9a4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -42,14 +44,14 @@ import org.onap.so.client.orchestration.SDNCVfModuleResources; import org.onap.so.client.orchestration.SDNCVnfResources; import org.onap.so.client.sdnc.beans.SDNCRequest; import org.onap.so.client.sdnc.endpoint.SDNCTopology; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class SDNCDeactivateTasks { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - SDNCDeactivateTasks.class); + private static final Logger logger = LoggerFactory.getLogger(SDNCDeactivateTasks.class); @Autowired private SDNCNetworkResources sdncNetworkResources; @Autowired diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java index 81ebfb1f41..b636fe1292 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -27,17 +29,17 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.BBObjectNotFoundException; -import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.SDNCVnfResources; import org.onap.so.client.orchestration.SDNCVfModuleResources; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class SDNCQueryTasks { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCQueryTasks.class); + private static final Logger logger = LoggerFactory.getLogger(SDNCQueryTasks.class); @Autowired private SDNCVnfResources sdncVnfResources; @Autowired diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java index 960fb9988a..292f29c349 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -42,13 +44,14 @@ import org.onap.so.client.orchestration.SDNCVfModuleResources; import org.onap.so.client.orchestration.SDNCVnfResources; import org.onap.so.client.sdnc.beans.SDNCRequest; import org.onap.so.client.sdnc.endpoint.SDNCTopology; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class SDNCUnassignTasks { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCUnassignTasks.class); + private static final Logger logger = LoggerFactory.getLogger(SDNCUnassignTasks.class); @Autowired private SDNCServiceInstanceResources sdncSIResources; @Autowired 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 7a433c06a6..c457034eca 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 @@ -5,6 +5,7 @@ import java.util.regex.Pattern; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.validation.PreBuildingBlockValidator; +import org.onap.so.bpmn.common.validation.Skip; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.client.exception.ExceptionBuilder; import org.slf4j.Logger; @@ -13,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component +@Skip public class CloudRegionOrchestrationValidator implements PreBuildingBlockValidator { private static Logger logger = LoggerFactory.getLogger(CloudRegionOrchestrationValidator.class); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java index 2065dfb71e..75f293655f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -33,13 +35,14 @@ import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective; import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective; import org.onap.so.db.catalog.beans.ResourceType; import org.onap.so.db.catalog.client.CatalogDbClient; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class OrchestrationStatusValidator { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, OrchestrationStatusValidator.class); + private static final Logger logger = LoggerFactory.getLogger(OrchestrationStatusValidator.class); private static final String BUILDING_BLOCK_DETAIL_NOT_FOUND = "Building Block (%s) not set up in Orchestration_Status_Validation table in CatalogDB."; private static final String UNKNOWN_RESOURCE_TYPE = "Building Block (%s) not set up correctly in Orchestration_Status_Validation table in CatalogDB. ResourceType=(%s), TargetAction=(%s)"; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java index 9075fcc3cf..36162af740 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -30,13 +32,14 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.SDNOHealthCheckResources; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class SDNOHealthCheckTasks { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNOHealthCheckTasks.class); + private static final Logger logger = LoggerFactory.getLogger(SDNOHealthCheckTasks.class); @Autowired private ExceptionBuilder exceptionUtil; @Autowired @@ -61,12 +64,12 @@ public class SDNOHealthCheckTasks { response = sdnoHealthCheckResources.healthCheck(vnf, requestContext); } catch (Exception ex) { - msoLogger.error(ex); + logger.error("Exception occurred", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex.getMessage()); } if (!response) { - msoLogger.error("SDNO Health Check failed"); + logger.error("SDNO Health Check failed"); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SDNO Health Check failed"); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java index 701817ab58..2559087619 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java @@ -110,8 +110,8 @@ public class VnfAdapterObjectMapper { return deleteVolumeGroupRequest; } - public Map<String, String> createVolumeGroupParams(RequestContext requestContext,GenericVnf genericVnf, VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException { - Map<String, String> volumeGroupParams = new HashMap<>(); + public Map<String, Object> createVolumeGroupParams(RequestContext requestContext,GenericVnf genericVnf, VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException { + Map<String, Object> volumeGroupParams = new HashMap<>(); final String USER_PARAM_NAME_KEY = "name"; final String USER_PARAM_VALUE_KEY = "value"; // sdncVfModuleQueryResponse will not be available in aLaCarte case @@ -147,7 +147,7 @@ public class VnfAdapterObjectMapper { return msoRequest; } - private void buildParamsMapFromSdncParams(Map<String,String> volumeGroupParams, GenericResourceApiParam sdncParameters) { + private void buildParamsMapFromSdncParams(Map<String,Object> volumeGroupParams, GenericResourceApiParam sdncParameters) { if (sdncParameters != null) { List<GenericResourceApiParamParam> sdncParametersList = sdncParameters.getParam(); if (sdncParametersList != null) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java index 352d4ec7d1..98174d59b6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java @@ -161,7 +161,7 @@ public class VnfAdapterVfModuleObjectMapper { return msoRequest; } - private Map<String,String> buildVfModuleParamsMap(RequestContext requestContext, ServiceInstance serviceInstance, GenericVnf genericVnf, + private Map<String,Object> buildVfModuleParamsMap(RequestContext requestContext, ServiceInstance serviceInstance, GenericVnf genericVnf, VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException { @@ -169,7 +169,7 @@ public class VnfAdapterVfModuleObjectMapper { GenericResourceApiVfModuleTopology vfModuleTop = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfModuleTopology.class); GenericResourceApiVnftopologyVnfTopology vnfTopology = vnfTop.getVnfTopology(); GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = vfModuleTop.getVfModuleTopology(); - Map<String,String> paramsMap = new HashMap<>(); + Map<String,Object> paramsMap = new HashMap<>(); if( vfModuleTopology.getSdncGeneratedCloudResources()) { buildParamsMapFromVfModuleSdncResponse(paramsMap, vfModuleTopology, true); @@ -184,17 +184,15 @@ public class VnfAdapterVfModuleObjectMapper { buildMandatoryParamsMap(paramsMap, serviceInstance, genericVnf, vfModule); // Parameters received from the request should overwrite any parameters received from SDNC + paramsMap.putAll(requestContext.getUserParams()); - if (requestContext.getUserParams() != null) { - paramsMap.putAll(requestContext.getUserParams()); - } if (vfModule.getCloudParams() != null) { paramsMap.putAll(vfModule.getCloudParams()); } return paramsMap; } - private void buildMandatoryParamsMap(Map<String,String> paramsMap, ServiceInstance serviceInstance, GenericVnf genericVnf, VfModule vfModule) { + private void buildMandatoryParamsMap(Map<String,Object> paramsMap, ServiceInstance serviceInstance, GenericVnf genericVnf, VfModule vfModule) { paramsMap.put("vnf_id", genericVnf.getVnfId()); paramsMap.put("vnf_name", genericVnf.getVnfName()); paramsMap.put("vf_module_id", vfModule.getVfModuleId()); @@ -209,7 +207,7 @@ public class VnfAdapterVfModuleObjectMapper { } } - private void buildParamsMapFromVnfSdncResponse(Map<String,String> paramsMap, GenericResourceApiVnftopologyVnfTopology vnfTopology, Map<String,String> networkRoleMap, boolean skipVnfResourceAssignments) throws JsonParseException, JsonMappingException, IOException { + private void buildParamsMapFromVnfSdncResponse(Map<String,Object> paramsMap, GenericResourceApiVnftopologyVnfTopology vnfTopology, Map<String,String> networkRoleMap, boolean skipVnfResourceAssignments) throws JsonParseException, JsonMappingException, IOException { // Get VNF parameters from SDNC response GenericResourceApiParam vnfParametersData = vnfTopology.getVnfParametersData(); buildParamsMapFromSdncParams(paramsMap, vnfParametersData); @@ -225,7 +223,7 @@ public class VnfAdapterVfModuleObjectMapper { } } - private void buildAvailabilityZones (Map<String,String> paramsMap, GenericResourceApiVnfresourceassignmentsVnfResourceAssignments vnfResourceAssignments) { + private void buildAvailabilityZones (Map<String,Object> paramsMap, GenericResourceApiVnfresourceassignmentsVnfResourceAssignments vnfResourceAssignments) { GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsAvailabilityZones availabilityZones = vnfResourceAssignments.getAvailabilityZones(); if (availabilityZones != null) { List<String> availabilityZonesList = availabilityZones.getAvailabilityZone(); @@ -237,7 +235,7 @@ public class VnfAdapterVfModuleObjectMapper { } } - private void buildVnfNetworks (Map<String,String> paramsMap, GenericResourceApiVnfresourceassignmentsVnfResourceAssignments vnfResourceAssignments, Map<String,String> networkRoleMap) { + private void buildVnfNetworks (Map<String,Object> paramsMap, GenericResourceApiVnfresourceassignmentsVnfResourceAssignments vnfResourceAssignments, Map<String,String> networkRoleMap) { GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks vnfNetworks = vnfResourceAssignments.getVnfNetworks(); if (vnfNetworks != null) { List<GenericResourceApiVnfNetworkData> vnfNetworksList = vnfNetworks.getVnfNetwork(); @@ -264,7 +262,7 @@ public class VnfAdapterVfModuleObjectMapper { } } - private void buildVnfNetworkSubnets(Map<String,String> paramsMap, GenericResourceApiVnfNetworkData vnfNetwork, String vnfNetworkKey) { + private void buildVnfNetworkSubnets(Map<String,Object> paramsMap, GenericResourceApiVnfNetworkData vnfNetwork, String vnfNetworkKey) { String vnfNetworkString = convertToString(vnfNetwork); Optional<String> ipv4Ips = jsonPath.locateResult(vnfNetworkString, "$.subnets-data.subnet-data[*].[?(@.ip-version == 'ipv4' && @.dhcp-enabled == 'Y')].subnet-id"); if(ipv4Ips.isPresent()) @@ -275,7 +273,7 @@ public class VnfAdapterVfModuleObjectMapper { addPairToMap(paramsMap, vnfNetworkKey, V6_SUBNET_ID, ipv6Ips.get()); } - private void buildParamsMapFromVfModuleSdncResponse(Map<String,String> paramsMap, GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology, boolean skipVfModuleAssignments) throws JsonParseException, JsonMappingException, IOException { + private void buildParamsMapFromVfModuleSdncResponse(Map<String,Object> paramsMap, GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology, boolean skipVfModuleAssignments) throws JsonParseException, JsonMappingException, IOException { // Get VF Module parameters from SDNC response GenericResourceApiParam vfModuleParametersData = vfModuleTopology.getVfModuleParameters(); buildParamsMapFromSdncParams(paramsMap, vfModuleParametersData); @@ -322,7 +320,7 @@ public class VnfAdapterVfModuleObjectMapper { } } - protected void buildVlanInformation(Map<String, String> paramsMap, + protected void buildVlanInformation(Map<String, Object> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) { String networkString = convertToString(network); @@ -352,7 +350,7 @@ public class VnfAdapterVfModuleObjectMapper { } } - private void buildVfModuleVmNames(Map<String,String> paramsMap, GenericResourceApiVmTopologyData vm, String key) { + private void buildVfModuleVmNames(Map<String,Object> paramsMap, GenericResourceApiVmTopologyData vm, String key) { String values = ""; GenericResourceApiVmtopologydataVmNames vmNames = vm.getVmNames(); if (vmNames != null) { @@ -373,7 +371,7 @@ public class VnfAdapterVfModuleObjectMapper { } } - private void buildVfModuleFloatingIps(Map<String,String> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) { + private void buildVfModuleFloatingIps(Map<String,Object> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) { GenericResourceApiVmnetworkdataFloatingIps floatingIps = network.getFloatingIps(); if (floatingIps != null) { List<String> floatingIpV4List = floatingIps.getFloatingIpV4(); @@ -397,7 +395,7 @@ public class VnfAdapterVfModuleObjectMapper { } } - private void buildVfModuleInterfaceRoutePrefixes(Map<String,String> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) { + private void buildVfModuleInterfaceRoutePrefixes(Map<String,Object> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) { GenericResourceApiVmnetworkdataInterfaceRoutePrefixes interfaceRoutePrefixes = network.getInterfaceRoutePrefixes(); if (interfaceRoutePrefixes != null) { List<String> interfaceRoutePrefixesList = interfaceRoutePrefixes.getInterfaceRoutePrefix(); @@ -421,7 +419,7 @@ public class VnfAdapterVfModuleObjectMapper { } } - private void buildVfModuleSriovParameters(Map<String,String> paramsMap, GenericResourceApiVmNetworkData network, String networkKey) { + private void buildVfModuleSriovParameters(Map<String,Object> paramsMap, GenericResourceApiVmNetworkData network, String networkKey) { // SRIOV Parameters GenericResourceApiVmnetworkdataSriovParameters sriovParameters = network.getSriovParameters(); if (sriovParameters != null) { @@ -447,7 +445,7 @@ public class VnfAdapterVfModuleObjectMapper { } } - private void buildVfModuleNetworkInformation(Map<String,String> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) { + private void buildVfModuleNetworkInformation(Map<String,Object> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) { GenericResourceApiVmnetworkdataNetworkInformationItems networkInformationItems = network.getNetworkInformationItems(); StringBuilder sbIpv4Ips = new StringBuilder(); @@ -500,7 +498,7 @@ public class VnfAdapterVfModuleObjectMapper { * Build Count of SubInterfaces, VLAN Tag, network_name, network_id, * ip_address (V4 and V6) and Floating IPs Addresses (V4 and V6) for Heat Template */ - private void buildParamsMapFromVfModuleForHeatTemplate(Map<String,String> paramsMap, GenericResourceApiVmTopologyData vm) { + private void buildParamsMapFromVfModuleForHeatTemplate(Map<String,Object> paramsMap, GenericResourceApiVmTopologyData vm) { GenericResourceApiVmtopologydataVmNames vmNames = vm.getVmNames(); if (vmNames != null) { @@ -520,7 +518,7 @@ public class VnfAdapterVfModuleObjectMapper { /* * Parse vnfcNames data to build Mapping from GenericResourceApi SDNC for Heat Template. */ - private void parseVnfcNamesData(Map<String,String> paramsMap, GenericResourceApiVmtopologydataVmnamesVnfcNames vnfcNames) { + private void parseVnfcNamesData(Map<String,Object> paramsMap, GenericResourceApiVmtopologydataVmnamesVnfcNames vnfcNames) { if (vnfcNames != null) { GenericResourceApiVnfcNetworkData vnfcNetworks = vnfcNames.getVnfcNetworks(); @@ -544,7 +542,7 @@ public class VnfAdapterVfModuleObjectMapper { * Build Count of SubInterfaces, VLAN Tag, network_name, network_id, * ip_address (V4 and V6) and Floating IPs Addresses (V4 and V6) for Heat Template */ - private void parseVnfcNetworkData(Map<String,String> paramsMap, GenericResourceApiVnfcnetworkdataVnfcNetworkData vnfcNetworkdata, int networkDataIdx) { + private void parseVnfcNetworkData(Map<String,Object> paramsMap, GenericResourceApiVnfcnetworkdataVnfcNetworkData vnfcNetworkdata, int networkDataIdx) { String vmTypeKey = vnfcNetworkdata.getVnfcType(); GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcPorts vnfcPorts = vnfcNetworkdata.getVnfcPorts(); @@ -588,7 +586,7 @@ public class VnfAdapterVfModuleObjectMapper { * Example: fw_subint_ctrl_port_0_subintcount * */ - private void buildVfModuleSubInterfacesCount(Map<String,String> paramsMap, String keyPrefix, GenericResourceApiSubInterfaceNetworkData vnicSubInterfaces) { + private void buildVfModuleSubInterfacesCount(Map<String,Object> paramsMap, String keyPrefix, GenericResourceApiSubInterfaceNetworkData vnicSubInterfaces) { List<GenericResourceApiSubinterfacenetworkdataSubInterfaceNetworkData> subInterfaceNetworkDataList = vnicSubInterfaces.getSubInterfaceNetworkData(); @@ -614,7 +612,7 @@ public class VnfAdapterVfModuleObjectMapper { * Example: fw_0_subint_ctrl_port_0_vlan_ids * */ - protected void buildVfModuleVlanTag(Map<String,String> paramsMap, String keyPrefix, String vnicSubInterfaces) { + protected void buildVfModuleVlanTag(Map<String,Object> paramsMap, String keyPrefix, String vnicSubInterfaces) { List<String> vlanTagIds = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].vlan-tag-id"); @@ -627,7 +625,7 @@ public class VnfAdapterVfModuleObjectMapper { * Example: fw_0_subint_ctrl_port_0_net_names * */ - protected void buildVfModuleNetworkName(Map<String,String> paramsMap, String keyPrefix, String vnicSubInterfaces) { + protected void buildVfModuleNetworkName(Map<String,Object> paramsMap, String keyPrefix, String vnicSubInterfaces) { List<String> neworkNames = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].network-name"); @@ -641,7 +639,7 @@ public class VnfAdapterVfModuleObjectMapper { * Example: fw_0_subint_ctrl_port_0_net_ids * */ - protected void buildVfModuleNetworkId(Map<String,String> paramsMap, String keyPrefix, String vnicSubInterfaces) { + protected void buildVfModuleNetworkId(Map<String,Object> paramsMap, String keyPrefix, String vnicSubInterfaces) { List<String> neworkIds = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].network-id"); @@ -654,7 +652,7 @@ public class VnfAdapterVfModuleObjectMapper { * {vm-type}_{index}_subint_{network-role}_port_{index}_ip_{index} -- for ipV4 * key = vm-type, networkRoleKey = NetWork-Role */ - protected void buildVfModuleIpV4AddressHeatTemplate(Map<String,String> paramsMap, String keyPrefix, String vnicSubInterfaces) { + protected void buildVfModuleIpV4AddressHeatTemplate(Map<String,Object> paramsMap, String keyPrefix, String vnicSubInterfaces) { List<String> ipv4Ips = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].network-information-items.network-information-item[?(@.ip-version == 'ipv4')].network-ips.network-ip[*]"); @@ -672,7 +670,7 @@ public class VnfAdapterVfModuleObjectMapper { * {vm-type}_{index}_subint_{network-role}_port_{index}_v6_ip_{index} -- for ipV6 * key = vm-type, networkRoleKey = NetWork-Role */ - protected void buildVfModuleIpV6AddressHeatTemplate(Map<String,String> paramsMap, String keyPrefix, String vnicSubInterfaces) { + protected void buildVfModuleIpV6AddressHeatTemplate(Map<String,Object> paramsMap, String keyPrefix, String vnicSubInterfaces) { List<String> ipv6Ips = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].network-information-items.network-information-item[?(@.ip-version == 'ipv6')].network-ips.network-ip[*]"); @@ -688,7 +686,7 @@ public class VnfAdapterVfModuleObjectMapper { * Building Criteria : * {vm-type}_subint_{network-role}_port_{index}_floating_ip -- for ipV4 */ - protected void buildVfModuleFloatingIpV4HeatTemplate(Map<String,String> paramsMap, String keyPrefix, String vnicSubInterfaces) { + protected void buildVfModuleFloatingIpV4HeatTemplate(Map<String,Object> paramsMap, String keyPrefix, String vnicSubInterfaces) { List<String> floatingV4 = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].floating-ips.floating-ip-v4[*]"); @@ -704,7 +702,7 @@ public class VnfAdapterVfModuleObjectMapper { * Building Criteria : * {vm-type}_subint_{network-role}_port_{index}_floating_v6_ip -- for ipV6 */ - protected void buildVfModuleFloatingIpV6HeatTemplate(Map<String,String> paramsMap, String keyPrefix, String vnicSubInterfaces) { + protected void buildVfModuleFloatingIpV6HeatTemplate(Map<String,Object> paramsMap, String keyPrefix, String vnicSubInterfaces) { List<String> floatingV6 = jsonPath.locateResultList(vnicSubInterfaces, "$.sub-interface-network-data[*].floating-ips.floating-ip-v6[*]"); @@ -714,19 +712,19 @@ public class VnfAdapterVfModuleObjectMapper { addPairToMap(paramsMap, keyPrefix, FLOATING_V6_IP, floatingV6); } - protected void addPairToMap(Map<String, String> paramsMap, String keyPrefix, String key, String value) { + protected void addPairToMap(Map<String, Object> paramsMap, String keyPrefix, String key, String value) { addPairToMap(paramsMap, keyPrefix, key, Collections.singletonList(value)); } - protected void addPairToMap(Map<String, String> paramsMap, String keyPrefix, String key, List<String> value) { + protected void addPairToMap(Map<String, Object> paramsMap, String keyPrefix, String key, List<String> value) { if (!value.isEmpty()) { paramsMap.put(keyPrefix + key, Joiner.on(",").join(value)); } } - private void buildParamsMapFromSdncParams(Map<String,String> paramsMap, GenericResourceApiParam parametersData) { + private void buildParamsMapFromSdncParams(Map<String,Object> paramsMap, GenericResourceApiParam parametersData) { if (parametersData != null) { List<GenericResourceApiParamParam> paramsList = parametersData.getParam(); if (paramsList != null) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java index 0419896444..9613fbdcf1 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -29,7 +31,8 @@ import org.onap.namingservice.model.NameGenDeleteResponse; import org.onap.namingservice.model.NameGenRequest; import org.onap.namingservice.model.NameGenResponse; import org.onap.so.client.exception.BadResponseException; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.http.HttpEntity; @@ -45,7 +48,7 @@ import org.springframework.web.client.RestTemplate; @Component public class NamingClient{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NamingClient.class); + private static final Logger logger = LoggerFactory.getLogger(NamingClient.class); private static final String ENDPOINT = "mso.naming.endpoint"; private static final String AUTH = "mso.naming.auth"; @@ -59,7 +62,7 @@ public class NamingClient{ public String postNameGenRequest(NameGenRequest request) throws BadResponseException, IOException { String targetUrl = env.getProperty(ENDPOINT); HttpHeaders headers = setHeaders(env.getProperty(AUTH)); - msoLogger.info("Sending postNameGenRequest to url: " + targetUrl); + logger.info("Sending postNameGenRequest to url: {}", targetUrl); HttpEntity<NameGenRequest> requestEntity = new HttpEntity<>(request, headers); ResponseEntity<NameGenResponse> response; try{ @@ -73,7 +76,7 @@ public class NamingClient{ public String deleteNameGenRequest(NameGenDeleteRequest request) throws BadResponseException, IOException { String targetUrl = env.getProperty(ENDPOINT); HttpHeaders headers = setHeaders(env.getProperty(AUTH)); - msoLogger.info("Sending deleteNameGenRequest to url: " + targetUrl); + logger.info("Sending deleteNameGenRequest to url: {}", targetUrl); HttpEntity<NameGenDeleteRequest> requestEntity = new HttpEntity<>(request, headers); ResponseEntity<NameGenDeleteResponse> response; try{ 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 3dcafe0ff4..787b811501 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 @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -31,6 +33,8 @@ import org.onap.namingservice.model.Respelement; import org.onap.so.client.exception.BadResponseException; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import org.springframework.web.client.HttpStatusCodeException; @@ -39,7 +43,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Component public class NamingClientResponseValidator { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NamingClientResponseValidator.class); + private static final Logger logger = LoggerFactory.getLogger(NamingClientResponseValidator.class); private static final String INSTANCE_GROUP_NAME = "instance-group-name"; private static final String NO_RESPONSE_FROM_NAMING_SERVICE = "Error did not receive a response from Naming Service."; private static final String NULL_RESPONSE_FROM_NAMING_SERVICE = "Error received a null response from Naming Service."; @@ -47,8 +51,9 @@ public class NamingClientResponseValidator { public String validateNameGenResponse(ResponseEntity<NameGenResponse> response) throws BadResponseException { if (response == null) { - msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, NO_RESPONSE_FROM_NAMING_SERVICE, "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_NAMING_SERVICE); + logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE, + "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), + NO_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE); } @@ -56,13 +61,14 @@ public class NamingClientResponseValidator { String generatedName = ""; NameGenResponse responseBody = response.getBody(); if (responseBody == null) { - msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NULL_RESPONSE_FROM_NAMING_SERVICE); + logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE, + "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), + NULL_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE); } if (isHttpCodeSuccess(responseCode)) { - msoLogger.info("Successful Response from Naming Service"); + logger.info("Successful Response from Naming Service"); List<Respelement> respList = responseBody.getElements(); if (respList != null) { @@ -85,16 +91,17 @@ public class NamingClientResponseValidator { errorMessageString = error.getMessage(); } String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); - msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, errorMessage, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.DataError, errorMessage); + logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError.getValue(), errorMessage); throw new BadResponseException(errorMessage); } } public String validateNameGenDeleteResponse(ResponseEntity<NameGenDeleteResponse> response) throws BadResponseException { if (response == null) { - msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, NO_RESPONSE_FROM_NAMING_SERVICE, "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_NAMING_SERVICE); + logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE, + "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), + NO_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE); } @@ -102,20 +109,21 @@ public class NamingClientResponseValidator { String responseMessage = ""; NameGenDeleteResponse responseBody = response.getBody(); if (responseBody == null) { - msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NULL_RESPONSE_FROM_NAMING_SERVICE); + logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE, + "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), + NULL_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE); } if (isHttpCodeSuccess(responseCode)) { - msoLogger.info("Successful Response from Naming Service"); + logger.info("Successful Response from Naming Service"); return responseMessage; } else { String errorMessageString = NAMING_SERVICE_ERROR; String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); - msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, errorMessage, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.DataError, errorMessage); + logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.DataError.getValue(), errorMessage); throw new BadResponseException(errorMessage); } } @@ -134,8 +142,8 @@ public class NamingClientResponseValidator { errorMessageString = error.getMessage(); } String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); - msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, errorMessage, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.DataError, errorMessage); + logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.DataError.getValue(), errorMessage); return errorMessage; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java index 86dd22b65c..3032b66e6d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -34,13 +36,15 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class AAIServiceInstanceResources { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIServiceInstanceResources.class); + private static final Logger logger = LoggerFactory.getLogger(AAIServiceInstanceResources + .class); @Autowired private InjectionHelper injectionHelper; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java index ef61319eee..5fa73c85ff 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -32,13 +34,14 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class AAIVfModuleResources { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIVfModuleResources.class); + private static final Logger logger = LoggerFactory.getLogger(AAIVfModuleResources.class); @Autowired private InjectionHelper injectionHelper; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java index a9a52bd115..0c65abfe0c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -27,21 +29,20 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class AAIVnfResources { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIVnfResources.class); + private static final Logger logger = LoggerFactory.getLogger(AAIVnfResources.class); @Autowired private InjectionHelper injectionHelper; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java index af97e55c14..7bb96ec2ed 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -29,13 +31,14 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class AAIVolumeGroupResources { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIVolumeGroupResources.class); + private static final Logger logger = LoggerFactory.getLogger(AAIVolumeGroupResources.class); @Autowired private InjectionHelper injectionHelper; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java index d0bf6da6c9..2a25ec5ba1 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -30,13 +32,14 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.namingservice.NamingClient; import org.onap.so.client.namingservice.NamingRequestObjectBuilder; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class NamingServiceResources { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NamingServiceResources.class); + private static final Logger logger = LoggerFactory.getLogger(NamingServiceResources.class); private static final String NAMING_TYPE = "instanceGroup"; @Autowired diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java index 8b53c28547..fb828c1981 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -30,14 +32,14 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class SDNCNetworkResources { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - SDNCNetworkResources.class); + private static final Logger logger = LoggerFactory.getLogger(SDNCNetworkResources.class); @Autowired private NetworkTopologyOperationRequestMapper sdncRM; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java index e7f0a40d2a..1e3d655298 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -34,14 +36,14 @@ import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class SDNCVfModuleResources { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - SDNCVfModuleResources.class); + private static final Logger logger = LoggerFactory.getLogger(SDNCVfModuleResources.class); @Autowired private VfModuleTopologyOperationRequestMapper sdncRM; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java index e5194e3e37..d8f2e47224 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -33,13 +35,14 @@ import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; import org.onap.so.client.sdnc.mapper.VnfTopologyOperationRequestMapper; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class SDNCVnfResources { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCVnfResources.class); + private static final Logger logger = LoggerFactory.getLogger(SDNCVnfResources.class); @Autowired private VnfTopologyOperationRequestMapper sdncRM; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java index 2d9032c7c0..de59e6835e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -32,13 +34,14 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class VnfAdapterVfModuleResources { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterVfModuleResources.class); + private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVfModuleResources.class); @Autowired private VnfAdapterVfModuleObjectMapper vnfAdapterVfModuleObjectMapper; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java index efbbeae737..737e9eeb37 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -30,13 +32,14 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.adapter.vnf.VnfVolumeAdapterClientImpl; import org.onap.so.client.adapter.vnf.mapper.VnfAdapterObjectMapper; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class VnfAdapterVolumeGroupResources { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterVolumeGroupResources.class); + private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVolumeGroupResources.class); @Autowired private VnfAdapterObjectMapper vnfAdapterObjectMapper; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java index 7ad2ef00b2..99d5fca31f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -29,7 +31,8 @@ import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.beans.SDNCProperties; import org.onap.so.client.sdnc.endpoint.SDNCTopology; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpHeaders; @@ -38,7 +41,7 @@ import org.springframework.stereotype.Component; @Component public class SDNCClient { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCClient.class); + private static final Logger logger = LoggerFactory.getLogger(SDNCClient.class); private BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>(); @Autowired 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 13ba107576..2f9c8da5f0 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 @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -30,6 +32,8 @@ import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.stereotype.Component; @@ -42,7 +46,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Component public class SdnCommonTasks { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCClient.class); + private static final Logger logger = LoggerFactory.getLogger(SDNCClient.class); private static final String RESPONSE_CODE = "response-code"; private static final String RESPONSE_MESSAGE = "response-message"; private static final String NO_RESPONSE_FROM_SDNC = "Error did not receive a response from SDNC."; @@ -63,11 +67,13 @@ public class SdnCommonTasks { try { jsonRequest = objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(request); } catch (JsonProcessingException e) { - msoLogger.error(MessageEnum.JAXB_EXCEPTION, COULD_NOT_CONVERT_SDNC_POJO_TO_JSON, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, e.getMessage()); + logger.error("{} {} {} {} {} {}", MessageEnum.JAXB_EXCEPTION.toString(), + COULD_NOT_CONVERT_SDNC_POJO_TO_JSON, + "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError.getValue(), e.getMessage()); throw new MapperException(COULD_NOT_CONVERT_SDNC_POJO_TO_JSON); } jsonRequest = "{\"input\":" + jsonRequest + "}"; - msoLogger.info(jsonRequest); + logger.info(jsonRequest); return jsonRequest; } @@ -94,8 +100,8 @@ public class SdnCommonTasks { */ public String validateSDNResponse(LinkedHashMap<String, Object> output) throws BadResponseException { if (CollectionUtils.isEmpty(output)) { - msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, NO_RESPONSE_FROM_SDNC, "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_SDNC); + logger.error("{} {} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN", + MsoLogger.getServiceName(), 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"); @@ -109,21 +115,21 @@ public class SdnCommonTasks { String jsonResponse; try { jsonResponse = objMapper.writeValueAsString(output); - msoLogger.debug(jsonResponse); + logger.debug(jsonResponse); } catch (JsonProcessingException e) { - msoLogger.warnSimple("Could not convert SDNC Response to String", e); + logger.warn("Could not convert SDNC Response to String", e); jsonResponse = ""; } - msoLogger.info("ResponseCode: " + responseCode + " ResponseMessage: " + responseMessage); + logger.info("ResponseCode: {} ResponseMessage: {}", responseCode, responseMessage); int code = StringUtils.isNotEmpty(responseCode) ? Integer.parseInt(responseCode) : 0; if (isHttpCodeSuccess(code)) { - msoLogger.info("Successful Response from SDNC"); + logger.info("Successful Response from SDNC"); return jsonResponse; } else { String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage); - msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, errorMessage, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.DataError, errorMessage); - throw new BadResponseException(errorMessage); + logger.error("{} {} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError.getValue(), errorMessage); + throw new BadResponseException(errorMessage); } } @@ -135,20 +141,23 @@ public class SdnCommonTasks { */ public String validateSDNGetResponse(LinkedHashMap<String, Object> output) throws BadResponseException { if (CollectionUtils.isEmpty(output)) { - msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, NO_RESPONSE_FROM_SDNC, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_SDNC); + logger.error("{} {} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC); throw new BadResponseException(NO_RESPONSE_FROM_SDNC); } ObjectMapper objMapper = new ObjectMapper(); - msoLogger.debug("Using object mapper"); + logger.debug("Using object mapper"); String stringOutput = ""; try { stringOutput = objMapper.writeValueAsString(output); } catch (Exception e) { - msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, BAD_RESPONSE_FROM_SDNC, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, BAD_RESPONSE_FROM_SDNC); + logger.error("{} {} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC, + "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), + BAD_RESPONSE_FROM_SDNC); throw new BadResponseException(BAD_RESPONSE_FROM_SDNC); } - msoLogger.debug("Received from GET request: " + stringOutput); + logger.debug("Received from GET request: {}", stringOutput); return stringOutput; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java index 2cd0947fa8..e46c456f88 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java @@ -22,16 +22,27 @@ package org.onap.so.client.sdnc.mapper; import java.net.URI; -import org.onap.sdnc.northbound.client.model.*; -import org.onap.so.bpmn.servicedecomposition.bbobjects.*; +import org.onap.sdnc.northbound.client.model.GenericResourceApiConfigurationinformationConfigurationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiGcrequestinputGcRequestInput; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component(value = "sdncGCTopologyOperationRequestMapper") public class GCTopologyOperationRequestMapper { - private static final GeneralTopologyObjectMapper generalTopologyObjectMapper = new GeneralTopologyObjectMapper(); + @Autowired + private GeneralTopologyObjectMapper generalTopologyObjectMapper; public GenericResourceApiGcTopologyOperationInformation assignOrActivateVnrReqMapper(SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration reqAction, @@ -82,5 +93,4 @@ public class GCTopologyOperationRequestMapper { } - } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java index 7632831111..fedbde251e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java @@ -20,18 +20,42 @@ package org.onap.so.client.sdnc.mapper; -import org.onap.sdnc.northbound.client.model.*; -import org.onap.so.bpmn.servicedecomposition.bbobjects.*; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.onap.sdnc.northbound.client.model.GenericResourceApiConfigurationinformationConfigurationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiGcrequestinputGcRequestInput; +import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkinformationNetworkInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnfInformation; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.beans.SDNCSvcAction; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.env.Environment; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import org.onap.so.client.exception.MapperException; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; @Component public class GeneralTopologyObjectMapper { + private static final Logger logger = LoggerFactory.getLogger(GeneralTopologyObjectMapper.class); + private ObjectMapper mapper = new ObjectMapper(); /* * Build GenericResourceApiRequestinformationRequestInformation @@ -194,4 +218,22 @@ public class GeneralTopologyObjectMapper { } return gcRequestInput; } + + + public String mapUserParamValue(Object value) { + if (value == null) { + return null; + } else { + if (value instanceof Map || value instanceof Set || value instanceof List) { + try { + return mapper.writeValueAsString(value); + } catch (JsonProcessingException e) { + logger.error("could not map value to string", e); + throw new IllegalArgumentException(e); + } + } else { + return value.toString(); + } + } + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java index 2b4834af42..188a228e5d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java @@ -23,15 +23,6 @@ package org.onap.so.client.sdnc.mapper; import java.util.Map; import java.util.UUID; -import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; -import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; -import org.onap.so.client.sdnc.beans.SDNCSvcAction; -import org.onap.so.client.sdnc.beans.SDNCSvcOperation; -import org.springframework.stereotype.Component; - import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkinformationNetworkInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkrequestinputNetworkRequestInput; @@ -41,6 +32,15 @@ import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnum import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader; import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; /** * Mapper creating SDNC request @@ -49,7 +49,8 @@ import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformatio @Component public class NetworkTopologyOperationRequestMapper { - static GeneralTopologyObjectMapper generalTopologyObjectMapper = new GeneralTopologyObjectMapper(); + @Autowired + private GeneralTopologyObjectMapper generalTopologyObjectMapper; public GenericResourceApiNetworkOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration reqAction, L3Network network, ServiceInstance serviceInstance, @@ -68,11 +69,11 @@ public class NetworkTopologyOperationRequestMapper { req.setNetworkInformation(networkInformation); if (requestContext.getUserParams() != null) { - for (Map.Entry<String, String> entry : requestContext.getUserParams().entrySet()) { + for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) { GenericResourceApiParam networkInputParameters = new GenericResourceApiParam(); GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam(); - paramItem.setName(entry.getKey()); - paramItem.setValue(entry.getValue()); + paramItem.setName(entry.getKey()); + paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue())); networkInputParameters.addParamItem(paramItem); networkRequestInput.setNetworkInputParameters(networkInputParameters); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java index 5b23707cb9..505466b22c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java @@ -23,13 +23,6 @@ package org.onap.so.client.sdnc.mapper; import java.util.Map; import java.util.UUID; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; -import org.onap.so.client.sdnc.beans.SDNCSvcAction; -import org.onap.so.client.sdnc.beans.SDNCSvcOperation; -import org.springframework.stereotype.Component; - import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; @@ -38,11 +31,19 @@ import org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheader import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiServicerequestinputServiceRequestInput; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; @Component public class ServiceTopologyOperationMapper{ - static GeneralTopologyObjectMapper generalTopologyObjectMapper = new GeneralTopologyObjectMapper(); + @Autowired + public GeneralTopologyObjectMapper generalTopologyObjectMapper; public GenericResourceApiServiceOperationInformation reqMapper (SDNCSvcOperation svcOperation, SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration resourceAction,ServiceInstance serviceInstance, Customer customer, RequestContext requestContext) { @@ -62,13 +63,13 @@ public class ServiceTopologyOperationMapper{ servOpInput.setServiceRequestInput(servReqInfo); if(requestContext.getUserParams()!=null){ - for (Map.Entry<String, String> entry : requestContext.getUserParams().entrySet()) { + for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) { GenericResourceApiServicerequestinputServiceRequestInput serviceRequestInput = new GenericResourceApiServicerequestinputServiceRequestInput(); serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceName()); GenericResourceApiParam serviceInputParameters = new GenericResourceApiParam(); GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam(); paramItem.setName(entry.getKey()); - paramItem.setValue(entry.getValue()); + paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue())); serviceInputParameters.addParamItem(paramItem ); serviceRequestInput.serviceInputParameters(serviceInputParameters); servOpInput.setServiceRequestInput(serviceRequestInput ); 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 b656579c69..f70ac8399f 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 @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -23,39 +25,43 @@ package org.onap.so.client.sdnc.mapper; import java.util.Map; import java.util.UUID; +import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; +import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiSvcActionEnumeration; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleResponseInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmodulerequestinputVfModuleRequestInput; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnfInformation; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; -import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; -import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; -import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader; -import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiSvcActionEnumeration; -import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnfInformation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmodulerequestinputVfModuleRequestInput; -import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleResponseInformation; - import com.fasterxml.jackson.databind.ObjectMapper; @Component public class VfModuleTopologyOperationRequestMapper { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VfModuleTopologyOperationRequestMapper.class); - static GeneralTopologyObjectMapper generalTopologyObjectMapper = new GeneralTopologyObjectMapper(); + private static final Logger logger = LoggerFactory.getLogger(VfModuleTopologyOperationRequestMapper.class); + + @Autowired + private GeneralTopologyObjectMapper generalTopologyObjectMapper; public GenericResourceApiVfModuleOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction, VfModule vfModule, VolumeGroup volumeGroup, GenericVnf vnf, ServiceInstance serviceInstance, @@ -122,10 +128,10 @@ public class VfModuleTopologyOperationRequestMapper { GenericResourceApiParam vfModuleInputParameters = new GenericResourceApiParam(); if (requestContext != null && requestContext.getUserParams() != null) { - for (Map.Entry<String, String> entry : requestContext.getUserParams().entrySet()) { + for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) { GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam(); paramItem.setName(entry.getKey()); - paramItem.setValue(entry.getValue()); + paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue())); vfModuleInputParameters.addParamItem(paramItem); } } @@ -166,8 +172,9 @@ public class VfModuleTopologyOperationRequestMapper { try { GenericResourceApiVfModuleResponseInformation assignResponseInfo = mapper.readValue(sdncAssignResponse, GenericResourceApiVfModuleResponseInformation.class); objectPath = assignResponseInfo.getVfModuleResponseInformation().getObjectPath(); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, e.getMessage(), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage()); + } catch (Exception e) { + logger.error("{} {} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage()); } } return objectPath; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java index e860d3cc48..7de393bb2f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java @@ -26,6 +26,16 @@ import java.util.Map; import java.util.UUID; import org.apache.commons.lang.StringUtils; +import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; +import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnfInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfrequestinputVnfRequestInput; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -36,23 +46,14 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; -import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; -import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; -import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader; -import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnfInformation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfrequestinputVnfRequestInput; -import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds; - @Component public class VnfTopologyOperationRequestMapper { - static GeneralTopologyObjectMapper generalTopologyObjectMapper = new GeneralTopologyObjectMapper(); + @Autowired + private GeneralTopologyObjectMapper generalTopologyObjectMapper; public GenericResourceApiVnfOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration requestAction, GenericVnf vnf, ServiceInstance serviceInstance, @@ -84,10 +85,10 @@ public class VnfTopologyOperationRequestMapper { GenericResourceApiParam vnfInputParameters = new GenericResourceApiParam(); if (requestContext.getUserParams() != null) { - for (Map.Entry<String, String> entry : requestContext.getUserParams().entrySet()) { + for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) { GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam(); paramItem.setName(entry.getKey()); - paramItem.setValue(entry.getValue()); + paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue())); vnfInputParameters.addParamItem(paramItem); vnfRequestInput.setVnfInputParameters(vnfInputParameters); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java index 7f09305d95..5a48a757bc 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -29,7 +31,8 @@ import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.sniro.beans.ManagerProperties; import org.onap.so.client.sniro.beans.SniroConductorRequest; import org.onap.so.client.sniro.beans.SniroManagerRequest; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpHeaders; @@ -42,7 +45,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; @Component public class SniroClient { - private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroClient.class); + private static final Logger logger = LoggerFactory.getLogger(SniroClient.class); @Autowired private ManagerProperties managerProperties; @@ -61,10 +64,10 @@ public class SniroClient { * @throws BpmnError */ public void postDemands(SniroManagerRequest homingRequest) throws BadResponseException, JsonProcessingException{ - log.trace("Started Sniro Client Post Demands"); + logger.trace("Started Sniro Client Post Demands"); String url = managerProperties.getHost() + managerProperties.getUri().get("v2"); - log.debug("Post demands url: " + url); - log.debug("Post demands payload: " + homingRequest.toJsonString()); + logger.debug("Post demands url: {}", url); + logger.debug("Post demands payload: {}", homingRequest.toJsonString()); HttpHeaders header = new HttpHeaders(); header.setContentType(MediaType.APPLICATION_JSON); @@ -79,7 +82,7 @@ public class SniroClient { LinkedHashMap<String, Object> response = baseClient.post(homingRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {}); validator.validateDemandsResponse(response); - log.trace("Completed Sniro Client Post Demands"); + logger.trace("Completed Sniro Client Post Demands"); } /** @@ -94,10 +97,10 @@ public class SniroClient { * @throws BadResponseException */ public void postRelease(SniroConductorRequest releaseRequest) throws BadResponseException { - log.trace("Started Sniro Client Post Release"); + logger.trace("Started Sniro Client Post Release"); String url = UrnPropertiesReader.getVariable("sniro.conductor.host") + UrnPropertiesReader.getVariable("sniro.conductor.uri"); - log.debug("Post release url: " + url); - log.debug("Post release payload: " + releaseRequest.toJsonString()); + logger.debug("Post release url: {}", url); + logger.debug("Post release payload: {}", releaseRequest.toJsonString()); HttpHeaders header = new HttpHeaders(); header.setContentType(MediaType.APPLICATION_JSON); @@ -110,7 +113,7 @@ public class SniroClient { LinkedHashMap<String, Object> response = baseClient.post(releaseRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {}); SniroValidator v = new SniroValidator(); v.validateReleaseResponse(response); - log.trace("Completed Sniro Client Post Release"); + logger.trace("Completed Sniro Client Post Release"); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java index 0d0c1be5aa..dcccd319c6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -28,7 +30,8 @@ import java.util.LinkedHashMap; import org.json.JSONObject; import org.onap.so.client.exception.BadResponseException; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -36,7 +39,7 @@ import org.springframework.stereotype.Component; @Component public class SniroValidator { - private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroValidator.class); + private static final Logger logger = LoggerFactory.getLogger(SniroValidator.class); /** * Validates the synchronous homing response from sniro manager @@ -44,29 +47,29 @@ public class SniroValidator { * @throws BadResponseException */ public void validateDemandsResponse(LinkedHashMap<String, Object> response) throws BadResponseException { - log.debug("Validating Sniro Managers synchronous response"); + logger.debug("Validating Sniro Managers synchronous response"); if(!response.isEmpty()){ JSONObject jsonResponse = new JSONObject(response); if(jsonResponse.has("requestStatus")){ String status = jsonResponse.getString("requestStatus"); if(status.equals("accepted")){ - log.debug("Sniro Managers synchronous response indicates accepted"); + logger.debug("Sniro Managers synchronous response indicates accepted"); }else{ String message = jsonResponse.getString("statusMessage"); if(isNotBlank(message)){ - log.debug("Sniro Managers response indicates failed: " + message); + logger.debug("Sniro Managers response indicates failed: " + message); }else{ - log.debug("Sniro Managers response indicates failed: no status message provided"); + logger.debug("Sniro Managers response indicates failed: no status message provided"); message = "error message not provided"; } throw new BadResponseException("Sniro Managers synchronous response indicates failed: " + message); } }else{ - log.debug("Sniro Managers synchronous response does not contain: request status"); + logger.debug("Sniro Managers synchronous response does not contain: request status"); throw new BadResponseException("Sniro Managers synchronous response does not contain: request status"); } }else{ - log.debug("Sniro Managers synchronous response is empty"); + logger.debug("Sniro Managers synchronous response is empty"); throw new BadResponseException("Sniro Managers synchronous response i is empty"); } } @@ -78,23 +81,23 @@ public class SniroValidator { * @throws BadResponseException */ public static void validateSolution(String response) throws BadResponseException{ - log.debug("Validating Sniro Managers asynchronous callback response"); + logger.debug("Validating Sniro Managers asynchronous callback response"); if(isNotBlank(response)) { JSONObject jsonResponse = new JSONObject(response); if(!jsonResponse.has("serviceException")){ - log.debug("Sniro Managers asynchronous response is valid"); + logger.debug("Sniro Managers asynchronous response is valid"); }else{ String message = jsonResponse.getJSONObject("serviceException").getString("text"); if(isNotBlank(message)){ - log.debug("Sniro Managers response contains a service exception: " + message); + logger.debug("Sniro Managers response contains a service exception: " + message); }else{ - log.debug("Sniro Managers response contains a service exception: no service exception text provided"); + logger.debug("Sniro Managers response contains a service exception: no service exception text provided"); message = "error message not provided"; } throw new BadResponseException("Sniro Managers asynchronous response contains a service exception: " + message); } }else{ - log.debug("Sniro Managers asynchronous response is empty"); + logger.debug("Sniro Managers asynchronous response is empty"); throw new BadResponseException("Sniro Managers asynchronous response is empty"); } } @@ -106,33 +109,31 @@ public class SniroValidator { * @throws BadResponseException */ public void validateReleaseResponse(LinkedHashMap<String, Object> response) throws BadResponseException { - log.debug("Validating Sniro Conductors response"); + logger.debug("Validating Sniro Conductors response"); if(!response.isEmpty()){ String status = (String) response.get("status"); if(isNotBlank(status)){ if(status.equals("success")){ - log.debug("Sniro Conductors synchronous response indicates success"); + logger.debug("Sniro Conductors synchronous response indicates success"); }else{ String message = (String) response.get("message"); if(isNotBlank(message)){ - log.debug("Sniro Conductors response indicates failed: " + message); + logger.debug("Sniro Conductors response indicates failed: " + message); }else{ - log.debug("Sniro Conductors response indicates failed: error message not provided"); + logger.debug("Sniro Conductors response indicates failed: error message not provided"); message = "error message not provided"; } throw new BadResponseException("Sniro Conductors synchronous response indicates failed: " + message); } }else{ - log.debug("Sniro Managers Conductors response does not contain: status"); + logger.debug("Sniro Managers Conductors response does not contain: status"); throw new BadResponseException("Sniro Conductors synchronous response does not contain: status"); } }else{ - log.debug("Sniro Conductors response is empty"); + logger.debug("Sniro Conductors response is empty"); throw new BadResponseException("Sniro Conductors response is empty"); } } - - } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java index bc8e27ce86..11417d646c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -24,19 +26,19 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import org.onap.so.logger.MsoLogger; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SniroConductorRequest implements Serializable{ private static final long serialVersionUID = 1906052095861777655L; - private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroConductorRequest.class); + private static final Logger logger = LoggerFactory.getLogger(SniroConductorRequest.class); @JsonProperty("release-locks") private List<Resource> resources = new ArrayList<Resource>(); @@ -55,7 +57,7 @@ public class SniroConductorRequest implements Serializable{ try{ json = ow.writeValueAsString(this); }catch (Exception e){ - log.error("Unable to convert SniroConductorRequest to string", e); + logger.error("Unable to convert SniroConductorRequest to string", e); } return json; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java index 3c39456318..c1e376814f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -22,20 +24,19 @@ package org.onap.so.client.sniro.beans; import java.io.Serializable; -import org.onap.so.logger.MsoLogger; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRawValue; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SniroManagerRequest implements Serializable{ private static final long serialVersionUID = -1541132882892163132L; - private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroManagerRequest.class); + private static final Logger logger = LoggerFactory.getLogger(SniroManagerRequest.class); @JsonProperty("requestInfo") private RequestInfo requestInformation; @@ -82,7 +83,7 @@ public class SniroManagerRequest implements Serializable{ try{ json = ow.writeValueAsString(this); }catch (Exception e){ - log.error("Unable to convert SniroManagerRequest to string", e); + logger.error("Unable to convert SniroManagerRequest to string", e); } return json.replaceAll("\\\\", ""); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/FileUtil.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/FileUtil.java index e35fe0db9f..366c9c11a9 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/FileUtil.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/FileUtil.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -22,7 +24,8 @@ package org.onap.so; import java.io.IOException; import java.io.InputStream; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -35,7 +38,7 @@ import org.onap.so.logger.MsoLogger; */ public class FileUtil { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, FileUtil.class); + private static final Logger logger = LoggerFactory.getLogger(FileUtil.class); /** * Read the specified resource file and return the contents as a String. @@ -58,7 +61,7 @@ public class FileUtil { return ""; } } catch (IOException e) { - LOGGER.debug("Exception:", e); + logger.debug("Exception:", e); return ""; } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java index 73d7257632..a8a249f386 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -43,6 +43,7 @@ import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; import org.mockito.Mockito; import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.adapters.nwrest.UpdateNetworkResponse; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -456,6 +457,29 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ String neutronSubnetId = createNetworkResponse.getSubnetMap().entrySet().iterator().next().getValue(); assertEquals(neutronSubnetId, network.getSubnets().get(0).getNeutronSubnetId()); } + + @Test + public void updateNetworkUpdatedTest() throws Exception { + UpdateNetworkResponse updateNetworkResponse = new UpdateNetworkResponse(); + updateNetworkResponse.setNeutronNetworkId("testNeutronNetworkId"); + HashMap<String, String> subnetMap = new HashMap<>(); + subnetMap.put("testSubnetId", "testNeutronSubnetId"); + updateNetworkResponse.setSubnetMap(subnetMap); + + network.getSubnets().add(subnet); + + execution.setVariable("updateNetworkResponse", updateNetworkResponse); + + doNothing().when(aaiNetworkResources).updateNetwork(network); + doNothing().when(aaiNetworkResources).updateSubnet(network, subnet); + + aaiUpdateTasks.updateNetworkUpdated(execution); + verify(aaiNetworkResources, times(1)).updateNetwork(network); + verify(aaiNetworkResources, times(1)).updateSubnet(network, subnet); + + String neutronSubnetId = updateNetworkResponse.getSubnetMap().entrySet().iterator().next().getValue(); + assertEquals(neutronSubnetId, network.getSubnets().get(0).getNeutronSubnetId()); + } @Test public void updateOrchestrationStatusNetworkTest() { diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java index 9f2f2fbdcc..478c512b0a 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; @@ -39,6 +40,8 @@ import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.onap.so.adapters.nwrest.CreateNetworkRequest; +import org.onap.so.adapters.nwrest.UpdateNetworkRequest; import org.onap.so.adapters.nwrest.UpdateNetworkResponse; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -83,35 +86,15 @@ public class NetworkAdapterUpdateTasksTest extends BaseTaskTest{ @Test public void updateNetworkTest() throws Exception { - UpdateNetworkResponse updateNetworkResponse = new UpdateNetworkResponse(); - updateNetworkResponse.setMessageId("messageId"); - updateNetworkResponse.setNetworkId("networkId"); - Optional<UpdateNetworkResponse> oUpdateNetworkResponse = Optional.of(updateNetworkResponse); - - doReturn(oUpdateNetworkResponse).when(networkAdapterResources).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer); - - networkAdapterUpdateTasks.updateNetwork(execution); - - verify(networkAdapterResources, times(1)).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer); - assertEquals(updateNetworkResponse, execution.getVariable("NetworkAdapterUpdateNetworkResponse")); - } - - @Test - public void updateNetworkNoResponseTest() throws Exception { - doReturn(Optional.empty()).when(networkAdapterResources).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer); - + String cloudRegionPo = "cloudRegionPo"; + UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest(); + execution.setVariable("cloudRegionPo", cloudRegionPo); + + doReturn(updateNetworkRequest).when(networkAdapterObjectMapper).createNetworkUpdateRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(Customer.class)); networkAdapterUpdateTasks.updateNetwork(execution); - - verify(networkAdapterResources, times(1)).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer); - assertNull(execution.getVariable("NetworkAdapterUpdateNetworkResponse")); + verify(networkAdapterObjectMapper, times(1)).createNetworkUpdateRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer); + assertEquals(updateNetworkRequest, execution.getVariable("networkAdapterRequest")); } - @Test - public void updateNetworkExceptionTest() throws UnsupportedEncodingException, NetworkAdapterClientException { - expectedException.expect(BpmnError.class); - doThrow(new NetworkAdapterClientException("ERROR")).when(networkAdapterResources).updateNetwork(any(RequestContext.class),any(CloudRegion.class), - any(OrchestrationContext.class),eq(serviceInstance),eq(network),any(Map.class),any(Customer.class)); - doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); - networkAdapterUpdateTasks.updateNetwork(execution); - } + } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtilsTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtilsTest.java new file mode 100644 index 0000000000..125c97109c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtilsTest.java @@ -0,0 +1,88 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.flowspecific.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; +import java.util.Optional; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.onap.so.bpmn.BaseTaskTest; + +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudSite; + +public class CloudSiteCatalogUtilsTest extends BaseTaskTest { + + @InjectMocks + private CloudSiteCatalogUtils cloudSiteCatalogUtils = new CloudSiteCatalogUtils(); + + @Test + public void testGetCloudSiteGetVersion30Test() throws Exception { + CloudSite cloudSite = new CloudSite(); + String testCloudSiteId = "testCloudSiteId"; + cloudSite.setClli(testCloudSiteId); + doReturn(cloudSite).when(catalogDbClient).getCloudSite(testCloudSiteId); + Optional<CloudSite> actualCloudSite = cloudSiteCatalogUtils.getCloudSite(testCloudSiteId); + assertEquals(actualCloudSite.get().getClli(), testCloudSiteId); + } + + @Test + public void testGetCloudSiteGetVersion25Test() throws Exception { + CloudSite cloudSite = new CloudSite(); + String testCloudSiteId = "testCloudSiteId"; + cloudSite.setClli(testCloudSiteId); + doReturn(null).when(catalogDbClient).getCloudSite(testCloudSiteId); + doReturn(cloudSite).when(catalogDbClient).getCloudSiteByClliAndAicVersion(testCloudSiteId, "2.5"); + Optional<CloudSite> actualCloudSite = cloudSiteCatalogUtils.getCloudSite(testCloudSiteId); + assertEquals(actualCloudSite.get().getClli(), testCloudSiteId); + } + + @Test + public void testGetIdentityUrlFromCloudSiteSuccessTest() throws Exception { + CloudSite cloudSite = new CloudSite(); + String testCloudSiteId = "testCloudSiteId"; + String testIdentityUrl = "testIdentityUrl"; + delegateExecution.setVariable("lcpCloudRegionId", testCloudSiteId); + cloudSite.setClli(testCloudSiteId); + CloudIdentity cloudIdentity = new CloudIdentity(); + cloudIdentity.setIdentityUrl(testIdentityUrl); + cloudSite.setIdentityService(cloudIdentity); + doReturn(cloudSite).when(catalogDbClient).getCloudSite(testCloudSiteId); + cloudSiteCatalogUtils.getIdentityUrlFromCloudSite(delegateExecution); + String actualIdentityUrl = (String) delegateExecution.getVariable("identityUrl"); + assertEquals(testIdentityUrl, actualIdentityUrl); + } + + @Test + public void testGetIdentityUrlFromCloudSiteNoCloudIdProvidedTest() throws Exception { + CloudSite cloudSite = new CloudSite(); + String testCloudSiteId = "testCloudSiteId"; + String testIdentityUrl = "testIdentityUrl"; + cloudSite.setClli(testCloudSiteId); + CloudIdentity cloudIdentity = new CloudIdentity(); + cloudIdentity.setIdentityUrl(testIdentityUrl); + cloudSite.setIdentityService(cloudIdentity); + doReturn(cloudSite).when(catalogDbClient).getCloudSite(testCloudSiteId); + cloudSiteCatalogUtils.getIdentityUrlFromCloudSite(delegateExecution); + String actualIdentityUrl = (String) delegateExecution.getVariable("identityUrl"); + assertEquals(null, actualIdentityUrl); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java index 59fad5cdd6..c4129a3b96 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java @@ -39,7 +39,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.json.JSONArray; import org.json.JSONObject; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource; @@ -211,13 +210,13 @@ public class SniroHomingV2IT extends BaseIntegrationTest{ JSONObject asyncResponse = new JSONObject(); asyncResponse.put("transactionId", "testRequestId").put("requestId", "testRequestId").put("requestState", "completed"); JSONArray solution1 = new JSONArray(); - solution1.put(new JSONObject().put("serviceResourceId", "testProxyId1").put("inventoryType", "service").put("solution", new JSONObject() + solution1.put(new JSONObject().put("serviceResourceId", "testProxyId1").put("solution", new JSONObject() .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId1"))) .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False")) .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName1")) .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli1")).put(new JSONObject().put("key", "aicVersion").put("value", "3")) .put(new JSONObject().put("key", "vnfId").put("value", "testVnfId1")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testSloudRegionId1")))); - solution1.put(new JSONObject().put("serviceResourceId", "testProxyId2").put("inventoryType", "service").put("solution", new JSONObject() + solution1.put(new JSONObject().put("serviceResourceId", "testProxyId2").put("solution", new JSONObject() .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId2"))) .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False")) .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "primaryPnfName").put("value", "testPrimaryPnfName2")) @@ -255,13 +254,13 @@ public class SniroHomingV2IT extends BaseIntegrationTest{ JSONObject asyncResponse = new JSONObject(); asyncResponse.put("transactionId", "testRequestId").put("requestId", "testRequestId").put("requestState", "completed"); JSONArray solution1 = new JSONArray(); - solution1.put(new JSONObject().put("serviceResourceId", "testProxyId1").put("inventoryType", "service").put("solution", new JSONObject() + solution1.put(new JSONObject().put("serviceResourceId", "testProxyId1").put("solution", new JSONObject() .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId1"))) .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False")) .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName1")) .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli1")).put(new JSONObject().put("key", "aicVersion").put("value", "3")) .put(new JSONObject().put("key", "vnfId").put("value", "testVnfId1")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testSloudRegionId1")))); - solution1.put(new JSONObject().put("serviceResourceId", "testProxyId2").put("inventoryType", "service").put("solution", new JSONObject() + solution1.put(new JSONObject().put("serviceResourceId", "testProxyId2").put("solution", new JSONObject() .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId2"))) .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False")) .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "primaryPnfName").put("value", "testPrimaryPnfName2")) @@ -269,13 +268,13 @@ public class SniroHomingV2IT extends BaseIntegrationTest{ .put(new JSONObject().put("key", "secondaryPnfName").put("value", "testSecondaryPnfName2")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testSloudRegionId2")))); JSONArray solution2 = new JSONArray(); - solution2.put(new JSONObject().put("serviceResourceId", "testProxyId1").put("inventoryType", "service").put("solution", new JSONObject() + solution2.put(new JSONObject().put("serviceResourceId", "testProxyId1").put("solution", new JSONObject() .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId3"))) .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False")) .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName3")) .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli3")).put(new JSONObject().put("key", "aicVersion").put("value", "3")) .put(new JSONObject().put("key", "vnfId").put("value", "testVnfId3")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testSloudRegionId3")))); - solution2.put(new JSONObject().put("serviceResourceId", "testProxyId2").put("inventoryType", "service").put("solution", new JSONObject() + solution2.put(new JSONObject().put("serviceResourceId", "testProxyId2").put("solution", new JSONObject() .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId4"))) .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False")) .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "primaryPnfName").put("value", "testPrimaryPnfName4")) @@ -335,19 +334,19 @@ public class SniroHomingV2IT extends BaseIntegrationTest{ JSONObject asyncResponse = new JSONObject(); asyncResponse.put("transactionId", "testRequestId").put("requestId", "testRequestId").put("requestState", "completed"); JSONArray solution1 = new JSONArray(); - solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId1").put("inventoryType", "service").put("solution", new JSONObject() + solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId1").put("solution", new JSONObject() .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId1"))) .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "True")) .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName1")) .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli1")).put(new JSONObject().put("key", "aicVersion").put("value", "3")) .put(new JSONObject().put("key", "vnfId").put("value", "testVnfId1")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testCloudRegionId1")))); - solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId2").put("inventoryType", "service").put("solution", new JSONObject() + solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId2").put("solution", new JSONObject() .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId2"))) .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "True")) .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName2")) .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli2")).put(new JSONObject().put("key", "aicVersion").put("value", "3")) .put(new JSONObject().put("key", "vnfId").put("value", "testVnfId1")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testCloudRegionId2")))); - solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId3").put("inventoryType", "cloud").put("solution", new JSONObject() + solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId3").put("solution", new JSONObject() .put("identifierType", "cloudRegionId").put("identifiers", new JSONArray().put("testCloudRegionId3"))) .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "True")) .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")) @@ -387,19 +386,19 @@ public class SniroHomingV2IT extends BaseIntegrationTest{ asyncResponse.put("transactionId", "testRequestId").put("requestId", "testRequestId").put("requestState", "completed"); JSONArray solution1 = new JSONArray(); JSONArray licenseSolution = new JSONArray(); - solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId1").put("inventoryType", "service").put("solution", new JSONObject() + solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId1").put("solution", new JSONObject() .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId1"))) .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "True")) .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName1")) .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli1")).put(new JSONObject().put("key", "aicVersion").put("value", "3")) .put(new JSONObject().put("key", "vnfId").put("value", "testVnfId1")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testCloudRegionId1")))); - solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId2").put("inventoryType", "service").put("solution", new JSONObject() + solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId2").put("solution", new JSONObject() .put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId2"))) .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "True")) .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName2")) .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli2")).put(new JSONObject().put("key", "aicVersion").put("value", "3")) .put(new JSONObject().put("key", "vnfId").put("value", "testVnfId1")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testCloudRegionId2")))); - solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId3").put("inventoryType", "cloud").put("solution", new JSONObject() + solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId3").put("solution", new JSONObject() .put("identifierType", "cloudRegionId").put("identifiers", new JSONArray().put("testCloudRegionId3"))) .put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "True")) .put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "aicClli").put("value", "testAicClli2")) diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java index 339e9cbf17..5169663add 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java @@ -72,7 +72,6 @@ public class VnfAdapterObjectMapperTest { } @Test - @Ignore public void test_createVolumeGroupRequestMapper() throws Exception { RequestContext requestContext = new RequestContext(); requestContext.setMsoRequestId("msoRequestId"); @@ -123,7 +122,7 @@ public class VnfAdapterObjectMapperTest { expectedCreateVolumeGroupRequest.setVfModuleType(volumeGroup.getModelInfoVfModule().getModelName()); expectedCreateVolumeGroupRequest.setModelCustomizationUuid(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID()); - Map<String, String> volumeGroupParams = new HashMap<>(); + Map<String, Object> volumeGroupParams = new HashMap<>(); volumeGroupParams.put("vnf_id", genericVnf.getVnfId()); volumeGroupParams.put("vnf_name", genericVnf.getVnfName()); volumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId()); @@ -201,7 +200,7 @@ public class VnfAdapterObjectMapperTest { expectedCreateVolumeGroupRequest.setVfModuleType(volumeGroup.getModelInfoVfModule().getModelName()); expectedCreateVolumeGroupRequest.setModelCustomizationUuid(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID()); - Map<String, String> volumeGroupParams = new HashMap<>(); + Map<String, Object> volumeGroupParams = new HashMap<>(); volumeGroupParams.put("vnf_id", genericVnf.getVnfId()); volumeGroupParams.put("vnf_name", genericVnf.getVnfName()); volumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId()); @@ -285,7 +284,6 @@ public class VnfAdapterObjectMapperTest { } @Test - @Ignore public void test_createVolumeGroupParams() throws Exception { GenericVnf genericVnf = new GenericVnf(); genericVnf.setVnfId("vnfId"); @@ -308,7 +306,7 @@ public class VnfAdapterObjectMapperTest { expectedVolumeGroupParams.put("paramTwo", "paramTwoValue"); expectedVolumeGroupParams.put("paramThree", "paramThreeValue"); - Map<String, String> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, sdncVfModuleQueryResponse); + Map<String, Object> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, sdncVfModuleQueryResponse); assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams); } @@ -329,13 +327,12 @@ public class VnfAdapterObjectMapperTest { expectedVolumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId()); expectedVolumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName()); RequestContext requestContext = new RequestContext(); - Map<String, String> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, null); + Map<String, Object> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, null); assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams); } @Test - @Ignore public void test_createVolumeGroupParams_with_user_params() throws Exception { GenericVnf genericVnf = new GenericVnf(); genericVnf.setVnfId("vnfId"); @@ -366,7 +363,7 @@ public class VnfAdapterObjectMapperTest { expectedVolumeGroupParams.put("paramThree", "paramThreeValue"); expectedVolumeGroupParams.put("userParamKey", "userParamValue"); - Map<String, String> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, sdncVfModuleQueryResponse); + Map<String, Object> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, sdncVfModuleQueryResponse); assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java index a156c382d1..00e5c10f73 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java @@ -76,7 +76,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest { serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); + Map<String, Object> userParams = new HashMap<>(); userParams.put("key1", "value2"); requestContext.setMsoRequestId("requestId"); requestContext.setUserParams(userParams); @@ -150,7 +150,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest { serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); + Map<String, Object> userParams = new HashMap<>(); userParams.put("key1", "value2"); requestContext.setMsoRequestId("requestId"); requestContext.setUserParams(userParams); @@ -223,7 +223,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest { serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); + Map<String, Object> userParams = new HashMap<>(); userParams.put("key1", "value2"); requestContext.setMsoRequestId("requestId"); requestContext.setUserParams(userParams); @@ -295,7 +295,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest { // RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); + Map<String, Object> userParams = new HashMap<>(); userParams.put("key1", "value2"); requestContext.setMsoRequestId("requestId"); requestContext.setUserParams(userParams); @@ -375,7 +375,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest { // RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); + Map<String, Object> userParams = new HashMap<>(); userParams.put("key1", "value2"); requestContext.setMsoRequestId("requestId"); requestContext.setUserParams(userParams); @@ -450,7 +450,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest { serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); + Map<String, Object> userParams = new HashMap<>(); userParams.put("key1", "value2"); requestContext.setMsoRequestId("requestId"); requestContext.setUserParams(userParams); @@ -521,7 +521,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest { serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); + Map<String, Object> userParams = new HashMap<>(); userParams.put("key1", "value1"); requestContext.setMsoRequestId("requestId"); requestContext.setUserParams(userParams); @@ -591,7 +591,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest { serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); + Map<String, Object> userParams = new HashMap<>(); userParams.put("key1", "value1"); requestContext.setMsoRequestId("requestId"); requestContext.setUserParams(userParams); @@ -661,7 +661,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest { serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); + Map<String, Object> userParams = new HashMap<>(); userParams.put("key1", "value1"); requestContext.setMsoRequestId("requestId"); requestContext.setUserParams(userParams); @@ -798,7 +798,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest { serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); + Map<String, Object> userParams = new HashMap<>(); userParams.put("key1", "value1"); requestContext.setMsoRequestId("requestId"); requestContext.setUserParams(userParams); @@ -853,7 +853,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest { String json = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "grApiVmNetworkSubSectionWith5GParams.json"))); GenericResourceApiVmNetworkData network = omapper.readValue(json, GenericResourceApiVmNetworkData.class); - Map<String, String> paramsMap = new HashMap<>(); + Map<String, Object> paramsMap = new HashMap<>(); vfModuleObjectMapper.buildVlanInformation(paramsMap, network, "testKey", "testType"); assertEquals("1,3", paramsMap.get("testKey_testType_private_vlans")); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java index 160feed426..81d30e33c5 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java @@ -67,7 +67,7 @@ public class VnfAdapterVfModuleObjectMapperTest { @Test public void addPairToMapTest() { - Map<String, String> map = new HashMap<>(); + Map<String, Object> map = new HashMap<>(); mapper.addPairToMap(map, "test", "_key", Arrays.asList("a", "b")); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java index 4d90a3fcc9..0023066949 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java @@ -22,9 +22,7 @@ package org.onap.so.client.orchestration; import static org.junit.Assert.assertNotNull; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.isA; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.times; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import java.net.URI; @@ -35,10 +33,11 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; +import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; @@ -47,19 +46,17 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.SDNCClient; -import org.onap.so.client.sdnc.endpoint.SDNCTopology; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper; -import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation; - @RunWith(MockitoJUnitRunner.Silent.class) public class SDNCConfigurationResourcesTest extends TestDataSetup{ @InjectMocks private SDNCConfigurationResources sdncConfigurationResources = new SDNCConfigurationResources(); - @Spy - GCTopologyOperationRequestMapper MOCK_gcTopologyMapper ; + @Mock + private GCTopologyOperationRequestMapper MOCK_gcTopologyMapper ; @Mock protected SDNCClient MOCK_sdncClient; @@ -82,24 +79,34 @@ public class SDNCConfigurationResourcesTest extends TestDataSetup{ @Test public void activateVnrConfigurationTest() throws BadResponseException, MapperException, URISyntaxException { GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.activateVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf,"uuid",new URI("http://localhost")); - assertNotNull(response); + verify(MOCK_gcTopologyMapper).assignOrActivateVnrReqMapper( + eq(SDNCSvcAction.ACTIVATE), eq(GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE), + eq(serviceInstance), eq(requestContext), eq(customer), any(Configuration.class), any(GenericVnf.class), any(String.class), any(URI.class)); + } @Test public void assignVnrConfigurationTest() throws BadResponseException, MapperException, URISyntaxException { GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.assignVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf,"uuid",new URI("http://localhost")); - assertNotNull(response); + verify(MOCK_gcTopologyMapper).assignOrActivateVnrReqMapper( + eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE), + eq(serviceInstance), eq(requestContext), eq(customer), any(Configuration.class), any(GenericVnf.class), any(String.class), any(URI.class)); + } @Test public void unAssignVnrConfigurationTest() throws BadResponseException, MapperException , URISyntaxException{ GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.unAssignVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration(),"uuid",new URI("http://localhost")); - assertNotNull(response); + verify(MOCK_gcTopologyMapper).deactivateOrUnassignVnrReqMapper( + eq(SDNCSvcAction.UNASSIGN), eq(serviceInstance), eq(requestContext), any(Configuration.class), any(String.class), any(URI.class)); + } @Test public void deactivateVnrConfigurationTest() throws BadResponseException, MapperException , URISyntaxException{ GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.deactivateVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration(),"uuid",new URI("http://localhost")); - assertNotNull(response); + verify(MOCK_gcTopologyMapper).deactivateOrUnassignVnrReqMapper( + eq(SDNCSvcAction.DEACTIVATE), eq(serviceInstance), eq(requestContext), any(Configuration.class), any(String.class), any(URI.class)); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java index f01eeaeae8..f4d442bbc3 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java @@ -24,9 +24,15 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.List; +import java.util.Map; import org.junit.Assert; import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation; import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -38,11 +44,14 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.sdnc.beans.SDNCSvcAction; -import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation; - - -public class GCTopologyOperationRequestMapperTest extends TestDataSetup{ +@RunWith(MockitoJUnitRunner.Silent.class) +public class GCTopologyOperationRequestMapperTest extends TestDataSetup { + + @Spy + private GeneralTopologyObjectMapper generalTopologyObjectMapper; + + @InjectMocks private GCTopologyOperationRequestMapper genObjMapper = new GCTopologyOperationRequestMapper(); @Test @@ -80,13 +89,13 @@ public class GCTopologyOperationRequestMapperTest extends TestDataSetup{ private RequestContext getRequestContext() { RequestContext requestContext = new RequestContext(); requestContext.setMsoRequestId("MsoRequestId"); - HashMap<String, String> userParams = getUserParams(); + Map<String, Object> userParams = getUserParams(); requestContext.setUserParams(userParams); return requestContext; } - private HashMap<String, String> getUserParams() { - HashMap<String,String> userParams = new HashMap<>(); + private Map<String, Object> getUserParams() { + Map<String,Object> userParams = new HashMap<>(); userParams.put("lppCustomerId","lppCustomerId"); return userParams; } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java index bf2cd347c0..3bb54278b6 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java @@ -29,6 +29,7 @@ import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import java.util.HashMap; +import java.util.Map; import org.junit.After; import org.junit.Before; @@ -104,7 +105,7 @@ public class GeneralTopologyObjectMapperTest extends TestDataSetup { customer.getServiceSubscription().getServiceInstances().add(serviceInstance); // RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); + Map<String, Object> userParams = new HashMap<>(); userParams.put("key1", "value1"); requestContext.setUserParams(userParams); requestContext.setProductFamilyId("productFamilyId"); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java index 307fe289a1..6a14f8b567 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java @@ -29,9 +29,16 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.HashMap; +import java.util.Map; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; @@ -45,10 +52,9 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; import com.fasterxml.jackson.databind.ObjectMapper; +@RunWith(MockitoJUnitRunner.class) public class NetworkTopologyOperationRequestMapperTest { private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; @@ -59,6 +65,12 @@ public class NetworkTopologyOperationRequestMapperTest { private RequestContext requestContext; private L3Network network; private CloudRegion cloudRegion; + + @Spy + private GeneralTopologyObjectMapper generalTopologyObjectMapper; + + @InjectMocks + private NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper(); @Before public void before() { @@ -93,7 +105,7 @@ public class NetworkTopologyOperationRequestMapperTest { serviceInstance.setCollection(networkCollection); // requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); + Map<String, Object> userParams = new HashMap<>(); userParams.put("key1", "value1"); requestContext.setUserParams(userParams); requestContext.setProductFamilyId("productFamilyId"); @@ -115,7 +127,6 @@ public class NetworkTopologyOperationRequestMapperTest { @Test public void createGenericResourceApiNetworkOperationInformationTest() throws Exception { - NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper(); GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper( SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); @@ -132,7 +143,6 @@ public class NetworkTopologyOperationRequestMapperTest { @Test public void reqMapperTest() throws Exception { - NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper(); GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper( SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); @@ -143,7 +153,6 @@ public class NetworkTopologyOperationRequestMapperTest { @Test public void reqMapperNoCollectionTest() throws Exception { - NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper(); GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper( SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstanceNoCollection, customer, requestContext, cloudRegion); @@ -154,7 +163,7 @@ public class NetworkTopologyOperationRequestMapperTest { @Test public void createGenericResourceApiNetworkOperationInformation_UnassignTest() throws Exception { - NetworkTopologyOperationRequestMapper mapperUnassign = new NetworkTopologyOperationRequestMapper(); + NetworkTopologyOperationRequestMapper mapperUnassign = mapper; GenericResourceApiNetworkOperationInformation networkSDNCrequestUnassign = mapperUnassign.reqMapper( SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); @@ -172,7 +181,6 @@ public class NetworkTopologyOperationRequestMapperTest { @Test public void createGenericResourceApiNetworkOperationInformationNoNetworkNameTest() throws Exception { - NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper(); //set network name NULL network.setNetworkName(null); GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper( diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java index 5d8b31b3bf..0bf06a0bb0 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java @@ -26,8 +26,13 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import java.nio.file.Files; import java.nio.file.Paths; import java.util.HashMap; +import java.util.Map; import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; @@ -41,8 +46,15 @@ import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnum import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; import com.fasterxml.jackson.databind.ObjectMapper; +@RunWith(MockitoJUnitRunner.class) public class ServiceTopologyOperationMapperTest { + @Spy + private GeneralTopologyObjectMapper generalTopologyObjectMapper; + + @InjectMocks + private ServiceTopologyOperationMapper mapper = new ServiceTopologyOperationMapper(); + @Test public void reqMapperTest() throws Exception { // prepare and set service instance @@ -64,12 +76,11 @@ public class ServiceTopologyOperationMapperTest { //prepare RequestContext RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); + Map<String, Object> userParams = new HashMap<>(); userParams.put("key1", "value1"); requestContext.setUserParams(userParams); requestContext.setProductFamilyId("productFamilyId"); - ServiceTopologyOperationMapper mapper = new ServiceTopologyOperationMapper(); GenericResourceApiServiceOperationInformation serviceOpInformation = mapper.reqMapper( SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, requestContext); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java index 7d5aa9d1d9..282f23caa7 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java @@ -35,6 +35,10 @@ import java.util.Map; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -54,11 +58,18 @@ import org.onap.so.client.sdnc.beans.SDNCSvcOperation; import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; import com.fasterxml.jackson.databind.ObjectMapper; +@RunWith(MockitoJUnitRunner.class) public class VfModuleTopologyOperationRequestMapperTest { private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; private final static String ERRORMESSAGE = "VF Module model info is null for testVfModuleId"; + @Spy + private GeneralTopologyObjectMapper generalTopologyObjectMapper; + + @InjectMocks + private VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper(); + @Rule public ExpectedException expectedException = ExpectedException.none(); @@ -84,7 +95,7 @@ public class VfModuleTopologyOperationRequestMapperTest { customer.getServiceSubscription().getServiceInstances().add(serviceInstance); // RequestContext requestContext = new RequestContext(); - HashMap<String,String> userParams = new HashMap<String,String>(); + Map<String,Object> userParams = new HashMap<>(); userParams.put("key1", "value1"); requestContext.setUserParams(userParams); requestContext.setProductFamilyId("productFamilyId"); @@ -124,7 +135,6 @@ public class VfModuleTopologyOperationRequestMapperTest { CloudRegion cloudRegion = new CloudRegion(); - VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper(); GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper( SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null); @@ -159,7 +169,6 @@ public class VfModuleTopologyOperationRequestMapperTest { vfModule.setVfModuleId("testVfModuleId"); vfModule.setVfModuleName("testVfModuleName"); - VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper(); GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper( SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, null, null); @@ -197,9 +206,9 @@ public class VfModuleTopologyOperationRequestMapperTest { // RequestContext requestContext = new RequestContext(); RequestParameters requestParameters = new RequestParameters(); - HashMap<String,Object> userParams1 = new HashMap<String,Object>(); + HashMap<String,Object> userParams1 = new HashMap<>(); userParams1.put("key1", "value1"); - List<Map<String,Object>> userParams = new ArrayList<Map<String,Object>>(); + List<Map<String,Object>> userParams = new ArrayList<>(); userParams.add(userParams1); requestParameters.setUserParams(userParams); @@ -230,7 +239,6 @@ public class VfModuleTopologyOperationRequestMapperTest { CloudRegion cloudRegion = new CloudRegion(); - VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper(); GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper( SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext, null); @@ -261,7 +269,7 @@ public class VfModuleTopologyOperationRequestMapperTest { customer.getServiceSubscription().getServiceInstances().add(serviceInstance); // RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); + Map<String, Object> userParams = new HashMap<String, Object>(); userParams.put("key1", "value1"); requestContext.setUserParams(userParams); requestContext.setProductFamilyId("productFamilyId"); @@ -284,7 +292,6 @@ public class VfModuleTopologyOperationRequestMapperTest { CloudRegion cloudRegion = new CloudRegion(); - VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper(); expectedException.expect(MapperException.class); expectedException.expectMessage(ERRORMESSAGE); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java index 63c3680e8c..229a8cf601 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java @@ -25,9 +25,14 @@ import static org.junit.Assert.assertNull; import java.util.ArrayList; import java.util.HashMap; +import java.util.Map; import java.util.List; import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -45,8 +50,15 @@ import org.onap.so.client.sdnc.beans.SDNCSvcOperation; import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; +@RunWith(MockitoJUnitRunner.class) public class VnfTopologyOperationRequestMapperTest { + @Spy + private GeneralTopologyObjectMapper generalTopologyObjectMapper; + + @InjectMocks + private VnfTopologyOperationRequestMapper mapper = new VnfTopologyOperationRequestMapper(); + @Test public void reqMapperTest() throws Exception { // prepare and set service instance @@ -106,14 +118,13 @@ public class VnfTopologyOperationRequestMapperTest { //prepare RequestContext RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); + Map<String, Object> userParams = new HashMap<>(); userParams.put("key1", "value1"); requestContext.setUserParams(userParams); requestContext.setProductFamilyId("productFamilyId"); CloudRegion cloudRegion = new CloudRegion(); - VnfTopologyOperationRequestMapper mapper = new VnfTopologyOperationRequestMapper(); GenericResourceApiVnfOperationInformation vnfOpInformation = mapper.reqMapper( SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext,true); diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java index 2595ddcbcd..247afb3124 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -53,7 +55,6 @@ import org.onap.so.cloudify.base.client.CloudifyConnectException; import org.onap.so.cloudify.base.client.CloudifyRequest; import org.onap.so.cloudify.base.client.CloudifyResponse; import org.onap.so.cloudify.base.client.CloudifyResponseException; -import org.onap.so.logger.MsoLogger; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonRootName; @@ -61,13 +62,15 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class HttpClientConnector implements CloudifyClientConnector { private static ObjectMapper DEFAULT_MAPPER; private static ObjectMapper WRAPPED_MAPPER; - private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, HttpClientConnector.class); + private static Logger logger = LoggerFactory.getLogger(HttpClientConnector.class); static { DEFAULT_MAPPER = new ObjectMapper(); @@ -141,7 +144,8 @@ public class HttpClientConnector implements CloudifyClientConnector { String entityJson = mapper.writeValueAsString (request.entity().getEntity()); entity = new StringEntity(entityJson, ContentType.create(request.entity().getContentType())); - LOGGER.debug ("Request JSON Body: " + entityJson.replaceAll("\"password\":\"[^\"]*\"", "\"password\":\"***\"")); + logger.debug ("Request JSON Body: {}", entityJson.replaceAll("\"password\":\"[^\"]*\"", + "\"password\":\"***\"")); } catch (JsonProcessingException e) { throw new HttpClientException ("Json processing error on request entity", e); @@ -198,7 +202,7 @@ public class HttpClientConnector implements CloudifyClientConnector { try { httpResponse = httpClient.execute(httpRequest); - LOGGER.debug ("Response status: " + httpResponse.getStatusLine().getStatusCode()); + logger.debug ("Response status: {}", httpResponse.getStatusLine().getStatusCode()); httpClientResponse = new HttpClientResponse (httpResponse); @@ -223,7 +227,7 @@ public class HttpClientConnector implements CloudifyClientConnector { } catch (Exception e) { // Catchall for anything else, must throw as a RuntimeException - LOGGER.error("Client exception", e); + logger.error("Client exception", e); throw new RuntimeException("Unexpected client exception", e); } finally { @@ -232,7 +236,7 @@ public class HttpClientConnector implements CloudifyClientConnector { try { httpResponse.close(); } catch (IOException e) { - LOGGER.debug("Unable to close HTTP Response: " + e); + logger.debug("Unable to close HTTP Response: " + e); } } diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java index 0c1743fc5f..b9e7851c98 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -25,7 +27,8 @@ import org.apache.http.HttpResponse; import com.fasterxml.jackson.databind.ObjectMapper; import org.onap.so.cloudify.base.client.CloudifyResponse; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -36,7 +39,7 @@ import java.util.Map; public class HttpClientResponse implements CloudifyResponse { - private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, HttpClientResponse.class); + private static Logger logger = LoggerFactory.getLogger(HttpClientResponse.class); private HttpResponse response = null; private String entityBody = null; @@ -47,9 +50,9 @@ public class HttpClientResponse implements CloudifyResponse { // Read the body so InputStream can be closed if (response.getEntity() == null) { - // No body - LOGGER.debug ("No Response Body"); - return; + // No body + logger.debug("No Response Body"); + return; } ByteArrayOutputStream responseBody = new ByteArrayOutputStream(); @@ -59,7 +62,7 @@ public class HttpClientResponse implements CloudifyResponse { throw new HttpClientException ("Error Reading Response Body", e); } entityBody = responseBody.toString(); - LOGGER.debug (entityBody); + logger.debug(entityBody); } @@ -94,7 +97,7 @@ public class HttpClientResponse implements CloudifyResponse { @Override public Map<String, String> headers() { - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); Header responseHeaders[] = response.getAllHeaders(); for (Header h : responseHeaders) { diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java index b6bfda159d..ea241aa074 100644 --- a/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java @@ -41,8 +41,6 @@ public class ServiceInstancesRequest implements Serializable { private String vfModuleInstanceId; @JsonProperty("configurationId") private String configurationId; - @JsonProperty("correlationId") - private String correlationId; @JsonProperty("instanceGroupId") private String instanceGroupId; @@ -102,14 +100,6 @@ public class ServiceInstancesRequest implements Serializable { this.configurationId = configurationId; } - public String getCorrelationId() { - return correlationId; - } - - public void setCorrelationId(String correlationId) { - this.correlationId = correlationId; - } - public String getInstanceGroupId() { return instanceGroupId; } @@ -128,7 +118,6 @@ public class ServiceInstancesRequest implements Serializable { sb.append(", volumeGroupInstanceId='").append(volumeGroupInstanceId).append('\''); sb.append(", vfModuleInstanceId='").append(vfModuleInstanceId).append('\''); sb.append(", configurationId='").append(configurationId).append('\''); - sb.append(", correlationId='").append(correlationId).append('\''); sb.append('}'); return sb.toString(); } diff --git a/common/src/test/java/org/onap/so/client/grm/exception/GRMClientCallFailedTest.java b/common/src/test/java/org/onap/so/client/grm/exception/GRMClientCallFailedTest.java new file mode 100644 index 0000000000..989a753800 --- /dev/null +++ b/common/src/test/java/org/onap/so/client/grm/exception/GRMClientCallFailedTest.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 IBM. + * ================================================================================ + * 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.grm.exception; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.so.client.grm.exceptions.GRMClientCallFailed; + +public class GRMClientCallFailedTest { + + @Test + public void testGRMClientCallFailedException() { + GRMClientCallFailed gRMClientCallFailed = new GRMClientCallFailed("failed", new Throwable("throwable")); + assertEquals("failed", gRMClientCallFailed.getMessage()); + assertEquals("throwable", gRMClientCallFailed.getCause().getMessage()); + } + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java index 829f8ce30c..7e9eed32b1 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java @@ -35,7 +35,7 @@ import com.fasterxml.jackson.annotation.JsonRootName; CommonConstants.REQUEST_ID_HEADER, CommonConstants.IS_BASE_VF_MODULE_VARIABLE, CommonConstants.RECIPE_TIMEOUT_VARIABLE, CommonConstants.REQUEST_ACTION_VARIABLE, CommonConstants.SERVICE_INSTANCE_ID_VARIABLE, - CommonConstants.CORRELATION_ID, CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE, + CommonConstants.PNF_CORRELATION_ID, CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE, CommonConstants.VOLUME_GROUP_ID_VARIABLE, CommonConstants.NETWORK_ID_VARIABLE, CommonConstants.CONFIGURATION_ID_VARIABLE, CommonConstants.SERVICE_TYPE_VARIABLE, CommonConstants.VNF_TYPE_VARIABLE, CommonConstants.VF_MODULE_TYPE_VARIABLE, @@ -68,8 +68,8 @@ public class CamundaVIDRequest { @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE) private CamundaInput serviceInstanceId; - @JsonProperty(CommonConstants.CORRELATION_ID) - private CamundaInput correlationId; + @JsonProperty(CommonConstants.PNF_CORRELATION_ID) + private CamundaInput pnfCorrelationId; @JsonProperty(CommonConstants.VNF_ID_VARIABLE) private CamundaInput vnfId; @@ -192,14 +192,14 @@ public class CamundaVIDRequest { this.serviceInstanceId = serviceInstanceId; } - @JsonProperty(CommonConstants.CORRELATION_ID) - public CamundaInput getCorrelationId() { - return correlationId; + @JsonProperty(CommonConstants.PNF_CORRELATION_ID) + public CamundaInput getPnfCorrelationId() { + return pnfCorrelationId; } - @JsonProperty(CommonConstants.CORRELATION_ID) - public void setCorrelationId(CamundaInput correlationId) { - this.correlationId = correlationId; + @JsonProperty(CommonConstants.PNF_CORRELATION_ID) + public void setPnfCorrelationId(CamundaInput pnfCorrelationId) { + this.pnfCorrelationId = pnfCorrelationId; } @JsonProperty(CommonConstants.VNF_ID_VARIABLE) diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java index 34cfe18508..d3e8323f37 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java @@ -5,6 +5,7 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2018 IBM. + * Modifications Copyright (c) 2019 Samsung * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,13 +42,15 @@ import org.onap.so.apihandler.camundabeans.CamundaRequest; import org.onap.so.apihandler.camundabeans.CamundaVIDRequest; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.slf4j.MDC; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; public class CamundaClient extends RequestClient{ - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CamundaClient.class); + private static Logger logger = LoggerFactory.getLogger(CamundaClient.class); private static final String CAMUNDA_URL_MESAGE = "Camunda url is: "; public CamundaClient() { @@ -60,19 +63,19 @@ public class CamundaClient extends RequestClient{ String requestTimeout, String schemaVersion, String serviceInstanceId, String action) throws ClientProtocolException, IOException{ HttpPost post = new HttpPost(url); - msoLogger.debug(CAMUNDA_URL_MESAGE + url); + logger.debug(CAMUNDA_URL_MESAGE + url); String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion); StringEntity input = new StringEntity(jsonReq); input.setContentType(CommonConstants.CONTENT_TYPE_JSON); - msoLogger.info("Camunda Request Content: " + jsonReq); + logger.info("Camunda Request Content: {}", jsonReq); post.setEntity(input); setupHeaders(post); HttpResponse response = client.execute(post); - msoLogger.debug("Response is: " + response); + logger.debug("Response is: {}", response); return response; } @@ -98,7 +101,7 @@ public class CamundaClient extends RequestClient{ public HttpResponse post(String jsonReq) throws ClientProtocolException, IOException{ HttpPost post = new HttpPost(url); - msoLogger.debug(CAMUNDA_URL_MESAGE + url); + logger.debug(CAMUNDA_URL_MESAGE + url); StringEntity input = new StringEntity(jsonReq); input.setContentType(CommonConstants.CONTENT_TYPE_JSON); @@ -118,7 +121,7 @@ public class CamundaClient extends RequestClient{ post.setEntity(input); HttpResponse response = client.execute(post); - msoLogger.debug("Response is: " + response); + logger.debug("Response is: {}", response); return response; } @@ -126,9 +129,9 @@ public class CamundaClient extends RequestClient{ public HttpResponse post(RequestClientParameter parameterObject) throws ClientProtocolException, IOException{ HttpPost post = new HttpPost(url); - msoLogger.debug(CAMUNDA_URL_MESAGE+ url); + logger.debug(CAMUNDA_URL_MESAGE+ url); String jsonReq = wrapVIDRequest(parameterObject.getRequestId(), parameterObject.isBaseVfModule(), parameterObject.getRecipeTimeout(), parameterObject.getRequestAction(), - parameterObject.getServiceInstanceId(), parameterObject.getCorrelationId(), parameterObject.getVnfId(), parameterObject.getVfModuleId(), parameterObject.getVolumeGroupId(), parameterObject.getNetworkId(), parameterObject.getConfigurationId(), + parameterObject.getServiceInstanceId(), parameterObject.getPnfCorrelationId(), parameterObject.getVnfId(), parameterObject.getVfModuleId(), parameterObject.getVolumeGroupId(), parameterObject.getNetworkId(), parameterObject.getConfigurationId(), parameterObject.getServiceType(), parameterObject.getVnfType(), parameterObject.getVfModuleType(), parameterObject.getNetworkType(), parameterObject.getRequestDetails(), parameterObject.getApiVersion(), parameterObject.isaLaCarte(), parameterObject.getRequestUri(), parameterObject.getRecipeParamXsd(), parameterObject.getInstanceGroupId()); @@ -151,7 +154,7 @@ public class CamundaClient extends RequestClient{ post.setEntity(input); HttpResponse response = client.execute(post); - msoLogger.debug("Response is: " + response); + logger.debug("Response is: {}", response); return response; } @@ -189,16 +192,17 @@ public class CamundaClient extends RequestClient{ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); jsonReq = mapper.writeValueAsString(camundaRequest); - msoLogger.trace("request body is " + jsonReq); + logger.trace("request body is {}", jsonReq); }catch(Exception e){ - msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request", e); + logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapRequest", + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); } return jsonReq; } protected String wrapVIDRequest(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, String serviceInstanceId, String correlationId, + int recipeTimeout, String requestAction, String serviceInstanceId, String pnfCorrelationId, String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, String serviceType, String vnfType, String vfModuleType, String networkType, String requestDetails, String apiVersion, boolean aLaCarte, String requestUri, String paramXsd, @@ -214,7 +218,7 @@ public class CamundaClient extends RequestClient{ CamundaIntegerInput recipeTimeoutInput = new CamundaIntegerInput(); CamundaInput requestActionInput = new CamundaInput(); CamundaInput serviceInstanceIdInput = new CamundaInput(); - CamundaInput correlationIdInput = new CamundaInput(); + CamundaInput pnfCorrelationIdInput = new CamundaInput(); CamundaInput vnfIdInput = new CamundaInput(); CamundaInput vfModuleIdInput = new CamundaInput(); CamundaInput volumeGroupIdInput = new CamundaInput(); @@ -236,7 +240,7 @@ public class CamundaClient extends RequestClient{ recipeTimeoutInput.setValue(recipeTimeout); requestActionInput.setValue(StringUtils.defaultString(requestAction)); serviceInstanceIdInput.setValue(StringUtils.defaultString(serviceInstanceId)); - correlationIdInput.setValue(StringUtils.defaultString(correlationId)); + pnfCorrelationIdInput.setValue(StringUtils.defaultString(pnfCorrelationId)); vnfIdInput.setValue(StringUtils.defaultString(vnfId)); vfModuleIdInput.setValue(StringUtils.defaultString(vfModuleId)); volumeGroupIdInput.setValue(StringUtils.defaultString(volumeGroupId)); @@ -261,7 +265,7 @@ public class CamundaClient extends RequestClient{ camundaRequest.setRecipeTimeout(recipeTimeoutInput); camundaRequest.setRequestAction(requestActionInput); camundaRequest.setServiceInstanceId(serviceInstanceIdInput); - camundaRequest.setCorrelationId(correlationIdInput); + camundaRequest.setPnfCorrelationId(pnfCorrelationIdInput); camundaRequest.setVnfId(vnfIdInput); camundaRequest.setVfModuleId(vfModuleIdInput); camundaRequest.setVolumeGroupId(volumeGroupIdInput); @@ -281,9 +285,10 @@ public class CamundaClient extends RequestClient{ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); jsonReq = mapper.writeValueAsString(camundaRequest); - msoLogger.trace("request body is " + jsonReq); + logger.trace("request body is {}", jsonReq); }catch(Exception e){ - msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapVIDRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request", e); + logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest", + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); } return jsonReq; } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java index bb0a4b0172..d8c785dcb3 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -28,10 +30,11 @@ import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class CamundaTaskClient extends RequestClient{ - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CamundaTaskClient.class); + private static Logger logger = LoggerFactory.getLogger(CamundaTaskClient.class); public CamundaTaskClient() { super(CommonConstants.CAMUNDATASK); @@ -40,7 +43,7 @@ public class CamundaTaskClient extends RequestClient{ @Override public HttpResponse post(String jsonReq) throws IOException{ HttpPost post = new HttpPost(url); - msoLogger.debug("Camunda Task url is: "+ url); + logger.debug("Camunda Task url is: {}", url); StringEntity input = new StringEntity(jsonReq); input.setContentType(CommonConstants.CONTENT_TYPE_JSON); @@ -75,7 +78,7 @@ public class CamundaTaskClient extends RequestClient{ @Override public HttpResponse get() throws IOException { HttpGet get = new HttpGet(url); - msoLogger.debug("Camunda Task url is: "+ url); + logger.debug("Camunda Task url is: {}", url); String encryptedCredentials; if(props!=null){ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH); diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java index b75ad9e415..24fb0e0d20 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java @@ -54,7 +54,7 @@ public final class CommonConstants { public static final String RECIPE_TIMEOUT_VARIABLE = "recipeTimeout"; public static final String REQUEST_ACTION_VARIABLE = "requestAction"; public static final String SERVICE_INSTANCE_ID_VARIABLE = "serviceInstanceId"; - public static final String CORRELATION_ID = "correlationId"; + public static final String PNF_CORRELATION_ID = "pnfCorrelationId"; public static final String VNF_ID_VARIABLE = "vnfId"; public static final String VF_MODULE_ID_VARIABLE = "vfModuleId"; public static final String VOLUME_GROUP_ID_VARIABLE = "volumeGroupId"; diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java index 4e37561891..ee1ea8e562 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -26,13 +28,14 @@ import java.io.FileNotFoundException; import java.io.InputStream; import java.io.InputStreamReader; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.ls.LSInput; import org.w3c.dom.ls.LSResourceResolver; public class PathResourceResolver implements LSResourceResolver { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, PathResourceResolver.class); + private static Logger logger = LoggerFactory.getLogger(PathResourceResolver.class); private String path; @@ -50,7 +53,7 @@ public class PathResourceResolver implements LSResourceResolver { try { stream = new FileInputStream(path + systemId); } catch (FileNotFoundException e) { - msoLogger.debug ("Could not resolve resource based on file: " + path + systemId, e); + logger.debug ("Could not resolve resource based on file: {}", path + systemId, e); } input.setPublicId(publicId); diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java index ca1ad7a277..9f5c8460a1 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -26,12 +28,13 @@ import java.security.GeneralSecurityException; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.CryptoUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.core.env.Environment; public abstract class RequestClient { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH,RequestClient.class); + private static Logger logger = LoggerFactory.getLogger(RequestClient.class); protected Environment props; protected String url; protected HttpClient client; @@ -80,7 +83,7 @@ public abstract class RequestClient { return result; } catch (GeneralSecurityException e) { - msoLogger.debug("Security exception", e); + logger.debug("Security exception", e); } return defaultValue; } @@ -91,7 +94,7 @@ public abstract class RequestClient { return result; } catch (GeneralSecurityException e) { - msoLogger.debug("Security exception", e); + logger.debug("Security exception", e); } return defaultValue; } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java index 1d18e2b02c..209f337a1e 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java @@ -28,7 +28,7 @@ public class RequestClientParameter { private int recipeTimeout; private String requestAction; private String serviceInstanceId; - private String correlationId; + private String pnfCorrelationId; private String vnfId; private String vfModuleId; private String volumeGroupId; @@ -51,7 +51,7 @@ public class RequestClientParameter { recipeTimeout = builder.recipeTimeout; requestAction = builder.requestAction; serviceInstanceId = builder.serviceInstanceId; - correlationId = builder.correlationId; + pnfCorrelationId = builder.pnfCorrelationId; vnfId = builder.vnfId; vfModuleId = builder.vfModuleId; volumeGroupId = builder.volumeGroupId; @@ -90,8 +90,8 @@ public class RequestClientParameter { return serviceInstanceId; } - public String getCorrelationId() { - return correlationId; + public String getPnfCorrelationId() { + return pnfCorrelationId; } public String getVnfId() { @@ -160,7 +160,7 @@ public class RequestClientParameter { private int recipeTimeout; private String requestAction; private String serviceInstanceId; - private String correlationId; + private String pnfCorrelationId; private String vnfId; private String vfModuleId; private String volumeGroupId; @@ -202,8 +202,8 @@ public class RequestClientParameter { return this; } - public Builder setCorrelationId(String correlationId) { - this.correlationId = correlationId; + public Builder setPnfCorrelationId(String pnfCorrelationId) { + this.pnfCorrelationId = pnfCorrelationId; return this; } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java index 0cac7db404..3d09a30731 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -37,6 +39,8 @@ import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import com.fasterxml.jackson.databind.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ResponseHandler { @@ -45,7 +49,7 @@ public class ResponseHandler { private String responseBody=""; private HttpResponse httpResponse; private int type; - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, ResponseHandler.class); + private static Logger logger = LoggerFactory.getLogger(ResponseHandler.class); public ResponseHandler(HttpResponse httpResponse, int type) throws ApiException{ this.httpResponse = httpResponse; diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java index 414ac8b3cc..da13ff509b 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -35,6 +37,8 @@ import org.apache.commons.io.IOUtils; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.xml.sax.SAXException; public class XMLValidator { @@ -54,7 +58,7 @@ public class XMLValidator { private SchemaFactory factory; private Schema schema; - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, XMLValidator.class); + private static Logger logger = LoggerFactory.getLogger(XMLValidator.class); public XMLValidator (String xsdFile){ @@ -73,7 +77,7 @@ public class XMLValidator { } catch (IOException | SAXException e) { - msoLogger.debug ("Cannot open file " + XSDS_PATH + xsdFile, e); + logger.debug ("Cannot open file {}", XSDS_PATH + xsdFile, e); errorMsg = "ErrorDetails: xsd file " + xsdFile + "could not be opened - " + e.getMessage (); } } @@ -89,11 +93,12 @@ public class XMLValidator { validator.validate (src2); } catch (IOException | SAXException e) { - msoLogger.debug ("Exception: ", e); + logger.debug ("Exception: ", e); return "ErrorDetails: " + e.getMessage (); } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_CANNOT_READ_SCHEMA, "", "", MsoLogger.ErrorCode.SchemaError, "APIH cannot read schema file", e); + logger.error("{} {} {}", MessageEnum.APIH_CANNOT_READ_SCHEMA.toString(), + MsoLogger.ErrorCode.SchemaError.getValue(), "APIH cannot read schema file", e); return "ErrorDetails: " + "Unable to read the schema file"; } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java index d801a94c9b..aeed65b3c3 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -22,7 +24,8 @@ package org.onap.so.apihandler.recipe; import java.io.IOException; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.http.client.ClientHttpResponse; import org.springframework.web.client.ResponseErrorHandler; @@ -31,14 +34,12 @@ import org.springframework.web.client.ResponseErrorHandler; public class CamundaClientErrorHandler implements ResponseErrorHandler{ - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CamundaClientErrorHandler.class); + private static Logger logger = LoggerFactory.getLogger(CamundaClientErrorHandler.class); @Override public void handleError(ClientHttpResponse response) throws IOException { - - msoLogger.debug(response.getBody().toString()); - //msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.ERROR, - // MsoLogger.ResponseCode.CommunicationError, e.getMessage(), "BPMN", fullURL, null); + + logger.debug(response.getBody().toString()); } @Override diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java index ef19852cd1..282ca12e2b 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -48,11 +50,13 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Provider public class ApiExceptionMapper implements ExceptionMapper<ApiException> { - private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ApiExceptionMapper.class); + private static Logger logger = LoggerFactory.getLogger(ApiExceptionMapper.class); private final JAXBContext context; @@ -132,7 +136,8 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> { } } catch (JsonProcessingException | JAXBException e) { String errorMsg = "Exception in buildServiceErrorResponse writing exceptionType to string " + e.getMessage(); - logger.error(MessageEnum.GENERAL_EXCEPTION, "BuildServiceErrorResponse", "", "", MsoLogger.ErrorCode.DataError, errorMsg, e); + logger.error("{} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), "BuildServiceErrorResponse", + MsoLogger.ErrorCode.DataError.getValue(), errorMsg, e); return errorMsg; } @@ -141,7 +146,7 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> { protected void writeErrorLog(Exception e, String errorText, ErrorLoggerInfo errorLogInfo) { if( e!= null) - logger.error(e); + logger.error("Exception occurred", e); if(errorLogInfo != null) logger.error(errorLogInfo.getLoggerMessageType().toString(), errorLogInfo.getErrorSource(), errorLogInfo.getTargetEntity(), errorLogInfo.getTargetServiceName(), errorLogInfo.getErrorCode(), errorText); diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java index 7a03ce0542..0958905720 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java @@ -148,7 +148,7 @@ public class CamundaClientTest{ int recipeTimeout = 10000; String requestAction = "createInstance"; String serviceInstanceId = "12345679"; - String correlationId = "12345679"; + String pnfCorrelationId = "12345679"; String vnfId = "234567891"; String vfModuleId = "345678912"; String volumeGroupId = "456789123"; @@ -164,7 +164,7 @@ public class CamundaClientTest{ String requestUri = "v7/serviceInstances/assign"; String instanceGroupId = "ff305d54-75b4-431b-adb2-eb6b9e5ff000"; - String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, serviceInstanceId, correlationId, + String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, serviceInstanceId, pnfCorrelationId, vnfId, vfModuleId, volumeGroupId, networkId, configurationId, serviceType, vnfType, vfModuleType, networkType, requestDetails, apiVersion, aLaCarte, requestUri, "", instanceGroupId); String expected = inputStream("/WrappedVIDRequest.json"); diff --git a/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json b/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json index 4c716c2ae3..b9d0a8c3c6 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json +++ b/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json @@ -1 +1 @@ -{"variables":{"bpmnRequest":{"value":"{requestDetails: }","type":"String"},"requestId":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"mso-request-id":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"isBaseVfModule":{"value":true,"type":"Boolean"},"recipeTimeout":{"value":10000,"type":"Integer"},"requestAction":{"value":"createInstance","type":"String"},"serviceInstanceId":{"value":"12345679","type":"String"},"correlationId":{"value":"12345679","type":"String"},"vnfId":{"value":"234567891","type":"String"},"vfModuleId":{"value":"345678912","type":"String"},"volumeGroupId":{"value":"456789123","type":"String"},"networkId":{"value":"567891234","type":"String"},"configurationId":{"value":"678912345","type":"String"},"serviceType":{"value":"testService","type":"String"},"vnfType":{"value":"testVnf","type":"String"},"vfModuleType":{"value":"vfModuleType","type":"String"},"networkType":{"value":"networkType","type":"String"},"recipeParams":{"value":"","type":"String"},"host":{"value":null,"type":"String"},"apiVersion":{"value":"6","type":"String"},"aLaCarte":{"value":true,"type":"Boolean"},"requestUri":{"value":"v7/serviceInstances/assign","type":"String"},"instanceGroupId":{"value":"ff305d54-75b4-431b-adb2-eb6b9e5ff000","type":"String"}}}
\ No newline at end of file +{"variables":{"bpmnRequest":{"value":"{requestDetails: }","type":"String"},"requestId":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"mso-request-id":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"isBaseVfModule":{"value":true,"type":"Boolean"},"recipeTimeout":{"value":10000,"type":"Integer"},"requestAction":{"value":"createInstance","type":"String"},"serviceInstanceId":{"value":"12345679","type":"String"},"pnfCorrelationId":{"value":"12345679","type":"String"},"vnfId":{"value":"234567891","type":"String"},"vfModuleId":{"value":"345678912","type":"String"},"volumeGroupId":{"value":"456789123","type":"String"},"networkId":{"value":"567891234","type":"String"},"configurationId":{"value":"678912345","type":"String"},"serviceType":{"value":"testService","type":"String"},"vnfType":{"value":"testVnf","type":"String"},"vfModuleType":{"value":"vfModuleType","type":"String"},"networkType":{"value":"networkType","type":"String"},"recipeParams":{"value":"","type":"String"},"host":{"value":null,"type":"String"},"apiVersion":{"value":"6","type":"String"},"aLaCarte":{"value":true,"type":"Boolean"},"requestUri":{"value":"v7/serviceInstances/assign","type":"String"},"instanceGroupId":{"value":"ff305d54-75b4-431b-adb2-eb6b9e5ff000","type":"String"}}}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java index d801a94c9b..74d5f7a9e6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -22,7 +24,8 @@ package org.onap.so.apihandler.recipe; import java.io.IOException; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.http.client.ClientHttpResponse; import org.springframework.web.client.ResponseErrorHandler; @@ -31,15 +34,12 @@ import org.springframework.web.client.ResponseErrorHandler; public class CamundaClientErrorHandler implements ResponseErrorHandler{ - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CamundaClientErrorHandler.class); + private static Logger logger = LoggerFactory.getLogger(CamundaClientErrorHandler.class); @Override public void handleError(ClientHttpResponse response) throws IOException { - - msoLogger.debug(response.getBody().toString()); - //msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.ERROR, - // MsoLogger.ResponseCode.CommunicationError, e.getMessage(), "BPMN", fullURL, null); - } + logger.debug(response.getBody().toString()); + } @Override public boolean hasError(ClientHttpResponse response) throws IOException { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java index 862e9a668f..b002aa9f54 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -23,6 +25,9 @@ package org.onap.so.apihandlerinfra; import java.net.URI; import java.util.Collections; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -38,13 +43,10 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; -import java.util.UUID; import org.apache.http.HttpStatus; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; import org.springframework.core.env.Environment; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -59,16 +61,16 @@ import io.swagger.annotations.ApiOperation; @Path("/globalhealthcheck") @Api(value="/globalhealthcheck",description="APIH Infra Global Health Check") public class GlobalHealthcheckHandler { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, GlobalHealthcheckHandler.class); - private static final String CONTEXTPATH_PROPERTY = "management.context-path"; - private static final String PROPERTY_DOMAIN = "mso.health.endpoints"; - private static final String CATALOGDB_PROPERTY = PROPERTY_DOMAIN+".catalogdb"; - private static final String REQUESTDB_PROPERTY = PROPERTY_DOMAIN+".requestdb"; - private static final String SDNC_PROPERTY = PROPERTY_DOMAIN+".sdnc"; - private static final String OPENSTACK_PROPERTY = PROPERTY_DOMAIN+".openstack"; - private static final String BPMN_PROPERTY = PROPERTY_DOMAIN+".bpmn"; - private static final String ASDC_PROPERTY = PROPERTY_DOMAIN+".asdc"; - private static final String REQUESTDBATTSVC_PROPERTY = PROPERTY_DOMAIN+".requestdbattsvc"; + private static Logger logger = LoggerFactory.getLogger(GlobalHealthcheckHandler.class); + private static final String CONTEXTPATH_PROPERTY = "management.context-path"; + private static final String PROPERTY_DOMAIN = "mso.health.endpoints"; + private static final String CATALOGDB_PROPERTY = PROPERTY_DOMAIN + ".catalogdb"; + private static final String REQUESTDB_PROPERTY = PROPERTY_DOMAIN + ".requestdb"; + private static final String SDNC_PROPERTY = PROPERTY_DOMAIN + ".sdnc"; + private static final String OPENSTACK_PROPERTY = PROPERTY_DOMAIN + ".openstack"; + private static final String BPMN_PROPERTY = PROPERTY_DOMAIN + ".bpmn"; + private static final String ASDC_PROPERTY = PROPERTY_DOMAIN + ".asdc"; + private static final String REQUESTDBATTSVC_PROPERTY = PROPERTY_DOMAIN + ".requestdbattsvc"; private static final String DEFAULT_PROPERTY_VALUE = ""; // e.g. /manage @@ -117,7 +119,7 @@ public class GlobalHealthcheckHandler { // Generated RequestId String requestId = requestContext.getProperty("requestId").toString(); MsoLogger.setLogContext(requestId, null); - msoLogger.info(MessageEnum.APIH_GENERATED_REQUEST_ID, requestId, "", ""); + logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); // set APIH status, this is the main entry point rsp.setApih(HealthcheckStatus.UP.toString()); @@ -137,14 +139,14 @@ public class GlobalHealthcheckHandler { rsp.setRequestdbAdapterAttsvc(querySubsystemHealth(MsoSubsystems.REQUESTDBATT)); // set Message rsp.setMessage(String.format("HttpStatus: %s", HttpStatus.SC_OK)); - msoLogger.info(rsp.toString(), "", ""); + logger.info(rsp.toString()); HEALTH_CHECK_RESPONSE = Response.status (HttpStatus.SC_OK) .entity (rsp) .build (); }catch (Exception ex){ - msoLogger.error(ex); + logger.error("Exception occurred", ex); rsp.setMessage(ex.getMessage()); HEALTH_CHECK_RESPONSE = Response.status (HttpStatus.SC_INTERNAL_SERVER_ERROR) .entity (rsp) @@ -170,7 +172,7 @@ public class GlobalHealthcheckHandler { // build final endpoint url UriBuilder builder = UriBuilder.fromPath(ept).path(actuatorContextPath).path(health); URI uri = builder.build(); - msoLogger.info("Calculated URL: "+uri.toString(), "", ""); + logger.info("Calculated URL: {}", uri.toString()); ResponseEntity<SubsystemHealthcheckResponse> result = restTemplate.exchange(uri, HttpMethod.GET, buildHttpEntityForRequest(), SubsystemHealthcheckResponse.class); @@ -178,13 +180,13 @@ public class GlobalHealthcheckHandler { return processResponseFromSubsystem(result,subsystem); }catch(Exception ex){ - msoLogger.error("Exception occured in GlobalHealthcheckHandler.querySubsystemHealth() "+ ex); + logger.error("Exception occured in GlobalHealthcheckHandler.querySubsystemHealth() ", ex); return HealthcheckStatus.DOWN.toString(); } } protected String processResponseFromSubsystem(ResponseEntity<SubsystemHealthcheckResponse> result, MsoSubsystems subsystem){ if(result == null || result.getStatusCodeValue() != HttpStatus.SC_OK){ - msoLogger.error(String.format("Globalhealthcheck: checking subsystem: %s failed ! result object is: %s", + logger.error(String.format("Globalhealthcheck: checking subsystem: %s failed ! result object is: %s", subsystem, result == null? "NULL": result)); return HealthcheckStatus.DOWN.toString(); @@ -196,7 +198,7 @@ public class GlobalHealthcheckHandler { if("UP".equalsIgnoreCase(status)){ return HealthcheckStatus.UP.toString(); }else{ - msoLogger.error(subsystem + ", query health endpoint did not return UP status!"); + logger.error("{}, query health endpoint did not return UP status!", subsystem); return HealthcheckStatus.DOWN.toString(); } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java index 81a197c85c..d686e80352 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -55,6 +57,8 @@ import org.onap.so.exceptions.ValidationException; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -68,7 +72,7 @@ import io.swagger.annotations.ApiOperation; @Path("/tasks") @Component public class ManualTasks { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, ManualTasks.class); + private static Logger logger = LoggerFactory.getLogger(ManualTasks.class); @org.springframework.beans.factory.annotation.Value("${mso.camunda.rest.task.uri}") @@ -94,9 +98,9 @@ public class ManualTasks { String requestId = requestContext.getProperty("requestId").toString(); MsoLogger.setLogContext(requestId, null); - msoLogger.info(MessageEnum.APIH_GENERATED_REQUEST_ID, requestId, "", ""); + logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); long startTime = System.currentTimeMillis (); - msoLogger.debug ("requestId is: " + requestId); + logger.debug ("requestId is: {}", requestId); TasksRequest taskRequest = null; String apiVersion = version.substring(1); @@ -203,9 +207,7 @@ public class ManualTasks { // BPEL accepted the request, the request is in progress if (bpelStatus == HttpStatus.SC_NO_CONTENT || bpelStatus == HttpStatus.SC_ACCEPTED) { - msoLogger.debug ("Received good response from Camunda"); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN completed the request"); + logger.debug ("Received good response from Camunda"); TaskRequestReference trr = new TaskRequestReference(); trr.setTaskId(taskId); String completeResp = null; @@ -224,8 +226,8 @@ public class ManualTasks { throw validateException; } - msoLogger.debug("Response to the caller: " + completeResp); - msoLogger.debug ("End of the transaction, the final response is: " + (String) completeResp); + logger.debug("Response to the caller: {}", completeResp); + logger.debug ("End of the transaction, the final response is: {}", completeResp); return builder.buildResponse(HttpStatus.SC_ACCEPTED, requestId, completeResp, apiVersion); } else { ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java index 7f602323e1..411a5e584a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -66,7 +68,6 @@ import org.onap.so.apihandlerinfra.vnfbeans.VnfInputs; import org.onap.so.apihandlerinfra.vnfbeans.VnfRequest; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository; import org.onap.so.exceptions.ValidationException; import org.onap.so.logger.LogConstants; import org.onap.so.logger.MessageEnum; @@ -84,6 +85,8 @@ import org.onap.so.serviceinstancebeans.RequestParameters; import org.onap.so.serviceinstancebeans.Service; import org.onap.so.serviceinstancebeans.ServiceException; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -107,7 +110,7 @@ public class MsoRequest { @Autowired private ResponseBuilder builder; - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH,MsoRequest.class); + private static Logger logger = LoggerFactory.getLogger(MsoRequest.class); public Response buildServiceErrorResponse (int httpResponseCode, MsoException exceptionType, String errorText, String messageId, List<String> variables, String version) { @@ -150,8 +153,9 @@ public class MsoRequest { mapper.setSerializationInclusion(Include.NON_DEFAULT); requestErrorStr = mapper.writeValueAsString(re); }catch(Exception e){ - msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in buildServiceErrorResponse writing exceptionType to string ", e); - } + logger.error("{} {} {}", MessageEnum.APIH_VALIDATION_ERROR.toString(), MsoLogger.ErrorCode.DataError.getValue(), + "Exception in buildServiceErrorResponse writing exceptionType to string ", e); + } return builder.buildResponse(httpResponseCode, null, requestErrorStr, version); } @@ -162,9 +166,9 @@ public class MsoRequest { public void parse (ServiceInstancesRequest sir, HashMap<String,String> instanceIdMap, Actions action, String version, String originalRequestJSON, int reqVersion, Boolean aLaCarteFlag) throws ValidationException, IOException { - msoLogger.debug ("Validating the Service Instance request"); + logger.debug ("Validating the Service Instance request"); List<ValidationRule> rules = new ArrayList<>(); - msoLogger.debug ("Incoming version is: " + version + " coverting to int: " + reqVersion); + logger.debug ("Incoming version is: {} coverting to int: {}", version, reqVersion); RequestParameters requestParameters = sir.getRequestDetails().getRequestParameters(); ValidationInformation info = new ValidationInformation(sir, instanceIdMap, action, reqVersion, aLaCarteFlag, requestParameters); @@ -249,9 +253,7 @@ public class MsoRequest { } }catch(Exception e){ - //msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, e); throw new ValidationException ("QueryParam ServiceInfo", e); - } } @@ -382,9 +384,10 @@ public class MsoRequest { aq.setRequestStatus (status.toString ()); aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER); } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request", e); - - if (!status.equals (Status.FAILED)) { + logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), MsoLogger.ErrorCode.DataError.getValue(), + "Exception when creation record request", e); + + if (!status.equals (Status.FAILED)) { throw e; } } @@ -421,9 +424,10 @@ public class MsoRequest { aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER); } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request", e); - - if (!status.equals (Status.FAILED)) { + logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), MsoLogger.ErrorCode.DataError.getValue(), + "Exception when creation record request", e); + + if (!status.equals (Status.FAILED)) { throw e; } } @@ -447,9 +451,10 @@ public class MsoRequest { request.setRequestUrl(MDC.get(LogConstants.HTTP_URL)); requestsDbClient.save(request); } catch (Exception e) { - msoLogger.error(MessageEnum.APIH_DB_UPDATE_EXC, e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "Exception when updating record in DB"); - msoLogger.debug ("Exception: ", e); - } + logger.error("{} {} {} {}", MessageEnum.APIH_DB_UPDATE_EXC.toString(), e.getMessage(), + MsoLogger.ErrorCode.DataError.getValue(), "Exception when updating record in DB"); + logger.debug("Exception: ", e); + } } @@ -531,8 +536,9 @@ public class MsoRequest { return null; } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DOM2STR_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in domToStr", e); - } + logger.error("{} {} {}", MessageEnum.APIH_DOM2STR_ERROR.toString(), MsoLogger.ErrorCode.DataError.getValue(), + "Exception in domToStr", e); + } return null; } @@ -556,12 +562,12 @@ public class MsoRequest { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(Include.NON_NULL); //mapper.configure(Feature.WRAP_ROOT_VALUE, true); - msoLogger.debug ("building sir from object " + sir); + logger.debug ("building sir from object {}", sir); String requestJSON = mapper.writeValueAsString(sir); // Perform mapping from VID-style modelInfo fields to ASDC-style modelInfo fields - msoLogger.debug("REQUEST JSON before mapping: " + requestJSON); + logger.debug("REQUEST JSON before mapping: {}", requestJSON); // modelUuid = modelVersionId requestJSON = requestJSON.replaceAll("\"modelVersionId\":","\"modelUuid\":"); // modelCustomizationUuid = modelCustomizationId @@ -570,7 +576,7 @@ public class MsoRequest { requestJSON = requestJSON.replaceAll("\"modelCustomizationName\":","\"modelInstanceName\":"); // modelInvariantUuid = modelInvariantId requestJSON = requestJSON.replaceAll("\"modelInvariantId\":","\"modelInvariantUuid\":"); - msoLogger.debug("REQUEST JSON after mapping: " + requestJSON); + logger.debug("REQUEST JSON after mapping: {}", requestJSON); return requestJSON; } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java index 35f196b263..cb458a7420 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -33,7 +35,8 @@ import javax.ws.rs.core.Response; import org.apache.http.HttpStatus; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; -import org.onap.so.utils.UUIDChecker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import io.swagger.annotations.Api; @@ -44,7 +47,7 @@ import io.swagger.annotations.ApiOperation; @Component public class NodeHealthcheckHandler { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, NodeHealthcheckHandler.class); + private static Logger logger = LoggerFactory.getLogger(NodeHealthcheckHandler.class); private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>"; @@ -61,8 +64,7 @@ public class NodeHealthcheckHandler { MsoLogger.setServiceName ("NodeHealthcheck"); // Generated RequestId String requestId = requestContext.getProperty("requestId").toString(); - MsoLogger.setLogContext(requestId, null); - msoLogger.info(MessageEnum.APIH_GENERATED_REQUEST_ID, requestId, "", ""); + logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); return HEALTH_CHECK_RESPONSE; } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java index b65b82a87d..d74a4de451 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -63,6 +65,8 @@ import org.onap.so.serviceinstancebeans.RequestDetails; import org.onap.so.serviceinstancebeans.RequestList; import org.onap.so.serviceinstancebeans.RequestStatus; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -76,7 +80,7 @@ import io.swagger.annotations.ApiOperation; @Component public class OrchestrationRequests { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, OrchestrationRequests.class); + private static Logger logger = LoggerFactory.getLogger(OrchestrationRequests.class); @Autowired @@ -106,7 +110,7 @@ public class OrchestrationRequests { requestProcessingData = requestsDbClient.getRequestProcessingDataBySoRequestId(requestId); } catch (Exception e) { - msoLogger.error(e); + logger.error("Exception occurred", e); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.AvailabilityError).build(); @@ -164,7 +168,7 @@ public class OrchestrationRequests { throw new ValidationException("At least one filter query param must be specified"); } }catch(ValidationException ex){ - msoLogger.error(ex); + logger.error("Exception occurred", ex); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.DataError).build(); ValidateException validateException = new ValidateException.Builder(ex.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).cause(ex).errorInfo(errorLoggerInfo).build(); @@ -202,7 +206,7 @@ public class OrchestrationRequests { public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) throws ApiException{ long startTime = System.currentTimeMillis (); - msoLogger.debug ("requestId is: " + requestId); + logger.debug ("requestId is: {}", requestId); ServiceInstancesRequest sir = null; InfraActiveRequests infraActiveRequest = null; @@ -212,7 +216,7 @@ public class OrchestrationRequests { ObjectMapper mapper = new ObjectMapper(); sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); } catch(IOException e){ - msoLogger.error(e); + logger.error("Exception occurred", e); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build(); @@ -223,7 +227,7 @@ public class OrchestrationRequests { try{ msoRequest.parseOrchestration(sir); } catch (Exception e) { - msoLogger.error(e); + logger.error("Exception occurred", e); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Error parsing request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) .errorInfo(errorLoggerInfo).build(); @@ -319,7 +323,7 @@ public class OrchestrationRequests { requestDetails = mapper.readValue(requestBody, RequestDetails.class); } } catch (IOException e) { - msoLogger.error(e); + logger.error("Exception occurred", e); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : ", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java index e3b218b90a..1f9f5f5fbe 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -83,6 +85,8 @@ import org.onap.so.serviceinstancebeans.VfModules; import org.onap.so.serviceinstancebeans.Vnfs; import org.onap.so.utils.CryptoUtils; import org.onap.so.utils.UUIDChecker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.ParameterizedTypeReference; @@ -126,7 +130,7 @@ import java.util.Optional; @Api(value="/onap/so/infra/serviceInstantiation",description="Infrastructure API Requests for Service Instances") public class ServiceInstances { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH,MsoRequest.class); + private static Logger logger = LoggerFactory.getLogger(MsoRequest.class); private static String NAME = "name"; private static String VALUE = "value"; private static final String SAVE_TO_DB = "save instance to db"; @@ -809,7 +813,7 @@ public class ServiceInstances { String vfModuleId = ""; String volumeGroupId = ""; String networkId = ""; - String correlationId = ""; + String pnfCorrelationId = ""; String instanceGroupId = null; if(sir.getServiceInstanceId () != null){ serviceInstanceId = sir.getServiceInstanceId (); @@ -834,7 +838,7 @@ public class ServiceInstances { instanceGroupId = sir.getInstanceGroupId(); } - correlationId = getCorrelationId(sir); + pnfCorrelationId = getPnfCorrelationId(sir); try{ infraActiveRequestsClient.save(currentActiveReq); @@ -858,7 +862,7 @@ public class ServiceInstances { .setRecipeTimeout(recipeLookupResult.getRecipeTimeout()) .setRequestAction(action.toString()) .setServiceInstanceId(serviceInstanceId) - .setCorrelationId(correlationId) + .setPnfCorrelationId(pnfCorrelationId) .setVnfId(vnfId) .setVfModuleId(vfModuleId) .setVolumeGroupId(volumeGroupId) @@ -893,7 +897,7 @@ public class ServiceInstances { try { validateHeaders(requestContext); } catch (ValidationException e) { - msoLogger.error(e); + logger.error("Exception occurred", e); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) .errorInfo(errorLoggerInfo).build(); @@ -944,7 +948,7 @@ public class ServiceInstances { return postBPELRequest(currentActiveReq, requestClientParameter, recipeLookupResult.getOrchestrationURI(), requestScope); } - private String getCorrelationId(ServiceInstancesRequest sir) { + private String getPnfCorrelationId(ServiceInstancesRequest sir) { return Optional.of(sir) .map(ServiceInstancesRequest::getRequestDetails) .map(RequestDetails::getRequestParameters) @@ -1016,7 +1020,7 @@ public class ServiceInstances { respHandler = new ResponseHandler (response, requestClient.getType ()); bpelStatus = respHandler.getStatus (); } catch (ApiException e) { - msoLogger.error(e); + logger.error("Exception occurred", e); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder("Exception caught mapping Camunda JSON response to object", HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) .errorInfo(errorLoggerInfo).build(); @@ -1041,7 +1045,7 @@ public class ServiceInstances { jsonResponse.getRequestReferences().setRequestSelfLink(null); } } catch (IOException e) { - msoLogger.error(e); + logger.error("Exception occurred", e); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder("Exception caught mapping Camunda JSON response to object", HttpStatus.SC_NOT_ACCEPTABLE, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) .errorInfo(errorLoggerInfo).build(); @@ -1130,7 +1134,7 @@ public class ServiceInstances { sir.getRequestDetails().setCloudConfiguration(serviceInstRequest.getRequestDetails().getCloudConfiguration()); sir.getRequestDetails().getRequestParameters().setUserParams(serviceInstRequest.getRequestDetails().getRequestParameters().getUserParams()); } - msoLogger.debug("Value as string: " + mapper.writeValueAsString(sir)); + logger.debug("Value as string: {}", mapper.writeValueAsString(sir)); return mapper.writeValueAsString(sir); } return null; @@ -1214,7 +1218,7 @@ public class ServiceInstances { headers.add(HttpHeaders.AUTHORIZATION, "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes())); } } catch(GeneralSecurityException e) { - msoLogger.error("Security exception", e); + logger.error("Security exception", e); } return headers; } @@ -1453,7 +1457,7 @@ public class ServiceInstances { } protected List<Map<String, Object>> configureUserParams(RequestParameters reqParams) throws IOException { - msoLogger.debug("Configuring UserParams for Macro Request"); + logger.debug("Configuring UserParams for Macro Request"); Map<String, Object> userParams = new HashMap<>(); for(Map<String, Object> params : reqParams.getUserParams()){ @@ -1789,7 +1793,7 @@ public class ServiceInstances { testApi = TestApi.valueOf(requestTestApi); return Optional.of(testApi.getModelName()); } catch (Exception e) { - msoLogger.warnSimple("Catching the exception on the valueOf enum call and continuing", e); + logger.warn("Catching the exception on the valueOf enum call and continuing", e); throw new IllegalArgumentException("Invalid TestApi is provided", e); } } @@ -1860,7 +1864,7 @@ public class ServiceInstances { serviceInstanceId = ""; String configurationId = ""; - String correlationId = ""; + String pnfCorrelationId = ""; if(sir.getServiceInstanceId () != null){ serviceInstanceId = sir.getServiceInstanceId (); @@ -1870,7 +1874,7 @@ public class ServiceInstances { configurationId = sir.getConfigurationId(); } - correlationId = getCorrelationId(sir); + pnfCorrelationId = getPnfCorrelationId(sir); try{ infraActiveRequestsClient.save(currentActiveReq); @@ -1893,7 +1897,7 @@ public class ServiceInstances { .setRecipeTimeout(Integer.parseInt(timeOut)) .setRequestAction(action.toString()) .setServiceInstanceId(serviceInstanceId) - .setCorrelationId(correlationId) + .setPnfCorrelationId(pnfCorrelationId) .setConfigurationId(configurationId) .setRequestDetails(mapJSONtoMSOStyle(requestJSON, sir, aLaCarte, action)) .setApiVersion(apiVersion) diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java index f9e6c276ec..0a72cf68ad 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -55,7 +57,8 @@ import org.onap.so.apihandlerinfra.tasksbeans.TasksGetResponse; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; -import org.onap.so.utils.UUIDChecker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @@ -72,7 +75,7 @@ import io.swagger.annotations.ApiOperation; public class TasksHandler { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH,TasksHandler.class); + private static Logger logger = LoggerFactory.getLogger(TasksHandler.class); @Value("${mso.camunda.rest.task.uri}") private String requestUrl; @@ -95,14 +98,9 @@ public class TasksHandler { @QueryParam("originalRequestDate") String originalRequestDate, @QueryParam("originalRequestorId") String originalRequestorId, @PathParam("version") String version) throws ApiException { - Response responseBack = null; - - String requestId = UUIDChecker.generateUUID(msoLogger); - MsoLogger.setServiceName ("ManualTasksQuery"); - // Generate a Request Id - UUIDChecker.generateUUID(msoLogger); + Response responseBack = null; String apiVersion = version.substring(1); - + // Prepare the query string to /task interface TaskVariables tv = new TaskVariables(); @@ -229,13 +227,9 @@ public class TasksHandler { throw validateException; } - return builder.buildResponse(HttpStatus.SC_ACCEPTED, requestId, jsonResponse, apiVersion); + return builder.buildResponse(HttpStatus.SC_ACCEPTED, "", jsonResponse, apiVersion); } - protected MsoLogger getMsoLogger () { - return msoLogger; - } - // Makes a GET call to Camunda to get variables for this task private TaskList getTaskInfo(String taskId) throws ApiException{ TaskList taskList; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java index d743c440e7..00f1d6889d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java @@ -4,12 +4,14 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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. @@ -24,6 +26,7 @@ package org.onap.so.apihandlerinfra.tenantisolation; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.HashMap; +import java.util.UUID; import javax.inject.Provider; import javax.transaction.Transactional; @@ -54,7 +57,8 @@ import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; -import org.onap.so.utils.UUIDChecker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -68,9 +72,9 @@ import io.swagger.annotations.ApiOperation; @Api(value="/onap/so/infra/cloudResources",description="API Requests for cloud resources - Tenant Isolation") public class CloudOrchestration { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, CloudOrchestration.class); + private static Logger logger = LoggerFactory.getLogger(CloudOrchestration.class); private static final String ENVIRONMENT_ID_KEY = "operationalEnvironmentId"; - + @Autowired private TenantIsolationRequest tenantIsolationRequest ; @@ -87,7 +91,7 @@ public class CloudOrchestration { @ApiOperation(value="Create an Operational Environment",response=Response.class) @Transactional public Response createOperationEnvironment(String request, @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException{ - msoLogger.debug("Received request to Create Operational Environment"); + logger.debug("Received request to Create Operational Environment"); return cloudOrchestration(request, Action.create, null, version, getRequestId(requestContext)); } @@ -99,7 +103,7 @@ public class CloudOrchestration { @Transactional public Response activateOperationEnvironment(String request, @PathParam("version") String version, @PathParam("operationalEnvironmentId") String operationalEnvironmentId, @Context ContainerRequestContext requestContext) throws ApiException{ - msoLogger.debug("Received request to Activate an Operational Environment"); + logger.debug("Received request to Activate an Operational Environment"); HashMap<String, String> instanceIdMap = new HashMap<>(); instanceIdMap.put(ENVIRONMENT_ID_KEY, operationalEnvironmentId); return cloudOrchestration(request, Action.activate, instanceIdMap, version, getRequestId(requestContext)); @@ -112,7 +116,7 @@ public class CloudOrchestration { @ApiOperation(value="Deactivate an Operational Environment",response=Response.class) @Transactional public Response deactivateOperationEnvironment(String request, @PathParam("version") String version, @PathParam("operationalEnvironmentId") String operationalEnvironmentId, @Context ContainerRequestContext requestContext) throws ApiException{ - msoLogger.debug("Received request to Deactivate an Operational Environment"); + logger.debug("Received request to Deactivate an Operational Environment"); HashMap<String, String> instanceIdMap = new HashMap<>(); instanceIdMap.put(ENVIRONMENT_ID_KEY, operationalEnvironmentId); return cloudOrchestration(request, Action.deactivate, instanceIdMap, version, getRequestId(requestContext)); @@ -121,7 +125,7 @@ public class CloudOrchestration { private Response cloudOrchestration(String requestJSON, Action action, HashMap<String, String> instanceIdMap, String version, String requestId) throws ApiException{ MsoLogger.setLogContext(requestId, null); - msoLogger.info(MessageEnum.APIH_GENERATED_REQUEST_ID, requestId, "", ""); + logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); long startTime = System.currentTimeMillis (); CloudOrchestrationRequest cor = null; tenantIsolationRequest.setRequestId(requestId); @@ -168,7 +172,7 @@ public class CloudOrchestration { if(instanceIdMap != null && instanceIdMap.get(ENVIRONMENT_ID_KEY) != null) { instanceId = instanceIdMap.get(ENVIRONMENT_ID_KEY); } else { - instanceId = UUIDChecker.generateUUID(msoLogger); + instanceId = UUID.randomUUID().toString(); tenantIsolationRequest.setOperationalEnvironmentId(instanceId); cor.setOperationalEnvironmentId(instanceId); } @@ -217,7 +221,7 @@ public class CloudOrchestration { private CloudOrchestrationRequest convertJsonToCloudOrchestrationRequest(String requestJSON, Action action, long startTime, CloudOrchestrationRequest cor) throws ApiException { try{ - msoLogger.debug("Converting incoming JSON request to Object"); + logger.debug("Converting incoming JSON request to Object"); ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(requestJSON, CloudOrchestrationRequest.class); } catch(IOException e){ diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java index 6d8ca96080..377b03c4ab 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -60,7 +62,8 @@ import org.onap.so.exceptions.ValidationException; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; -import org.onap.so.utils.UUIDChecker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -74,7 +77,7 @@ import io.swagger.annotations.ApiOperation; @Api(value="onap/so/infra/cloudResourcesRequests",description="API GET Requests for cloud resources - Tenant Isolation") public class CloudResourcesOrchestration { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, CloudResourcesOrchestration.class); + private static Logger logger = LoggerFactory.getLogger(CloudResourcesOrchestration.class); @Autowired RequestsDbClient requestDbClient; @@ -94,7 +97,7 @@ public class CloudResourcesOrchestration { CloudOrchestrationRequest cor = null; - msoLogger.debug ("requestId is: " + requestId); + logger.debug ("requestId is: " + requestId); try{ ObjectMapper mapper = new ObjectMapper(); @@ -156,7 +159,6 @@ public class CloudResourcesOrchestration { @Transactional public Response getOperationEnvironmentStatusFilter(@Context UriInfo ui, @PathParam("version") String version ) throws ApiException{ MsoLogger.setServiceName ("getOperationEnvironmentStatusFilter"); - UUIDChecker.generateUUID(msoLogger); MultivaluedMap<String, String> queryParams = ui.getQueryParameters(); List<String> requestIdKey = queryParams.get("requestId"); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java index e75d56e7d3..ace0fb664c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -48,6 +50,8 @@ import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.RequestError; import org.onap.so.serviceinstancebeans.ServiceException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -62,7 +66,7 @@ import io.swagger.annotations.ApiOperation; @Api(value="/onap/so/infra/modelDistributions",description="API Requests for Model Distributions") public class ModelDistributionRequest { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, ModelDistributionRequest.class); + private static Logger logger = LoggerFactory.getLogger(ModelDistributionRequest.class); @Autowired private Provider<TenantIsolationRunnable> tenantIsolationRunnable; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java index 855a5433f3..47cbb0c895 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -49,6 +51,8 @@ import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.UUIDChecker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @@ -75,7 +79,7 @@ public class TenantIsolationRequest { @Autowired private RequestsDbClient requestsDbClient; - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, TenantIsolationRequest.class); + private static Logger logger = LoggerFactory.getLogger(TenantIsolationRequest.class); TenantIsolationRequest (String requestId) { @@ -351,8 +355,9 @@ public class TenantIsolationRequest { request.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER); requestsDbClient.save(request); } catch (Exception e) { - msoLogger.error(MessageEnum.APIH_DB_UPDATE_EXC, e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "Exception when updating record in DB"); - msoLogger.debug ("Exception: ", e); + logger.error("{} {} {} {}", MessageEnum.APIH_DB_UPDATE_EXC.toString(), e.getMessage(), + MsoLogger.ErrorCode.DataError.getValue(), "Exception when updating record in DB"); + logger.debug("Exception: ", e); } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java index 7ad7e6626d..00ce137ee3 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -35,7 +37,8 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDBHelper; -import org.slf4j.MDC; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.scheduling.annotation.Async; @@ -45,7 +48,7 @@ import org.springframework.stereotype.Component; @Scope("prototype") public class TenantIsolationRunnable { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, TenantIsolationRunnable.class); + private static final Logger logger = LoggerFactory.getLogger(TenantIsolationRunnable.class); @Autowired private RequestsDBHelper requestDb; @@ -62,8 +65,9 @@ public class TenantIsolationRunnable { @Async public void run(Action action, String operationalEnvType, CloudOrchestrationRequest cor, String requestId) throws ApiException { - - msoLogger.debug ("Starting threadExecution in TenantIsolationRunnable for Action " + action.name() + " and OperationalEnvType: " + operationalEnvType); + + logger.debug("Starting threadExecution in TenantIsolationRunnable for Action {} and OperationalEnvType: {}", + action.name(), operationalEnvType); try { if(Action.create.equals(action)) { @@ -74,7 +78,8 @@ public class TenantIsolationRunnable { } else { ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build(); ValidateException validateException = new ValidateException.Builder("Invalid OperationalEnvironment Type specified for Create Action", - HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo).build(); + HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo) + .build(); throw validateException; } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java index 6a5de77c73..870fa11b5c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -34,14 +36,15 @@ import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.graphinventory.entities.uri.Depth; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Component public class AAIClientHelper { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, AAIClientHelper.class); + private static Logger logger = LoggerFactory.getLogger(AAIClientHelper.class); /** * Get managing ECOMP Environment Info from A&AI diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java index dcd3a42875..eb0721270d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -22,13 +24,14 @@ package org.onap.so.apihandlerinfra.tenantisolation.helpers; import org.onap.so.db.request.beans.OperationalEnvDistributionStatus; import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Component public class ActivateVnfDBHelper { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, ActivateVnfDBHelper.class); + private static Logger logger = LoggerFactory.getLogger(ActivateVnfDBHelper.class); /** * Insert record to OperationalEnvServiceModelStatus table 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 5ead7ddd7f..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 @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -39,13 +41,15 @@ import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.CryptoUtils; import org.onap.so.utils.TargetEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @Component public class SDCClientHelper { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, SDCClientHelper.class); + private static Logger logger = LoggerFactory.getLogger(SDCClientHelper.class); private static final String SDC_CONTENT_TYPE = "application/json"; private static final String SDC_ACCEPT_TYPE = "application/json"; private static String PARTIAL_SDC_URI = "/sdc/v1/catalog/services/"; @@ -106,9 +110,9 @@ public class SDCClientHelper { sdcResponseJsonObj = enhanceJsonResponse(new JSONObject(responseData), statusCode); } catch (Exception ex) { - msoLogger.debug("calling SDC Exception message: " + ex.getMessage()); + logger.debug("calling SDC Exception message: {}", ex.getMessage()); String errorMessage = " Encountered Error while calling SDC POST Activate. " + ex.getMessage(); - msoLogger.debug(errorMessage); + logger.debug(errorMessage); sdcResponseJsonObj.put("statusCode", String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode())); sdcResponseJsonObj.put("messageId", ""); sdcResponseJsonObj.put("message", errorMessage); @@ -217,7 +221,7 @@ public class SDCClientHelper { } catch (Exception e) { - msoLogger.debug("Failed to decrypt credentials: " + toDecrypt, e); + logger.debug("Failed to decrypt credentials: {}", toDecrypt, e); } return result; } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java index 1d2a445c40..f70fe71554 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java @@ -50,6 +50,8 @@ import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDBHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @@ -58,7 +60,7 @@ import org.springframework.stereotype.Component; @Component public class ActivateVnfOperationalEnvironment { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, ActivateVnfOperationalEnvironment.class); + private static final Logger logger = LoggerFactory.getLogger(ActivateVnfOperationalEnvironment.class); private static final int DEFAULT_ACTIVATE_RETRY_COUNT = 3; private static final String DISTRIBUTION_STATUS_SENT = "SENT"; private static final String OPER_ENVIRONMENT_ID_KEY = "operational-environment-id"; @@ -100,12 +102,12 @@ public class ActivateVnfOperationalEnvironment { ecompOperationalEnvironmentId = operationalEnvironments.get(0).getURIKeys().get(OPER_ENVIRONMENT_ID_KEY); } } - msoLogger.debug(" vnfOperationalEnvironmentId : " + vnfOperationalEnvironmentId); - msoLogger.debug(" ecompOperationalEnvironmentId : " + ecompOperationalEnvironmentId); + logger.debug(" vnfOperationalEnvironmentId : {}", vnfOperationalEnvironmentId); + logger.debug(" ecompOperationalEnvironmentId : {}", ecompOperationalEnvironmentId); OperationalEnvironment operationalEnv = wrapper.asBean(OperationalEnvironment.class).get(); String workloadContext = operationalEnv.getWorkloadContext(); - msoLogger.debug(" aai workloadContext: " + workloadContext); + logger.debug(" aai workloadContext: {}", workloadContext); if (!vidWorkloadContext.equals(workloadContext)) { ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build(); throw new ValidateException.Builder(" The vid workloadContext did not match from aai record. " + " vid workloadContext:" + vidWorkloadContext + " aai workloadContext:" + workloadContext, 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 66cfd349df..219a2efcac 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 @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -42,13 +44,15 @@ import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDBHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class ActivateVnfStatusOperationalEnvironment { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, ActivateVnfStatusOperationalEnvironment.class); + private static Logger logger = LoggerFactory.getLogger(ActivateVnfStatusOperationalEnvironment.class); private String origRequestId = ""; private String errorMessage = ""; private OperationalEnvDistributionStatus queryDistributionDbResponse = null; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java index b09bbae0ad..6ba78aa175 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -32,13 +34,15 @@ import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientObjectBuilde import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDBHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class CreateEcompOperationalEnvironment { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CreateEcompOperationalEnvironment.class); + private static Logger logger = LoggerFactory.getLogger(CreateEcompOperationalEnvironment.class); @Autowired private AAIClientObjectBuilder aaiClientObjectBuilder; @@ -56,11 +60,12 @@ public class CreateEcompOperationalEnvironment { // Call client to publish to DMaap try { - msoLogger.debug("1" + request.getOperationalEnvironmentId()); - msoLogger.debug("2" + request.getRequestDetails().getRequestInfo().getInstanceName()); - msoLogger.debug("3" + request.getRequestDetails().getRequestParameters().getOperationalEnvironmentType().toString()); - msoLogger.debug("4" + request.getRequestDetails().getRequestParameters().getTenantContext()); - msoLogger.debug("5" + request.getRequestDetails().getRequestParameters().getWorkloadContext()); + logger.debug("1 {}", request.getOperationalEnvironmentId()); + logger.debug("2 {}", request.getRequestDetails().getRequestInfo().getInstanceName()); + logger.debug("3 {}", request.getRequestDetails().getRequestParameters().getOperationalEnvironmentType() + .toString()); + logger.debug("4 {}", request.getRequestDetails().getRequestParameters().getTenantContext()); + logger.debug("5 {}", request.getRequestDetails().getRequestParameters().getWorkloadContext()); dmaapClient.dmaapPublishOperationalEnvRequest(request.getOperationalEnvironmentId(), diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java index 36226aae68..2eaba25234 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -48,6 +50,8 @@ import org.onap.so.client.grm.beans.Version; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDBHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -56,7 +60,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Component public class CreateVnfOperationalEnvironment { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CreateVnfOperationalEnvironment.class); + private static Logger logger = LoggerFactory.getLogger(CreateVnfOperationalEnvironment.class); protected CloudOrchestrationRequest request; @Autowired @@ -78,7 +82,7 @@ public class CreateVnfOperationalEnvironment { OperationalEnvironment aaiEnv = aaiResultWrapper.asBean(OperationalEnvironment.class).get(); //Find ECOMP environments in GRM - msoLogger.debug(" Start of GRM findRunningServicesAsString"); + logger.debug(" Start of GRM findRunningServicesAsString"); String searchKey = getSearchKey(aaiEnv); String tenantContext = getTenantContext().toUpperCase(); String jsonResponse = getGrmClient().findRunningServicesAsString(searchKey, 1, tenantContext); @@ -92,7 +96,7 @@ public class CreateVnfOperationalEnvironment { int ctr = 0; int total = serviceEndpointRequestList.size(); for (ServiceEndPointRequest requestList : serviceEndpointRequestList) { - msoLogger.debug("Creating endpoint " + ++ctr + " of " + total + ": " + requestList.getServiceEndPoint().getName()); + logger.debug("Creating endpoint " + ++ctr + " of " + total + ": " + requestList.getServiceEndPoint().getName()); getGrmClient().addServiceEndPoint(requestList); } @@ -137,7 +141,7 @@ public class CreateVnfOperationalEnvironment { private List<ServiceEndPointRequest> buildEndPointRequestList(ServiceEndPointList serviceEndPointList) throws TenantIsolationException { List<ServiceEndPoint> endpointList = serviceEndPointList.getServiceEndPointList(); - msoLogger.debug("Number of service endpoints from GRM: " + endpointList.size()); + logger.debug("Number of service endpoints from GRM: {}", endpointList.size()); List<ServiceEndPointRequest> serviceEndPointRequestList = new ArrayList<ServiceEndPointRequest>(); for(ServiceEndPoint serviceEndpoint : endpointList) { serviceEndPointRequestList.add(buildServiceEndpoint(serviceEndpoint)); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java index 977184e2c5..2181215ca7 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -35,13 +37,16 @@ import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDBHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class DeactivateVnfOperationalEnvironment { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, DeactivateVnfOperationalEnvironment.class); + private static Logger logger = LoggerFactory.getLogger(DeactivateVnfOperationalEnvironment + .class); @Autowired private AAIClientHelper aaiHelper; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java index a6fdcc958d..5eb3083003 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -25,7 +27,6 @@ import org.onap.so.apihandlerinfra.Action; import org.onap.so.apihandlerinfra.Actions; import org.onap.so.apihandlerinfra.Constants; import org.onap.so.exceptions.ValidationException; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.InstanceDirection; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; @@ -33,11 +34,16 @@ import org.onap.so.serviceinstancebeans.RelatedInstance; import org.onap.so.serviceinstancebeans.RelatedInstanceList; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; import org.onap.so.utils.UUIDChecker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class RelatedInstancesValidation implements ValidationRule{ - private static boolean empty(String s) { - return (s == null || s.trim().isEmpty()); - } + + private static Logger logger = LoggerFactory.getLogger(RelatedInstancesValidation.class); + + private static boolean empty(String s) { + return (s == null || s.trim().isEmpty()); + } @Override public ValidationInformation validate(ValidationInformation info) throws ValidationException{ ServiceInstancesRequest sir = info.getSir(); @@ -50,7 +56,6 @@ public class RelatedInstancesValidation implements ValidationRule{ String vfModuleType = null; String vfModuleModelName = null; ModelInfo modelInfo = info.getSir().getRequestDetails().getModelInfo(); - MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, RelatedInstancesValidation.class); RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList(); String serviceModelName = null; String vnfModelName = null; @@ -229,7 +234,7 @@ public class RelatedInstancesValidation implements ValidationRule{ (reqVersion >= 4 && (requestScope.equalsIgnoreCase(ModelType.volumeGroup.name ()) || requestScope.equalsIgnoreCase(ModelType.vfModule.name ())) && action == Action.updateInstance || (requestScope.equalsIgnoreCase(ModelType.vfModule.name ()) && action == Action.scaleOut)) || (requestScope.equalsIgnoreCase(ModelType.service.name()) && (action.equals(Action.addRelationships) || action.equals(Action.removeRelationships)))){ - msoLogger.debug ("related instance exception"); + logger.debug("related instance exception"); throw new ValidationException ("related instances"); } if(instanceList == null && requestScope.equalsIgnoreCase(ModelType.instanceGroup.toString()) && action == Action.createInstance){ @@ -242,4 +247,4 @@ public class RelatedInstancesValidation implements ValidationRule{ info.setVfModuleType(vfModuleType); return info; } -}
\ No newline at end of file +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java index 4d4f23c083..54e7b27168 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -20,27 +22,20 @@ package org.onap.so.apihandlerinfra; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.client.WireMock; import org.junit.After; import org.junit.BeforeClass; import org.junit.runner.RunWith; -import org.onap.so.logger.MsoLogger; -import org.onap.so.logger.MsoLogger.Catalog; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; import org.springframework.core.env.Environment; -import org.springframework.http.HttpHeaders; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.jdbc.Sql.ExecutionPhase; import org.springframework.test.context.junit4.SpringRunner; import javax.transaction.Transactional; @@ -55,7 +50,7 @@ import java.nio.file.Paths; @Transactional @AutoConfigureWireMock(port = 0) public abstract class BaseTest { - protected MsoLogger logger = MsoLogger.getMsoLogger(Catalog.GENERAL, BaseTest.class); + protected Logger logger = LoggerFactory.getLogger(BaseTest.class); protected TestRestTemplate restTemplate = new TestRestTemplate("test", "test"); @Autowired @@ -90,4 +85,4 @@ public abstract class BaseTest { public String getTestUrl(String requestId) { return "/infraActiveRequests/" + requestId; } -}
\ No newline at end of file +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailedTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailedTest.java new file mode 100644 index 0000000000..2cb02e9666 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailedTest.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 IBM. + * ================================================================================ + * 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.apihandlerinfra.tenantisolation.exceptions; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.so.apihandlerinfra.BaseTest; + +public class AAIClientCallFailedTest extends BaseTest { + + @Test + public void testAAIClientCallFailedException() { + AAIClientCallFailed aAIClientCallFailed = new AAIClientCallFailed("failed", new Throwable("throwable")); + assertEquals("failed", aAIClientCallFailed.getMessage()); + assertEquals("throwable", aAIClientCallFailed.getCause().getMessage()); + } +} diff --git a/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processInstanceVariables.json b/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processInstanceVariables.json index 15c87ea1e9..7762da7c2d 100644 --- a/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processInstanceVariables.json +++ b/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processInstanceVariables.json @@ -287,7 +287,7 @@ }, { "type": "String", - "value": "{\"requestDetails\":{\"modelInfo\":{\"modelInvariantUuid\":\"8e2be9fa-fffb-4e23-89a5-65497709f507\",\"modelType\":\"service\",\"modelName\":\"PNFSERVICE\",\"modelVersion\":\"1.0\",\"modelUuid\":\"4f7afc34-e475-41ca-be73-40f9a0f7ffa4\"},\"requestInfo\":{\"productFamilyId\":\"c8d92bf2-2c2e-4802-94e0-3f9e0825cc08\",\"source\":\"UUI\",\"instanceName\":\"AFRPOSTMAN51\",\"suppressRollback\":false,\"requestorId\":\"demo\"},\"subscriberInfo\":{\"globalSubscriberId\":\"Demonstration\"},\"cloudConfiguration\":{\"tenantId\":\"3e001881bcb342418ab5f2788a73255d\",\"lcpCloudRegionId\":\"regionOne_aaa_bbb\"},\"requestParameters\":{\"alaCarte\":false,\"subscriptionServiceType\":\"vCPE\",\"userParams\":[{\"name\":\"Homing_Solution\",\"value\":\"dummy\"}],\"aLaCarte\":false},\"project\":{\"projectName\":\"Project-Demonstration\"},\"owningEntity\":{\"owningEntityId\":\"c77274d4-4881-493a-ad46-368ea0996eb3\",\"owningEntityName\":\"OE-Demonstration\"}},\"correlationId\":\"afr\"}", + "value": "{\"requestDetails\":{\"modelInfo\":{\"modelInvariantUuid\":\"8e2be9fa-fffb-4e23-89a5-65497709f507\",\"modelType\":\"service\",\"modelName\":\"PNFSERVICE\",\"modelVersion\":\"1.0\",\"modelUuid\":\"4f7afc34-e475-41ca-be73-40f9a0f7ffa4\"},\"requestInfo\":{\"productFamilyId\":\"c8d92bf2-2c2e-4802-94e0-3f9e0825cc08\",\"source\":\"UUI\",\"instanceName\":\"AFRPOSTMAN51\",\"suppressRollback\":false,\"requestorId\":\"demo\"},\"subscriberInfo\":{\"globalSubscriberId\":\"Demonstration\"},\"cloudConfiguration\":{\"tenantId\":\"3e001881bcb342418ab5f2788a73255d\",\"lcpCloudRegionId\":\"regionOne_aaa_bbb\"},\"requestParameters\":{\"alaCarte\":false,\"subscriptionServiceType\":\"vCPE\",\"userParams\":[{\"name\":\"Homing_Solution\",\"value\":\"dummy\"}],\"aLaCarte\":false},\"project\":{\"projectName\":\"Project-Demonstration\"},\"owningEntity\":{\"owningEntityId\":\"c77274d4-4881-493a-ad46-368ea0996eb3\",\"owningEntityName\":\"OE-Demonstration\"}},\"pnfCorrelationId\":\"afr\"}", "valueInfo": { }, @@ -314,7 +314,7 @@ }, "id": "595745ec-9736-11e8-8caf-022ac9304eeb", - "name": "correlationId", + "name": "pnfCorrelationId", "processDefinitionKey": "AFRFLOW", "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", @@ -4203,7 +4203,7 @@ }, { "type": "String", - "value": "{\"requestDetails\":{\"modelInfo\":{\"modelInvariantUuid\":\"8e2be9fa-fffb-4e23-89a5-65497709f507\",\"modelType\":\"service\",\"modelName\":\"PNFSERVICE\",\"modelVersion\":\"1.0\",\"modelUuid\":\"4f7afc34-e475-41ca-be73-40f9a0f7ffa4\"},\"requestInfo\":{\"productFamilyId\":\"c8d92bf2-2c2e-4802-94e0-3f9e0825cc08\",\"source\":\"UUI\",\"instanceName\":\"AFRPOSTMAN51\",\"suppressRollback\":false,\"requestorId\":\"demo\"},\"subscriberInfo\":{\"globalSubscriberId\":\"Demonstration\"},\"cloudConfiguration\":{\"tenantId\":\"3e001881bcb342418ab5f2788a73255d\",\"lcpCloudRegionId\":\"regionOne_aaa_bbb\"},\"requestParameters\":{\"alaCarte\":false,\"subscriptionServiceType\":\"vCPE\",\"userParams\":[{\"name\":\"Homing_Solution\",\"value\":\"dummy\"}],\"aLaCarte\":false},\"project\":{\"projectName\":\"Project-Demonstration\"},\"owningEntity\":{\"owningEntityId\":\"c77274d4-4881-493a-ad46-368ea0996eb3\",\"owningEntityName\":\"OE-Demonstration\"}},\"correlationId\":\"afr\"}", + "value": "{\"requestDetails\":{\"modelInfo\":{\"modelInvariantUuid\":\"8e2be9fa-fffb-4e23-89a5-65497709f507\",\"modelType\":\"service\",\"modelName\":\"PNFSERVICE\",\"modelVersion\":\"1.0\",\"modelUuid\":\"4f7afc34-e475-41ca-be73-40f9a0f7ffa4\"},\"requestInfo\":{\"productFamilyId\":\"c8d92bf2-2c2e-4802-94e0-3f9e0825cc08\",\"source\":\"UUI\",\"instanceName\":\"AFRPOSTMAN51\",\"suppressRollback\":false,\"requestorId\":\"demo\"},\"subscriberInfo\":{\"globalSubscriberId\":\"Demonstration\"},\"cloudConfiguration\":{\"tenantId\":\"3e001881bcb342418ab5f2788a73255d\",\"lcpCloudRegionId\":\"regionOne_aaa_bbb\"},\"requestParameters\":{\"alaCarte\":false,\"subscriptionServiceType\":\"vCPE\",\"userParams\":[{\"name\":\"Homing_Solution\",\"value\":\"dummy\"}],\"aLaCarte\":false},\"project\":{\"projectName\":\"Project-Demonstration\"},\"owningEntity\":{\"owningEntityId\":\"c77274d4-4881-493a-ad46-368ea0996eb3\",\"owningEntityName\":\"OE-Demonstration\"}},\"pnfCorrelationId\":\"afr\"}", "valueInfo": { }, |