* 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);
}
} 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
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{
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;
* (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
* @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<>();
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);
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)
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);
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
--- /dev/null
+/*
+ * ============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());
+ }
+
+}
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;
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;
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 {
}
@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) {
--- /dev/null
+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)));
+ }
+
+}
--- /dev/null
+{
+ "a" : "value",
+ "b" : {
+ "my-key" : "my-value",
+ "array" : [1, 3, 4]
+ }
+}
\ No newline at end of file
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() {
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;
}
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;
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;
}
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() {
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;
}
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() {
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;
}
</exclusion>
</exclusions>
</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>
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:
-
server:
port: 8090
-flyway:
- baseline-on-migrate: false
- jdbc-url: jdbc:mariadb://localhost:3306/catalogdb
- user: catalog
- password: catalog123
+
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
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
-
- <plugins>
+
+ <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</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>
</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>
</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>
<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>
<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>
<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>
</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>
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();
}
}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()));
* ================================================================================
* 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
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;
}
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;
}
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;
* ================================================================================
* 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
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;
}
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;
}
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;
* 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.
*/
package org.onap.so.adapters.network;
-
+
import java.net.MalformedURLException;
import java.net.URL;
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;
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;
@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;
*/
@Override
public void healthCheckA () {
- LOGGER.debug ("Health check call in Network Adapter");
+ logger.debug ("Health check call in Network Adapter");
}
/**
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
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);
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;
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
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);
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;
}
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
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);
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;
}
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
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;
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
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;
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;
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);
}
}
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
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;
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;
* 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.
* ============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;
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;
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")
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;
*/
@Override
public void healthCheck () {
- LOGGER.debug ("Health check call in Network Adapter");
+ logger.debug ("Health check call in Network Adapter");
}
/**
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 ();
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);
}
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);
}
// 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;
}
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);
}
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 ();
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.
}
}
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;
}
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);
}
}
} 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);
}
}
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);
}
}
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);
}
}
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);
}
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;
}
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 ();
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);
}
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);
}
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);
}
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.
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);
}
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
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();
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);
}
}
} 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);
}
}
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);
}
}
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);
}
}
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);
}
networkRollback.setNeutronNetworkId((String) outputs.get(NETWORK_ID));
}
else {
- LOGGER.debug("outputs is NULL");
+ logger.debug("outputs is NULL");
}
networkRollback.setNetworkType(networkType);
// Save previous parameters
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;
}
}
}
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
// 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();
.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);
}
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);
}
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 ();
|| 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);
}
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);
}
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;
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;
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;
}
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 ();
|| 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);
}
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 ();
}
// 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))
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
}
} 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;
}
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;
}
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;
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 ();
}
// 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))
// 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;
}
{
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"))
rtIsNull = true;
}
if (!rtIsNull) {
- LOGGER.debug("Input RT:" + rt.toString());
+ logger.debug("Input RT:{}", rt);
String role = rt.getRouteTargetRole();
String rtValue = rt.getRouteTarget();
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);
}
}
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
stackParams.put ("policy_refsdata", node);
}
- LOGGER.debug ("StackParams updated with policy refs");
+ logger.debug("StackParams updated with policy refs");
return;
}
stackParams.put ("route_table_refs", csl);
}
- LOGGER.debug ("StackParams updated with route_table refs");
+ logger.debug("StackParams updated with route_table refs");
return;
}
//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);
}
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
// 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;
}
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);
}
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);
}
}
// 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;
}
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
}
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;
}
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;
}
* 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
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;
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;
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;
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
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();
}
}
}
@Override
public void run() {
- LOGGER.debug ("CreateNetworkTask start");
+ logger.debug("CreateNetworkTask start");
try {
// Synchronous Web Service Outputs
Holder<String> networkId = new Holder<>();
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());
}
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());
}
}
@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)
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();
}
}
}
@Override
public void run() {
- LOGGER.debug("DeleteNetworkTask start");
+ logger.debug("DeleteNetworkTask start");
try {
Holder<Boolean> networkDeleted = new Holder<>();
if (req.getCloudSiteId().equals(TESTING_KEYWORD)) {
}
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()) {
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());
}
}
@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 {
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);
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);
@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
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();
}
}
}
@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()) {
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());
}
}
@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)
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();
}
}
}
@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<> ();
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()) {
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());
}
}
* 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.
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;
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;
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.
*/
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 ();
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;
}
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;
}
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;
}
*/
@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;
}
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;
}
}
* 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.
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;
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;
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.
@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
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 ();
}
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();
}
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();
}
}
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();
}
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();
}
* ================================================================================
* 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
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;
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;
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;
}
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++;
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));
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) {
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;
@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,
@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 )
@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,
@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 )
@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,
@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 );
* 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
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;
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;
@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";
*/
@Override
public void healthCheckA () {
- LOGGER.debug ("Health check call in VNF Adapter");
+ logger.debug ("Health check call in VNF Adapter");
}
/**
String vnfName,
String requestType,
String volumeGroupHeatStackId,
- Map <String, String> inputs,
+ Map <String, Object> inputs,
Boolean failIfExists,
Boolean backout,
Boolean enableBridge,
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
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 {
.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);
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;
}
String vnfName,
String requestType,
String volumeGroupHeatStackId,
- Map <String, String> inputs,
+ Map <String, Object> inputs,
String messageId,
MsoRequest msoRequest,
String notificationUrl) {
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;
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 {
.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);
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;
}
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;
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 {
.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 {
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;
}
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;
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 {
.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;
}
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;
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 {
.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;
}
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);
}
}
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
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;
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;
String vnfName,
String requestType,
String volumeGroupHeatStackId,
- Map <String, String> inputs,
+ Map <String, Object> inputs,
Boolean failIfExists,
Boolean backout,
Boolean enableBridge,
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 {
return stringOutputs;
}
- private Map <String, Object> copyStringInputs (Map <String, String> stringInputs) {
+ private Map <String, Object> copyStringInputs (Map <String, Object> stringInputs) {
return new HashMap <> (stringInputs);
}
String volumeGroupHeatStackId,
String baseVfHeatStackId,
String modelCustomizationUuid,
- Map <String, String> inputs,
+ Map <String, Object> inputs,
Boolean failIfExists,
Boolean backout,
Boolean enableBridge,
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 {
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
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
// 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
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 {
*/
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 {
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) {
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;
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) {
String vnfName,
String requestType,
String volumeGroupHeatStackId,
- Map <String, String> inputs,
+ Map <String, Object> inputs,
Boolean failIfExists,
Boolean backout,
Boolean enableBridge,
String vnfName,
String requestType,
String volumeGroupHeatStackId,
- Map <String, String> inputs,
+ Map <String, Object> inputs,
MsoRequest msoRequest,
Holder <Map <String, String>> outputs,
Holder <VnfRollback> rollback)
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) {
String volumeGroupId,
String baseVfModuleId,
String modelCustomizationUuid,
- Map <String, String> inputs,
+ Map <String, Object> inputs,
Boolean failIfExists,
Boolean backout,
Boolean enableBridge,
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);
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
String vnfName,
String requestType,
String volumeGroupHeatStackId,
- Map <String, String> inputs,
+ Map <String, Object> inputs,
Boolean failIfExists,
Boolean backout,
Boolean enableBridge,
String vnfName,
String requestType,
String volumeGroupHeatStackId,
- Map <String, String> inputs,
+ Map <String, Object> inputs,
MsoRequest msoRequest,
Holder <Map <String, String>> outputs,
Holder <VnfRollback> rollback)
* 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);
}
} 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) {
return null;
}
} else if (type.equalsIgnoreCase("boolean")) {
- return new Boolean(inputValue);
+ return new Boolean(inputValue.toString());
}
// Nothing else matched. Return the original string
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) {
String volumeGroupId,
String baseVfModuleId,
String modelCustomizationUuid,
- Map <String, String> inputs,
+ Map <String, Object> inputs,
Boolean failIfExists,
Boolean backout,
Boolean enableBridge,
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
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;
//TODO Logging, SkipAAI, CREATED flags, Integrate with BPEL, Auth,
@Autowired
- @Qualifier("VnfBpel")
private Provider<BpelRestClient> bpelRestClientProvider;
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;
private VnfAdapterRestUtils vnfAdapterRestUtils;
@Autowired
- @Qualifier("VnfBpel")
private Provider<BpelRestClient> bpelRestClientProvider;
/*
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;
/**
private MsoVnfAdapterImpl vnfAdapter;
@Autowired
- @Qualifier("VnfBpel")
private Provider<BpelRestClient> bpelRestClientProvider;
@POST
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;
/**
private VnfAdapterRestUtils vnfAdapterRestUtils;
@Autowired
- @Qualifier("VnfBpel")
private Provider<BpelRestClient> bpelRestClientProvider;
@POST
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:
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:
-
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
doReturn(1).when(mockExternalTask).getRetries();
auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
Mockito.verify(mockExternalTaskService).handleBpmnError(mockExternalTask,
- "AuditAAIInventoryFailure", "Number of Retries Exceeded auditing inventory");
+ "AuditAAIInventoryFailure");
}
@Test
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")));
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")));
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"))
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"))
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- Map<String, String> map = new HashMap<>();
+ Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
try {
@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");
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,
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,
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,
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,
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,
.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,
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);
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);
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);
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);
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);
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);
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");
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
* ================================================================================
* 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
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;
@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);
+ }
+ }
}
* ================================================================================
* 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
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;
// 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;
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,
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;
}
* 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
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;
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;
@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;
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);
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");
}
/**
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);
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 ()
+ ")");
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 (),
}
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 (),
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);
}
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");
+ }
+
}
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();
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);
}
}
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,
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 (
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 {
}
- } 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) {
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;
}
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());
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);
}
}
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());
}
}
} 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());
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)){
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);
} catch(ArtifactInstallerException e){
deploySuccessful = false;
errorMessage = e.getMessage();
- LOGGER.error(e);
+ logger.error("Exception occurred", e);
}
}
// 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());
} 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) {
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)){
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);
+ }
}
}
return UNKNOWN;
}
-
}
* ================================================================================
* 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
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;
@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.
*/
@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");
}
}
* ================================================================================
* 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
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;
@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{
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
+ }
+}
* ================================================================================
* 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
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;
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 {
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() {
}
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);
* ================================================================================
* 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
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;
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;
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;
}
}
* ================================================================================
* 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
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 {
private VfModule vfModule;
private VfModuleCustomization vfModuleCustomization;
-
- //private VnfResource vnfResource;
-
+
private VnfResourceCustomization vnfResourceCustomization;
private AllottedResource allottedResource;
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(){
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);
}
this.toscaCsar = toscaCsar;
}
- public static MsoLogger getLogger() {
- return LOGGER;
- }
-
public boolean isDeployedSuccessfully() {
return isDeployedSuccessfully;
}
* 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
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;
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).
*
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;
/**
//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));
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;
}
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";
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();
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;
}
}
}
} 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;
}
}
/* outputStream.close(); */
} catch (IOException e) {
- LOGGER.error("Unable to open file.", e);
+ logger.error("Unable to open file.", e);
}
}
}
* 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
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;
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;
@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;
}
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(),
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());
}
}
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);
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);
}
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;
* ================================================================================
* 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
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;
@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;
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 {
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
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;
}
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;
}
}
- 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);
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);
}
}
* 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
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);
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());
* ================================================================================
* 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
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;
@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";
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;
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);
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;
}
try {
return CryptoUtils.decrypt(prop, urnPropertiesReader.getVariable(encryptionKey));
} catch(GeneralSecurityException e) {
- msoLogger.debug("Security exception", e);
+ logger.debug("Security exception", e);
}
return defaultValue;
}
* ================================================================================
* 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
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;
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
@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;
String jsonStr = "";
try {
jsonStr = mapper.writeValueAsString(this);
- } catch(JsonProcessingException e) {
- msoLogger.error("JsonProcessingException", e);
+ } catch (JsonProcessingException e) {
+ logger.error("JsonProcessingException", e);
}
return jsonStr;
}
* ================================================================================
* 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
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
@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;
@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;
}
-
}
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;
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 {
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();
}
}
} catch (Exception e) {
- LOGGER.error("not able to retrieve service order.");
+ logger.error("not able to retrieve service order.");
}
return resourceSequence;
}
}
} catch (Exception e) {
- LOGGER.error("not able to retrieve service instance");
+ logger.error("not able to retrieve service instance");
}
return new HashMap();
}
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;
}
String jsonStr = null;
try {
jsonStr = mapper.writeValueAsString(srcObj);
- } catch(JsonProcessingException e) {
- LOGGER.error("SdcToscaParserException", e);
+ } catch (JsonProcessingException e) {
+ logger.error("SdcToscaParserException", e);
}
return jsonStr;
}
* 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
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";
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;
}
}
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;
}
}
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;
}
}
* ================================================================================
* 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
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.
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);
}
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);
}
}
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;
}
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() {
--- /dev/null
+package org.onap.so.bpmn.common.validation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Skip {
+
+}
* ================================================================================
* 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
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 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;
}
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);
}
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");
}
}
}
@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")
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() {
* ================================================================================
* 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
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")
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;
}
+ subscriptionServiceType + ", userParams=" + userParams
+ ", aLaCarte=" + aLaCarte + "]";
}
-}
\ No newline at end of file
+}
* ================================================================================
* 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
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;
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";
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);
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());
}
}
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");
}
}
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");
}
}
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");
}
}
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 =
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();
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;
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;
}
}
* ================================================================================
* 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
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")
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();
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));
}
}
}
CollectionNetworkResourceCustomization collectionNetworkResourceCust) {
return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class);
}
-}
\ No newline at end of file
+}
* ================================================================================
* 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
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;
@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.";
request.setVnfId(vnfId);
this.requestsDbClient.updateInfraActiveRequests(request);
} else {
- msoLogger.debug(REQUEST_ERROR);
+ logger.debug(REQUEST_ERROR);
}
}
request.setVfModuleId(vfModuleId);
this.requestsDbClient.updateInfraActiveRequests(request);
} else {
- msoLogger.debug(REQUEST_ERROR);
+ logger.debug(REQUEST_ERROR);
}
}
request.setVolumeGroupId(volumeGroupId);
this.requestsDbClient.updateInfraActiveRequests(request);
} else {
- msoLogger.debug(REQUEST_ERROR);
+ logger.debug(REQUEST_ERROR);
}
}
request.setNetworkId(networkId);
this.requestsDbClient.updateInfraActiveRequests(request);
} else {
- msoLogger.debug(REQUEST_ERROR);
+ logger.debug(REQUEST_ERROR);
}
}
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;
});
}
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;
});
}
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;
});
}
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;
});
}
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;
});
}
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;
});
}
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;
});
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) {
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) {
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) {
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) {
return Optional.of(volumeGroup);
}
}
-}
\ No newline at end of file
+}
* ================================================================================
* 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
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;
@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;
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();
}
}
* ================================================================================
* 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
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;
@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
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");
}
}
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 {
} catch (Exception ex) {
// keep default vnfType value
}
- WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
+
String errorCode = ASTERISK;
try {
errorCode = "" + workflowException.getErrorCode();
// 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,
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);
}
}
* ================================================================================
* 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
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;
@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 {
} 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);
}
* ================================================================================
* 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
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;
@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;
try {
return new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(dmaapBean);
} catch (JsonProcessingException e) {
- msoLogger.error(e);
+ logger.error("Exception occurred", e);
throw new MapperException(e.getMessage());
}
}
* ================================================================================
* 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
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";
}
}
- 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)
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";
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)
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");
}
* ================================================================================
* 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
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;
@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;
@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
executor.initialize();
return executor;
}
-}
\ No newline at end of file
+}
--- /dev/null
+/*-
+ * ============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");
+ }
+
+}
* ================================================================================
* 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
import java.io.IOException;
import java.io.InputStream;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
*
*/
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.
return "";
}
} catch (IOException e) {
- LOGGER.debug("Exception:", e);
+ logger.debug("Exception:", e);
return "";
}
}
* ================================================================================
* 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
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;
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 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;
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);
}
//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();
//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);
}
}
* ================================================================================
* 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
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;
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;
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;
}
//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();
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);
}
}
* ================================================================================
* 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
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;
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
*/
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;
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;
}
//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();
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);
}
}
* ================================================================================
* 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
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;
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
*/
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;
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>"));
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;
}
//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();
sleep(delay);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
- LOGGER.debug("Exception :",e1);
+ logger.debug("Exception :",e1);
}
try {
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);
}
}
* ================================================================================
* 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
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;
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
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;
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");
}
//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
//Delay sending callback response
sleep(delay);
} catch (InterruptedException e1) {
- LOGGER.debug("Exception :",e1);
+ logger.debug("Exception :",e1);
}
try {
TargetEntity.VNF_ADAPTER);
client.post(payLoad);
} catch (Exception e) {
- LOGGER.debug("Exception :",e);
+ logger.debug("Exception :",e);
}
}
* ================================================================================
* 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
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;
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
*/
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;
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;
}
//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();
//Delay sending callback response
sleep(delay);
} catch (InterruptedException e1) {
- LOGGER.debug("Exception :",e1);
+ logger.debug("Exception :",e1);
}
try {
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);
}
}
* ================================================================================
* 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
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;
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
*/
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;
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;
}
//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();
//Delay sending callback response
sleep(delay);
} catch (InterruptedException e1) {
- LOGGER.debug("Exception :", e1);
+ logger.debug("Exception :", e1);
}
try {
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);
}
}
@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"));
}
@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);
--- /dev/null
+{
+ "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"
+ }
+ }
+}
"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"
"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": [
{
* 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
package org.onap.so.bpmn.core.xml;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
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;
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);
*/
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;
}
}
return out.toString();
} catch (Exception e) {
- LOGGER.debug("Exception at readResourceFile stream: " + e);
+ logger.debug("Exception at readResourceFile stream: " + e);
return null;
}
}
//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();
* ================================================================================
* 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
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() {
}
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;
try {
stmt.close();
} catch (Exception e) {
- LOGGER.debug("Exception :",e);
+ logger.debug("Exception :",e);
}
}
try {
connection.close();
} catch (Exception e) {
- LOGGER.debug("Exception :",e);
+ logger.debug("Exception :",e);
}
}
}
}
-}
\ No newline at end of file
+}
* ================================================================================
* 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
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;
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;
long startTime = System.currentTimeMillis();
- LOGGER.debug(logMarker + " " + method + " received message: "
+ logger.debug(logMarker + " " + method + " received message: "
+ (message == null ? "" : System.lineSeparator()) + message);
try {
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 + "'";
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 + "'");
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);
+ 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;
// 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 + "'");
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;
}
}
- LOGGER.debug("Retry correlate for OptimisticLockingException, retryCount:" + retryCount);
+ logger.debug("Retry correlate for OptimisticLockingException, retryCount:{}", retryCount);
for (; retryCount >0 ; retryCount--) {
.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);
}
}
+ 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
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;
* @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);
}
/**
*/
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);
}
/**
* ================================================================================
* 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
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;
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
/**
* ================================================================================
* 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
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;
@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
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 + "'")
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();
}
return Response.status(204).build();
}
}
-}
\ No newline at end of file
+}
* ================================================================================
* 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
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
// 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);
* 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
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;
@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;
try {
//Kickoff the process
- ProcessThread thread = new ProcessThread(inputVariables,processKey,msoLogger);
+ ProcessThread thread = new ProcessThread(inputVariables,processKey);
thread.start();
Map<String, Object> responseMap = null;
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;
}
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();
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);
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) {
try {
return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null ? true : false ;
} catch (Exception e) {
- msoLogger.debug("Exception :",e);
+ logger.debug("Exception :",e);
return true;
}
}
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);
}
} 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");
}
}
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();
}
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();
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);
}
responseMapVariable);
if (responseMap != null) {
- msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable
+ logger.debug(LOGMARKER + "Obtained " + responseMapVariable
+ " from process " + processInstanceId + " history");
return responseMap;
}
// 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);
}
}
- 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);
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);
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;
}
.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;
}
}
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;
}
}
* ================================================================================
* 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
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;
* 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;
MsoLogger.setLogContext(requestId, svcid);
}
} catch(Exception e) {
- logger.error(e);
+ logger.error("Exception occurred", e);
}
}
}
* ================================================================================
* 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
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;
@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;
* ================================================================================
* 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
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;
@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;
@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
executor.initialize();
return executor;
}
-}
\ No newline at end of file
+}
job-execution:
max-pool-size: 30
core-pool-size: 3
-entitymanager:
- packagesToScan: com
pnf:
dmaap:
host: message-router
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:
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:
-
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
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:
* 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
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.
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() {
.withStatus(200)));
}
-}
\ No newline at end of file
+}
* ================================================================================
* 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
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.
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.
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();
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();
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();
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.
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() {
* 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
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.
public class FalloutHandlerIT extends BaseIntegrationTest {
- MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,FalloutHandlerIT.class);
+ Logger logger = LoggerFactory.getLogger(FalloutHandlerIT.class);
private void setupMocks() {
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
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
* ================================================================================
* 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
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() {
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");
completeVariables.put("responseValue", "skip");
taskService.complete(task.getId(), completeVariables);
} catch(Exception e) {
- logger.debug("GOT EXCEPTION: " + e.getMessage());
+ logger.debug("GOT EXCEPTION: {}", e.getMessage());
}
}
Assert.assertTrue(isProcessEnded(businessKey));
}
-}
\ No newline at end of file
+}
* ================================================================================
* 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
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;
@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 = "";
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);
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
"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",
}
@Test
-
public void testHoming_error_inputVariable() throws Exception {
String businessKey = UUID.randomUUID().toString();
* 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
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.
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.
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();
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();
}
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();
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();
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();
}
* ================================================================================
* 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
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.
private final CallbackSet callbacks = new CallbackSet();
- MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,SDNCAdapterRestV2IT.class);
+ Logger logger = LoggerFactory.getLogger(SDNCAdapterRestV2IT.class);
/**
* ================================================================================
* 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
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;
/**
@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();
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);
* 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
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.
public class UpdateAAIGenericVnfIT extends BaseIntegrationTest {
- MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class);
+ Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
/**
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();
Assert.assertTrue(isProcessEnded(businessKey));
WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- logger.debug("Workflow Exception: " + workflowException);
+ logger.debug("Workflow Exception: {}", workflowException);
Assert.assertNotNull(workflowException);
logEnd();
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();
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();
* 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
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.
public class UpdateAAIVfModuleIT extends BaseIntegrationTest {
- MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class);
+ Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
/**
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();
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();
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();
/*-
- * ============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
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.
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";
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"));
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"));
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"));
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"));
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"));
* ================================================================================
* 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
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;
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
* 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");
}
/**
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);
}
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);
}
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();
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);
for (String var : notAllowed) {
if (var.equals(key)) {
String msg = "Cannot specify " + var + " in injected variables";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
}
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());
}
}
if (msoRequestId == null || msoRequestId.trim().equals("")) {
String msg = "No request-id element in " + request;
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
}
*/
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;
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();
String msg = "Response entity is " +
(entity == null ? "null" : entity.getClass().getName()) +
", expected WorkflowResponse";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
return null; // unreachable
}
} 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
}
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
}
if (callbackData == null) {
String msg = "No callback defined for '" + action + "' SDNC request";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
contentType = JSON;
} else {
String msg = "Invalid SDNC program modifier: '" + modifier + "'";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
if (callbackData == null) {
String msg = "No callback defined for '" + action + "' SDNC request";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
if (callbackData == null) {
String msg = "No callback defined for '" + action + "' SDNC request";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
respMsg = "SERVER ERROR";
} else {
String msg = "Invalid SDNC program modifier: '" + modifier + "'";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
if (callbackData == null) {
String msg = "No callback defined for '" + action + "' VNF REST request";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
contentType = "text/plain";
} else {
String msg = "Invalid VNF REST program modifier: '" + modifier + "'";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
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);
}
if (!injected) {
String msg = "Failed to inject VNF '" + action + "' callback";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
* @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;
.list().size();
if (actual != last) {
- msoLogger.debug("There are now " + actual + " "
- + processKey + " instances");
+ logger.debug("There are now {} {} instances", actual, processKey);
last = actual;
}
} catch (InterruptedException e) {
String msg = "Interrupted waiting for there to be " + count + " "
+ processKey + " instances";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
String msg = "Timed out waiting for there to be " + count + " "
+ processKey + " instances";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
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;
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");
}
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));
}
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);
// 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;
}
// 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));
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;
}
// 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;
}
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.
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;
}
// 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.
}
} 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;
}
// 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.
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;
}
if (callbackData == null) {
String msg = "No '" + action + "' workflow message callback is defined";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
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);
}
contentType = callbackData.getContentType();
} else {
String msg = "Invalid workflow message program modifier: '" + modifier + "'";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
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;
}
if (callbackData == null) {
String msg = "No '" + action + "' workflow message callback is defined";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
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);
}
contentType = callbackData.getContentType();
} else {
String msg = "Invalid workflow message program modifier: '" + modifier + "'";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
}
}
}
- 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;
}
* @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;
}
} catch (InterruptedException e) {
String msg = "Interrupted waiting for process with business key " +
businessKey + " to end";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
String msg = "Process with business key " + businessKey +
" did not end within " + timeout + "ms";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
* @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;
}
} catch (InterruptedException e) {
String msg = "Interrupted waiting for process with business key " +
businessKey + " to end";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
String msg = "Process with business key " + businessKey +
" did not end within " + timeout + "ms";
- msoLogger.debug(msg);
+ logger.debug(msg);
fail(msg);
}
.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;
}
}
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;
}
}
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;
}
}
.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;
}
}
.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;
}
}
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;
@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);
assertThat(instance).isEnded().hasPassedInOrder(
"CreateAndActivatePnf_StartEvent",
"CheckInputs",
- "CheckAiiForCorrelationId",
+ "CheckAiiForPnfCorrelationId",
"DoesAaiContainInfoAboutPnf",
"AaiEntryExists",
"InformDmaapClient",
@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);
assertThat(instance).isEnded().hasPassedInOrder(
"CreateAndActivatePnf_StartEvent",
"CheckInputs",
- "CheckAiiForCorrelationId",
+ "CheckAiiForPnfCorrelationId",
"DoesAaiContainInfoAboutPnf",
"CreatePnfEntryInAai",
"AaiEntryExists",
@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;
return null;
}
- public String getCorrelationId() {
- return correlationId;
+ public String getPnfCorrelationId() {
+ return pnfCorrelationId;
}
public Runnable getInformConsumer() {
}
public boolean haveRegisteredConsumer() {
- return correlationId != null;
+ return pnfCorrelationId != null;
}
}
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();
}
@Override
- public void createEntry(String correlationId, Pnf entry) {
- created.put(correlationId, entry);
+ public void createEntry(String pnfCorrelationId, Pnf entry) {
+ created.put(pnfCorrelationId, entry);
}
@Override
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
<?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>
<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>
<?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" />
<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" />
</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>
<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>
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");
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()
}
msoLogger.trace("Exit postProcessRollback ")
}
-
-
}
* ================================================================================
* 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
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);
.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;
});
@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
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;
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;
@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());
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;
* Implementation of "Create Pnf entry in AAI" task in CreateAndActivatePnfResource.bpmn
*
* Inputs:
- * - correlationId - String
+ * - pnfCorrelationId - String
* - pnfUuid - String
*/
@Component
@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);
}
}
@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) {
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";
@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())
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;
@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");
}
}
public interface DmaapClient {
- void registerForUpdate(String correlationId, Runnable informConsumer);
+ void registerForUpdate(String pnfCorrelationId, Runnable informConsumer);
- Runnable unregister(String correlationId);
+ Runnable unregister(String pnfCorrelationId);
}
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;
}
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();
}
}
@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();
}
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);
}
}
}
- 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();
}
}
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;
}
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
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;
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;
break;
}
}
- LOGGER.debug("Get Terminal TP from InventoryOSS");
+ logger.debug("Get Terminal TP from InventoryOSS");
return tpInfoMap;
}
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;
}
try {
jsonStr = mapper.writeValueAsString(srcObj);
} catch (JsonProcessingException e) {
- LOGGER.debug("SdcToscaParserException", e);
+ logger.debug("SdcToscaParserException", e);
}
return jsonStr;
}
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) {
* ================================================================================
* 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
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";
} 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());
}
}
* ================================================================================
* 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
@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";
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);
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);
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!");
}
}
* ================================================================================
* 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
@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";
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);
} 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);
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!");
}
}
* ================================================================================
* 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
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
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,
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);
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;
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);
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
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
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());
}
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);
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;
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();
}
}
public void setUp() {
executionFake = new DelegateExecutionFake();
executionFake.setVariable("serviceInstanceId", SERVICE_INSTANCE_ID);
- executionFake.setVariable("correlationId", PNF_NAME);
+ executionFake.setVariable("pnfCorrelationId", PNF_NAME);
}
@Test
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;
return null;
}
- public String getCorrelationId() {
- return correlationId;
+ public String getPnfCorrelationId() {
+ return pnfCorrelationId;
}
public Runnable getInformConsumer() {
}
public boolean haveRegisteredConsumer() {
- return correlationId != null;
+ return pnfCorrelationId != null;
}
}
// when
informDmaapClient.execute(delegateExecution);
// then
- assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId");
+ assertThat(dmaapClientTest.getPnfCorrelationId()).isEqualTo("testPnfCorrelationId");
assertThat(dmaapClientTest.getInformConsumer()).isNotNull();
verifyZeroInteractions(messageCorrelationBuilder);
}
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();
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);
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;
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;
}
@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);
}
}
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;
}
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;
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();
}
@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
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();
}
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();
}
@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;
* 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());
/**
* 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);
}
/**
* 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);
}
.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");
<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" />
<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>
<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>
<bpmn:textAnnotation id="TextAnnotation_1eyzes8">
<bpmn:text><![CDATA[Inputs:
 - timeoutForPnfEntryNotification - String
- - correlationId - String
+ - pnfCorrelationId - String
- uuid - String]]></bpmn:text>
</bpmn:textAnnotation>
</bpmn:process>
<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">
<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>
<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" />
</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>
]]></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()
<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>
<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" />
<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>
<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" />
(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">
<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>
<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">
<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">
<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">
</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">
</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">
<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">
</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">
<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" />
</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">
</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">
</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">
<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" />
</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">
</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">
</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">
</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">
<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" />
<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>
* ================================================================================
* 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
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;
@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;
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: ";
* @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();
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");
}
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());
}
}
* @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);
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());
}
}
* @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");
*
*/
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())){
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{
*
*/
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());
}
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){
*
*/
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);
*
*/
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);
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){
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();
*
*/
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");
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;
* ================================================================================
* 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
@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";
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) {
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);
}
} 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);
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);
}
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);
}
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());
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);
* ================================================================================
* 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
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";
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);
}
}
* ================================================================================
* 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
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;
* ================================================================================
* 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
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;
.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();
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
-}
\ No newline at end of file
+}
* ================================================================================
* 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
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;
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";
}
/**
- * 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
*/
}
}
+ /**
+ * 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));
}
}
-}
\ No newline at end of file
+}
* ================================================================================
* 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
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;
@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";
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);
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);
}
}
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);
}
* ================================================================================
* 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
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;
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;
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);
+ }
+ }
}
* ================================================================================
* 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
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
* ================================================================================
* 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
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
* ================================================================================
* 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
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;
@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";
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);
}
}
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);
}
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
}
public void runAppcCommand(BuildingBlockExecution execution, Action action) {
- msoLogger.trace("Start runAppcCommand ");
+ logger.trace("Start runAppcCommand ");
String appcCode = "1002";
String appcMessage = "";
try {
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);
}
* ================================================================================
* 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
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;
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
* ================================================================================
* 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
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
*/
public void processSilentSuccess(BuildingBlockExecution execution) {
String msg = "Silent success processing network assign";
- msoLogger.info(msg);
+ logger.info(msg);
}
/**
--- /dev/null
+/*-
+ * ============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
* ================================================================================
* 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
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 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
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);
}
}
public void callAppcClient(BuildingBlockExecution execution) {
- msoLogger.trace("Start runAppcCommand ");
+ logger.trace("Start runAppcCommand ");
String appcCode = "1002";
String appcMessage = "";
try{
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);
}
* ================================================================================
* 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
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
* ================================================================================
* 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
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
* ================================================================================
* 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
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;
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
}
public void callAppcClient(BuildingBlockExecution execution) {
- msoLogger.trace("Start runAppcCommand ");
+ logger.trace("Start runAppcCommand ");
String appcCode = "1002";
String appcMessage = "";
try {
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);
}
* ================================================================================
* 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
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.";
* ================================================================================
* 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
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
* ================================================================================
* 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
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
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();
* ================================================================================
* 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
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
* ================================================================================
* 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
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
* ================================================================================
* 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
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
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;
import org.springframework.stereotype.Component;
@Component
+@Skip
public class CloudRegionOrchestrationValidator implements PreBuildingBlockValidator {
private static Logger logger = LoggerFactory.getLogger(CloudRegionOrchestrationValidator.class);
* ================================================================================
* 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
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)";
* ================================================================================
* 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
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
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");
}
}
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
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) {
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 {
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);
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());
}
}
- 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);
}
}
- 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();
}
}
- 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();
}
}
- 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())
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);
}
}
- protected void buildVlanInformation(Map<String, String> paramsMap,
+ protected void buildVlanInformation(Map<String, Object> paramsMap,
GenericResourceApiVmNetworkData network, String key, String networkKey) {
String networkString = convertToString(network);
}
}
- 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) {
}
}
- 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();
}
}
- 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();
}
}
- 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) {
}
}
- 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();
* 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) {
/*
* 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();
* 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();
* 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();
* 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");
* 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");
* 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");
* {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[*]");
* {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[*]");
* 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[*]");
* 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[*]");
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) {
* ================================================================================
* 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
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;
@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";
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{
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{
* ================================================================================
* 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
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;
@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.";
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);
}
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) {
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);
}
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);
}
}
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;
}
* ================================================================================
* 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
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;
* ================================================================================
* 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
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;
* ================================================================================
* 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
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;
* ================================================================================
* 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
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;
* ================================================================================
* 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
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
* ================================================================================
* 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
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;
* ================================================================================
* 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
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;
* ================================================================================
* 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
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;
* ================================================================================
* 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
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;
* ================================================================================
* 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
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;
* ================================================================================
* 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
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;
@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
* ================================================================================
* 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
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;
@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.";
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;
}
*/
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");
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);
}
}
*/
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;
}
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,
}
-
}
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
}
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();
+ }
+ }
+ }
}
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;
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
@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,
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);
}
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;
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) {
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 );
* ================================================================================
* 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
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,
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);
}
}
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;
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;
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,
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);
}
* ================================================================================
* 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
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;
@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;
* @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);
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");
}
/**
* @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);
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");
}
}
* ================================================================================
* 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
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;
@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
* @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");
}
}
* @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");
}
}
* @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");
}
}
-
-
}
* ================================================================================
* 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
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>();
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;
}
* ================================================================================
* 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
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;
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("\\\\", "");
}
* ================================================================================
* 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
import java.io.IOException;
import java.io.InputStream;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
*
*/
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.
return "";
}
} catch (IOException e) {
- LOGGER.debug("Exception:", e);
+ logger.debug("Exception:", e);
return "";
}
}
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;
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() {
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;
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;
@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);
- }
+
}
--- /dev/null
+/*-
+ * ============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);
+ }
+}
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;
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"))
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"))
.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"))
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"))
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"))
}
@Test
- @Ignore
public void test_createVolumeGroupRequestMapper() throws Exception {
RequestContext requestContext = new RequestContext();
requestContext.setMsoRequestId("msoRequestId");
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());
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());
}
@Test
- @Ignore
public void test_createVolumeGroupParams() throws Exception {
GenericVnf genericVnf = new GenericVnf();
genericVnf.setVnfId("vnfId");
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);
}
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");
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);
}
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);
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);
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);
//
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);
//
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);
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);
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);
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);
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);
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);
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"));
@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"));
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;
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;
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;
@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));
+
}
}
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;
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
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;
}
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
+import java.util.Map;
import org.junit.After;
import org.junit.Before;
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");
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;
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/";
private RequestContext requestContext;
private L3Network network;
private CloudRegion cloudRegion;
+
+ @Spy
+ private GeneralTopologyObjectMapper generalTopologyObjectMapper;
+
+ @InjectMocks
+ private NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper();
@Before
public void before() {
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");
@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);
@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);
@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);
@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);
@Test
public void createGenericResourceApiNetworkOperationInformationNoNetworkNameTest() throws Exception {
- NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper();
//set network name NULL
network.setNetworkName(null);
GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper(
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;
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
//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);
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;
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();
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");
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);
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);
//
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);
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);
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");
CloudRegion cloudRegion = new CloudRegion();
- VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper();
expectedException.expect(MapperException.class);
expectedException.expectMessage(ERRORMESSAGE);
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;
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
//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);
* ================================================================================
* 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
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;
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();
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);
try {
httpResponse = httpClient.execute(httpRequest);
- LOGGER.debug ("Response status: " + httpResponse.getStatusLine().getStatusCode());
+ logger.debug ("Response status: {}", httpResponse.getStatusLine().getStatusCode());
httpClientResponse = new HttpClientResponse (httpResponse);
}
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 {
try {
httpResponse.close();
} catch (IOException e) {
- LOGGER.debug("Unable to close HTTP Response: " + e);
+ logger.debug("Unable to close HTTP Response: " + e);
}
}
* ================================================================================
* 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
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;
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;
// 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();
throw new HttpClientException ("Error Reading Response Body", e);
}
entityBody = responseBody.toString();
- LOGGER.debug (entityBody);
+ logger.debug(entityBody);
}
@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) {
private String vfModuleInstanceId;
@JsonProperty("configurationId")
private String configurationId;
- @JsonProperty("correlationId")
- private String correlationId;
@JsonProperty("instanceGroupId")
private String instanceGroupId;
this.configurationId = configurationId;
}
- public String getCorrelationId() {
- return correlationId;
- }
-
- public void setCorrelationId(String correlationId) {
- this.correlationId = correlationId;
- }
-
public String getInstanceGroupId() {
return instanceGroupId;
}
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();
}
--- /dev/null
+/*-
+ * ============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());
+ }
+
+}
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,
@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;
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)
* 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.
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() {
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;
}
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);
post.setEntity(input);
HttpResponse response = client.execute(post);
- msoLogger.debug("Response is: " + response);
+ logger.debug("Response is: {}", response);
return response;
}
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());
post.setEntity(input);
HttpResponse response = client.execute(post);
- msoLogger.debug("Response is: " + response);
+ logger.debug("Response is: {}", response);
return response;
}
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,
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();
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));
camundaRequest.setRecipeTimeout(recipeTimeoutInput);
camundaRequest.setRequestAction(requestActionInput);
camundaRequest.setServiceInstanceId(serviceInstanceIdInput);
- camundaRequest.setCorrelationId(correlationIdInput);
+ camundaRequest.setPnfCorrelationId(pnfCorrelationIdInput);
camundaRequest.setVnfId(vnfIdInput);
camundaRequest.setVfModuleId(vfModuleIdInput);
camundaRequest.setVolumeGroupId(volumeGroupIdInput);
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;
}
* ================================================================================
* 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
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);
@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);
@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);
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";
* ================================================================================
* 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
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;
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);
* ================================================================================
* 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
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;
return result;
}
catch (GeneralSecurityException e) {
- msoLogger.debug("Security exception", e);
+ logger.debug("Security exception", e);
}
return defaultValue;
}
return result;
}
catch (GeneralSecurityException e) {
- msoLogger.debug("Security exception", e);
+ logger.debug("Security exception", e);
}
return defaultValue;
}
private int recipeTimeout;
private String requestAction;
private String serviceInstanceId;
- private String correlationId;
+ private String pnfCorrelationId;
private String vnfId;
private String vfModuleId;
private String volumeGroupId;
recipeTimeout = builder.recipeTimeout;
requestAction = builder.requestAction;
serviceInstanceId = builder.serviceInstanceId;
- correlationId = builder.correlationId;
+ pnfCorrelationId = builder.pnfCorrelationId;
vnfId = builder.vnfId;
vfModuleId = builder.vfModuleId;
volumeGroupId = builder.volumeGroupId;
return serviceInstanceId;
}
- public String getCorrelationId() {
- return correlationId;
+ public String getPnfCorrelationId() {
+ return pnfCorrelationId;
}
public String getVnfId() {
private int recipeTimeout;
private String requestAction;
private String serviceInstanceId;
- private String correlationId;
+ private String pnfCorrelationId;
private String vnfId;
private String vfModuleId;
private String volumeGroupId;
return this;
}
- public Builder setCorrelationId(String correlationId) {
- this.correlationId = correlationId;
+ public Builder setPnfCorrelationId(String pnfCorrelationId) {
+ this.pnfCorrelationId = pnfCorrelationId;
return this;
}
* ================================================================================
* 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
import org.onap.so.logger.MsoLogger;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
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;
* ================================================================================
* 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
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 {
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){
} 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 ();
}
}
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";
}
* ================================================================================
* 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
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;
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
* ================================================================================
* 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
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;
}
} 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;
}
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);
int recipeTimeout = 10000;
String requestAction = "createInstance";
String serviceInstanceId = "12345679";
- String correlationId = "12345679";
+ String pnfCorrelationId = "12345679";
String vnfId = "234567891";
String vfModuleId = "345678912";
String volumeGroupId = "456789123";
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");
-{"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
* ================================================================================
* 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
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;
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 {
* ================================================================================
* 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
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;
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;
@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
// 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());
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)
// 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);
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();
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();
}
}
* 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
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;
@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}")
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);
// 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;
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();
* 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
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;
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;
@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) {
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);
}
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);
}
}catch(Exception e){
- //msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, e);
throw new ValidationException ("QueryParam ServiceInfo", e);
-
}
}
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;
}
}
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;
}
}
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);
+ }
}
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;
}
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
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;
}
* ================================================================================
* 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
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;
@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>";
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;
}
}
* ================================================================================
* 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
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;
@Component
public class OrchestrationRequests {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, OrchestrationRequests.class);
+ private static Logger logger = LoggerFactory.getLogger(OrchestrationRequests.class);
@Autowired
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();
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();
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;
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();
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();
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();
* 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
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;
@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";
String vfModuleId = "";
String volumeGroupId = "";
String networkId = "";
- String correlationId = "";
+ String pnfCorrelationId = "";
String instanceGroupId = null;
if(sir.getServiceInstanceId () != null){
serviceInstanceId = sir.getServiceInstanceId ();
instanceGroupId = sir.getInstanceGroupId();
}
- correlationId = getCorrelationId(sir);
+ pnfCorrelationId = getPnfCorrelationId(sir);
try{
infraActiveRequestsClient.save(currentActiveReq);
.setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
.setRequestAction(action.toString())
.setServiceInstanceId(serviceInstanceId)
- .setCorrelationId(correlationId)
+ .setPnfCorrelationId(pnfCorrelationId)
.setVnfId(vnfId)
.setVfModuleId(vfModuleId)
.setVolumeGroupId(volumeGroupId)
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();
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)
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();
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();
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;
headers.add(HttpHeaders.AUTHORIZATION, "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()));
}
} catch(GeneralSecurityException e) {
- msoLogger.error("Security exception", e);
+ logger.error("Security exception", e);
}
return headers;
}
}
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()){
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);
}
}
serviceInstanceId = "";
String configurationId = "";
- String correlationId = "";
+ String pnfCorrelationId = "";
if(sir.getServiceInstanceId () != null){
serviceInstanceId = sir.getServiceInstanceId ();
configurationId = sir.getConfigurationId();
}
- correlationId = getCorrelationId(sir);
+ pnfCorrelationId = getPnfCorrelationId(sir);
try{
infraActiveRequestsClient.save(currentActiveReq);
.setRecipeTimeout(Integer.parseInt(timeOut))
.setRequestAction(action.toString())
.setServiceInstanceId(serviceInstanceId)
- .setCorrelationId(correlationId)
+ .setPnfCorrelationId(pnfCorrelationId)
.setConfigurationId(configurationId)
.setRequestDetails(mapJSONtoMSOStyle(requestJSON, sir, aLaCarte, action))
.setApiVersion(apiVersion)
* ================================================================================
* 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
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;
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;
@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();
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;
* ================================================================================
* 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.
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
+import java.util.UUID;
import javax.inject.Provider;
import javax.transaction.Transactional;
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;
@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 ;
@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));
}
@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));
@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));
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);
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);
}
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){
* ================================================================================
* 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
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;
@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;
CloudOrchestrationRequest cor = null;
- msoLogger.debug ("requestId is: " + requestId);
+ logger.debug ("requestId is: " + requestId);
try{
ObjectMapper mapper = new ObjectMapper();
@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");
* ================================================================================
* 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
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;
@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;
* ================================================================================
* 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
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;
@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) {
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);
}
}
* ================================================================================
* 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
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;
@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;
@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)) {
} 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;
}
* ================================================================================
* 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
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
* ================================================================================
* 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
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
* ================================================================================
* 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
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/";
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);
}
catch (Exception e) {
- msoLogger.debug("Failed to decrypt credentials: " + toDecrypt, e);
+ logger.debug("Failed to decrypt credentials: {}", toDecrypt, e);
}
return result;
}
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;
@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";
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,
* ================================================================================
* 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
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;
* ================================================================================
* 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
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;
// 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(),
* ================================================================================
* 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
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 CreateVnfOperationalEnvironment {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CreateVnfOperationalEnvironment.class);
+ private static Logger logger = LoggerFactory.getLogger(CreateVnfOperationalEnvironment.class);
protected CloudOrchestrationRequest request;
@Autowired
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);
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);
}
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));
* ================================================================================
* 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
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;
* 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
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;
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();
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;
(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){
info.setVfModuleType(vfModuleType);
return info;
}
-}
\ No newline at end of file
+}
* ================================================================================
* 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
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;
@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
public String getTestUrl(String requestId) {
return "/infraActiveRequests/" + requestId;
}
-}
\ No newline at end of file
+}
--- /dev/null
+/*-
+ * ============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());
+ }
+}
},
{
"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": {
},
},
"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",
},
{
"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": {
},