aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-openstack-adapters')
-rw-r--r--adapters/mso-openstack-adapters/pom.xml36
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAudit.java55
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAuditList.java25
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java38
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java12
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java77
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java42
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java71
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java62
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java39
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java62
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java5
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java18
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java35
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java184
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java78
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java42
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CatalogDBConfig.java77
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java1
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java11
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java1
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/CSAR.java189
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java29
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java386
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java270
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java146
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java67
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java64
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java32
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java32
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/ObjectFactory.java69
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/QueryVnfNotification.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/UpdateVnfNotification.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfAdapterNotify_Service.java29
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeException.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java33
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java29
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientException.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV2ClientImpl.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV3ClientImpl.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactory.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java28
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduStatus.java12
-rw-r--r--adapters/mso-openstack-adapters/src/main/resources/application-local.yaml103
-rw-r--r--adapters/mso-openstack-adapters/src/main/resources/application.yaml20
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/AllTestsTestSuite.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java101
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java26
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java91
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java74
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java1
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java24
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java30
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java23
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java7
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java65
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java20
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml2
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/GetResources.json2
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json4
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json4
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json30
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json30
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json2
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json3
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml17
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/application-test.yaml20
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/logback-test.xml14
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/schema.sql145
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/vfModule.json38
88 files changed, 2259 insertions, 1347 deletions
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index 088f9499ce..7ffcd8308c 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -82,7 +82,7 @@
<keep>true</keep>
</configuration>
</execution>
-
+
<execution>
<id>generate-vnf-async-stubs</id>
<phase>process-classes</phase>
@@ -123,7 +123,7 @@
</configuration>
</execution>
</executions>
- </plugin>
+ </plugin>
-->
<plugin>
<groupId>org.jacoco</groupId>
@@ -147,13 +147,22 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>original</id>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
<pluginManagement>
<plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings
- only. It has no influence on the Maven build itself. -->
+ <!--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>
<artifactId>lifecycle-mapping</artifactId>
@@ -164,14 +173,14 @@
<pluginExecution>
<pluginExecutionFilter>
<groupId>
- org.jvnet.jax-ws-commons
- </groupId>
+ org.jvnet.jax-ws-commons
+ </groupId>
<artifactId>
- jaxws-maven-plugin
- </artifactId>
+ jaxws-maven-plugin
+ </artifactId>
<versionRange>
- [2.3,)
- </versionRange>
+ [2.3,)
+ </versionRange>
<goals>
<goal>wsgen</goal>
</goals>
@@ -219,11 +228,6 @@
<version>${cxf.version}</version>
</dependency>
<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>
@@ -250,7 +254,7 @@
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
- <version>3.2.1</version>
+ <version>3.2.2</version>
</dependency>
<dependency>
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAudit.java
deleted file mode 100644
index 0a186ccb82..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAudit.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.onap.so.adapters.audit;
-
-import java.io.Serializable;
-import java.net.URI;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-public class AAIObjectAudit implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -4560928512855386021L;
- private boolean doesObjectExist = false;
- private Object aaiObject;
- private URI resourceURI;
- private String aaiObjectType;
-
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("doesObjectExist", doesObjectExist).append("aaiObject", aaiObject)
- .append("resourceURI", resourceURI).append("aaiObjectType", aaiObjectType).toString();
- }
-
- public String getAaiObjectType() {
- return aaiObjectType;
- }
-
- public void setAaiObjectType(String aaiObjectType) {
- this.aaiObjectType = aaiObjectType;
- }
-
- public boolean isDoesObjectExist() {
- return doesObjectExist;
- }
-
- public void setDoesObjectExist(boolean doesObjectExist) {
- this.doesObjectExist = doesObjectExist;
- }
-
- public Object getAaiObject() {
- return aaiObject;
- }
-
- public void setAaiObject(Object aaiObject) {
- this.aaiObject = aaiObject;
- }
-
- public URI getResourceURI() {
- return resourceURI;
- }
-
- public void setResourceURI(URI resourceURI) {
- this.resourceURI = resourceURI;
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAuditList.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAuditList.java
deleted file mode 100644
index f3a2cfea9b..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAuditList.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.onap.so.adapters.audit;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-public class AAIObjectAuditList implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 6712662349909726930L;
- private List<AAIObjectAudit> auditList = new ArrayList<>();
-
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("auditList", auditList).toString();
- }
-
- public List<AAIObjectAudit> getAuditList() {
- return auditList;
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
index 52f5478f2f..8edce124ec 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
@@ -1,8 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+
package org.onap.so.adapters.audit;
import java.util.Optional;
import org.camunda.bpm.client.task.ExternalTask;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
@@ -20,6 +43,8 @@ public abstract class AbstractAuditService {
protected static final String UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI =
"Unable to find all VServers and L-Interaces in A&AI";
+ protected static final String UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK = "Unable to find VServers in Openstack";
+
@Autowired
public Environment env;
@@ -45,12 +70,12 @@ public abstract class AbstractAuditService {
* @param auditList
* @return
*/
- protected boolean didDeleteAuditFail(Optional<AAIObjectAuditList> auditList) {
- if (auditList.get().getAuditList() != null && !auditList.get().getAuditList().isEmpty()) {
+ protected boolean didDeleteAuditFail(AAIObjectAuditList auditList) {
+ if (auditList.getAuditList() != null && !auditList.getAuditList().isEmpty()) {
if (logger.isInfoEnabled()) {
- logger.info("Audit Results: {}", auditList.get().toString());
+ logger.info("Audit Results: {}", auditList.toString());
}
- return auditList.get().getAuditList().stream().filter(AAIObjectAudit::isDoesObjectExist).findFirst()
+ return auditList.getAuditList().stream().filter(AAIObjectAudit::isDoesObjectExist).findFirst()
.map(v -> true).orElse(false);
} else {
return false;
@@ -62,9 +87,12 @@ public abstract class AbstractAuditService {
}
protected void setupMDC(ExternalTask externalTask) {
+ logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
String msoRequestId = externalTask.getVariable("mso-request-id");
- if (msoRequestId != null && !msoRequestId.isEmpty())
+ if (msoRequestId != null && !msoRequestId.isEmpty()) {
MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
+ }
+ MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName());
}
protected long calculateRetryDelay(int currentRetries) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
index 947c6ddfeb..1e5b6de857 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,8 +27,10 @@ import java.util.Map;
import java.util.Optional;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -47,9 +49,9 @@ public class AuditCreateStackService extends AbstractAuditService {
public Environment environment;
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
Map<String, Object> variables = new HashMap<>();
- setupMDC(externalTask);
boolean success = false;
try {
logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory,
@@ -57,6 +59,8 @@ public class AuditCreateStackService extends AbstractAuditService {
Optional<AAIObjectAuditList> auditListOpt = heatStackAudit.auditHeatStack(auditInventory.getCloudRegion(),
auditInventory.getCloudOwner(), auditInventory.getTenantId(), auditInventory.getHeatStackName());
if (auditListOpt.isPresent()) {
+ auditListOpt.get().setAuditType("create");
+ auditListOpt.get().setHeatStackName(auditInventory.getHeatStackName());
GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
variables.put("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditListOpt.get()));
success = !didCreateAuditFail(auditListOpt);
@@ -68,6 +72,7 @@ public class AuditCreateStackService extends AbstractAuditService {
if (success) {
externalTaskService.complete(externalTask, variables);
logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
if (externalTask.getRetries() == null) {
logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
@@ -77,6 +82,7 @@ public class AuditCreateStackService extends AbstractAuditService {
} else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
externalTaskService.complete(externalTask, variables);
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
externalTask.getId(), externalTask.getRetries() - 1,
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java
new file mode 100644
index 0000000000..1c707fe795
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java
@@ -0,0 +1,77 @@
+package org.onap.so.adapters.audit;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Optional;
+import org.onap.so.audit.beans.AuditInventory;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.db.request.beans.RequestProcessingData;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.objects.audit.AAIObjectAuditList;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+
+@Component
+public class AuditDataService {
+
+ @Autowired
+ private RequestsDbClient requestsDbClient;
+
+ /**
+ * Checks to see if an entry already exist for the given heat stack and writes audit stack data to the request
+ * database if it doesn't.
+ *
+ * @throws JsonProcessingException
+ */
+ public void writeStackDataToRequestDb(AuditInventory auditInventory, AAIObjectAuditList auditList)
+ throws JsonProcessingException {
+ List<RequestProcessingData> requestProcessingDataList =
+ requestsDbClient.getRequestProcessingDataByGroupingIdAndNameAndTag(auditInventory.getVfModuleId(),
+ auditInventory.getHeatStackName(), "AuditStackData");
+ if (requestProcessingDataList.isEmpty()) {
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
+ String auditListString = objectMapper.getMapper().writeValueAsString(auditList);;
+
+ RequestProcessingData requestProcessingData = new RequestProcessingData();
+ requestProcessingData.setSoRequestId(auditInventory.getMsoRequestId());
+ requestProcessingData.setGroupingId(auditInventory.getVfModuleId());
+ requestProcessingData.setName(auditInventory.getHeatStackName());
+ requestProcessingData.setTag("AuditStackData");
+ requestProcessingData.setValue(auditListString);
+
+ requestsDbClient.saveRequestProcessingData(requestProcessingData);
+ }
+ }
+
+ /**
+ * Retrieves audit stack data from the request database.
+ *
+ * @throws IOException
+ * @throws JsonMappingException
+ * @throws JsonParseException
+ */
+ public Optional<AAIObjectAuditList> getStackDataFromRequestDb(AuditInventory auditInventory)
+ throws JsonParseException, JsonMappingException, IOException {
+
+ List<RequestProcessingData> requestProcessingDataList =
+ requestsDbClient.getRequestProcessingDataByGroupingIdAndNameAndTag(auditInventory.getVfModuleId(),
+ auditInventory.getHeatStackName(), "AuditStackData");
+ if (!requestProcessingDataList.isEmpty()) {
+ RequestProcessingData requestProcessingData = requestProcessingDataList.get(0);
+ String auditListString = requestProcessingData.getValue();
+
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
+ AAIObjectAuditList auditList =
+ objectMapper.getMapper().readValue(auditListString, AAIObjectAuditList.class);
+
+ return Optional.of(auditList);
+ } else {
+ return Optional.empty();
+ }
+ }
+
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
index 048e6dbba2..0aa4f9bdc3 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,8 +25,10 @@ import java.util.Map;
import java.util.Optional;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -39,26 +41,38 @@ public class AuditDeleteStackService extends AbstractAuditService {
private static final Logger logger = LoggerFactory.getLogger(AuditDeleteStackService.class);
@Autowired
- public HeatStackAudit heatStackAudit;
+ protected HeatStackAudit heatStackAudit;
@Autowired
- public Environment environment;
+ protected AuditVServer auditVservers;
+
+ @Autowired
+ protected AuditDataService auditDataService;
+
+ @Autowired
+ protected Environment env;
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
Map<String, Object> variables = new HashMap<>();
- setupMDC(externalTask);
boolean success = false;
try {
- logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory,
- externalTask.getRetries());
- Optional<AAIObjectAuditList> auditListOpt = heatStackAudit.auditHeatStack(auditInventory.getCloudRegion(),
- auditInventory.getCloudOwner(), auditInventory.getTenantId(), auditInventory.getHeatStackName());
+ logger.info("Executing External Task Delete Audit Inventory. Retry Number: {}", externalTask.getRetries());
+ Optional<AAIObjectAuditList> auditListOpt = auditDataService.getStackDataFromRequestDb(auditInventory);
if (auditListOpt.isPresent()) {
- GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
- variables.put("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditListOpt.get()));
- success = didDeleteAuditFail(auditListOpt);
+ auditVservers.auditVservers(auditListOpt.get());
+ } else {
+ logger.debug("Auditing Vservers based on vf module relationships");
+ auditListOpt = auditVservers.auditVserversThroughRelationships(auditInventory.getGenericVnfId(),
+ auditInventory.getHeatStackName());
}
+ auditListOpt.get().setHeatStackName(auditInventory.getHeatStackName());
+ auditListOpt.get().setAuditType("delete");
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
+ variables.put("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditListOpt.get()));
+ success = !didDeleteAuditFail(auditListOpt.get());
+
} catch (Exception e) {
logger.error("Error during audit of stack", e);
}
@@ -66,6 +80,7 @@ public class AuditDeleteStackService extends AbstractAuditService {
if (success) {
externalTaskService.complete(externalTask, variables);
logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
if (externalTask.getRetries() == null) {
logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
@@ -74,7 +89,8 @@ public class AuditDeleteStackService extends AbstractAuditService {
UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, getRetrySequence().length, 10000);
} else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
- externalTaskService.complete(externalTask);
+ externalTaskService.complete(externalTask, variables);
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
externalTask.getId(), externalTask.getRetries() - 1,
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java
new file mode 100644
index 0000000000..2ef7d5b325
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java
@@ -0,0 +1,71 @@
+package org.onap.so.adapters.audit;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.audit.beans.AuditInventory;
+import org.onap.so.objects.audit.AAIObjectAuditList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AuditQueryStackService extends AbstractAuditService {
+
+ private static final Logger logger = LoggerFactory.getLogger(AuditQueryStackService.class);
+
+ @Autowired
+ protected HeatStackAudit heatStackAudit;
+
+ @Autowired
+ protected AuditDataService auditDataService;
+
+ protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ setupMDC(externalTask);
+ AuditInventory auditInventory = externalTask.getVariable("auditInventory");
+ boolean success = false;
+ Map<String, Object> variables = new HashMap<>();
+ try {
+ logger.info("Executing External Task Query Audit Inventory. Audit Inventory: {} \n Retry Number: {}",
+ auditInventory.toString(), externalTask.getRetries());
+
+ Optional<AAIObjectAuditList> auditList = heatStackAudit.queryHeatStack(auditInventory.getCloudOwner(),
+ auditInventory.getCloudRegion(), auditInventory.getTenantId(), auditInventory.getHeatStackName());
+
+ if (auditList.isPresent()) {
+ success = true;
+ auditDataService.writeStackDataToRequestDb(auditInventory, auditList.get());
+ }
+ if (success) {
+ externalTaskService.complete(externalTask, variables);
+ logger.debug("The External Task {} was Successful", externalTask.getId());
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ } else {
+ if (externalTask.getRetries() == null) {
+ logger.debug("The External Task {} Failed. Setting Retries to Default Start Value: {}",
+ externalTask.getId(), getRetrySequence().length);
+ externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK,
+ UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, getRetrySequence().length, 10000);
+ } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
+ logger.debug("The External Task {} Failed. All Retries Exhausted", externalTask.getId());
+ externalTaskService.complete(externalTask, variables);
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ } else {
+ logger.debug("The External Task {} Failed. Decrementing Retries to {} , Retry Delay: ",
+ externalTask.getId(), externalTask.getRetries() - 1,
+ calculateRetryDelay(externalTask.getRetries()));
+ externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK,
+ UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, externalTask.getRetries() - 1,
+ calculateRetryDelay(externalTask.getRetries()));
+ }
+ logger.debug("The External Task {} Failed", externalTask.getId());
+ }
+ } catch (Exception e) {
+ logger.error("Error during audit query of stack", e);
+ }
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
index 3508810e04..6a42456715 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
@@ -40,6 +40,10 @@ public class AuditStackService {
private static final Logger logger = LoggerFactory.getLogger(AuditStackService.class);
+ private static final String DEFAULT_AUDIT_LOCK_TIME = "60000";
+
+ private static final String DEFAULT_MAX_CLIENTS_FOR_TOPIC = "10";
+
@Autowired
public Environment env;
@@ -49,37 +53,59 @@ public class AuditStackService {
@Autowired
private AuditDeleteStackService auditDeleteStack;
+ @Autowired
+ private AuditQueryStackService auditQueryStack;
+
@PostConstruct
public void auditAddAAIInventory() {
- String auth = "";
- try {
- auth = CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey"));
- } catch (IllegalStateException | GeneralSecurityException e) {
- logger.error("Error Decrypting Password", e);
+ for (int i = 0; i < getMaxClients(); i++) {
+ ExternalTaskClient client = createExternalTaskClient();
+ client.subscribe("InventoryAddAudit")
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
+ .handler(auditCreateStack::executeExternalTask).open();
}
- ClientRequestInterceptor interceptor =
- new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth);
- ExternalTaskClient client = ExternalTaskClient.create()
- .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
- .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
- client.subscribe("InventoryAddAudit").lockDuration(60000).handler(auditCreateStack::executeExternalTask).open();
}
@PostConstruct
public void auditDeleteAAIInventory() {
+ for (int i = 0; i < getMaxClients(); i++) {
+ ExternalTaskClient client = createExternalTaskClient();
+ client.subscribe("InventoryDeleteAudit")
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
+ .handler(auditDeleteStack::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void auditQueryInventory() {
+ for (int i = 0; i < getMaxClients(); i++) {
+ ExternalTaskClient client = createExternalTaskClient();
+ client.subscribe("InventoryQueryAudit")
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
+ .handler(auditQueryStack::executeExternalTask).open();
+ }
+ }
+
+ protected ExternalTaskClient createExternalTaskClient() {
+ ClientRequestInterceptor interceptor = createClientRequestInterceptor();
+ return ExternalTaskClient.create().baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1)
+ .addInterceptor(interceptor).asyncResponseTimeout(120000)
+ .backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
+ }
+
+ protected ClientRequestInterceptor createClientRequestInterceptor() {
String auth = "";
try {
auth = CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey"));
} catch (IllegalStateException | GeneralSecurityException e) {
logger.error("Error Decrypting Password", e);
}
- ClientRequestInterceptor interceptor =
- new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth);
- ExternalTaskClient client = ExternalTaskClient.create()
- .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
- .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
- client.subscribe("InventoryDeleteAudit").lockDuration(60000).handler(auditDeleteStack::executeExternalTask)
- .open();
+ return new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth);
}
+ protected int getMaxClients() {
+ return Integer.parseInt(env.getProperty("workflow.topics.maxClients", DEFAULT_MAX_CLIENTS_FOR_TOPIC));
+ }
+
+
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
index 5ca045d988..14d83b3b06 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
@@ -20,14 +20,18 @@
package org.onap.so.adapters.audit;
+import java.util.List;
import java.util.Optional;
import java.util.Set;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.client.aai.AAIObjectPlurals;
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.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
@@ -38,6 +42,38 @@ import com.fasterxml.jackson.core.JsonProcessingException;
public class AuditVServer extends AbstractAudit {
private static final Logger logger = LoggerFactory.getLogger(AuditVServer.class);
+ public void auditVservers(AAIObjectAuditList aaiObjectAuditList) {
+
+ aaiObjectAuditList.getAuditList().forEach(aaiObjectAudit -> {
+ boolean vserverExist = getAaiClient().exists(AAIUriFactory
+ .createResourceFromExistingURI(AAIObjectType.VSERVER, aaiObjectAudit.getResourceURI()));
+ aaiObjectAudit.setDoesObjectExist(vserverExist);
+ });
+ }
+
+ public Optional<AAIObjectAuditList> auditVserversThroughRelationships(String genericVnfId, String vfModuleName) {
+ AAIObjectAuditList auditList = new AAIObjectAuditList();
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, genericVnfId)
+ .queryParam("vf-module-name", vfModuleName);
+ if (getAaiClient().get(uri).getRelationships().isPresent()) {
+ List<AAIResourceUri> relatedVservers =
+ getAaiClient().get(uri).getRelationships().get().getRelatedUris(AAIObjectType.VSERVER);
+ if (!relatedVservers.isEmpty()) {
+ relatedVservers.forEach(vserverUri -> {
+ Optional<Vserver> vserver = getAaiClient().get(vserverUri).asBean(Vserver.class);
+ Vserver vServerShallow = new Vserver();
+ BeanUtils.copyProperties(vserver, vServerShallow);
+ AAIObjectAudit vServerAudit = new AAIObjectAudit();
+ vServerAudit.setAaiObject(vServerShallow);
+ vServerAudit.setAaiObjectType(AAIObjectType.VSERVER.typeName());
+ vServerAudit.setDoesObjectExist(true);
+ auditList.getAuditList().add(vServerAudit);
+ });
+ }
+ }
+ return Optional.of(auditList);
+ }
+
public Optional<AAIObjectAuditList> auditVservers(Set<Vserver> vServersToAudit, String tenantId, String cloudOwner,
String cloudRegion) {
if (vServersToAudit == null || vServersToAudit.isEmpty()) {
@@ -48,8 +84,9 @@ public class AuditVServer extends AbstractAudit {
try {
logger.debug("Vserver to Audit: {}", objectMapper.getMapper().writeValueAsString(vserver));
} catch (JsonProcessingException e) {
-
+ logger.error("Json parse exception: {}", e.getMessage());
}
+
});
AAIObjectAuditList auditList = new AAIObjectAuditList();
vServersToAudit.stream().forEach(vServer -> auditList.getAuditList()
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
index 627f6a276c..ffa76cf8ee 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
@@ -3,6 +3,8 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications 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.
@@ -35,10 +37,15 @@ import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.Vlan;
import org.onap.aai.domain.yang.Vlans;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.openstack.utils.MsoNeutronUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.woorea.openstack.heat.model.Link;
@@ -54,7 +61,7 @@ public class HeatStackAudit {
protected static final Logger logger = LoggerFactory.getLogger(HeatStackAudit.class);
- private static final String exceptionMsg = "Error finding Path from Self Link";
+ private static final String EXCEPTION_MSG = "Error finding Path from Self Link";
@Autowired
protected MsoHeatUtils heat;
@@ -65,6 +72,28 @@ public class HeatStackAudit {
@Autowired
protected AuditVServer auditVservers;
+ public Optional<AAIObjectAuditList> queryHeatStack(String cloudOwner, String cloudRegion, String tenantId,
+ String heatStackName) {
+ try {
+ logger.debug("Fetching Top Level Stack Information");
+ Resources resources = heat.queryStackResources(cloudRegion, tenantId, heatStackName, 3);
+ List<Resource> novaResources = resources.getList().stream()
+ .filter(p -> "OS::Nova::Server".equals(p.getType())).collect(Collectors.toList());
+ if (novaResources.isEmpty())
+ return Optional.of(new AAIObjectAuditList());
+ else {
+ Set<Vserver> vserversToAudit = createVserverSet(novaResources);
+ AAIObjectAuditList aaiObjectAuditList = new AAIObjectAuditList();
+ vserversToAudit.stream().forEach(vServer -> aaiObjectAuditList.getAuditList()
+ .add(createAAIObjectAudit(cloudOwner, cloudRegion, tenantId, vServer)));
+ return Optional.of(aaiObjectAuditList);
+ }
+ } catch (Exception e) {
+ logger.error("Error during query stack resources", e);
+ return Optional.of(new AAIObjectAuditList());
+ }
+ }
+
public Optional<AAIObjectAuditList> auditHeatStack(String cloudRegion, String cloudOwner, String tenantId,
String heatStackName) {
try {
@@ -112,10 +141,10 @@ public class HeatStackAudit {
processNestedResourceGroup(cloudRegion, tenantId, vServersWithLInterface,
nestedResourceGroupResources);
} else
- throw new Exception(exceptionMsg);
+ throw new Exception(EXCEPTION_MSG);
} catch (Exception e) {
logger.error("Error Parsing Link to obtain Path", e);
- throw new Exception(exceptionMsg);
+ throw new Exception(EXCEPTION_MSG);
}
}
}
@@ -145,7 +174,7 @@ public class HeatStackAudit {
addSubInterfaceToVserver(vServersWithLInterface, subinterfaceStack, subinterfaceResources);
}
} else
- throw new Exception(exceptionMsg);
+ throw new Exception(EXCEPTION_MSG);
}
@@ -214,6 +243,31 @@ public class HeatStackAudit {
return vserversToAudit;
}
+ protected Set<Vserver> createVserverSet(List<Resource> novaResources) {
+ Set<Vserver> vserversToAudit = new HashSet<>();
+ for (Resource novaResource : novaResources) {
+ Vserver auditVserver = new Vserver();
+ auditVserver.setLInterfaces(new LInterfaces());
+ auditVserver.setVserverId(novaResource.getPhysicalResourceId());
+ vserversToAudit.add(auditVserver);
+ }
+ return vserversToAudit;
+ }
+
+ protected AAIObjectAudit createAAIObjectAudit(String cloudOwner, String cloudRegion, String tenantId,
+ Vserver vServer) {
+ AAIObjectAudit aaiObjectAudit = new AAIObjectAudit();
+ Vserver vServerShallow = new Vserver();
+ BeanUtils.copyProperties(vServer, vServerShallow);
+ aaiObjectAudit.setAaiObject(vServerShallow);
+ aaiObjectAudit.setAaiObjectType(AAIObjectType.VSERVER.typeName());
+ aaiObjectAudit.setResourceURI(AAIUriFactory
+ .createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenantId, vServer.getVserverId())
+ .build());
+
+ return aaiObjectAudit;
+ }
+
/**
* @param novaResource Single openstack resource that is of type Nova
* @param neutronPorts List of Neutron ports created within the stack
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java
index 4453071e06..69e16986da 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java
@@ -22,12 +22,11 @@ package org.onap.so.adapters.inventory.create;
import java.util.Optional;
import java.util.stream.Stream;
-import org.onap.aai.domain.yang.LInterface;
-import org.onap.so.adapters.audit.AAIObjectAudit;
-import org.onap.so.adapters.audit.AAIObjectAuditList;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.springframework.stereotype.Component;
@Component
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
index 8bd813026f..49a9e7e171 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
@@ -59,7 +59,9 @@ public class CreateInventoryService {
ExternalTaskClient client = ExternalTaskClient.create()
.baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
.asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
- client.subscribe("InventoryCreate").lockDuration(60000).handler(createInventory::executeExternalTask).open();
+ client.subscribe("InventoryCreate")
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
+ .handler(createInventory::executeExternalTask).open();
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
index 4958bbc7f2..a6c61704ad 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
@@ -3,6 +3,8 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ *
+ * 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.
@@ -23,8 +25,8 @@ package org.onap.so.adapters.inventory.create;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.adapters.audit.AAIObjectAuditList;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
@@ -39,6 +41,8 @@ public class CreateInventoryTask {
private static final Logger logger = LoggerFactory.getLogger(CreateInventoryTask.class);
+ private static final String AAI_INVENTORY_FAILURE = "AAIInventoryFailure";
+
@Autowired
CreateAAIInventory createInventory;
@@ -73,9 +77,10 @@ public class CreateInventoryTask {
if (success) {
externalTaskService.complete(externalTask);
logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else if (inventoryException) {
logger.debug("The External Task Id: {} Failed, Retry not needed", externalTask.getId());
- externalTaskService.handleBpmnError(externalTask, "AAIInventoryFailure");
+ externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
} else {
if (externalTask.getRetries() == null) {
logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
@@ -84,7 +89,8 @@ public class CreateInventoryTask {
UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, getRetrySequence().length, 10000);
} else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
- externalTaskService.handleBpmnError(externalTask, "AAIInventoryFailure");
+ externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
externalTask.getId(), externalTask.getRetries() - 1,
@@ -97,13 +103,15 @@ public class CreateInventoryTask {
}
} else {
logger.debug("The External Task Id: {} Failed, No Audit Results Written", externalTask.getId());
- externalTaskService.handleBpmnError(externalTask, "AAIInventoryFailure");
+ externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
}
}
private void setupMDC(ExternalTask externalTask) {
try {
- String msoRequestId = (String) externalTask.getVariable("mso-request-id");
+ logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
+ MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName());
+ String msoRequestId = externalTask.getVariable("mso-request-id");
if (msoRequestId != null && !msoRequestId.isEmpty())
MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
} catch (Exception e) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java
index 24fa9af7f9..ed31c1c67e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.adapters.inventory.create;
public class InventoryException extends Exception {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java
index 0c55bd6945..25667efc71 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java
@@ -66,7 +66,7 @@ public class ContrailSubnet {
private List<ContrailSubnetPool> allocationPools = new ArrayList<>();
@JsonProperty("network_ipam_refs_data_ipam_subnets_host_routes")
- private final ContrailSubnetHostRoutes host_routes = new ContrailSubnetHostRoutes();
+ private final ContrailSubnetHostRoutes hostRoutes = new ContrailSubnetHostRoutes();
public ContrailSubnet() {
super();
@@ -173,7 +173,7 @@ public class ContrailSubnet {
}
}
if (inputSubnet.getHostRoutes() != null) {
- List<ContrailSubnetHostRoute> hrList = host_routes.getHost_routes();
+ List<ContrailSubnetHostRoute> hrList = hostRoutes.getHostRoutes();
for (HostRoute hr : inputSubnet.getHostRoutes()) {
if (!msoCommonUtils.isNullOrEmpty(hr.getPrefix())
|| !msoCommonUtils.isNullOrEmpty(hr.getNextHop())) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java
index b1908d9541..0802194b4a 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java
@@ -33,12 +33,12 @@ public class ContrailSubnetHostRoutes {
public ContrailSubnetHostRoutes() {}
- public List<ContrailSubnetHostRoute> getHost_routes() {
+ public List<ContrailSubnetHostRoute> getHostRoutes() {
return hostRoutes;
}
- public void setHost_routes(List<ContrailSubnetHostRoute> host_routes) {
- this.hostRoutes = host_routes;
+ public void setHostRoutes(List<ContrailSubnetHostRoute> hostRoutes) {
+ this.hostRoutes = hostRoutes;
}
@Override
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
index 4753b1c18d..e95e9a3a83 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
@@ -11,9 +11,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,6 +47,7 @@ import org.onap.so.adapters.network.async.client.UpdateNetworkNotification;
import org.onap.so.adapters.network.exceptions.NetworkException;
import org.onap.so.entity.MsoRequest;
import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.NetworkRollback;
import org.onap.so.openstack.beans.NetworkStatus;
@@ -71,6 +72,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
private static final String NETWORK_EXCEPTION_MSG = "Got a NetworkException on createNetwork: ";
private static final String CREATE_NETWORK_ERROR_LOGMSG = "{} {} Error sending createNetwork notification {} ";
private static final String FAULT_INFO_ERROR_LOGMSG = "{} {} Exception - fault info ";
+ private static final String SHARED = "shared";
+ private static final String EXTERNAL = "external";
@Autowired
private Environment environment;
@@ -127,13 +130,13 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
HashMap<String, String> params = (HashMap<String, String>) networkParams;
if (params == null)
- params = new HashMap<String, String>();
+ params = new HashMap<>();
String shared = null;
String external = null;
- if (params.containsKey("shared"))
- shared = params.get("shared");
- if (params.containsKey("external"))
- external = params.get("external");
+ if (params.containsKey(SHARED))
+ shared = params.get(SHARED);
+ if (params.containsKey(EXTERNAL))
+ external = params.get(EXTERNAL);
try {
networkAdapter.createNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkName,
@@ -211,13 +214,13 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
HashMap<String, String> params = (HashMap<String, String>) networkParams;
if (params == null)
- params = new HashMap<String, String>();
+ params = new HashMap<>();
String shared = null;
String external = null;
- if (params.containsKey("shared"))
- shared = params.get("shared");
- if (params.containsKey("external"))
- external = params.get("external");
+ if (params.containsKey(SHARED))
+ shared = params.get(SHARED);
+ if (params.containsKey(EXTERNAL))
+ external = params.get(EXTERNAL);
try {
networkAdapter.updateNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkId,
@@ -268,7 +271,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoRequest msoRequest, String notificationUrl) {
logger.debug("Async Query Network {} in {}/{}", networkNameOrId, cloudSiteId, tenantId);
- String errorCreateNetworkMessage = "{} {} Error sending createNetwork notification {} ";
+ String errorCreateNetworkMessage = CREATE_NETWORK_ERROR_LOGMSG;
// Use the synchronous method to perform the actual Create
@@ -367,8 +370,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl);
notifyPort.deleteNetworkNotification(messageId, false, exCat, eMsg, null);
} catch (Exception e1) {
- logger.error("{} {} Error sending createNetwork notification {} ",
- MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, ErrorCode.DataError.getValue(), e1.getMessage(), e1);
+ logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
+ ErrorCode.DataError.getValue(), e1.getMessage(), e1);
}
return;
@@ -402,7 +405,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
return;
}
- logger.info("{} {}", MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId());
+ logger.info(LoggingAnchor.TWO, MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId());
// Use the synchronous method to perform the actual Create
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
index a79a6191cf..afc227faf0 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
@@ -33,6 +33,7 @@ import java.util.Map;
import java.util.Optional;
import javax.jws.WebService;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.network.beans.ContrailPolicyRef;
import org.onap.so.adapters.network.beans.ContrailPolicyRefSeq;
import org.onap.so.adapters.network.beans.ContrailSubnet;
@@ -88,8 +89,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private static final String NETWORK_ID = "network_id";
private static final String NETWORK_FQDN = "network_fqdn";
private static final String CREATE_NETWORK_CONTEXT = "CreateNetwork";
- private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
private static final String NEUTRON_MODE = "NEUTRON";
+ private static final String CLOUD_OWNER = "CloudOwner";
private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class);
@@ -115,6 +116,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
@Autowired
private NetworkResourceRepository networkResourceRepo;
+ public MsoNetworkAdapterImpl() {}
+
/**
* Health Check web method. Does nothing but return to show the adapter is deployed.
*/
@@ -128,7 +131,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
*
* @see MsoNetworkAdapterImpl#MsoNetworkAdapterImpl(MsoPropertiesFactory)
*/
- public MsoNetworkAdapterImpl() {}
@Override
public void createNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid,
@@ -205,7 +207,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
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, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
// Set the detailed error as the Exception 'message'
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -240,8 +242,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (failIfExists != null && failIfExists) {
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, ErrorCode.DataError.getValue(),
- error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_ALREADY_EXIST,
+ ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
} else {
// Populate the outputs from the existing network.
@@ -285,7 +287,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
HeatTemplate heatTemplate = networkResource.getHeatTemplate();
if (heatTemplate == null) {
String error = String.format("Network error - undefined Heat Template. Network Type = %s", networkType);
- logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(),
+ error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
@@ -308,7 +311,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
StackInfo heatStack = null;
long queryNetworkStarttime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkName);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName);
} catch (MsoException me) {
me.addContext(CREATE_NETWORK_CONTEXT);
logger.error("{} {} Create Network (heat): query network {} in {}/{}: ",
@@ -322,20 +325,21 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (failIfExists != null && failIfExists) {
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, ErrorCode.DataError.getValue(),
- error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_ALREADY_EXIST,
+ ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
} else {
// Populate the outputs from the existing stack.
networkId.value = heatStack.getCanonicalName();
- neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
- rollback.value = networkRollback; // Default rollback - no updates performed
- if (aic3template) {
- networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
- }
- Map<String, Object> outputs = heatStack.getOutputs();
Map<String, String> sMap = new HashMap<>();
- if (outputs != null) {
+ if (heatStack.getOutputs() != null) {
+ neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
+ rollback.value = networkRollback; // Default rollback - no updates performed
+ if (aic3template) {
+ networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
+ }
+ Map<String, Object> outputs = heatStack.getOutputs();
+
for (Map.Entry<String, Object> entry : outputs.entrySet()) {
String key = entry.getKey();
if (key != null && key.startsWith("subnet")) {
@@ -371,7 +375,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
stackParams = heat.validateStackParams(stackParams, heatTemplate);
} catch (IllegalArgumentException e) {
String error = "Create Network: Configuration Error: " + e.getMessage();
- logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error, e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error, e);
// Input parameters were not valid
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
@@ -421,7 +425,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
try {
if (backout == null)
backout = true;
- heatStack = heat.createStack(cloudSiteId, "CloudOwner", tenantId, networkName, null, template,
+ heatStack = heat.createStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName, null, template,
stackParams, true, heatTemplate.getTimeoutMinutes(), null, null, null, backout.booleanValue());
} catch (MsoException me) {
me.addContext(CREATE_NETWORK_CONTEXT);
@@ -435,9 +439,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// For Heat-based orchestration, the MSO-tracked network ID is the heat stack,
// and the neutronNetworkId is the network UUID returned in stack outputs.
networkId.value = heatStack.getCanonicalName();
- neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
- if (aic3template) {
- networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
+ if (heatStack.getOutputs() != null) {
+ neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
+ if (aic3template) {
+ networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
+ }
}
Map<String, Object> outputs = heatStack.getOutputs();
Map<String, String> sMap = new HashMap<>();
@@ -456,13 +462,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
}
}
+ networkRollback.setNeutronNetworkId((String) outputs.get(NETWORK_ID));
}
subnetIdMap.value = sMap;
rollback.value = networkRollback;
// Populate remaining rollback info and response parameters.
networkRollback.setNetworkStackId(heatStack.getCanonicalName());
- networkRollback.setNeutronNetworkId((String) heatStack.getOutputs().get(NETWORK_ID));
networkRollback.setNetworkCreated(true);
networkRollback.setNetworkType(networkType);
@@ -537,7 +543,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
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, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
// Set the detailed error as the Exception 'message'
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -569,8 +575,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (netInfo == null) {
String error = String.format("Update Nework: Network %s does not exist in %s/%s", networkId,
cloudSiteId, tenantId);
- logger.error("{} {} {}", MessageEnum.RA_NETWORK_NOT_FOUND, ErrorCode.BusinessProcesssError.getValue(),
- error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_NOT_FOUND,
+ ErrorCode.BusinessProcesssError.getValue(), error);
// Does not exist. Throw an exception (can't update a non-existent network)
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -602,7 +608,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
StackInfo heatStack = null;
long queryStackStarttime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkName);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName);
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
logger.error("{} {} Exception - QueryStack query {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
@@ -613,7 +619,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (heatStack == null || (heatStack.getStatus() == HeatStatus.NOTFOUND)) {
String error = String.format("UpdateNetwork: Stack %s does not exist in %s/%s", networkName,
cloudSiteId, tenantId);
- logger.error("{} {} {}", MessageEnum.RA_NETWORK_NOT_FOUND, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_NOT_FOUND, ErrorCode.DataError.getValue(),
+ error);
// Network stack does not exist. Return an error
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -644,7 +651,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
HeatTemplate heatTemplate = networkResource.getHeatTemplate();
if (heatTemplate == null) {
String error = "Network error - undefined Heat Template. Network Type=" + networkType;
- logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(),
+ error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
@@ -672,7 +680,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
stackParams = heat.validateStackParams(stackParams, heatTemplate);
} catch (IllegalArgumentException e) {
String error = "UpdateNetwork: Configuration Error: Network Type=" + networkType;
- logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL, e);
}
@@ -720,7 +728,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Ignore MsoStackNotFound exception because we already checked.
long updateStackStarttime = System.currentTimeMillis();
try {
- heatStack = heatWithUpdate.updateStack(cloudSiteId, "CloudOwner", tenantId, networkId, template,
+ heatStack = heatWithUpdate.updateStack(cloudSiteId, CLOUD_OWNER, tenantId, networkId, template,
stackParams, true, heatTemplate.getTimeoutMinutes());
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
@@ -802,7 +810,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
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, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_UNKOWN_PARAM, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -814,8 +822,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// All Networks are orchestrated via HEAT or Neutron
if (!("HEAT".equals(mode) || NEUTRON_MODE.equals(mode))) {
String error = "CreateNetwork: Configuration Error: Network Type = " + networkType;
- logger.error("{} {} {}", MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT, ErrorCode.DataError.getValue(),
- error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT,
+ ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
@@ -834,9 +842,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} else {
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, ErrorCode.DataError.getValue(), error);
+ networkType, networkResource.getAicVersionMin(), networkResource.getAicVersionMax(), cloudSiteId,
+ cloudSite.getCloudVersion());
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -845,7 +853,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
validateNetworkParams(neutronNetworkType, networkName, physicalNetworkName, vlans, routeTargets);
if (!missing.isEmpty()) {
String error = "Create Network: Missing parameters: " + missing;
- logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -890,7 +898,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
|| commonUtils.isNullOrEmpty(networkNameOrId)) {
String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId";
- logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -899,7 +907,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
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, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
// Set the detailed error as the Exception 'message'
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -907,12 +915,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Use MsoNeutronUtils for all NEUTRON commands
String mode;
- String neutronId;
+ String neutronId = null;
// Try Heat first, since networks may be named the same as the Heat stack
StackInfo heatStack = null;
long queryStackStarttime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkNameOrId);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkNameOrId);
} catch (MsoException me) {
me.addContext("QueryNetwork");
logger.error("{} {} Exception - Query Network (heat): {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
@@ -923,12 +931,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Populate the outputs based on the returned Stack information
if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) {
// Found it. Get the neutronNetworkId for further query
+ Map<String, String> sMap = new HashMap<>();
Map<String, Object> outputs = heatStack.getOutputs();
- neutronId = (String) outputs.get(NETWORK_ID);
mode = "HEAT";
-
- Map<String, String> sMap = new HashMap<>();
if (outputs != null) {
+ neutronId = (String) outputs.get(NETWORK_ID);
+
for (String key : outputs.keySet()) {
if (key != null && key.startsWith("subnet_id_")) // multiples subnet_%aaid% outputs
{
@@ -958,7 +966,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (netInfo != null) {
// Found. Populate the output elements
networkExists.value = Boolean.TRUE;
- if ("HEAT".equals(mode)) {
+ if ("HEAT".equals(mode) && heatStack != null) {
networkId.value = heatStack.getCanonicalName();
} else {
networkId.value = netInfo.getId();
@@ -1017,7 +1025,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (commonUtils.isNullOrEmpty(cloudSiteId) || commonUtils.isNullOrEmpty(tenantId)
|| commonUtils.isNullOrEmpty(networkId)) {
String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId";
- logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -1065,9 +1073,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// was deleted.
// So query first to report back if stack WAS deleted or just NOTOFUND
StackInfo heatStack = null;
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkId);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkId);
if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) {
- heat.deleteStack(tenantId, "CloudOwner", cloudSiteId, networkId, true);
+ heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true);
networkDeleted.value = true;
} else {
networkDeleted.value = false;
@@ -1150,7 +1158,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
try {
// The deleteStack function in MsoHeatUtils returns success if the stack
// was not found. So don't bother to query first.
- heat.deleteStack(tenantId, "CloudOwner", cloudSiteId, networkId, true);
+ heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true);
} catch (MsoException me) {
me.addContext("RollbackNetwork");
logger.error("{} {} Exception - Rollback Network (heat): {} in {}/{} ",
@@ -1290,15 +1298,23 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Resource Property
List<ContrailPolicyRef> prlist = new ArrayList<>();
int index = 1;
- for (String pf : pFqdns) {
- if (!commonUtils.isNullOrEmpty(pf)) {
- ContrailPolicyRef pr = new ContrailPolicyRef();
- ContrailPolicyRefSeq refSeq = new ContrailPolicyRefSeq(String.valueOf(index), "0");
- pr.setSeq(refSeq);
- index++;
- logger.debug("Contrail PolicyRefs Data:{}", pr);
- prlist.add(pr);
+
+ if (pFqdns != null) {
+ for (String pf : pFqdns) {
+ if (!commonUtils.isNullOrEmpty(pf)) {
+ ContrailPolicyRef pr = new ContrailPolicyRef();
+ ContrailPolicyRefSeq refSeq = new ContrailPolicyRefSeq(String.valueOf(index), "0");
+ pr.setSeq(refSeq);
+ index++;
+ logger.debug("Contrail PolicyRefs Data:{}", pr);
+ prlist.add(pr);
+ }
}
+ } else {
+ String error = "Null pFqdns at start of mergePolicyRefs";
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MARSHING_ERROR, ErrorCode.BusinessProcesssError.getValue(),
+ error);
+ throw new MsoAdapterException(error);
}
JsonNode node = null;
@@ -1309,8 +1325,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
logger.debug("Json PolicyRefs Data:{}", jsonString);
} catch (Exception e) {
String error = "Error creating JsonNode for policyRefs Data";
- logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, ErrorCode.BusinessProcesssError.getValue(), error,
- e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MARSHING_ERROR, ErrorCode.BusinessProcesssError.getValue(),
+ error, e);
throw new MsoAdapterException(error);
}
// update parameters
@@ -1386,7 +1402,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
logger.debug("Json Subnet List:{}", jsonString);
} catch (Exception e) {
String error = "Error creating JsonNode from input subnets";
- logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, ErrorCode.DataError.getValue(), error, e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MARSHING_ERROR, ErrorCode.DataError.getValue(), error, e);
throw new MsoAdapterException(error);
}
// update parameters
@@ -1432,7 +1448,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
curR = curR.replace("%subnetId%", subnet.getSubnetId());
} else {
String error = "Missing Required AAI SubnetId for subnet in HEAT Template";
- logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new MsoAdapterException(error);
}
@@ -1446,7 +1462,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
curR = curR.replace("%cidr%", subnet.getCidr());
} else {
String error = "Missing Required cidr for subnet in HEAT Template";
- logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new MsoAdapterException(error);
}
@@ -1461,13 +1477,19 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
if (subnet.getAllocationPools() != null) {
- curR = curR + " allocation_pools:\n";
+ StringBuilder tempBuf = new StringBuilder();
+ tempBuf.append(curR);
+ tempBuf.append(" allocation_pools:\n");
for (Pool pool : subnet.getAllocationPools()) {
if (!commonUtils.isNullOrEmpty(pool.getStart()) && !commonUtils.isNullOrEmpty(pool.getEnd())) {
- curR = curR + " - start: " + pool.getStart() + "\n";
- curR = curR + " end: " + pool.getEnd() + "\n";
+ tempBuf.append(" - start: ");
+ tempBuf.append(pool.getStart());
+ tempBuf.append("\n end: ");
+ tempBuf.append(pool.getEnd());
+ tempBuf.append("\n");
}
}
+ curR = tempBuf.toString();
}
resourcesBuf.append(curR);
@@ -1476,7 +1498,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
curO = curO.replace("%subnetId%", subnet.getSubnetId());
outputsBuf.append(curO);
-
}
// append resources and outputs in heatTemplate
logger.debug("Tempate initial:{}", heatTemplate);
@@ -1500,23 +1521,28 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
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());
- String name = sNode.path("subnet_name").textValue();
- String uuid = sNode.path("subnet_uuid").textValue();
- String aaiId = name; // default
- // try to find aaiId for name in input subnetList
- if (subnets != null) {
- for (Subnet subnet : subnets) {
- if (subnet != null && !commonUtils.isNullOrEmpty(subnet.getSubnetName())) {
- if (subnet.getSubnetName().equals(name)) {
- aaiId = subnet.getSubnetId();
- break;
+ if (rootNode != null) {
+ for (JsonNode sNode : rootNode.path("ipam_subnets")) {
+ 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
+ // try to find aaiId for name in input subnetList
+ if (subnets != null) {
+ for (Subnet subnet : subnets) {
+ if (subnet != null && !commonUtils.isNullOrEmpty(subnet.getSubnetName())) {
+ if (subnet.getSubnetName().equals(name)) {
+ aaiId = subnet.getSubnetId();
+ break;
+ }
}
}
}
+ sMap.put(aaiId, uuid); // bpmn needs aaid to uuid map
}
- sMap.put(aaiId, uuid); // bpmn needs aaid to uuid map
+ } else {
+ logger.error("{} {} null rootNode - cannot get subnet-uuids", MessageEnum.RA_MARSHING_ERROR,
+ ErrorCode.DataError.getValue());
}
} catch (Exception e) {
logger.error("{} {} Exception getting subnet-uuids ", MessageEnum.RA_MARSHING_ERROR,
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
index b44704d1cf..4eb5d5637f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
@@ -24,11 +24,6 @@
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;
@@ -47,6 +42,7 @@ 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.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.network.exceptions.NetworkException;
import org.onap.so.adapters.nwrest.ContrailNetwork;
import org.onap.so.adapters.nwrest.CreateNetworkError;
@@ -74,9 +70,15 @@ import org.onap.so.openstack.beans.RouteTarget;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
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")
@@ -86,7 +88,9 @@ public class NetworkAdapterRest {
private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterRest.class);
private static final String TESTING_KEYWORD = "___TESTING___";
- private String EXCEPTION = "Exception:";
+ private String exceptionMsg = "Exception:";
+ private static final String SHARED = "shared";
+ private static final String EXTERNAL = "external";
@Autowired
private MsoNetworkAdapterImpl adapter;
@@ -159,6 +163,11 @@ public class NetworkAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("CreateNetworkTask start");
try {
// Synchronous Web Service Outputs
@@ -170,7 +179,7 @@ public class NetworkAdapterRest {
HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams();
if (params == null) {
- params = new HashMap<String, String>();
+ params = new HashMap<>();
}
String shared = null;
String external = null;
@@ -192,15 +201,15 @@ public class NetworkAdapterRest {
ctn = new ContrailNetwork();
req.setContrailNetwork(ctn);
}
- if (params.containsKey("shared")) {
- shared = params.get("shared");
+ if (params.containsKey(SHARED)) {
+ shared = params.get(SHARED);
} else {
if (ctn.getShared() != null) {
shared = ctn.getShared();
}
}
- if (params.containsKey("external")) {
- external = params.get("external");
+ if (params.containsKey(EXTERNAL)) {
+ external = params.get(EXTERNAL);
} else {
if (ctn.getExternal() != null) {
external = ctn.getExternal();
@@ -218,10 +227,10 @@ public class NetworkAdapterRest {
pvn = new ProviderVlanNetwork();
req.setProviderVlanNetwork(pvn);
}
- if (params.containsKey("shared"))
- shared = params.get("shared");
- if (params.containsKey("external"))
- external = params.get("external");
+ if (params.containsKey(SHARED))
+ shared = params.get(SHARED);
+ if (params.containsKey(EXTERNAL))
+ external = params.get(EXTERNAL);
adapter.createNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
req.getModelCustomizationUuid(), req.getNetworkName(),
req.getProviderVlanNetwork().getPhysicalNetworkName(),
@@ -233,7 +242,7 @@ public class NetworkAdapterRest {
rollback.value.getNetworkStackId(), networkFqdn.value, rollback.value.getNetworkCreated(),
subnetIdMap.value, rollback.value, req.getMessageId());
} catch (NetworkException e) {
- logger.debug(EXCEPTION, e);
+ logger.debug(exceptionMsg, e);
eresp = new CreateNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
if (!req.isSynchronous()) {
@@ -316,6 +325,11 @@ public class NetworkAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("DeleteNetworkTask start");
try {
Holder<Boolean> networkDeleted = new Holder<>();
@@ -328,7 +342,7 @@ public class NetworkAdapterRest {
}
response = new DeleteNetworkResponse(req.getNetworkId(), networkDeleted.value, req.getMessageId());
} catch (NetworkException e) {
- logger.debug(EXCEPTION, e);
+ logger.debug(exceptionMsg, e);
eresp = new DeleteNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
if (!req.isSynchronous()) {
@@ -461,13 +475,18 @@ public class NetworkAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getNetworkRollback().getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
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(exceptionMsg, e);
eresp = new RollbackNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true,
req.getMessageId());
}
@@ -549,6 +568,11 @@ public class NetworkAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("UpdateNetworkTask start");
try {
Holder<Map<String, String>> subnetIdMap = new Holder<>();
@@ -573,15 +597,15 @@ public class NetworkAdapterRest {
ctn = new ContrailNetwork();
req.setContrailNetwork(ctn);
}
- if (params.containsKey("shared")) {
- shared = params.get("shared");
+ if (params.containsKey(SHARED)) {
+ shared = params.get(SHARED);
} else {
if (ctn.getShared() != null) {
shared = ctn.getShared();
}
}
- if (params.containsKey("external")) {
- external = params.get("external");
+ if (params.containsKey(EXTERNAL)) {
+ external = params.get(EXTERNAL);
} else {
if (ctn.getExternal() != null) {
external = ctn.getExternal();
@@ -598,11 +622,11 @@ public class NetworkAdapterRest {
pvn = new ProviderVlanNetwork();
req.setProviderVlanNetwork(pvn);
}
- if (params.containsKey("shared")) {
- shared = params.get("shared");
+ if (params.containsKey(SHARED)) {
+ shared = params.get(SHARED);
}
- if (params.containsKey("external")) {
- external = params.get("external");
+ if (params.containsKey(EXTERNAL)) {
+ external = params.get(EXTERNAL);
}
adapter.updateNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getNetworkName(),
@@ -614,7 +638,7 @@ public class NetworkAdapterRest {
// an update
subnetIdMap.value, req.getMessageId());
} catch (NetworkException e) {
- logger.debug(EXCEPTION, e);
+ logger.debug(exceptionMsg, e);
eresp = new UpdateNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
if (!req.isSynchronous()) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java
index c275073c46..68142e6cc9 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java
@@ -57,11 +57,11 @@ public class NetworkAdapterNotify_Service extends Service {
}
public NetworkAdapterNotify_Service() {
- super(__getWsdlLocation(), NETWORKADAPTERNOTIFY_QNAME);
+ super(getWsdlLocation(), NETWORKADAPTERNOTIFY_QNAME);
}
public NetworkAdapterNotify_Service(WebServiceFeature... features) {
- super(__getWsdlLocation(), NETWORKADAPTERNOTIFY_QNAME, features);
+ super(getWsdlLocation(), NETWORKADAPTERNOTIFY_QNAME, features);
}
public NetworkAdapterNotify_Service(URL wsdlLocation) {
@@ -100,7 +100,7 @@ public class NetworkAdapterNotify_Service extends Service {
return super.getPort(new QName(URL, "MsoNetworkAdapterAsyncImplPort"), NetworkAdapterNotify.class, features);
}
- private static URL __getWsdlLocation() {
+ private static URL getWsdlLocation() {
if (NETWORKADAPTERNOTIFY_EXCEPTION != null) {
throw NETWORKADAPTERNOTIFY_EXCEPTION;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java
index 81ccd8aa04..a7a2974660 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java
@@ -39,22 +39,22 @@ import javax.xml.namespace.QName;
@XmlRegistry
public class ObjectFactory {
- private static final String Url = "http://org.onap.so/networkNotify";
- private static final QName _RollbackNetworkNotification_QNAME = new QName(Url, "rollbackNetworkNotification");
- private static final QName _UpdateNetworkNotification_QNAME = new QName(Url, "updateNetworkNotification");
+ private static final String URL = "http://org.onap.so/networkNotify";
+ private static final QName _RollbackNetworkNotification_QNAME = new QName(URL, "rollbackNetworkNotification");
+ private static final QName _UpdateNetworkNotification_QNAME = new QName(URL, "updateNetworkNotification");
private static final QName _QueryNetworkNotificationResponse_QNAME =
- new QName(Url, "queryNetworkNotificationResponse");
+ new QName(URL, "queryNetworkNotificationResponse");
private static final QName _UpdateNetworkNotificationResponse_QNAME =
- new QName(Url, "updateNetworkNotificationResponse");
+ new QName(URL, "updateNetworkNotificationResponse");
private static final QName _CreateNetworkNotificationResponse_QNAME =
- new QName(Url, "createNetworkNotificationResponse");
- private static final QName _DeleteNetworkNotification_QNAME = new QName(Url, "deleteNetworkNotification");
+ new QName(URL, "createNetworkNotificationResponse");
+ private static final QName _DeleteNetworkNotification_QNAME = new QName(URL, "deleteNetworkNotification");
private static final QName _DeleteNetworkNotificationResponse_QNAME =
- new QName(Url, "deleteNetworkNotificationResponse");
- private static final QName _CreateNetworkNotification_QNAME = new QName(Url, "createNetworkNotification");
- private static final QName _QueryNetworkNotification_QNAME = new QName(Url, "queryNetworkNotification");
+ new QName(URL, "deleteNetworkNotificationResponse");
+ private static final QName _CreateNetworkNotification_QNAME = new QName(URL, "createNetworkNotification");
+ private static final QName _QueryNetworkNotification_QNAME = new QName(URL, "queryNetworkNotification");
private static final QName _RollbackNetworkNotificationResponse_QNAME =
- new QName(Url, "rollbackNetworkNotificationResponse");
+ new QName(URL, "rollbackNetworkNotificationResponse");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package:
@@ -211,7 +211,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link RollbackNetworkNotification }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "rollbackNetworkNotification")
+ @XmlElementDecl(namespace = URL, name = "rollbackNetworkNotification")
public JAXBElement<RollbackNetworkNotification> createRollbackNetworkNotification(
RollbackNetworkNotification value) {
return new JAXBElement<>(_RollbackNetworkNotification_QNAME, RollbackNetworkNotification.class, null, value);
@@ -221,7 +221,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link UpdateNetworkNotification }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "updateNetworkNotification")
+ @XmlElementDecl(namespace = URL, name = "updateNetworkNotification")
public JAXBElement<UpdateNetworkNotification> createUpdateNetworkNotification(UpdateNetworkNotification value) {
return new JAXBElement<>(_UpdateNetworkNotification_QNAME, UpdateNetworkNotification.class, null, value);
}
@@ -230,7 +230,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link QueryNetworkNotificationResponse }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "queryNetworkNotificationResponse")
+ @XmlElementDecl(namespace = URL, name = "queryNetworkNotificationResponse")
public JAXBElement<QueryNetworkNotificationResponse> createQueryNetworkNotificationResponse(
QueryNetworkNotificationResponse value) {
return new JAXBElement<>(_QueryNetworkNotificationResponse_QNAME, QueryNetworkNotificationResponse.class, null,
@@ -241,7 +241,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link UpdateNetworkNotificationResponse }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "updateNetworkNotificationResponse")
+ @XmlElementDecl(namespace = URL, name = "updateNetworkNotificationResponse")
public JAXBElement<UpdateNetworkNotificationResponse> createUpdateNetworkNotificationResponse(
UpdateNetworkNotificationResponse value) {
return new JAXBElement<>(_UpdateNetworkNotificationResponse_QNAME, UpdateNetworkNotificationResponse.class,
@@ -252,7 +252,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link CreateNetworkNotificationResponse }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "createNetworkNotificationResponse")
+ @XmlElementDecl(namespace = URL, name = "createNetworkNotificationResponse")
public JAXBElement<CreateNetworkNotificationResponse> createCreateNetworkNotificationResponse(
CreateNetworkNotificationResponse value) {
return new JAXBElement<>(_CreateNetworkNotificationResponse_QNAME, CreateNetworkNotificationResponse.class,
@@ -263,7 +263,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link DeleteNetworkNotification }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "deleteNetworkNotification")
+ @XmlElementDecl(namespace = URL, name = "deleteNetworkNotification")
public JAXBElement<DeleteNetworkNotification> createDeleteNetworkNotification(DeleteNetworkNotification value) {
return new JAXBElement<>(_DeleteNetworkNotification_QNAME, DeleteNetworkNotification.class, null, value);
}
@@ -272,7 +272,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link DeleteNetworkNotificationResponse }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "deleteNetworkNotificationResponse")
+ @XmlElementDecl(namespace = URL, name = "deleteNetworkNotificationResponse")
public JAXBElement<DeleteNetworkNotificationResponse> createDeleteNetworkNotificationResponse(
DeleteNetworkNotificationResponse value) {
return new JAXBElement<>(_DeleteNetworkNotificationResponse_QNAME, DeleteNetworkNotificationResponse.class,
@@ -283,7 +283,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link CreateNetworkNotification }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "createNetworkNotification")
+ @XmlElementDecl(namespace = URL, name = "createNetworkNotification")
public JAXBElement<CreateNetworkNotification> createCreateNetworkNotification(CreateNetworkNotification value) {
return new JAXBElement<>(_CreateNetworkNotification_QNAME, CreateNetworkNotification.class, null, value);
}
@@ -292,7 +292,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link QueryNetworkNotification }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "queryNetworkNotification")
+ @XmlElementDecl(namespace = URL, name = "queryNetworkNotification")
public JAXBElement<QueryNetworkNotification> createQueryNetworkNotification(QueryNetworkNotification value) {
return new JAXBElement<>(_QueryNetworkNotification_QNAME, QueryNetworkNotification.class, null, value);
}
@@ -301,7 +301,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link RollbackNetworkNotificationResponse }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "rollbackNetworkNotificationResponse")
+ @XmlElementDecl(namespace = URL, name = "rollbackNetworkNotificationResponse")
public JAXBElement<RollbackNetworkNotificationResponse> createRollbackNetworkNotificationResponse(
RollbackNetworkNotificationResponse value) {
return new JAXBElement<>(_RollbackNetworkNotificationResponse_QNAME, RollbackNetworkNotificationResponse.class,
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
index 4396fc035d..9fc5c979d8 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
@@ -89,7 +89,7 @@ public class CXFConfiguration {
}
@Bean
- public ServletRegistrationBean SoapDispatcherServlet() {
+ public ServletRegistrationBean soapDispatcherServlet() {
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new CXFServlet(), "/services/*");
servletRegistrationBean.setName("services");
return servletRegistrationBean;
@@ -149,7 +149,7 @@ public class CXFConfiguration {
}
@Bean
- public Endpoint VnfAsyncAdapterEndpoint() {
+ public Endpoint vnfAsyncAdapterEndpoint() {
EndpointImpl endpoint = new EndpointImpl(springBus(), vnfAdapterAsyncImpl);
endpoint.publish("/VnfAsyncAdapter");
endpoint.setWsdlLocation("VnfAsyncAdapter.wsdl");
@@ -160,7 +160,7 @@ public class CXFConfiguration {
}
@Bean
- public Endpoint VnfCloudAdapterEndpoint() {
+ public Endpoint vnfCloudAdapterEndpoint() {
EndpointImpl endpoint = new EndpointImpl(springBus(), vnfCloudifyAdapterImpl);
endpoint.publish("/VnfCloudifyAdapterImpl");
endpoint.setWsdlLocation("VnfCloudifyAdapterImpl.wsdl");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CatalogDBConfig.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CatalogDBConfig.java
new file mode 100644
index 0000000000..299e695275
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CatalogDBConfig.java
@@ -0,0 +1,77 @@
+/*-
+ * ============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.adapters.openstack;
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.context.annotation.Profile;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
+
+@Configuration
+@EnableTransactionManagement
+@EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactory",
+ basePackages = {"org.onap.so.db.catalog.data.repository"})
+@EnableScheduling
+@Profile({"!test"})
+public class CatalogDBConfig {
+
+ @Bean
+ @ConfigurationProperties(prefix = "spring.datasource.hikari")
+ public HikariConfig catalogDbConfig() {
+ return new HikariConfig();
+ }
+
+ @Primary
+ @Bean(name = "dataSource")
+ public DataSource dataSource() {
+ HikariConfig hikariConfig = this.catalogDbConfig();
+ return new HikariDataSource(hikariConfig);
+ }
+
+ @Primary
+ @Bean(name = "entityManagerFactory")
+ public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder,
+ @Qualifier("dataSource") DataSource dataSource) {
+ return builder.dataSource(dataSource).packages("org.onap.so.db.catalog.beans").persistenceUnit("catalogDB")
+ .build();
+ }
+
+ @Primary
+ @Bean(name = "transactionManager")
+ public PlatformTransactionManager transactionManager(
+ @Qualifier("entityManagerFactory") EntityManagerFactory entityManagerFactory) {
+ return new JpaTransactionManager(entityManagerFactory);
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java
index 97a2500c59..436836491d 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java
@@ -22,7 +22,6 @@ package org.onap.so.adapters.openstack;
import java.util.concurrent.Executor;
import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java
index 34177ff5a3..d75824357f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java
@@ -48,10 +48,9 @@ import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
-import org.springframework.http.client.BufferingClientHttpRequestFactory;
-import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
+import javax.inject.Provider;
@Component
public class ValetClient {
@@ -75,6 +74,9 @@ public class ValetClient {
private static final String BODY = ", body=";
@Autowired
private ObjectMapper mapper;
+ @Autowired
+ private Provider<RestTemplate> templateProvider;
+
protected String baseUrl;
protected String basePath;
@@ -123,10 +125,7 @@ public class ValetClient {
}
private RestTemplate getRestTemplate() {
- RestTemplate restTemplate = new RestTemplate();
- restTemplate
- .setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()));
- return restTemplate;
+ return templateProvider.get();
}
/*
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
index 906c285c28..62e9d562a6 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
@@ -204,7 +204,6 @@ public class BpelRestClient {
* @return true if the post succeeded, false if all retries failed
*/
public boolean bpelPost(final String toBpelStr, final String bpelUrl, final boolean isxml) {
- debug("Sending response to BPEL: " + toBpelStr);
int totalretries = 0;
int retryint = retryInterval;
while (true) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/CSAR.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/CSAR.java
deleted file mode 100644
index 7786b872ef..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/CSAR.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*-
- * ============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.adapters.vnf;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-import org.onap.so.adapters.vdu.VduArtifact;
-import org.onap.so.adapters.vdu.VduArtifact.ArtifactType;
-import org.onap.so.adapters.vdu.VduModelInfo;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
-import com.google.common.io.Files;
-
-/**
- * The purpose of this class is to create a CSAR byte array from Vdu inputs for the purpose of forwarding to a TOSCA
- * orchestrator.
- *
- * @author DeWayne
- *
- */
-public class CSAR {
- private static final String MANIFEST_FILENAME = "MANIFEST.MF";
- private VduModelInfo vduModel;
-
- public CSAR(VduModelInfo model) {
- this.vduModel = model;
- }
-
- /**
- * Creates a byte array representation of a CSAR corresponding to the VduBlueprint arg in the constructor.
- *
- * @return
- * @throws VnfException
- */
- public byte[] create() {
- File dir = Files.createTempDir();
-
- /**
- * Create subdir
- */
- File metadir = new File(dir.getAbsolutePath() + "/TOSCA-Metadata");
- if (!metadir.mkdir()) {
- throw new RuntimeException("CSAR TOSCA-Metadata directory create failed");
- }
-
- /**
- * Organize model info for consumption
- */
- VduArtifact mainTemplate = null;
- List<VduArtifact> extraFiles = new ArrayList<>();
- for (VduArtifact artifact : vduModel.getArtifacts()) {
- if (artifact.getType() == ArtifactType.MAIN_TEMPLATE) {
- mainTemplate = artifact;
- } else {
- extraFiles.add(artifact);
- }
- }
-
- if (mainTemplate == null) { // make a dummy to avoid null pointers
- mainTemplate = new VduArtifact("", new byte[0], null);
- }
-
- /**
- * Write template files
- */
- try (OutputStream ofs = new FileOutputStream(new File(dir, mainTemplate.getName()));
- PrintStream mfstream =
- new PrintStream(new File(metadir.getAbsolutePath() + '/' + MANIFEST_FILENAME));) {
- ofs.write(mainTemplate.getContent());
-
- /**
- * Write other files
- */
- if (!extraFiles.isEmpty()) {
- for (VduArtifact artifact : extraFiles) {
- try (OutputStream out = new FileOutputStream(new File(dir, artifact.getName()));) {
- out.write(artifact.getContent());
- }
- }
- }
-
-
- /**
- * Create manifest
- */
- mfstream.println("TOSCA-Meta-File-Version: 1.0");
- mfstream.println("CSAR-Version: 1.1");
- mfstream.println("Created-by: ONAP");
- mfstream.println("Entry-Definitions: " + mainTemplate.getName());
-
- /**
- * ZIP it up
- */
- ByteArrayOutputStream zipbytes = new ByteArrayOutputStream();
- ZipOutputStream zos = new ZipOutputStream(zipbytes);
- compressTree(zos, "", dir, dir);
- zos.close();
- return zipbytes.toByteArray();
-
- } catch (Exception e) {
- throw new RuntimeException("Failed to create CSAR: " + e.getMessage());
- } finally {
- /**
- * Clean up tmpdir
- */
- deleteDirectory(dir);
- }
- }
-
- /**
- * Private methods
- */
-
- /**
- * Compresses (ZIPs) a directory tree
- *
- * @param dir
- * @throws IOException
- */
- private void compressTree(ZipOutputStream zos, String path, File basedir, File dir) throws IOException {
- if (!dir.isDirectory())
- return;
-
- for (File f : dir.listFiles()) {
- if (f.isDirectory()) {
- String newpath = path + f.getName() + '/';
- ZipEntry entry = new ZipEntry(newpath);
- zos.putNextEntry(entry);
- zos.closeEntry();
- compressTree(zos, newpath, basedir, f);
- } else {
- ZipEntry ze = new ZipEntry(
- f.getAbsolutePath().substring(basedir.getAbsolutePath().length() + 1).replaceAll("\\\\", "/"));
- zos.putNextEntry(ze);
- // read the file and write to ZipOutputStream
- try (FileInputStream fis = new FileInputStream(f);) {
- byte[] buffer = new byte[1024];
- int len;
- while ((len = fis.read(buffer)) > 0) {
- zos.write(buffer, 0, len);
- }
- }
- zos.closeEntry();
- }
- }
- }
-
- private boolean deleteDirectory(File directory) {
- if (directory.exists()) {
- File[] files = directory.listFiles();
- if (null != files) {
- for (int i = 0; i < files.length; i++) {
- if (files[i].isDirectory()) {
- deleteDirectory(files[i]);
- } else {
- files[i].delete();
- }
- }
- }
- }
- return (directory.delete());
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
index fe11fa07b4..6713c2d069 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
@@ -45,6 +45,7 @@ import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify_Service;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.entity.MsoRequest;
import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
@@ -64,6 +65,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
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";
+ private static final String UPDATE_VNFA = "{} UpdateVnfA";
+ private static final String EXCEPTION_UPDATEVNF_NOTIFICATION = "{} {} Exception sending updateVnf notification ";
@Autowired
private Environment environment;
@@ -151,7 +154,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
ErrorCode.BusinessProcesssError.getValue(), e1);
}
- logger.info("{}", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
+ logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
return;
}
logger.debug("Async Create VNF: {} VnfId:{}", vnfName, vnfId.value);
@@ -173,7 +176,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String vnfName, String requestType, String volumeGroupHeatStackId, Map<String, Object> inputs,
String messageId, MsoRequest msoRequest, String notificationUrl) {
- logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF);
+ logger.info(UPDATE_VNFA, MessageEnum.RA_ASYNC_UPDATE_VNF);
// Use the synchronous method to perform the actual Create
MsoVnfAdapter vnfAdapter = vnfImpl;
@@ -187,7 +190,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
vnfAdapter.updateVnf(cloudSiteId, cloudOwner, tenantId, vnfType, vnfVersion, vnfName, requestType,
volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback);
} catch (VnfException e) {
- logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_UPDATE_VNF_ERR,
+ logger.error(EXCEPTION_UPDATEVNF_NOTIFICATION, MessageEnum.RA_UPDATE_VNF_ERR,
ErrorCode.BusinessProcesssError.getValue(), e);
org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
String eMsg = null;
@@ -204,10 +207,10 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
notifyPort.updateVnfNotification(messageId, false, exCat, eMsg, null, null);
} catch (Exception e1) {
- logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
+ logger.error(EXCEPTION_UPDATEVNF_NOTIFICATION, MessageEnum.RA_SEND_VNF_NOTIF_ERR,
ErrorCode.BusinessProcesssError.getValue(), e1);
}
- logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
+ logger.info(UPDATE_VNFA, MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
return;
}
logger.debug("Async Update VNF: {} VnfId:{}", vnfName, vnfId.value);
@@ -217,10 +220,10 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
notifyPort.updateVnfNotification(messageId, true, null, null, copyUpdateOutputs(outputs),
copyVrb(vnfRollback));
} catch (Exception e) {
- logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
+ logger.error(EXCEPTION_UPDATEVNF_NOTIFICATION, MessageEnum.RA_SEND_VNF_NOTIF_ERR,
ErrorCode.BusinessProcesssError.getValue(), e);
}
- logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
+ logger.info(UPDATE_VNFA, MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
return;
}
@@ -242,8 +245,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
public void queryVnfA(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String messageId,
MsoRequest msoRequest, String notificationUrl) {
- String serviceName = "QueryVnfA";
- logger.info("{}", MessageEnum.RA_ASYNC_QUERY_VNF);
+ logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_QUERY_VNF);
// Use the synchronous method to perform the actual query
MsoVnfAdapter vnfAdapter = vnfImpl;
@@ -320,8 +322,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
public void deleteVnfA(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String messageId,
MsoRequest msoRequest, String notificationUrl) {
- String serviceName = "DeleteVnfA";
- logger.info("{}", MessageEnum.RA_ASYNC_DELETE_VNF);
+ logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_DELETE_VNF);
// Use the synchronous method to perform the actual delete
MsoVnfAdapter vnfAdapter = vnfImpl;
@@ -457,7 +458,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
CreateVnfNotification.Outputs outputs = new CreateVnfNotification.Outputs();
if (hMap != null && hMap.value != null) {
- Map<String, String> sMap = new HashMap<>();
+ Map<String, String> sMap;
sMap = hMap.value;
CreateVnfNotification.Outputs.Entry entry = new CreateVnfNotification.Outputs.Entry();
@@ -475,7 +476,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
UpdateVnfNotification.Outputs outputs = new UpdateVnfNotification.Outputs();
if (hMap != null && hMap.value != null) {
- Map<String, String> sMap = new HashMap<>();
+ Map<String, String> sMap;
sMap = hMap.value;
UpdateVnfNotification.Outputs.Entry entry = new UpdateVnfNotification.Outputs.Entry();
@@ -495,7 +496,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
QueryVnfNotification.Outputs outputs = new QueryVnfNotification.Outputs();
if (hMap != null && hMap.value != null) {
- Map<String, String> sMap = new HashMap<>();
+ Map<String, String> sMap;
sMap = hMap.value;
QueryVnfNotification.Outputs.Entry entry = new QueryVnfNotification.Outputs.Entry();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
index 5c7e70673b..af2fa24ff9 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
@@ -6,6 +6,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
+ * Modifications 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.
@@ -35,6 +36,7 @@ import java.util.Optional;
import java.util.concurrent.TimeUnit;
import javax.jws.WebService;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.commons.collections.CollectionUtils;
import org.onap.so.adapters.valet.GenericValetResponse;
import org.onap.so.adapters.valet.ValetClient;
@@ -63,10 +65,9 @@ import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
import org.onap.so.db.catalog.utils.MavenLikeVersioning;
import org.onap.so.entity.MsoRequest;
-import org.onap.so.logger.ErrorCode;
import org.onap.so.heatbridge.HeatBridgeApi;
import org.onap.so.heatbridge.HeatBridgeImpl;
-import org.onap.so.heatbridge.openstack.api.OpenstackClient;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
@@ -79,10 +80,6 @@ import org.onap.so.openstack.exceptions.MsoHeatNotFoundException;
import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.openstack.utils.MsoHeatUtilsWithUpdate;
-import org.openstack4j.model.compute.Flavor;
-import org.openstack4j.model.compute.Image;
-import org.openstack4j.model.compute.Server;
-import org.openstack4j.model.heat.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -92,6 +89,10 @@ import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.openstack4j.model.compute.Flavor;
+import org.openstack4j.model.compute.Image;
+import org.openstack4j.model.compute.Server;
+import org.openstack4j.model.heat.Resource;
@WebService(serviceName = "VnfAdapter", endpointInterface = "org.onap.so.adapters.vnf.MsoVnfAdapter",
targetNamespace = "http://org.onap.so/vnf")
@@ -107,7 +108,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
private static final Logger logger = LoggerFactory.getLogger(MsoVnfAdapterImpl.class);
- private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
+
private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter.";
private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters";
private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq";
@@ -115,15 +116,20 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
private static final String VALET_ENABLED = "org.onap.so.adapters.vnf.valet_enabled";
private static final String FAIL_REQUESTS_ON_VALET_FAILURE =
"org.onap.so.adapters.vnf.fail_requests_on_valet_failure";
- private static final String SUCCESS_MSG = "Successfully received response from Open Stack";
+ private static final String OPENSTACK = "OpenStack";
+ private static final String DELETE_VNF = "DeleteVNF";
+ private static final String QUERY_STACK = "QueryStack";
+ private static final String CREATE_VFM_MODULE = "CreateVFModule";
+ private static final String CREATE_VF_STACK = "Create VF: Stack";
+ private static final String STACK = "Stack";
+ private static final String USER_ERROR = "USER ERROR";
+ private static final String VERSION_MIN = "VersionMin";
+ private static final String VERSION_MAX = "VersionMax";
@Autowired
private VFModuleCustomizationRepository vfModuleCustomRepo;
-
-
@Autowired
private VnfResourceRepository vnfResourceRepo;
-
@Autowired
private MsoHeatUtilsWithUpdate heatU;
@Autowired
@@ -133,7 +139,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
/**
* DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL.
- *
+ *
* @see MsoVnfAdapterImpl#MsoVnfAdapterImpl(MsoPropertiesFactory, CloudConfigFactory)
*/
public MsoVnfAdapterImpl() {
@@ -190,7 +196,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
String vfModuleId = "";
// Create a hook here to catch shortcut createVf requests:
if (requestType != null && requestType.startsWith("VFMOD")) {
- logger.debug("Calling createVfModule from createVnf -- requestType=" + requestType);
+ logger.debug("Calling createVfModule from createVnf -- requestType={}", requestType);
String newRequestType = requestType.substring(5);
String vfVolGroupHeatStackId = "";
String vfBaseHeatStackId = "";
@@ -252,13 +258,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Holder<Boolean> vnfExists, Holder<String> vnfId, Holder<VnfStatus> status,
Holder<Map<String, String>> outputs) throws VnfException {
- logger.debug("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
+ logger.debug("Querying VNF {} in {}/{}", vnfName, cloudSiteId, tenantId);
// Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
- StackInfo heatStack = null;
- long subStartTime = System.currentTimeMillis();
+ StackInfo heatStack;
try {
heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vnfName);
} catch (MsoException me) {
@@ -267,8 +271,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Convert to a generic VnfException
String error =
"Query VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId,
- tenantId, "OpenStack", "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryStack", me);
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, tenantId,
+ OPENSTACK, "QueryVNF", ErrorCode.DataError.getValue(), "Exception - " + QUERY_STACK, me);
logger.debug(error);
throw new VnfException(me);
}
@@ -311,25 +315,17 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
throws VnfException {
logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
- // Use the MsoHeatUtils to delete the stack. Set the polling flag to true.
- // The possible outcomes of deleteStack are a StackInfo object with status
- // of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
- // could be thrown.
- long subStartTime = System.currentTimeMillis();
try {
heat.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true);
} catch (MsoException me) {
- me.addContext("DeleteVNF");
+ me.addContext(DELETE_VNF);
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
String error =
"Delete VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner,
- cloudSiteId, tenantId, "OpenStack", "DeleteVNF", ErrorCode.DataError.getValue(),
- "Exception - DeleteVNF", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, OPENSTACK, DELETE_VNF, ErrorCode.DataError.getValue(), "Exception - " + DELETE_VNF, me);
logger.debug(error);
throw new VnfException(me);
}
@@ -345,10 +341,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void rollbackVnf(VnfRollback rollback) throws VnfException {
- long startTime = System.currentTimeMillis();
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
- logger.info(MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
+ logger.info(MessageEnum.RA_ROLLBACK_NULL.toString(), OPENSTACK, "rollbackVnf");
return;
}
@@ -372,9 +367,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("RollbackVNF");
String error =
"Rollback VNF: " + vnfId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfId, cloudOwner,
- cloudSiteId, tenantId, "OpenStack", "DeleteStack", ErrorCode.DataError.getValue(),
- "Exception - DeleteStack", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfId, cloudOwner, cloudSiteId,
+ tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(), "Exception - DeleteStack", me);
logger.debug(error);
throw new VnfException(me);
}
@@ -438,13 +432,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug(" HeatBridgeMain.py returned {} with code {}", wait, p.exitValue());
return wait && p.exitValue() == 0;
} catch (IOException e) {
- logger.debug(" HeatBridgeMain.py failed with IO Exception! " + e);
+ logger.debug(" HeatBridgeMain.py failed with IO Exception! {}", e);
return false;
} catch (RuntimeException e) {
- logger.debug(" HeatBridgeMain.py failed during runtime!" + e);
+ logger.debug(" HeatBridgeMain.py failed during runtime! {}", e);
return false;
} catch (Exception e) {
- logger.debug(" HeatBridgeMain.py failed for unknown reasons! " + e);
+ logger.debug(" HeatBridgeMain.py failed for unknown reasons! {}", e);
return false;
}
}
@@ -462,7 +456,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
HeatBridgeApi heatBridgeClient =
new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity, cloudOwner, cloudSiteId, tenantId);
- OpenstackClient openstackClient = heatBridgeClient.authenticate();
List<Resource> stackResources = heatBridgeClient.queryNestedHeatStackResources(heatStackId);
List<Server> osServers = heatBridgeClient.getAllOpenstackServers(stackResources);
@@ -591,7 +584,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
useMCUuid = false;
mcu = "";
} else {
- logger.debug("Found modelCustomizationUuid! Will use that: " + mcu);
+ logger.debug("Found modelCustomizationUuid! Will use that: {}", mcu);
useMCUuid = true;
}
}
@@ -618,7 +611,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
requestTypeString = requestTypeString.substring(1);
}
- // 1607 - let's parse out the request type we're being sent
+ // let's parse out the request type we're being sent
boolean isBaseRequest = false;
boolean isVolumeRequest = false;
if (requestTypeString.startsWith("VOLUME")) {
@@ -627,8 +620,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("requestTypeString = " + requestTypeString + ", nestedStackId = " + nestedStackId
+ ", nestedBaseStackId = " + nestedBaseStackId);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
// Build a default rollback object (no actions performed)
VnfRollback vfRollback = new VnfRollback();
@@ -648,57 +639,60 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
StackInfo heatStack = null;
- long subStartTime1 = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vfModuleName);
+ if (heat != null) {
+ heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vfModuleName);
+ } else {
+ throw new MsoHeatNotFoundException();
+ }
} catch (MsoException me) {
String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(),
- "Exception - queryStack", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ "Exception - " + QUERY_STACK, me);
logger.debug(error);
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
- me.addContext("CreateVFModule");
+ me.addContext(CREATE_VFM_MODULE);
throw new VnfException(me);
}
- // New with 1607 - more precise handling/messaging if the stack already exists
+ // more precise handling/messaging if the stack already exists
if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) {
// INIT, CREATED, NOTFOUND, FAILED, BUILDING, DELETING, UNKNOWN, UPDATING, UPDATED
HeatStatus status = heatStack.getStatus();
if (status == HeatStatus.INIT || status == HeatStatus.BUILDING || status == HeatStatus.DELETING
|| status == HeatStatus.UPDATING) {
// fail - it's in progress - return meaningful error
- String error = "Create VF: Stack " + vfModuleName + " already exists and has status "
+ String error = CREATE_VF_STACK + " " + vfModuleName + " already exists and has status "
+ status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ "; please wait for it to complete, or fix manually.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(),
- "Stack " + vfModuleName + " already exists");
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ STACK + " " + vfModuleName + " already exists");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
heatStack.getCanonicalName());
}
if (status == HeatStatus.FAILED) {
// fail - it exists and is in a FAILED state
- String error = "Create VF: Stack " + vfModuleName + " already exists and is in FAILED state in "
+ String error = CREATE_VF_STACK + " " + vfModuleName + " already exists and is in FAILED state in "
+ cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(),
- "Stack " + vfModuleName + " already exists and is " + "in FAILED state");
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ STACK + " " + vfModuleName + " already exists and is " + "in FAILED state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
heatStack.getCanonicalName());
}
if (status == HeatStatus.UNKNOWN || status == HeatStatus.UPDATED) {
// fail - it exists and is in a FAILED state
- String error = "Create VF: Stack " + vfModuleName + " already exists and has status "
+ String error = CREATE_VF_STACK + " " + vfModuleName + " already exists and has status "
+ status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(),
- "Stack " + vfModuleName + " already exists and is " + "in UPDATED or UNKNOWN state");
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ STACK + " " + vfModuleName + " already exists and is " + "in UPDATED or UNKNOWN state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
heatStack.getCanonicalName());
@@ -706,11 +700,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (status == HeatStatus.CREATED) {
// fail - it exists
if (failIfExists != null && failIfExists) {
- String error = "Create VF: Stack " + vfModuleName + " already exists in " + cloudOwner + "/"
+ String error = CREATE_VF_STACK + " " + vfModuleName + " already exists in " + cloudOwner + "/"
+ cloudSiteId + "/" + tenantId;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(),
- vfModuleName, cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack",
- ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists");
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ STACK + " " + vfModuleName + " already exists");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
heatStack.getCanonicalName());
@@ -728,7 +722,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// handle a nestedStackId if sent- this one would be for the volume - so applies to both Vf and Vnf
StackInfo nestedHeatStack = null;
- long subStartTime2 = System.currentTimeMillis();
+
Map<String, Object> nestedVolumeOutputs = null;
if (nestedStackId != null) {
try {
@@ -737,20 +731,20 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
- me.addContext("CreateVFModule");
+ me.addContext(CREATE_VFM_MODULE);
String error = "Create VFModule: Attached heatStack ID Query " + nestedStackId + " in " + cloudOwner
+ "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack",
- ErrorCode.BusinessProcesssError.getValue(), "MsoException trying to query nested stack", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.BusinessProcesssError.getValue(),
+ "MsoException trying to query nested stack", me);
logger.debug("ERROR trying to query nested stack= {}", error);
throw new VnfException(me);
}
if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) {
String error = "Create VFModule: Attached heatStack ID DOES NOT EXIST " + nestedStackId + " in "
- + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "queryStack",
+ + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " " + USER_ERROR;
+ logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, error, OPENSTACK, QUERY_STACK,
ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Attached heatStack ID " + "DOES NOT EXIST");
logger.debug(error);
@@ -763,7 +757,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// handle a nestedBaseStackId if sent- this is the stack ID of the base. Should be null for VNF requests
StackInfo nestedBaseHeatStack = null;
- long subStartTime3 = System.currentTimeMillis();
Map<String, Object> baseStackOutputs = null;
if (nestedBaseStackId != null) {
try {
@@ -772,21 +765,20 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
- me.addContext("CreateVFModule");
+ me.addContext(CREATE_VFM_MODULE);
String error = "Create VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in "
+ cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "OpenStack", "QueryStack",
- ErrorCode.BusinessProcesssError.getValue(), "MsoException trying to query nested base stack",
- me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.BusinessProcesssError.getValue(),
+ "MsoException trying to query nested base stack", me);
logger.debug("ERROR trying to query nested base stack= {}", error);
throw new VnfException(me);
}
if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) {
String error = "Create VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId
- + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "QueryStack",
+ + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " " + USER_ERROR;
+ logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, error, OPENSTACK, QUERY_STACK,
ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Attached base heatStack ID DOES NOT EXIST");
logger.debug("Exception occurred", error);
@@ -797,31 +789,25 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
}
- // Ready to deploy the new VNF
-
-
-
try {
// Retrieve the VF
VfModule vf = null;
VnfResource vnfResource = null;
VfModuleCustomization vfmc = null;
- logger.debug("version: {}", vfVersion);
if (useMCUuid) {
- // 1707 - db refactoring
vfmc = vfModuleCustomRepo.findFirstByModelCustomizationUUIDOrderByCreatedDesc(mcu);
if (vfmc != null)
vf = vfmc.getVfModule();
else
vf = null;
- // 1702 - this will be the new way going forward. We find the vf by mcu - otherwise, code is the same.
+ // this will be the new way going forward. We find the vf by mcu - otherwise, code is the same.
if (vf == null) {
logger.debug("Unable to find vfModuleCust with modelCustomizationUuid={}", mcu);
String error =
"Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + mcu;
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
- "VF Module ModelCustomizationUuid", modelCustomizationUuid, "OpenStack",
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ "VF Module ModelCustomizationUuid", modelCustomizationUuid, OPENSTACK,
ErrorCode.DataError.getValue(),
"Create VF Module: Unable to find vfModule with " + "modelCustomizationUuid=" + mcu);
logger.debug(error);
@@ -849,8 +835,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
if (vnfResource == null) {
String error = "Create VNF: Unknown VNF Type: " + vnfType;
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VNF Type", vnfType,
- "OpenStack", ErrorCode.DataError.getValue(), "Create VNF: Unknown VNF Type");
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VNF Type", vnfType,
+ OPENSTACK, ErrorCode.DataError.getValue(), "Create VNF: Unknown VNF Type");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
@@ -858,11 +844,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
// By here - we have either a vf or vnfResource
- // 1607 - Add version check
+ // Add version check
// First - see if it's in the VnfResource record
// if we have a vf Module - then we have to query to get the VnfResource record.
- if (!oldWay && vf.getVnfResources() != null) {
- vnfResource = vf.getVnfResources();
+ if (!oldWay) {
+ if (vf != null) {
+ vnfResource = vf.getVnfResources();
+ }
if (vnfResource == null) {
logger.debug("Unable to find vnfResource will not error for now...");
}
@@ -906,7 +894,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
equalToMax = aicV.isTheSameVersion(maxVersionVnf);
} catch (Exception e) {
logger.debug(
- "An exception occurred while trying to test AIC Version {} - will default to not check",
+ "An exception occurred while trying to test Cloud Version {} - will default to not check",
e.getMessage(), e);
doNotTest = true;
}
@@ -914,35 +902,28 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if ((moreThanMin || equalToMin) // aic >= min
&& (equalToMax || !(moreThanMax))) { // aic <= max
logger.debug("VNF Resource " + vnfResource.getModelName() + ", ModelUuid="
- + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:"
- + maxVersionVnf + " supported on Cloud: " + cloudSiteId + " with AIC_Version:"
- + cloudSiteOpt.get().getCloudVersion());
+ + vnfResource.getModelUUID() + " " + VERSION_MIN + " =" + minVersionVnf + " "
+ + VERSION_MAX + " :" + maxVersionVnf + " supported on Cloud: " + cloudSiteId
+ + " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion());
} else {
// ERROR
String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid="
- + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:"
- + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId
+ + vnfResource.getModelUUID() + " " + VERSION_MIN + " =" + minVersionVnf + " "
+ + VERSION_MAX + " :" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId
+ " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion();
- logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK,
ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
} else {
- logger.debug("bypassing testing AIC version...");
+ logger.debug("bypassing testing Cloud version...");
}
} // let this error out downstream to avoid introducing uncertainty at this stage
} else {
logger.debug("cloudConfig is NULL - cannot check cloud site version");
}
- } else {
- logger.debug(
- "AIC Version not set in VNF_Resource - this is expected thru 1607 - do not error here - not checked"
- + ".");
}
- // End Version check 1607
-
-
// By the time we get here - heatTemplateId and heatEnvtId should be populated (or null)
HeatTemplate heatTemplate = null;
@@ -964,9 +945,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (heatTemplate == null) {
String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType
- + ", reqType=" + requestTypeString;
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
- vfModuleType, "OpenStack", ErrorCode.DataError.getValue(), error);
+ + ", modelCustomizationUuid=" + mcu + ", vfModuleUuid="
+ + (vf != null ? vf.getModelUUID() : "null") + ", vnfResourceModelUuid="
+ + vnfResource.getModelUUID() + ", reqType=" + requestTypeString;
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template " + "ID",
+ vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -978,9 +961,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("No environment parameter found for this Type " + vfModuleType);
} else {
if (heatEnvironment == null) {
- String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
- logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
- "OpenStack", ErrorCode.DataError.getValue(), error);
+ String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType
+ + ", modelCustomizationUuid=" + mcu + ", vfModuleUuid="
+ + (vf != null ? vf.getModelUUID() : "null") + ", vnfResourceModelUuid="
+ + vnfResource.getModelUUID() + ", reqType=" + requestTypeString;
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ "Heat " + "Environment ID", OPENSTACK, ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -1006,7 +992,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
nestedTemplatesChecked = null;
}
- // 1510 - Also add the files: for any get_files associated with this vnf_resource_id
+ // Also add the files: for any get_files associated with this vnf_resource_id
// *if* there are any
List<HeatFiles> heatFiles = null;
@@ -1027,11 +1013,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (!isVolumeRequest || addGetFilesOnVolumeReq) {
if (oldWay) {
- logger.debug(
- "In MsoVnfAdapterImpl createVfModule, this should not happen - old way is gamma only - no heat "
- + "files!");
+ logger.debug("In MsoVnfAdapterImpl createVfModule, this should not happen, no heat files!");
} else {
- // 1607 - now use VF_MODULE_TO_HEAT_FILES table
+ // now use VF_MODULE_TO_HEAT_FILES table
logger.debug(
"In MsoVnfAdapterImpl createVfModule, about to call db.getHeatFilesForVfModule avec vfModuleId="
+ vf.getModelUUID());
@@ -1058,9 +1042,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
String missingParams = null;
List<String> paramList = new ArrayList<>();
- // New for 1510 - consult the PARAM_ALIAS field to see if we've been
+ // consult the PARAM_ALIAS field to see if we've been
// supplied an alias. Only check if we don't find it initially.
- // Also new in 1510 - don't flag missing parameters if there's an environment - because they might be there.
+ // don't flag missing parameters if there's an environment - because they might be there.
// And also new - add parameter to turn off checking all together if we find we're blocking orders we
// shouldn't
boolean checkRequiredParameters = true;
@@ -1075,7 +1059,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// No problem - default is true
logger.debug("An exception occured trying to get property {}", MsoVnfAdapterImpl.CHECK_REQD_PARAMS, e);
}
- // 1604 - Add enhanced environment & parameter checking
// Part 1: parse envt entries to see if reqd parameter is there (before used a simple grep
// Part 2: only submit to openstack the parameters in the envt that are in the heat template
// Note this also removes any comments
@@ -1083,7 +1066,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (heatEnvironment != null && heatEnvironment.getEnvironment() != null
&& heatEnvironment.getEnvironment().contains("parameters:")) {
- logger.debug("Enhanced environment checking enabled - 1604");
StringBuilder sb = new StringBuilder(heatEnvironment.getEnvironment());
mhee = new MsoHeatEnvironmentEntry(sb);
@@ -1101,10 +1083,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
} else {
logger.debug("NO ENVIRONMENT for this entry");
}
- // New with 1707 - all variables converted to their native object types
+ // all variables converted to their native object types
Map<String, Object> goldenInputs = null;
- logger.debug("Now handle the inputs....first convert");
ArrayList<String> parameterNames = new ArrayList<>();
HashMap<String, String> aliasToParam = new HashMap<>();
StringBuilder sb = new StringBuilder("\nTemplate Parameters:\n");
@@ -1161,7 +1142,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (checkRequiredParameters) {
// Problem - missing one or more required parameters
String error = "Create VFModule: Missing Required inputs: " + missingParams;
- logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "OpenStack",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams, OPENSTACK,
ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -1205,31 +1186,21 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Have the tenant. Now deploy the stack itself
// Ignore MsoTenantNotFound and MsoStackAlreadyExists exceptions
// because we already checked for those.
- long createStackStarttime = System.currentTimeMillis();
try {
- // heatStack = heat.createStack(cloudSiteId, tenantId, vnfName, template, inputs, true,
- // heatTemplate.getTimeoutMinutes());
if (backout == null) {
backout = true;
}
if (heat != null) {
- logger.debug("heat is not null!!");
heatStack = heat.createStack(cloudSiteId, cloudOwner, tenantId, vfModuleName, null, template,
goldenInputs, true, heatTemplate.getTimeoutMinutes(), newEnvironmentString,
nestedTemplatesChecked, heatFilesObjects, backout.booleanValue());
} else {
- logger.debug("heat is null!");
throw new MsoHeatNotFoundException();
}
} catch (MsoException me) {
- me.addContext("CreateVFModule");
- String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/"
- + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType,
- cloudOwner, cloudSiteId, tenantId, "OpenStack", ErrorCode.DataError.getValue(),
- "MsoException - createStack", me);
- logger.debug(error);
+ me.addContext(CREATE_VFM_MODULE);
+ logger.error("Error creating Stack", me);
if (isValetEnabled && sendResponseToValet) {
logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
try {
@@ -1243,17 +1214,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
throw new VnfException(me);
} catch (NullPointerException npe) {
- String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/"
- + tenantId + ": " + npe;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType,
- cloudOwner, cloudSiteId, tenantId, "OpenStack", ErrorCode.DataError.getValue(),
- "NullPointerException - createStack", npe);
- logger.debug(error);
- logger.debug("NULL POINTER EXCEPTION at heat.createStack");
- // npe.addContext ("CreateVNF");
+ logger.error("Error creating Stack", npe);
throw new VnfException("NullPointerException during heat.createStack");
} catch (Exception e) {
- logger.debug("unhandled exception at heat.createStack", e);
+ logger.error("Error creating Stack", e);
throw new VnfException("Exception during heat.createStack! " + e.getMessage());
}
// Reach this point if createStack is successful.
@@ -1278,7 +1242,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("VF Module {} successfully created", vfModuleName);
// call heatbridge
heatbridge(heatStack, cloudOwner, cloudSiteId, tenantId, genericVnfName, vfModuleId);
- return;
} catch (Exception e) {
logger.debug("unhandled exception in create VF", e);
throw new VnfException("Exception during create VF " + e.getMessage());
@@ -1291,11 +1254,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("Deleting VF {} in ", vnfName, cloudOwner + "/" + cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
// 1702 capture the output parameters on a delete
// so we'll need to query first
- Map<String, Object> stackOutputs = null;
+ Map<String, Object> stackOutputs;
try {
stackOutputs = heat.queryStackForOutputs(cloudSiteId, cloudOwner, tenantId, vnfName);
} catch (MsoException me) {
@@ -1304,9 +1266,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("DeleteVFModule");
String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId
+ "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner,
- cloudSiteId, tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(),
- "Exception - QueryStack", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(), "Exception - " + QUERY_STACK, me);
logger.debug(error);
throw new VnfException(me);
}
@@ -1324,22 +1285,16 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
msoRequest, failRequestOnValetFailure);
}
- // Use the MsoHeatUtils to delete the stack. Set the polling flag to true.
- // The possible outcomes of deleteStack are a StackInfo object with status
- // of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
- // could be thrown.
- long subStartTime = System.currentTimeMillis();
try {
heat.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true);
} catch (MsoException me) {
- me.addContext("DeleteVNF");
+ me.addContext(DELETE_VNF);
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
String error =
"Delete VF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner,
- cloudSiteId, tenantId, "OpenStack", "DeleteStack", ErrorCode.DataError.getValue(),
- "Exception - deleteStack", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(), "Exception - deleteStack", me);
logger.debug(error);
if (isValetEnabled && valetDeleteRequestSucceeded) {
logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
@@ -1446,9 +1401,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("requestTypeString = " + requestTypeString + ", nestedVolumeStackId = " + nestedStackId
+ ", nestedBaseStackId = " + nestedBaseStackId);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
-
// Build a default rollback object (no actions performed)
VnfRollback vfRollback = new VnfRollback();
vfRollback.setCloudSiteId(cloudSiteId);
@@ -1462,8 +1414,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
vfRollback.setVfModuleStackId(vfModuleStackId);
vfRollback.setModelCustomizationUuid(mcu);
- StackInfo heatStack = null;
- long queryStackStarttime = System.currentTimeMillis();
+ StackInfo heatStack;
logger.debug("UpdateVfModule - querying for {}", vfModuleName);
try {
heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vfModuleName);
@@ -1473,9 +1424,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("UpdateVFModule");
String error = "Update VFModule: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(),
- "Exception - QueryStack", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ "Exception - " + QUERY_STACK, me);
logger.debug(error);
throw new VnfException(me);
}
@@ -1485,9 +1436,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Not Found
String error = "Update VF: Stack " + vfModuleName + " does not exist in " + cloudOwner + "/" + cloudSiteId
+ "/" + tenantId;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_NOT_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(),
- error);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_NOT_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(), error);
throw new VnfNotFound(cloudSiteId, cloudOwner, tenantId, vfModuleName);
} else {
logger.debug("Found Existing stack, status={}", heatStack.getStatus());
@@ -1498,7 +1448,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// 1604 Cinder Volume support - handle a nestedStackId if sent (volumeGroupHeatStackId):
StackInfo nestedHeatStack = null;
- long queryStackStarttime2 = System.currentTimeMillis();
Map<String, Object> nestedVolumeOutputs = null;
if (nestedStackId != null) {
try {
@@ -1510,18 +1459,17 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("UpdateVFModule");
String error = "Update VF: Attached heatStack ID Query " + nestedStackId + " in " + cloudOwner + "/"
+ cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner,
- cloudSiteId, tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
"Exception - " + error, me);
logger.debug("ERROR trying to query nested stack= {}", error);
throw new VnfException(me);
}
if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) {
String error = "Update VFModule: Attached volume heatStack ID DOES NOT EXIST " + nestedStackId + " in "
- + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName,
- cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "QueryStack",
- ErrorCode.DataError.getValue(), error);
+ + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " " + USER_ERROR;
+ logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner,
+ cloudSiteId, tenantId, error, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
@@ -1534,7 +1482,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
StackInfo nestedBaseHeatStack = null;
Map<String, Object> baseStackOutputs = null;
if (nestedBaseStackId != null) {
- long queryStackStarttime3 = System.currentTimeMillis();
try {
logger.debug("Querying for nestedBaseStackId = {}", nestedBaseStackId);
nestedBaseHeatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, nestedBaseStackId);
@@ -1544,18 +1491,17 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("UpdateVfModule");
String error = "Update VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in "
+ cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
"Exception - " + error, me);
logger.debug("ERROR trying to query nested base stack= {}", error);
throw new VnfException(me);
}
if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) {
String error = "Update VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId
- + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "QueryStack",
- ErrorCode.DataError.getValue(), error);
+ + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " " + USER_ERROR;
+ logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, error, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
@@ -1584,8 +1530,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
if (vf == null) {
String error = "Update VfModule: unable to find vfModule with modelCustomizationUuid=" + mcu;
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module Type",
- vfModuleType, "OpenStack", ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module Type", vfModuleType,
+ OPENSTACK, ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
logger.debug("Got VF module definition from Catalog: {}", vf.toString());
@@ -1657,15 +1603,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (!doNotTest) {
if ((moreThanMin || equalToMin) // aic >= min
&& ((equalToMax) || !(moreThanMax))) { // aic <= max
- logger.debug("VNF Resource " + vnfResource.getModelName() + " VersionMin=" + minVersionVnf
- + " VersionMax:" + maxVersionVnf + " supported on Cloud: " + cloudSiteId
- + " with AIC_Version:" + aicV);
+ logger.debug("VNF Resource " + vnfResource.getModelName() + " " + VERSION_MIN + " ="
+ + minVersionVnf + " " + VERSION_MAX + " :" + maxVersionVnf + " supported on Cloud: "
+ + cloudSiteId + " with AIC_Version:" + aicV);
} else {
// ERROR
- String error = "VNF Resource type: " + vnfResource.getModelName() + " VersionMin="
- + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: "
- + cloudSiteId + " with AIC_Version:" + aicV;
- logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
+ String error = "VNF Resource type: " + vnfResource.getModelName() + " " + VERSION_MIN + " ="
+ + minVersionVnf + " " + VERSION_MAX + " :" + maxVersionVnf
+ + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + aicV;
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK,
ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -1695,18 +1641,20 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (heatTemplate == null) {
String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType
- + ", reqType=" + requestTypeString;
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
- vfModuleType, "OpenStack", ErrorCode.DataError.getValue(), error);
+ + ", modelCustomizationUuid=" + mcu + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType="
+ + requestTypeString;
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
+ vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
logger.debug("Got HEAT Template from DB: {}", heatTemplate.getHeatTemplate());
}
if (heatEnvironment == null) {
- String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
- logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
- "OpenStack", ErrorCode.DataError.getValue(), error);
+ String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid="
+ + mcu + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType=" + requestTypeString;
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
+ OPENSTACK, ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
logger.debug("Got Heat Environment from DB: {}", heatEnvironment.getEnvironment());
@@ -1913,14 +1861,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Problem - missing one or more required parameters
if (checkRequiredParameters) {
String error = "Update VNF: Missing Required inputs: " + missingParams;
- logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "OpenStack",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams, OPENSTACK,
ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
logger.debug("found missing parameters - but checkRequiredParameters is false - will not block");
}
- } else {
- logger.debug("No missing parameters found - ok to proceed");
}
// Just submit the envt entry as received from the database
@@ -1935,8 +1881,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// This is not a valid parameter for this template
extraParams.removeAll(paramList);
if (!extraParams.isEmpty()) {
- logger.warn("{} {} {} {} {} {}", MessageEnum.RA_VNF_EXTRA_PARAM.toString(), vnfType,
- extraParams.toString(), "OpenStack", ErrorCode.DataError.getValue(), "Extra params");
+ logger.warn(LoggingAnchor.SIX, MessageEnum.RA_VNF_EXTRA_PARAM.toString(), vnfType,
+ extraParams.toString(), OPENSTACK, ErrorCode.DataError.getValue(), "Extra params");
inputs.keySet().removeAll(extraParams);
}
}
@@ -1989,7 +1935,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Have the tenant. Now deploy the stack itself
// Ignore MsoTenantNotFound and MsoStackAlreadyExists exceptions
// because we already checked for those.
- long updateStackStarttime = System.currentTimeMillis();
try {
heatStack = heatU.updateStack(cloudSiteId, cloudOwner, tenantId, vfModuleName, template, goldenInputs, true,
heatTemplate.getTimeoutMinutes(), newEnvironmentString,
@@ -1999,8 +1944,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("UpdateVFModule");
String error = "Update VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
- cloudSiteId, tenantId, "OpenStack", ErrorCode.DataError.getValue(), "Exception - " + error, me);
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_UPDATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, ErrorCode.DataError.getValue(), "Exception - " + error, me);
if (isValetEnabled && sendResponseToValet) {
logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
try {
@@ -2035,7 +1980,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
outputs.value = copyStringOutputs(heatStack.getOutputs());
rollback.value = vfRollback;
- return;
}
private String getVfModuleNameFromModuleStackId(String vfModuleStackId) {
@@ -2083,7 +2027,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Map<String, Object> nestedTemplates) {
boolean haveGetFiles = true;
boolean haveNestedTemplates = true;
- Map<String, Object> files = new HashMap<String, Object>();
+ Map<String, Object> files = new HashMap<>();
if (getFiles == null || getFiles.isEmpty()) {
haveGetFiles = false;
}
@@ -2139,7 +2083,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (newInputs != null) {
Map<String, Object> oldGold = goldenInputs;
logger.debug("parameters before being modified by valet:{}", oldGold.toString());
- goldenInputs = new HashMap<String, Object>();
+ goldenInputs = new HashMap<>();
for (String key : newInputs.keySet()) {
goldenInputs.put(key, newInputs.get(key));
}
@@ -2201,13 +2145,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Map<String, Object> newInputs = vur.getParameters();
if (newInputs != null) {
Map<String, Object> oldGold = goldenInputs;
- logger.debug("parameters before being modified by valet:{}", oldGold.toString());
- goldenInputs = new HashMap<String, Object>();
+ logger.debug("parameters before being modified by valet:{}", oldGold);
+ goldenInputs = new HashMap<>();
for (String key : newInputs.keySet()) {
goldenInputs.put(key, newInputs.get(key));
}
valetModifiedParamsHolder.value = goldenInputs;
- logger.debug("parameters after being modified by valet:{}", goldenInputs.toString());
+ logger.debug("parameters after being modified by valet:{}", goldenInputs);
valetSucceeded = true;
}
} else {
@@ -2275,7 +2219,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
valetDeleteRequestSucceeded = false;
valetErrorMessage = e.getMessage();
}
- if (valetDeleteRequestSucceeded == false && failRequestOnValetFailure == true) {
+ if (!valetDeleteRequestSucceeded && failRequestOnValetFailure) {
logger.error("ValetDeleteRequestFailed - del req still will be sent to openstack",
new VnfException("ValetDeleteRequestFailedError"));
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
index 2ea7ff417c..f09fa34cb9 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
@@ -32,6 +32,8 @@ import java.util.Optional;
import java.util.Set;
import javax.jws.WebService;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
+import com.woorea.openstack.heat.Heat;
import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.cloud.CloudConfig;
@@ -79,15 +81,12 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
private static Logger logger = LoggerFactory.getLogger(MsoVnfCloudifyAdapterImpl.class);
- private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
- private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter.";
- private static final String LOG_REPLY_NAME = "MSO-VnfAdapter:MSO-BPMN.";
private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters";
- private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq";
- private static final String CLOUDIFY_RESPONSE_SUCCESS = "Successfully received response from Cloudify";
private static final String CLOUDIFY = "Cloudify";
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
+ private static final String BRACKETS = LoggingAnchor.NINE;
+ private static final String OPENSTACK = "OpenStack";
@Autowired
protected CloudConfig cloudConfig;
@@ -105,16 +104,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
protected MsoCloudifyUtils cloudifyUtils;
/**
- * Health Check web method. Does nothing but return to show the adapter is deployed.
- */
- @Override
- public void healthCheck() {
- logger.debug("Health check call in VNF Cloudify Adapter");
- }
-
- /**
* DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL.
- *
+ *
* @see MsoVnfCloudifyAdapterImpl#MsoVnfAdapterImpl(MsoPropertiesFactory, CloudConfigFactory)
*/
public MsoVnfCloudifyAdapterImpl() {
@@ -122,6 +113,14 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
}
/**
+ * Health Check web method. Does nothing but return to show the adapter is deployed.
+ */
+ @Override
+ public void healthCheck() {
+ logger.debug("Health check call in VNF Cloudify Adapter");
+ }
+
+ /**
* This is the "Create VNF" web service implementation. This function is now unsupported and will return an error.
*
*/
@@ -177,10 +176,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
Holder<Map<String, String>> outputs) throws VnfException {
logger.debug("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
- long subStartTime = System.currentTimeMillis();
-
DeploymentInfo deployment = null;
try {
@@ -191,13 +186,13 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
deployment = null;
} catch (MsoException me) {
// Failed to query the Deployment due to a cloudify exception.
+ logger.debug("Failed to query the Deployment due to a cloudify exception");
// Convert to a generic VnfException
me.addContext("QueryVNF");
String error = "Query VNF (Cloudify): " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner,
- cloudSiteId, tenantId, CLOUDIFY, "QueryVNF", ErrorCode.DataError.getValue(),
- "Exception - queryDeployment", me);
+ logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId,
+ CLOUDIFY, "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryDeployment", me);
logger.debug(error);
throw new VnfException(me);
}
@@ -217,7 +212,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
logger.debug("VNF {} not found", vnfName);
}
- return;
}
@@ -243,10 +237,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void rollbackVnf(VnfRollback rollback) throws VnfException {
- long startTime = System.currentTimeMillis();
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
- logger.info("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
+ logger.info(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_NULL.toString(), OPENSTACK, "rollbackVnf");
return;
}
@@ -269,7 +262,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// The possible outcomes of deleteStack are a StackInfo object with status
// of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
// could be thrown.
- long subStartTime = System.currentTimeMillis();
try {
// KLUDGE - Cloudify requires Tenant Name for Openstack. We have the ID.
// Go directly to Keystone until APIs could be updated to supply the name.
@@ -286,13 +278,12 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
me.addContext("RollbackVNF");
String error = "Rollback VF Module: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner,
- cloudSiteId, tenantId, CLOUDIFY, "DeleteDeployment", ErrorCode.DataError.getValue(),
+ logger.error(BRACKETS, MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId,
+ tenantId, CLOUDIFY, "DeleteDeployment", ErrorCode.DataError.getValue(),
"Exception - DeleteDeployment", me);
logger.debug(error);
throw new VnfException(me);
}
- return;
}
@@ -320,37 +311,38 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
}
private Map<String, String> copyStringOutputs(Map<String, Object> stackOutputs) {
- Map<String, String> stringOutputs = new HashMap<String, String>();
- for (String key : stackOutputs.keySet()) {
- if (stackOutputs.get(key) instanceof String) {
- stringOutputs.put(key, (String) stackOutputs.get(key));
- } else if (stackOutputs.get(key) instanceof Integer) {
+ Map<String, String> stringOutputs = new HashMap<>();
+ for (Map.Entry<String, Object> entry : stackOutputs.entrySet()) {
+ if (entry.getValue() instanceof String) {
+ stringOutputs.put(entry.getKey(), (String) entry.getValue());
+ } else if (entry.getValue() instanceof Integer) {
try {
- String str = "" + stackOutputs.get(key);
- stringOutputs.put(key, str);
+ String str = "" + entry.getValue();
+ stringOutputs.put(entry.getKey(), str);
} catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs");
+ logger.error("Unable to add " + entry.getKey() + " to outputs", e);
}
- } else if (stackOutputs.get(key) instanceof JsonNode) {
+ } else if (entry.getValue() instanceof JsonNode) {
try {
- String str = this.convertNode((JsonNode) stackOutputs.get(key));
- stringOutputs.put(key, str);
+ String str = this.convertNode((JsonNode) entry.getValue());
+ stringOutputs.put(entry.getKey(), str);
} catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs - exception converting JsonNode");
+ logger.error("Unable to add " + entry.getKey() + " to outputs - exception converting JsonNode", e);
}
- } else if (stackOutputs.get(key) instanceof java.util.LinkedHashMap) {
+ } else if (entry.getValue() instanceof java.util.LinkedHashMap) {
try {
- String str = JSON_MAPPER.writeValueAsString(stackOutputs.get(key));
- stringOutputs.put(key, str);
+ String str = JSON_MAPPER.writeValueAsString(entry.getValue());
+ stringOutputs.put(entry.getKey(), str);
} catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs - exception converting LinkedHashMap");
+ logger.error("Unable to add " + entry.getKey() + " to outputs - exception converting LinkedHashMap",
+ e);
}
} else {
try {
- String str = stackOutputs.get(key).toString();
- stringOutputs.put(key, str);
+ String str = entry.getValue().toString();
+ stringOutputs.put(entry.getKey(), str);
} catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs - unable to call .toString() " + e.getMessage());
+ logger.error("Unable to add " + entry.getKey() + " to outputs - unable to call .toString() ", e);
}
}
}
@@ -366,18 +358,17 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
} else if (inputs.size() < 1) {
sb.append("\tEMPTY");
} else {
- for (String str : inputs.keySet()) {
+ for (Map.Entry<String, Object> entry : inputs.entrySet()) {
String outputString;
try {
- outputString = inputs.get(str).toString();
+ outputString = entry.getValue().toString();
} catch (Exception e) {
- outputString = "Unable to call toString() on the value for " + str;
+ outputString = "Unable to call toString() on the value for " + entry.getKey();
}
- sb.append("\t\nitem " + i++ + ": '" + str + "'='" + outputString + "'");
+ sb.append("\t\nitem " + i++ + ": '" + entry.getKey() + "'='" + outputString + "'");
}
}
logger.debug(sb.toString());
- return;
}
private void sendMapToDebug(Map<String, Object> inputs) {
@@ -388,12 +379,11 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
} else if (inputs.size() < 1) {
sb.append("\tEMPTY");
} else {
- for (String str : inputs.keySet()) {
- sb.append("\titem " + i++ + ": " + str + "=" + inputs.get(str));
+ for (Map.Entry<String, Object> entry : inputs.entrySet()) {
+ sb.append("\titem " + i++ + ": " + entry.getKey() + "=" + entry.getValue());
}
}
logger.debug(sb.toString());
- return;
}
private String convertNode(final JsonNode node) {
@@ -402,9 +392,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
final String json = JSON_MAPPER.writeValueAsString(obj);
return json;
} catch (JsonParseException jpe) {
- logger.debug("Error converting json to string " + jpe.getMessage());
+ logger.error("Error converting json to string ", jpe);
} catch (Exception e) {
- logger.debug("Error converting json to string " + e.getMessage());
+ logger.error("Error converting json to string ", e);
}
return "[Error converting json to string]";
}
@@ -413,44 +403,44 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (objectMap == null) {
return null;
}
- Map<String, String> stringMap = new HashMap<String, String>();
- for (String key : objectMap.keySet()) {
- if (!stringMap.containsKey(key)) {
- Object obj = objectMap.get(key);
+ Map<String, String> stringMap = new HashMap<>();
+ for (Map.Entry<String, Object> entry : objectMap.entrySet()) {
+ if (!stringMap.containsKey(entry.getKey())) {
+ Object obj = entry.getValue();
if (obj instanceof String) {
- stringMap.put(key, (String) objectMap.get(key));
+ stringMap.put(entry.getKey(), (String) entry.getValue());
} else if (obj instanceof JsonNode) {
// This is a bit of mess - but I think it's the least impacting
// let's convert it BACK to a string - then it will get converted back later
try {
String str = this.convertNode((JsonNode) obj);
- stringMap.put(key, str);
+ stringMap.put(entry.getKey(), str);
} catch (Exception e) {
- logger.debug("DANGER WILL ROBINSON: unable to convert value for JsonNode " + key);
+ logger.error("DANGER WILL ROBINSON: unable to convert value for JsonNode " + entry.getKey(), e);
// okay in this instance - only string values (fqdn) are expected to be needed
}
} else if (obj instanceof java.util.LinkedHashMap) {
logger.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode");
try {
String str = JSON_MAPPER.writeValueAsString(obj);
- stringMap.put(key, str);
+ stringMap.put(entry.getKey(), str);
} catch (Exception e) {
- logger.debug("DANGER WILL ROBINSON: unable to convert value for LinkedHashMap " + key);
+ logger.error(
+ "DANGER WILL ROBINSON: unable to convert value for LinkedHashMap " + entry.getKey(), e);
}
} else if (obj instanceof Integer) {
try {
String str = "" + obj;
- stringMap.put(key, str);
+ stringMap.put(entry.getKey(), str);
} catch (Exception e) {
- logger.debug("DANGER WILL ROBINSON: unable to convert value for Integer " + key);
+ logger.error("DANGER WILL ROBINSON: unable to convert value for Integer " + entry.getKey(), e);
}
} else {
try {
String str = obj.toString();
- stringMap.put(key, str);
+ stringMap.put(entry.getKey(), str);
} catch (Exception e) {
- logger.debug(
- "DANGER WILL ROBINSON: unable to convert value " + key + " (" + e.getMessage() + ")");
+ logger.error("DANGER WILL ROBINSON: unable to convert value " + entry.getKey(), e);
}
}
}
@@ -506,14 +496,12 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String volumeGroupId, String baseVfModuleId, String modelCustomizationUuid, Map<String, Object> inputs,
Boolean failIfExists, Boolean backout, Boolean enableBridge, MsoRequest msoRequest, Holder<String> vnfId,
Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback) throws VnfException {
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
// Require a model customization ID. Every VF Module definition must have one.
if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) {
logger.debug("Missing required input: modelCustomizationUuid");
String error = "Create vfModule error: Missing required input: modelCustomizationUuid";
- logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
"VF Module ModelCustomizationUuid", CLOUDIFY, ErrorCode.DataError.getValue(),
"Create VF Module: Missing required input: modelCustomizationUuid");
logger.debug(error);
@@ -576,7 +564,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid="
+ modelCustomizationUuid;
logger.debug(error);
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
"VF Module " + "ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb",
ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -589,7 +577,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
vnfResource = vfmc.getVfModule().getVnfResources();
} catch (Exception e) {
- logger.debug("unhandled exception in create VF - [Query]" + e.getMessage());
+ logger.error("unhandled exception in create VF - [Query]", e);
throw new VnfException("Exception during create VF " + e.getMessage());
}
@@ -612,7 +600,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid="
+ vnfResource.getModelUUID() + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax
+ " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion();
- logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK,
ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -624,14 +612,13 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// First, look up to see if the VF already exists.
- long subStartTime1 = System.currentTimeMillis();
try {
cloudifyDeployment = cloudifyUtils.queryDeployment(cloudSiteId, tenantId, vfModuleName);
} catch (MsoException me) {
// Failed to query the Deployment due to a cloudify exception.
String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
"Exception - queryDeployment", me);
logger.debug(error);
@@ -652,9 +639,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (failIfExists != null && failIfExists) {
String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudOwner + "/"
+ cloudSiteId + "/" + tenantId;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(),
- vfModuleName, cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment",
- ErrorCode.DataError.getValue(), "Deployment " + vfModuleName + " already exists");
+ logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
+ "Deployment " + vfModuleName + " already exists");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
cloudifyDeployment.getId());
@@ -673,8 +660,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String error = "Create VF: Deployment " + vfModuleName + " already exists and has status "
+ status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ "; please wait for it to complete, or fix manually.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
+ logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
"Deployment " + vfModuleName + " already exists");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId());
@@ -682,8 +669,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// fail - it exists and is in a FAILED state
String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in "
+ cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
+ logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
"Deployment " + vfModuleName + " already " + "exists and is in FAILED state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId());
@@ -692,8 +679,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String error = "Create VF: Deployment " + vfModuleName + " already exists and has status "
+ status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
+ logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
"Deployment " + vfModuleName + " already " + "exists and is in " + status.toString()
+ " state");
logger.debug(error);
@@ -703,8 +690,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String error = "Create VF: Deployment " + vfModuleName + " already exists with unexpected status "
+ status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
+ logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
"Deployment " + vfModuleName + " already " + "exists and is in an unknown state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId());
@@ -718,7 +705,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// If a Volume Group was provided, query its outputs for inclusion in Module input parameters
if (volumeGroupId != null) {
- long subStartTime2 = System.currentTimeMillis();
DeploymentInfo volumeDeployment = null;
try {
volumeDeployment = cloudifyUtils.queryDeployment(cloudSiteId, tenantId, volumeGroupId);
@@ -726,9 +712,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Failed to query the Volume GroupDeployment due to a cloudify exception.
String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudOwner + "/"
+ cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
- cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(volume)",
- ErrorCode.DataError.getValue(), "Exception - queryDeployment(volume)", me);
+ logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudOwner, cloudSiteId,
+ tenantId, CLOUDIFY, "queryDeployment(volume)", ErrorCode.DataError.getValue(),
+ "Exception - queryDeployment(volume)", me);
logger.debug(error);
// Convert to a generic VnfException
me.addContext("CreateVFModule(QueryVolume)");
@@ -738,9 +724,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (volumeDeployment == null || volumeDeployment.getStatus() == DeploymentStatus.NOTFOUND) {
String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in "
+ cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
- cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(volume)",
- ErrorCode.BusinessProcesssError.getValue(),
+ logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudSiteId, tenantId,
+ error, CLOUDIFY, "queryDeployment(volume)", ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Attached Volume Group DOES NOT EXIST");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -768,7 +753,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
}
if (baseVfModuleId != null) {
- long subStartTime2 = System.currentTimeMillis();
DeploymentInfo baseDeployment = null;
try {
baseDeployment = cloudifyUtils.queryDeployment(cloudSiteId, tenantId, baseVfModuleId);
@@ -776,9 +760,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Failed to query the Volume GroupDeployment due to a cloudify exception.
String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudOwner + "/"
+ cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
- cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(Base)",
- ErrorCode.DataError.getValue(), "Exception - queryDeployment(Base)", me);
+ logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(Base)", ErrorCode.DataError.getValue(),
+ "Exception - queryDeployment(Base)", me);
logger.debug(error);
// Convert to a generic VnfException
me.addContext("CreateVFModule(QueryBase)");
@@ -788,8 +772,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (baseDeployment == null || baseDeployment.getStatus() == DeploymentStatus.NOTFOUND) {
String error = "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in "
+ cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
- cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(Base)",
+ logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudSiteId,
+ tenantId, error, CLOUDIFY, "queryDeployment(Base)",
ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Base " + "Module DOES NOT EXIST");
logger.debug(error);
@@ -823,18 +807,20 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (heatTemplate == null) {
String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType
+ + ", modelCustomizationUuid=" + modelCustomizationUuid + ", vfModuleUuid=" + vf.getModelUUID()
+ ", reqType=" + requestType;
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
- vfModuleType, "OpenStack", ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
+ vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
logger.debug("Got HEAT Template from DB: {}", heatTemplate.getHeatTemplate());
}
if (heatEnvironment == null) {
- String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
- logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
- "OpenStack", ErrorCode.DataError.getValue(), error);
+ String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid="
+ + modelCustomizationUuid + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType=" + requestType;
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
+ OPENSTACK, ErrorCode.DataError.getValue(), error);
// Alarm on this error, configuration must be fixed
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -844,21 +830,21 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
try {
// All variables converted to their native object types
- HashMap<String, Object> goldenInputs = new HashMap<String, Object>();
- List<String> extraInputs = new ArrayList<String>();
+ HashMap<String, Object> goldenInputs = new HashMap<>();
+ List<String> extraInputs = new ArrayList<>();
// NOTE: SKIP THIS FOR CLOUDIFY for now. Just use what was passed in.
// This whole section needs to be rewritten.
Boolean skipInputChecks = false;
if (skipInputChecks) {
- goldenInputs = new HashMap<String, Object>();
- for (String key : inputs.keySet()) {
- goldenInputs.put(key, inputs.get(key));
+ goldenInputs = new HashMap<>();
+ for (Map.Entry<String, Object> entry : inputs.entrySet()) {
+ goldenInputs.put(entry.getKey(), entry.getValue());
}
} else {
// Build maps for the parameters (including aliases) to simplify checks
- HashMap<String, HeatTemplateParam> params = new HashMap<String, HeatTemplateParam>();
+ HashMap<String, HeatTemplateParam> params = new HashMap<>();
Set<HeatTemplateParam> paramSet = heatTemplate.getParameters();
logger.debug("paramSet has {} entries", paramSet.size());
@@ -868,7 +854,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Include aliases.
String alias = htp.getParamAlias();
- if (alias != null && !alias.equals("") && !params.containsKey(alias)) {
+ if (alias != null && !"".equals(alias) && !params.containsKey(alias)) {
params.put(alias, htp);
}
}
@@ -894,18 +880,18 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Next add in Volume Group Outputs if there are any. Copy directly without conversions.
if (volumeGroupOutputs != null && !volumeGroupOutputs.isEmpty()) {
- for (String key : volumeGroupOutputs.keySet()) {
- if (params.containsKey(key) && !goldenInputs.containsKey(key)) {
- goldenInputs.put(key, volumeGroupOutputs.get(key));
+ for (Map.Entry<String, Object> entry : volumeGroupOutputs.entrySet()) {
+ if (params.containsKey(entry.getKey()) && !goldenInputs.containsKey(entry.getKey())) {
+ goldenInputs.put(entry.getKey(), entry.getValue());
}
}
}
// Next add in Base Module Outputs if there are any. Copy directly without conversions.
if (baseModuleOutputs != null && !baseModuleOutputs.isEmpty()) {
- for (String key : baseModuleOutputs.keySet()) {
- if (params.containsKey(key) && !goldenInputs.containsKey(key)) {
- goldenInputs.put(key, baseModuleOutputs.get(key));
+ for (Map.Entry<String, Object> entry : baseModuleOutputs.entrySet()) {
+ if (params.containsKey(entry.getKey()) && !goldenInputs.containsKey(entry.getKey())) {
+ goldenInputs.put(entry.getKey(), entry.getValue());
}
}
}
@@ -949,7 +935,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
}
} catch (Exception e) {
// No problem - default is true
- logger.debug("An exception occured trying to get property {}",
+ logger.error("An exception occured trying to get property {}",
MsoVnfCloudifyAdapterImpl.CHECK_REQD_PARAMS, e);
}
@@ -969,8 +955,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (checkRequiredParameters) {
// Problem - missing one or more required parameters
String error = "Create VFModule: Missing Required inputs: " + missingParams;
- logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, CLOUDIFY,
- ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams,
+ CLOUDIFY, ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
@@ -997,7 +983,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (!cloudifyUtils.isBlueprintLoaded(cloudSiteId, blueprintId)) {
logger.debug("Blueprint " + blueprintId + " is not loaded. Will upload it now.");
- Map<String, byte[]> blueprintFiles = new HashMap<String, byte[]>();
+ Map<String, byte[]> blueprintFiles = new HashMap<>();
blueprintFiles.put(blueprintName, blueprint.getBytes());
@@ -1032,16 +1018,14 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
catch (MsoException me) {
me.addContext("CreateVFModule");
String error = "Create VF Module: Upload blueprint failed. Blueprint=" + blueprintName + ": " + me;
- logger.error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType,
- cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(),
- "MsoException - uploadBlueprint", me);
+ logger.error(LoggingAnchor.SEVEN, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
+ tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), "MsoException - uploadBlueprint", me);
logger.debug(error);
throw new VnfException(me);
}
// Ignore MsoTenantNotFound and MsoStackAlreadyExists exceptions
// because we already checked for those.
- long createDeploymentStarttime = System.currentTimeMillis();
try {
// KLUDGE - Cloudify requires Tenant Name for Openstack. We have the ID.
// Go directly to Keystone until APIs could be updated to supply the name.
@@ -1059,27 +1043,27 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
me.addContext("CreateVFModule");
String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType,
- cloudOwner, cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(),
"MsoException - createDeployment", me);
logger.debug(error);
throw new VnfException(me);
} catch (NullPointerException npe) {
String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + npe;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType,
- cloudOwner, cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(),
"NullPointerException - createDeployment", npe);
logger.debug(error);
logger.debug("NULL POINTER EXCEPTION at cloudify.createAndInstallDeployment");
// npe.addContext ("CreateVNF");
throw new VnfException("NullPointerException during cloudify.createAndInstallDeployment");
} catch (Exception e) {
- logger.debug("unhandled exception at cloudify.createAndInstallDeployment");
+ logger.error("unhandled exception at cloudify.createAndInstallDeployment", e);
throw new VnfException("Exception during cloudify.createAndInstallDeployment! " + e.getMessage());
}
} catch (Exception e) {
- logger.debug("unhandled exception in create VF");
+ logger.error("unhandled exception in create VF", e);
throw new VnfException("Exception during create VF " + e.getMessage());
}
@@ -1093,15 +1077,13 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
rollback.value = vfRollback;
- logger.debug("VF Module successfully created", vfModuleName);
- return;
+ logger.debug("VF Module successfully created {}", vfModuleName);
+
}
public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfName,
MsoRequest msoRequest, Holder<Map<String, String>> outputs) throws VnfException {
logger.debug("Deleting VF " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
// 1702 capture the output parameters on a delete
// so we'll need to query first
@@ -1113,9 +1095,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
me.addContext("DeleteVFModule");
String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId
+ "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner,
- cloudSiteId, tenantId, CLOUDIFY, "QueryDeployment", ErrorCode.DataError.getValue(),
- "Exception - QueryDeployment", me);
+ logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId,
+ CLOUDIFY, "QueryDeployment", ErrorCode.DataError.getValue(), "Exception - QueryDeployment", me);
logger.debug(error);
throw new VnfException(me);
}
@@ -1127,7 +1108,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// The possible outcomes of deleteStack are a StackInfo object with status
// of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
// could be thrown.
- long subStartTime = System.currentTimeMillis();
try {
cloudifyUtils.uninstallAndDeleteDeployment(cloudSiteId, tenantId, vnfName, 5);
} catch (MsoException me) {
@@ -1135,8 +1115,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Convert to a generic VnfException
String error =
"Delete VF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner,
- cloudSiteId, tenantId, "DeleteDeployment", "DeleteDeployment", ErrorCode.DataError.getValue(),
+ logger.error(BRACKETS, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId,
+ "DeleteDeployment", "DeleteDeployment", ErrorCode.DataError.getValue(),
"Exception - DeleteDeployment: " + me.getMessage());
logger.debug(error);
throw new VnfException(me);
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
index 7b48d0b07f..41bcc8c481 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
@@ -42,6 +42,7 @@ import java.util.Optional;
import java.util.Set;
import javax.jws.WebService;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.vdu.CloudInfo;
import org.onap.so.adapters.vdu.VduException;
import org.onap.so.adapters.vdu.VduInstance;
@@ -68,7 +69,6 @@ import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
-import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry;
@@ -91,7 +91,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Transactional
public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
- private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
private static Logger logger = LoggerFactory.getLogger(MsoVnfPluginAdapterImpl.class);
private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters";
@@ -122,16 +121,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
protected VfModuleCustomizationToVduMapper vduMapper;
/**
- * Health Check web method. Does nothing but return to show the adapter is deployed.
- */
- @Override
- public void healthCheck() {
- logger.debug("Health check call in VNF Plugin Adapter");
- }
-
- /**
* DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL.
- *
+ *
* @see MsoVnfPluginAdapterImpl#MsoVnfAdapterImpl(MsoPropertiesFactory, CloudConfigFactory)
*/
public MsoVnfPluginAdapterImpl() {
@@ -139,6 +130,14 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
/**
+ * Health Check web method. Does nothing but return to show the adapter is deployed.
+ */
+ @Override
+ public void healthCheck() {
+ logger.debug("Health check call in VNF Plugin Adapter");
+ }
+
+ /**
* This is the "Create VNF" web service implementation. This function is now unsupported and will return an error.
*
*/
@@ -188,11 +187,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
Holder<Map<String, String>> outputs) throws VnfException {
logger.debug("Querying VNF " + vnfNameOrId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
- long subStartTime = System.currentTimeMillis();
-
- VduInstance vduInstance = null;
+ VduInstance vduInstance;
CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null);
VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
@@ -205,7 +200,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
e.addContext("QueryVNF");
String error = "Query VNF (VDU): " + vnfNameOrId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ ": " + e;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudOwner,
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudOwner,
cloudSiteId, tenantId, "VDU", "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryVDU",
e);
logger.debug(error);
@@ -253,10 +248,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void rollbackVnf(VnfRollback rollback) throws VnfException {
- long startTime = System.currentTimeMillis();
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
- logger.info("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
+ logger.info(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
return;
}
@@ -280,7 +274,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Use the VduPlugin to delete the VF Module.
VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
- long subStartTime = System.currentTimeMillis();
try {
// TODO: Get a reasonable timeout. Use a global property, or store the creation timeout in rollback object
// and use that.
@@ -293,7 +286,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
ve.addContext("RollbackVFModule");
String error = "Rollback VF Module: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + ve;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner,
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner,
cloudSiteId, tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(), "Exception - DeleteVdu",
ve);
logger.debug(error);
@@ -330,14 +323,14 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String type = templateParam.getParamType();
logger.debug("Parameter: {} is of type ", templateParam.getParamName(), type);
- if (type.equalsIgnoreCase("number")) {
+ if ("number".equalsIgnoreCase(type)) {
try {
return Integer.valueOf(inputValue.toString());
} catch (Exception e) {
logger.debug("Unable to convert " + inputValue + " to an integer!", e);
return null;
}
- } else if (type.equalsIgnoreCase("json")) {
+ } else if ("json".equalsIgnoreCase(type)) {
try {
JsonNode jsonNode = JSON_MAPPER.readTree(JSON_MAPPER.writeValueAsString(inputValue));
return jsonNode;
@@ -345,8 +338,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
logger.debug("Unable to convert " + inputValue + " to a JsonNode!", e);
return null;
}
- } else if (type.equalsIgnoreCase("boolean")) {
- return new Boolean(inputValue.toString());
+ } else if ("boolean".equalsIgnoreCase(type)) {
+ return Boolean.valueOf(inputValue.toString());
}
// Nothing else matched. Return the original string
@@ -354,7 +347,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
private Map<String, String> copyStringOutputs(Map<String, Object> stackOutputs) {
- Map<String, String> stringOutputs = new HashMap<String, String>();
+ Map<String, String> stringOutputs = new HashMap<>();
for (String key : stackOutputs.keySet()) {
if (stackOutputs.get(key) instanceof String) {
stringOutputs.put(key, (String) stackOutputs.get(key));
@@ -448,7 +441,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (objectMap == null) {
return null;
}
- Map<String, String> stringMap = new HashMap<String, String>();
+ Map<String, String> stringMap = new HashMap<>();
for (String key : objectMap.keySet()) {
if (!stringMap.containsKey(key)) {
Object obj = objectMap.get(key);
@@ -541,14 +534,12 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String volumeGroupId, String baseVfModuleId, String modelCustomizationUuid, Map<String, Object> inputs,
Boolean failIfExists, Boolean backout, Boolean enableBridge, MsoRequest msoRequest, Holder<String> vnfId,
Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback) throws VnfException {
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
// Require a model customization ID. Every VF Module definition must have one.
if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) {
logger.debug("Missing required input: modelCustomizationUuid");
String error = "Create vfModule error: Missing required input: modelCustomizationUuid";
- logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
"VF Module ModelCustomizationUuid", "VDU", ErrorCode.DataError,
"Create VF Module: " + "Missing required input: modelCustomizationUuid");
logger.debug(error);
@@ -612,7 +603,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid="
+ modelCustomizationUuid;
logger.debug(error);
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
"VF Module ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb", ErrorCode.DataError,
error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -625,7 +616,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
vnfResource = vfModuleCust.getVfModule().getVnfResources();
} catch (Exception e) {
- logger.debug("unhandled exception in create VF - [Query]" + e.getMessage());
+ logger.debug("unhandled exception in create VF - [Query] {}", e.getMessage());
throw new VnfException("Exception during create VF " + e.getMessage());
}
@@ -651,7 +642,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
"VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID()
+ " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: "
+ cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion();
- logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -666,16 +657,15 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Use the VduPlugin.
VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
- long subStartTime1 = System.currentTimeMillis();
try {
vduInstance = vduPlugin.queryVdu(cloudInfo, vfModuleName);
} catch (VduException me) {
// Failed to query the VDU due to a plugin exception.
String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
- "Exception - queryVdu", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "Exception - queryVdu",
+ me);
logger.debug(error);
// Convert to a generic VnfException
me.addContext("CreateVFModule");
@@ -692,9 +682,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// fail - it exists
String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudOwner + "/"
+ cloudSiteId + "/" + tenantId;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(),
- vfModuleName, cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu",
- ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists");
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ "VF Module " + vfModuleName + " already exists");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
vduInstance.getVduInstanceId());
@@ -714,8 +704,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String error = "Create VF: Deployment " + vfModuleName + " already exists and has status "
+ status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ "; please wait for it to complete, or fix manually.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"VF Module " + vfModuleName + " already exists");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
@@ -724,8 +714,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// fail - it exists and is in a FAILED state
String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in "
+ cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"VF Module " + vfModuleName + " already exists and is in FAILED state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
@@ -735,8 +725,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String error = "Create VF: Deployment " + vfModuleName + " already exists and has status "
+ status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"VF Module " + vfModuleName + " already exists and is in " + status.toString() + " state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
@@ -746,8 +736,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String error = "Create VF: Deployment " + vfModuleName + " already exists with unexpected status "
+ status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"VF Module " + vfModuleName + " already exists and is in an unknown state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
@@ -762,16 +752,15 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// If a Volume Group was provided, query its outputs for inclusion in Module input parameters
if (volumeGroupId != null) {
- long subStartTime2 = System.currentTimeMillis();
- VduInstance volumeVdu = null;
+ VduInstance volumeVdu;
try {
volumeVdu = vduPlugin.queryVdu(cloudInfo, volumeGroupId);
} catch (VduException me) {
// Failed to query the Volume Group VDU due to a plugin exception.
String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudOwner + "/"
+ cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
- cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu(volume)", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu(volume)", ErrorCode.DataError.getValue(),
"Exception - queryVdu(volume)", me);
logger.debug(error);
// Convert to a generic VnfException
@@ -782,8 +771,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (volumeVdu == null || volumeVdu.getStatus().getState() == VduStateType.NOTFOUND) {
String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in "
+ cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
- cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)",
+ logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudOwner,
+ cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)",
ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Attached Volume Group " + "DOES NOT EXIST");
logger.debug(error);
@@ -812,15 +801,14 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
if (baseVfModuleId != null) {
- long subStartTime2 = System.currentTimeMillis();
- VduInstance baseVdu = null;
+ VduInstance baseVdu;
try {
baseVdu = vduPlugin.queryVdu(cloudInfo, baseVfModuleId);
} catch (MsoException me) {
// Failed to query the Base VF Module due to a Vdu Plugin exception.
String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudOwner + "/"
+ cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu(Base)", ErrorCode.DataError.getValue(),
"Exception - queryVdu(Base)", me);
logger.debug(error);
@@ -832,8 +820,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (baseVdu == null || baseVdu.getStatus().getState() == VduStateType.NOTFOUND) {
String error = "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudOwner
+ "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(),
- baseVfModuleId, cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)",
+ logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudOwner,
+ cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)",
ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Base Module DOES NOT EXIST");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -864,8 +852,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (heatTemplate == null) {
String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType
+ + ", modelCustomizationUuid=" + modelCustomizationUuid + ", vfModuleUuid=" + vfModule.getModelUUID()
+ ", reqType=" + requestType;
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
vfModuleType, "VNF", ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
@@ -874,8 +863,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
if (heatEnvironment == null) {
- String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
- logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
+ String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid="
+ + modelCustomizationUuid + ", vfModuleUuid=" + vfModule.getModelUUID() + ", reqType=" + requestType;
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
"OpenStack", ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -886,19 +876,19 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Create the combined set of parameters from the incoming request, base-module outputs,
// volume-module outputs. Also, convert all variables to their native object types.
- HashMap<String, Object> goldenInputs = new HashMap<String, Object>();
- List<String> extraInputs = new ArrayList<String>();
+ HashMap<String, Object> goldenInputs = new HashMap<>();
+ List<String> extraInputs = new ArrayList<>();
Boolean skipInputChecks = false;
if (skipInputChecks) {
- goldenInputs = new HashMap<String, Object>();
+ goldenInputs = new HashMap<>();
for (String key : inputs.keySet()) {
goldenInputs.put(key, inputs.get(key));
}
} else {
// Build maps for the parameters (including aliases) to simplify checks
- HashMap<String, HeatTemplateParam> params = new HashMap<String, HeatTemplateParam>();
+ HashMap<String, HeatTemplateParam> params = new HashMap<>();
Set<HeatTemplateParam> paramSet = heatTemplate.getParameters();
logger.debug("paramSet has " + paramSet.size() + " entries");
@@ -908,7 +898,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Include aliases.
String alias = htp.getParamAlias();
- if (alias != null && !alias.equals("") && !params.containsKey(alias)) {
+ if (alias != null && !"".equals(alias) && !params.containsKey(alias)) {
params.put(alias, htp);
}
}
@@ -1009,7 +999,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (checkRequiredParameters) {
// Problem - missing one or more required parameters
String error = "Create VFModule: Missing Required inputs: " + missingParams;
- logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "VDU",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "VDU",
ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -1025,7 +1015,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Here we go... ready to deploy the VF Module.
- long instantiateVduStartTime = System.currentTimeMillis();
if (backout == null)
backout = true;
@@ -1046,7 +1035,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
me.addContext("CreateVFModule");
String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
cloudSiteId, tenantId, "VDU", ErrorCode.DataError.getValue(), "MsoException - instantiateVdu", me);
logger.debug(error);
// Convert to a generic VnfException
@@ -1054,7 +1043,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
} catch (NullPointerException npe) {
String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ ": " + npe;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
cloudSiteId, tenantId, "VDU", ErrorCode.DataError.getValue(),
"NullPointerException - instantiateVdu", npe);
logger.debug(error);
@@ -1087,11 +1076,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
MsoRequest msoRequest, Holder<Map<String, String>> outputs) throws VnfException {
logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
// Capture the output parameters on a delete, so need to query first
- VduInstance vduInstance = null;
+ VduInstance vduInstance;
CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null);
// Use the VduPlugin.
@@ -1105,7 +1092,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
e.addContext("QueryVFModule");
String error = "Query VfModule (VDU): " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + e;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudOwner,
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudOwner,
cloudSiteId, tenantId, "VDU", "QueryVFModule", ErrorCode.DataError.getValue(),
"Exception - queryVDU", e);
logger.debug(error);
@@ -1122,7 +1109,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// - a vnfInstance object with status of NOTFOUND (VDU did not exist, treat as success)
// - a vnfInstance object with status of FAILED (error)
// Also, VduException could be thrown.
- long subStartTime = System.currentTimeMillis();
try {
// TODO: Get an appropriate timeout value - require access to the model
vduPlugin.deleteVdu(cloudInfo, vfModuleId, 5);
@@ -1131,7 +1117,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Convert to a generic VnfException
String error =
"Delete VF: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner,
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner,
cloudSiteId, tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(),
"Exception - DeleteVdu: " + me.getMessage());
logger.debug(error);
@@ -1165,11 +1151,11 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
CloudSite cloudSite = cloudSiteOp.get();
String orchestrator = cloudSite.getOrchestrator();
- if (orchestrator.equalsIgnoreCase("CLOUDIFY")) {
+ if ("CLOUDIFY".equalsIgnoreCase(orchestrator)) {
return cloudifyUtils;
- } else if (orchestrator.equalsIgnoreCase("HEAT")) {
+ } else if ("HEAT".equalsIgnoreCase(orchestrator)) {
return heatUtils;
- } else if (orchestrator.equalsIgnoreCase("MULTICLOUD")) {
+ } else if ("MULTICLOUD".equalsIgnoreCase(orchestrator)) {
return multicloudUtils;
} else {
// Default if cloudSite record exists - return HEAT plugin - will fail later
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
index e81b211b27..8c871c742e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
@@ -40,7 +40,9 @@ import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpStatus;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
@@ -61,6 +63,7 @@ import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -86,19 +89,10 @@ public class VnfAdapterRest {
@Autowired
private MsoVnfAdapterImpl vnfAdapter;
- // TODO Logging, SkipAAI, CREATED flags, Integrate with BPEL, Auth,
@Autowired
private Provider<BpelRestClient> bpelRestClientProvider;
-
- /*
- * URL:http://localhost:8080/vnfs/rest/v1/vnfs/<aaivnfid>/vf-modules/<aaimodid> REQUEST: {"deleteVfModuleRequest":
- * {"cloudSiteId": "DAN", "tenantId": "214b428a1f554c02935e66330f6a5409", "vnfId": "somevnfid", "vfModuleId":
- * "somemodid", "vfModuleStackId": "4e567676-e266-4594-a3a6-131c8a2baf73", "messageId": "ra.1", "notificationUrl":
- * "http://localhost:8089/vnfmock", "skipAAI": true, "msoRequest": { "requestId": "ra1", "serviceInstanceId": "sa1"
- * }} }
- */
@DELETE
@Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@@ -176,18 +170,21 @@ public class VnfAdapterRest {
@Override
public void run() {
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
String cloudsite = req.getCloudSiteId();
Holder<Map<String, String>> outputs = new Holder<>();
if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) {
- // vnfAdapter.deleteVnf (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(),
- // req.getMsoRequest());
vnfAdapter.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
req.getVfModuleStackId(), req.getMsoRequest(), outputs);
}
response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE,
req.getMessageId(), outputs.value);
} catch (VnfException e) {
- logger.error("{} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(),
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_DELETE_VNF_ERR.toString(),
ErrorCode.BusinessProcesssError.getValue(), "VnfException - Delete VNF Module", e);
eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE,
req.getMessageId());
@@ -200,13 +197,7 @@ public class VnfAdapterRest {
}
}
- /*
- * URL:http://localhost:8080/vnfs/rest/v1/vnfs/<aaiVnfId>/vf-modules/<aaiVfModuleId>?cloudSiteId=DAN&tenantId=
- * vfModule?&skipAAI=TRUE&msoRequest.requestId=ra1&msoRequest.serviceInstanceId=si1&vfModuleName=T2N2S1 RESP:
- * {"queryVfModuleResponse": { "vfModuleId": "AvfmodId", "vfModuleOutputs": {"entry": { "key":
- * "server_private_ip_1", "value": "10.100.1.25" }}, "vfModuleStackId":
- * "RaaVnf1/abfa8a6d-feb1-40af-aea3-109403b1cf6b", "vnfId": "AvnfID", "vnfStatus": "ACTIVE" }}
- */
+
@GET
@Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@@ -251,7 +242,7 @@ public class VnfAdapterRest {
logger.debug("Query vfModule exit");
return Response.status(respStatus).entity(new GenericEntity<QueryVfModuleResponse>(qryResp) {}).build();
} catch (VnfException e) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e);
VfModuleExceptionResponse excResp =
new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null);
@@ -298,7 +289,7 @@ public class VnfAdapterRest {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR, "createVfModule",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_CREATE_VNF_ERR, "createVfModule",
ErrorCode.BusinessProcesssError, "Exception - createVfModule", e);
return Response.serverError().build();
}
@@ -340,6 +331,11 @@ public class VnfAdapterRest {
public void run() {
logger.debug("CreateVfModuleTask start");
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
// Synchronous Web Service Outputs
Holder<String> vfModuleStackId = new Holder<>();
Holder<Map<String, String>> outputs = new Holder<>();
@@ -379,7 +375,7 @@ public class VnfAdapterRest {
BpelRestClient bpelClient = bpelRestClientProvider.get();
bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
}
- logger.debug("CreateVfModuleTask exit: code=" + getStatusCode() + RESP + getResponse());
+ logger.debug("CreateVfModuleTask exit: code=" + getStatusCode());
}
}
@@ -408,7 +404,7 @@ public class VnfAdapterRest {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule",
ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e);
return Response.serverError().build();
}
@@ -449,9 +445,11 @@ public class VnfAdapterRest {
@Override
public void run() {
try {
- // MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory, cloudConfigFactory);
-
- // Synchronous Web Service Outputs
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
Holder<String> vfModuleStackId = new Holder<>();
Holder<Map<String, String>> outputs = new Holder<>();
Holder<VnfRollback> vnfRollback = new Holder<>();
@@ -481,13 +479,7 @@ public class VnfAdapterRest {
}
}
- /*
- * URL:http://localhost:8080/vnfs/rest/v1/vnfs/<aaivnfid>/vf-modules/<aaimodid>/rollback REQUEST:
- * {"deleteVfModuleRequest": {"cloudSiteId": "DAN", "tenantId": "214b428a1f554c02935e66330f6a5409", "vnfId":
- * "somevnfid", "vfModuleId": "somemodid", "vfModuleStackId": "4e567676-e266-4594-a3a6-131c8a2baf73", "messageId":
- * "ra.1", "notificationUrl": "http://localhost:8089/vnfmock", "skipAAI": true, "msoRequest": { "requestId": "ra1",
- * "serviceInstanceId": "sa1" }} }
- */
+
@DELETE
@Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}/rollback")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@@ -516,7 +508,7 @@ public class VnfAdapterRest {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule",
ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e);
return Response.serverError().build();
}
@@ -557,13 +549,18 @@ public class VnfAdapterRest {
@Override
public void run() {
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getVfModuleRollback().getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
VfModuleRollback vmr = req.getVfModuleRollback();
VnfRollback vrb = new VnfRollback(vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudOwner(),
vmr.getCloudSiteId(), true, true, vmr.getMsoRequest(), null, null, null, null);
vnfAdapter.rollbackVnf(vrb);
response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId());
} catch (VnfException e) {
- logger.error("{} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR, ErrorCode.BusinessProcesssError,
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_VNF_ERR, ErrorCode.BusinessProcesssError,
"Exception" + " - " + "rollbackVfModule", e);
eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false,
req.getMessageId());
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
index 440b0dae0a..9a7354c40c 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
@@ -39,7 +39,9 @@ import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpStatus;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
@@ -60,6 +62,7 @@ import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import io.swagger.annotations.Api;
@@ -82,6 +85,7 @@ public class VnfAdapterRestV2 {
private static Logger logger = LoggerFactory.getLogger(VnfAdapterRestV2.class);
private static final String TESTING_KEYWORD = "___TESTING___";
private static final String RESP = ", resp=";
+ private static final String BRACKETS = LoggingAnchor.FOUR;
@Autowired
private VnfAdapterRestUtils vnfAdapterRestUtils;
@@ -131,10 +135,11 @@ public class VnfAdapterRestV2 {
// This is an asynchronous request
try {
Thread t1 = new Thread(task);
+ MDC.getCopyOfContextMap();
t1.start();
} catch (Exception e) {
// problem handling delete, send generic failure as sync resp to caller
- logger.error("{} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), "deleteVfModule",
+ logger.error(BRACKETS, MessageEnum.RA_DELETE_VNF_ERR.toString(), "deleteVfModule",
ErrorCode.BusinessProcesssError.getValue(), "Exception in deleteVfModule", e);
return Response.serverError().build();
}
@@ -177,8 +182,13 @@ public class VnfAdapterRestV2 {
@Override
public void run() {
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
String cloudsite = req.getCloudSiteId();
- Holder<Map<String, String>> outputs = new Holder<Map<String, String>>();
+ Holder<Map<String, String>> outputs = new Holder<>();
if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) {
// vnfAdapter.deleteVnf (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(),
// req.getMsoRequest());
@@ -190,7 +200,7 @@ public class VnfAdapterRestV2 {
response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE,
req.getMessageId(), outputs.value);
} catch (VnfException e) {
- logger.error("{} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(),
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_DELETE_VNF_ERR.toString(),
ErrorCode.BusinessProcesssError.getValue(), "VnfException - " + "Delete VNF Module", e);
eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE,
req.getMessageId());
@@ -200,6 +210,7 @@ public class VnfAdapterRestV2 {
bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
}
logger.debug("Delete vfModule exit: code=" + getStatusCode() + RESP + getResponse());
+ MDC.clear();
}
}
@@ -237,10 +248,10 @@ public class VnfAdapterRestV2 {
try {
int respStatus = HttpStatus.SC_OK;
QueryVfModuleResponse qryResp = new QueryVfModuleResponse(aaiVnfId, aaiVfModuleId, null, null, null);
- Holder<Boolean> vnfExists = new Holder<Boolean>();
- Holder<String> vfModuleId = new Holder<String>();
- Holder<VnfStatus> status = new Holder<VnfStatus>();
- Holder<Map<String, String>> outputs = new Holder<Map<String, String>>();
+ Holder<Boolean> vnfExists = new Holder<>();
+ Holder<String> vfModuleId = new Holder<>();
+ Holder<VnfStatus> status = new Holder<>();
+ Holder<Map<String, String>> outputs = new Holder<>();
// Support different Adapter Implementations
MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudSiteId);
@@ -259,7 +270,7 @@ public class VnfAdapterRestV2 {
logger.debug("Query vfModule exit");
return Response.status(respStatus).entity(new GenericEntity<QueryVfModuleResponse>(qryResp) {}).build();
} catch (VnfException e) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e);
VfModuleExceptionResponse excResp =
new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null);
@@ -308,7 +319,7 @@ public class VnfAdapterRestV2 {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), "createVfModule",
+ logger.error(BRACKETS, MessageEnum.RA_CREATE_VNF_ERR.toString(), "createVfModule",
ErrorCode.BusinessProcesssError.getValue(), "Exception - createVfModule", e);
return Response.serverError().build();
}
@@ -352,10 +363,15 @@ public class VnfAdapterRestV2 {
public void run() {
logger.debug("CreateVfModuleTask start");
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
// Synchronous Web Service Outputs
- Holder<String> vfModuleStackId = new Holder<String>();
- Holder<Map<String, String>> outputs = new Holder<Map<String, String>>();
- Holder<VnfRollback> vnfRollback = new Holder<VnfRollback>();
+ Holder<String> vfModuleStackId = new Holder<>();
+ Holder<Map<String, String>> outputs = new Holder<>();
+ Holder<VnfRollback> vnfRollback = new Holder<>();
String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
logger.debug("completeVnfVfModuleType=" + completeVnfVfModuleType);
@@ -423,7 +439,7 @@ public class VnfAdapterRestV2 {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule",
+ logger.error(BRACKETS, MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule",
ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e);
return Response.serverError().build();
}
@@ -466,12 +482,15 @@ public class VnfAdapterRestV2 {
@Override
public void run() {
try {
- // MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory, cloudConfigFactory);
-
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
// Synchronous Web Service Outputs
- Holder<String> vfModuleStackId = new Holder<String>();
- Holder<Map<String, String>> outputs = new Holder<Map<String, String>>();
- Holder<VnfRollback> vnfRollback = new Holder<VnfRollback>();
+ Holder<String> vfModuleStackId = new Holder<>();
+ Holder<Map<String, String>> outputs = new Holder<>();
+ Holder<VnfRollback> vnfRollback = new Holder<>();
String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
logger.debug("in updateVf - completeVnfVfModuleType=" + completeVnfVfModuleType);
@@ -535,7 +554,7 @@ public class VnfAdapterRestV2 {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule",
+ logger.error(BRACKETS, MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule",
ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e);
return Response.serverError().build();
}
@@ -576,6 +595,11 @@ public class VnfAdapterRestV2 {
@Override
public void run() {
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getVfModuleRollback().getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
VfModuleRollback vmr = req.getVfModuleRollback();
VnfRollback vrb = new VnfRollback(vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudOwner(),
vmr.getCloudSiteId(), true, vmr.isVfModuleCreated(), vmr.getMsoRequest(), null, null, null,
@@ -587,7 +611,7 @@ public class VnfAdapterRestV2 {
response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId());
} catch (VnfException e) {
- logger.error("{} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(),
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_VNF_ERR.toString(),
ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e);
eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false,
req.getMessageId());
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java
index c02a872a85..87df7fdc37 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java
@@ -25,11 +25,6 @@
package org.onap.so.adapters.vnf;
-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.Map;
import javax.inject.Provider;
@@ -47,6 +42,7 @@ 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.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
@@ -67,8 +63,14 @@ import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
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 VNF Volumes (http://host:port/vnfs/rest/v1/volume-groups) Both
@@ -155,6 +157,11 @@ public class VolumeAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("CreateVFModule VolumesTask start");
try {
// Synchronous Web Service Outputs
@@ -302,6 +309,11 @@ public class VolumeAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("DeleteVNFVolumesTask start");
try {
if (!req.getCloudSiteId().equals(TESTING_KEYWORD)) {
@@ -394,6 +406,11 @@ public class VolumeAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getVolumeGroupRollback().getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("DeleteVNFVolumesTask start");
try {
VolumeGroupRollback vgr = req.getVolumeGroupRollback();
@@ -487,6 +504,11 @@ public class VolumeAdapterRest {
public void run() {
logger.debug("UpdateVNFVolumesTask start");
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
Holder<Map<String, String>> outputs = new Holder<>();
Holder<VnfRollback> vnfRollback = new Holder<>();
String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
index 0ceba20051..77c9b1e2f5 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
@@ -24,11 +24,6 @@
package org.onap.so.adapters.vnf;
-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.Map;
import javax.inject.Provider;
@@ -46,6 +41,7 @@ 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.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
@@ -66,8 +62,14 @@ import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
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 VNF Volumes (http://host:port/vnfs/rest/v1/volume-groups) Both
@@ -158,6 +160,11 @@ public class VolumeAdapterRestV2 {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("CreateVFModule VolumesTask start");
try {
// Synchronous Web Service Outputs
@@ -288,6 +295,11 @@ public class VolumeAdapterRestV2 {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("DeleteVNFVolumesTask start");
String cloudSiteId = req.getCloudSiteId();
try {
@@ -383,6 +395,11 @@ public class VolumeAdapterRestV2 {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getVolumeGroupRollback().getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("RollbackVNFVolumesTask start");
try {
VolumeGroupRollback vgr = req.getVolumeGroupRollback();
@@ -480,6 +497,11 @@ public class VolumeAdapterRestV2 {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("UpdateVNFVolumesTask start");
try {
Holder<Map<String, String>> outputs = new Holder<>();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/ObjectFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/ObjectFactory.java
index ced49e2313..bb2a9059b9 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/ObjectFactory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/ObjectFactory.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,28 +36,28 @@ import javax.xml.namespace.QName;
* The Java representation of XML content can consist of schema derived interfaces and classes representing the binding
* of schema type definitions, element declarations and model groups. Factory methods for each of these are provided in
* this class.
- *
+ *
*/
@XmlRegistry
public class ObjectFactory {
private static final String URL = "http://org.onap.so/vnfNotify";
- private final static QName _QueryVnfNotification_QNAME = new QName(URL, "queryVnfNotification");
- private final static QName _RollbackVnfNotification_QNAME = new QName(URL, "rollbackVnfNotification");
- private final static QName _CreateVnfNotification_QNAME = new QName(URL, "createVnfNotification");
- private final static QName _DeleteVnfNotification_QNAME = new QName(URL, "deleteVnfNotification");
- private final static QName _UpdateVnfNotification_QNAME = new QName(URL, "updateVnfNotification");
+ private static final QName _QueryVnfNotification_QNAME = new QName(URL, "queryVnfNotification");
+ private static final QName _RollbackVnfNotification_QNAME = new QName(URL, "rollbackVnfNotification");
+ private static final QName _CreateVnfNotification_QNAME = new QName(URL, "createVnfNotification");
+ private static final QName _DeleteVnfNotification_QNAME = new QName(URL, "deleteVnfNotification");
+ private static final QName _UpdateVnfNotification_QNAME = new QName(URL, "updateVnfNotification");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package:
* org.onap.so.adapters.vnf.async.client
- *
+ *
*/
public ObjectFactory() {}
/**
* Create an instance of {@link UpdateVnfNotification }
- *
+ *
*/
public UpdateVnfNotification createUpdateVnfNotification() {
return new UpdateVnfNotification();
@@ -65,7 +65,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link UpdateVnfNotification.Outputs }
- *
+ *
*/
public UpdateVnfNotification.Outputs createUpdateVnfNotificationOutputs() {
return new UpdateVnfNotification.Outputs();
@@ -73,7 +73,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link CreateVnfNotification }
- *
+ *
*/
public CreateVnfNotification createCreateVnfNotification() {
return new CreateVnfNotification();
@@ -81,7 +81,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link CreateVnfNotification.Outputs }
- *
+ *
*/
public CreateVnfNotification.Outputs createCreateVnfNotificationOutputs() {
return new CreateVnfNotification.Outputs();
@@ -89,7 +89,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link QueryVnfNotification }
- *
+ *
*/
public QueryVnfNotification createQueryVnfNotification() {
return new QueryVnfNotification();
@@ -97,7 +97,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link QueryVnfNotification.Outputs }
- *
+ *
*/
public QueryVnfNotification.Outputs createQueryVnfNotificationOutputs() {
return new QueryVnfNotification.Outputs();
@@ -105,7 +105,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link RollbackVnfNotification }
- *
+ *
*/
public RollbackVnfNotification createRollbackVnfNotification() {
return new RollbackVnfNotification();
@@ -113,7 +113,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link DeleteVnfNotification }
- *
+ *
*/
public DeleteVnfNotification createDeleteVnfNotification() {
return new DeleteVnfNotification();
@@ -121,7 +121,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link MsoRequest }
- *
+ *
*/
public MsoRequest createMsoRequest() {
return new MsoRequest();
@@ -129,7 +129,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link VnfRollback }
- *
+ *
*/
public VnfRollback createVnfRollback() {
return new VnfRollback();
@@ -137,7 +137,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link UpdateVnfNotification.Outputs.Entry }
- *
+ *
*/
public UpdateVnfNotification.Outputs.Entry createUpdateVnfNotificationOutputsEntry() {
return new UpdateVnfNotification.Outputs.Entry();
@@ -145,7 +145,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link CreateVnfNotification.Outputs.Entry }
- *
+ *
*/
public CreateVnfNotification.Outputs.Entry createCreateVnfNotificationOutputsEntry() {
return new CreateVnfNotification.Outputs.Entry();
@@ -153,7 +153,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link QueryVnfNotification.Outputs.Entry }
- *
+ *
*/
public QueryVnfNotification.Outputs.Entry createQueryVnfNotificationOutputsEntry() {
return new QueryVnfNotification.Outputs.Entry();
@@ -161,52 +161,47 @@ public class ObjectFactory {
/**
* Create an instance of {@link JAXBElement }{@code <}{@link QueryVnfNotification }{@code >}}
- *
+ *
*/
@XmlElementDecl(namespace = URL, name = "queryVnfNotification")
public JAXBElement<QueryVnfNotification> createQueryVnfNotification(QueryVnfNotification value) {
- return new JAXBElement<QueryVnfNotification>(_QueryVnfNotification_QNAME, QueryVnfNotification.class, null,
- value);
+ return new JAXBElement<>(_QueryVnfNotification_QNAME, QueryVnfNotification.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link RollbackVnfNotification }{@code >}}
- *
+ *
*/
@XmlElementDecl(namespace = URL, name = "rollbackVnfNotification")
public JAXBElement<RollbackVnfNotification> createRollbackVnfNotification(RollbackVnfNotification value) {
- return new JAXBElement<RollbackVnfNotification>(_RollbackVnfNotification_QNAME, RollbackVnfNotification.class,
- null, value);
+ return new JAXBElement<>(_RollbackVnfNotification_QNAME, RollbackVnfNotification.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link CreateVnfNotification }{@code >}}
- *
+ *
*/
@XmlElementDecl(namespace = URL, name = "createVnfNotification")
public JAXBElement<CreateVnfNotification> createCreateVnfNotification(CreateVnfNotification value) {
- return new JAXBElement<CreateVnfNotification>(_CreateVnfNotification_QNAME, CreateVnfNotification.class, null,
- value);
+ return new JAXBElement<>(_CreateVnfNotification_QNAME, CreateVnfNotification.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link DeleteVnfNotification }{@code >}}
- *
+ *
*/
@XmlElementDecl(namespace = URL, name = "deleteVnfNotification")
public JAXBElement<DeleteVnfNotification> createDeleteVnfNotification(DeleteVnfNotification value) {
- return new JAXBElement<DeleteVnfNotification>(_DeleteVnfNotification_QNAME, DeleteVnfNotification.class, null,
- value);
+ return new JAXBElement<>(_DeleteVnfNotification_QNAME, DeleteVnfNotification.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link UpdateVnfNotification }{@code >}}
- *
+ *
*/
@XmlElementDecl(namespace = URL, name = "updateVnfNotification")
public JAXBElement<UpdateVnfNotification> createUpdateVnfNotification(UpdateVnfNotification value) {
- return new JAXBElement<UpdateVnfNotification>(_UpdateVnfNotification_QNAME, UpdateVnfNotification.class, null,
- value);
+ return new JAXBElement<>(_UpdateVnfNotification_QNAME, UpdateVnfNotification.class, null, value);
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/QueryVnfNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/QueryVnfNotification.java
index 8968851fe1..8681070972 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/QueryVnfNotification.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/QueryVnfNotification.java
@@ -310,7 +310,7 @@ public class QueryVnfNotification {
*/
public List<QueryVnfNotification.Outputs.Entry> getEntry() {
if (entry == null) {
- entry = new ArrayList<QueryVnfNotification.Outputs.Entry>();
+ entry = new ArrayList<>();
}
return this.entry;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/UpdateVnfNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/UpdateVnfNotification.java
index b738d6dc64..968b3767c3 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/UpdateVnfNotification.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/UpdateVnfNotification.java
@@ -266,7 +266,7 @@ public class UpdateVnfNotification {
*/
public List<UpdateVnfNotification.Outputs.Entry> getEntry() {
if (entry == null) {
- entry = new ArrayList<UpdateVnfNotification.Outputs.Entry>();
+ entry = new ArrayList<>();
}
return this.entry;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfAdapterNotify_Service.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfAdapterNotify_Service.java
index e1a42706a9..402d0af8e4 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfAdapterNotify_Service.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfAdapterNotify_Service.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,15 +31,16 @@ import javax.xml.ws.WebServiceFeature;
/**
* This class was generated by the JAX-WS RI. JAX-WS RI 2.2.9-b14002 Generated source version: 2.2
- *
+ *
*/
@WebServiceClient(name = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify",
wsdlLocation = "/VnfAdapterNotify.wsdl")
public class VnfAdapterNotify_Service extends Service {
- private final static URL VNFADAPTERNOTIFY_WSDL_LOCATION;
- private final static WebServiceException VNFADAPTERNOTIFY_EXCEPTION;
- private final static QName VNFADAPTERNOTIFY_QNAME = new QName("http://org.onap.so/vnfNotify", "vnfAdapterNotify");
+ private static final URL VNFADAPTERNOTIFY_WSDL_LOCATION;
+ private static final WebServiceException VNFADAPTERNOTIFY_EXCEPTION;
+ private static final String VNF_NOTIFY_URL = "http://org.onap.so/vnfNotify";
+ private static final QName VNFADAPTERNOTIFY_QNAME = new QName(VNF_NOTIFY_URL, "vnfAdapterNotify");
static {
VNFADAPTERNOTIFY_WSDL_LOCATION = org.onap.so.adapters.vnf.async.client.VnfAdapterNotify_Service.class
@@ -53,11 +54,11 @@ public class VnfAdapterNotify_Service extends Service {
}
public VnfAdapterNotify_Service() {
- super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME);
+ super(getWsdlLocation(), VNFADAPTERNOTIFY_QNAME);
}
public VnfAdapterNotify_Service(WebServiceFeature... features) {
- super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME, features);
+ super(getWsdlLocation(), VNFADAPTERNOTIFY_QNAME, features);
}
public VnfAdapterNotify_Service(URL wsdlLocation) {
@@ -77,28 +78,26 @@ public class VnfAdapterNotify_Service extends Service {
}
/**
- *
+ *
* @return returns VnfAdapterNotify
*/
@WebEndpoint(name = "MsoVnfAdapterAsyncImplPort")
public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort() {
- return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"),
- VnfAdapterNotify.class);
+ return super.getPort(new QName(VNF_NOTIFY_URL, "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class);
}
/**
- *
+ *
* @param features A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features
* not in the <code>features</code> parameter will have their default values.
* @return returns VnfAdapterNotify
*/
@WebEndpoint(name = "MsoVnfAdapterAsyncImplPort")
public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort(WebServiceFeature... features) {
- return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"),
- VnfAdapterNotify.class, features);
+ return super.getPort(new QName(VNF_NOTIFY_URL, "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class, features);
}
- private static URL __getWsdlLocation() {
+ private static URL getWsdlLocation() {
if (VNFADAPTERNOTIFY_EXCEPTION != null) {
throw VNFADAPTERNOTIFY_EXCEPTION;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
index c6fd73d9cb..aebd04f32c 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeException.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeException.java
index 9bf2ec73f4..60dfded1f8 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeException.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeException.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index a5e6a4558f..ae15b70b00 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
@@ -50,16 +70,17 @@ import org.onap.so.heatbridge.helpers.AaiHelper;
import org.onap.so.heatbridge.openstack.api.OpenstackClient;
import org.onap.so.heatbridge.openstack.factory.OpenstackClientFactoryImpl;
import org.onap.so.heatbridge.utils.HeatBridgeUtils;
-import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.ErrorCode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.so.logger.LoggingAnchor;
+import org.onap.so.logger.MessageEnum;
import org.openstack4j.model.compute.Server;
import org.openstack4j.model.heat.Resource;
import org.openstack4j.model.network.IP;
import org.openstack4j.model.network.Network;
import org.openstack4j.model.network.NetworkType;
import org.openstack4j.model.network.Port;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
@@ -323,9 +344,9 @@ public class HeatBridgeImpl implements HeatBridgeApi {
}
} catch (WebApplicationException e) {
// Silently log that we failed to update the Pserver p-interface with PCI-ID
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.GENERAL_EXCEPTION, pserverHostName,
- matchingPifName.get(), cloudOwner, tenantId, "OpenStack", "Heatbridge",
- ErrorCode.DataError.getValue(), "Exception - Failed to add sriov-pf object to pserver", e);
+ logger.error(LoggingAnchor.NINE, MessageEnum.GENERAL_EXCEPTION, pserverHostName, matchingPifName.get(),
+ cloudOwner, tenantId, "OpenStack", "Heatbridge", ErrorCode.DataError.getValue(),
+ "Exception - Failed to add sriov-pf object to pserver", e);
}
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
index dd64d53732..f2d61d2587 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
@@ -14,10 +34,6 @@ package org.onap.so.heatbridge.constants;
public class HeatBridgeConstants {
- private HeatBridgeConstants() {
- throw new IllegalStateException("Trying to instantiate a constants class.");
- }
-
/**
* Openstack related constants
*/
@@ -70,4 +86,9 @@ public class HeatBridgeConstants {
public static final String KEY_MSO_REQUEST_ID = "msoRequestId";
public static final String KEY_SO_WORKFLOW_EXCEPTION = "WorkflowException";
public static final String KEY_PROCESS_STATUS_MSG = "processStatusMsg";
+
+ private HeatBridgeConstants() {
+ throw new IllegalStateException("Trying to instantiate a constants class.");
+ }
+
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java
index edf5e2d339..018a4eac8d 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java
index bd74bf6aa0..f0c5a0b434 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
index 515f2dc0e5..137aaa9f41 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada.
*
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java
index fd5dabc784..69c76fad84 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java
index 1fa41ee2a0..7184ec1e93 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientException.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientException.java
index a062ca826d..26d92ebb80 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientException.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientException.java
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java
index 2843eb226e..5a2b0732dc 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV2ClientImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV2ClientImpl.java
index 760be72b3f..95b4cd7cfd 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV2ClientImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV2ClientImpl.java
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV3ClientImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV3ClientImpl.java
index dddd82ce6a..a0c05b4dba 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV3ClientImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV3ClientImpl.java
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactory.java
index 5019eec09b..b00f926e52 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactory.java
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java
index 25b3f1dbeb..bbcd54e6f8 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java
index 9726197172..be086677db 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
@@ -20,10 +40,6 @@ import javax.annotation.Nonnull;
public class HeatBridgeUtils {
- private HeatBridgeUtils() {
- throw new IllegalStateException("Trying to instantiate a utility class.");
- }
-
/**
* IaaS naming convention for compute/p-interface to openstack/physical-network name mapping
*/
@@ -32,6 +48,10 @@ public class HeatBridgeUtils {
private static final String COMPUTE_SIDE_SHARED_SRIOV_PREFIX = "sriov-s-";
private static final String COMPUTE_SIDE_DEDICATED_SRIOV_PREFIX = "sriov-d-";
+ private HeatBridgeUtils() {
+ throw new IllegalStateException("Trying to instantiate a utility class.");
+ }
+
public static Optional<String> getMatchingPserverPifName(@Nonnull final String physicalNetworkName) {
Preconditions.checkState(!Strings.isNullOrEmpty(physicalNetworkName),
"Physical network name is null or " + "empty!");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduStatus.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduStatus.java
index 0c4b9e01b9..66b2e52570 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduStatus.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduStatus.java
@@ -25,8 +25,14 @@ package org.onap.so.vdu.utils;
* Enum status values to capture the state of a generic (cloud-agnostic) VDU.
*/
public enum VduStatus {
- NOTFOUND, INSTANTIATING, INSTANTIATED, DELETING, DELETED, // Note - only returned in success response to deleteVdu
- // call.
- UPDATING, FAILED, UNKNOWN
+ NOTFOUND,
+ INSTANTIATING,
+ INSTANTIATED,
+ DELETING,
+ DELETED, // Note - only returned in success response to deleteVdu
+ // call.
+ UPDATING,
+ FAILED,
+ UNKNOWN
}
diff --git a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml b/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml
deleted file mode 100644
index 2ec5be7448..0000000000
--- a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml
+++ /dev/null
@@ -1,103 +0,0 @@
-# will be used as entry in DB to say SITE OFF/ON for healthcheck
-# MSO Properties go here
-org:
- onap:
- so:
- adapters:
- default_keystone_url_version: /v2.0
- default_keystone_reg_ex: "/[vV][0-9]"
- vnf:
- bpelauth: 1DDAD7A55A230BB446AA2125053EFB46455F43E48B60155E1C53236E175DFC722A6BE120F6DB390C60034C7564AEB653EA
- checkRequiredParameters: true
- addGetFilesOnVolumeReq: false
- sockettimeout: 30
- connecttimeout: 30
- retrycount: 5
- retryinterval: -15
- retrylist: 408,429,500,502,503,504,900
- network:
- bpelauth: 1DDAD7A55A230BB446AA2125053EFB46455F43E48B60155E1C53236E175DFC722A6BE120F6DB390C60034C7564AEB653EA
- sockettimeout: 5
- connecttimeout: 5
- retrycount: 5
- retryinterval: -15
- retrylist: 408,429,500,502,503,504,900
- encryptionKey: aa3871669d893c7fb8abbcda31b88b4f
- tenant:
- default_x_aic_orm_client_string: ECOMP-MSO
- default_keystone_url_version: /v2.0
- default_keystone_reg_ex: "/[vV][0-9]"
- default_tenant_description: ECOMP Tenant
- default_region_type: single
- default_user_role: admin
- default_success_status_string: Success
- default_no_regions_status_string: no regions
- default_orm_request_path: /v1/orm/customers/
- default_orm_url_replace_this: 8080
- default_orm_url_replace_with_this: 7080
- default_quota_value: 10
- set_default_quota: false
- po:
- retryCodes: 504
- retryDelay: 5
- retryCount: 3
- pollTimeout: 7500
- pollInterval: 15
-
-server-port: 8080
-ssl-enable: false
-tomcat:
- max-threads: 50
-mso:
- msoKey: 07a7159d3bf51a0e53be7a8f89699be7
- auth: 6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436
- logPath: logs
- msb-ip: localhost
- msb-port: ${wiremock.server.port}
- workflow:
- endpoint: http://bpmn-infra:8081/sobpmnengine
- topics:
- retryMultiplier: 1000
- config:
- cadi:
- aafId: test
- catalog:
- db:
- spring:
- endpoint: "http://localhost:8080"
- db:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
- site-name: localDevEnv
- async:
- core-pool-size: 50
- max-pool-size: 50
- queue-capacity: 500
-
-spring:
- security:
- usercredentials:
- -
- username: sdnc
- password: '$2a$12$mukkC6IvLikKGBdwqGnev.H0ccvV6K13TFeLvyNhJoCuNkRjWhqi6'
- role: SDNC-Client
- -
- username: sitecontrol
- password: '$2a$12$VBUF.qBmeK1FNyO2MqTpD.P2M1tvlesZlhCkAjjHvF9hmYNVdMDmu'
- role: SiteControl-Client
- -
- username: bpel
- password: '$2a$12$/GW0/AVAUooTag.7GDc9a.jW7XH3nq/.QsJJJFZJ0N24iXB2W9ksO'
- role: BPEL-Client
- -
- username: sniro
- password: '$2a$12$lbOQWS1iDmdQPxW2Mb6OiuTzGaPUrkrvoKVn2zwpFWb6n5Y86Lf1y'
- role: SNIRO-Client
- -
- username: apih
- password: '$2a$12$e1BGJ7qknMN/b7bqsQvU2OT9iGunt9IlfQclKlCs6n240oHBfcO5y'
- role: MSO-Client
- -
- username: mso_admin
- password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
- role: ACTUATOR
-
diff --git a/adapters/mso-openstack-adapters/src/main/resources/application.yaml b/adapters/mso-openstack-adapters/src/main/resources/application.yaml
index f66d77db48..ba31daaeaf 100644
--- a/adapters/mso-openstack-adapters/src/main/resources/application.yaml
+++ b/adapters/mso-openstack-adapters/src/main/resources/application.yaml
@@ -4,7 +4,7 @@
server:
port: 8080
tomcat:
- max-threads: 50
+ max-threads: 75
mso:
logPath: ./logs/openstack
@@ -19,18 +19,22 @@ mso:
retrySequence: 1, 1, 2, 3, 5, 8, 13, 20
spring:
datasource:
- url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
- username: ${DB_USERNAME}
- password: ${DB_PASSWORD}
- driver-class-name: org.mariadb.jdbc.Driver
- initialization-mode: never
+ hikari:
+ jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
+ username: ${DB_USERNAME}
+ password: ${DB_PASSWORD}
+ driver-class-name: org.mariadb.jdbc.Driver
+ pool-name: catdb-pool
+ registerMbeans: true
jpa:
- show-sql: true
+ show-sql: false
hibernate:
dialect: org.hibernate.dialect.MySQL5Dialect
- ddl-auto: validate
+ ddl-auto: none
naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
enable-lazy-load-no-trans: true
+ main:
+ allow-bean-definition-overriding: true
org:
onap:
so:
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/AllTestsTestSuite.java
index a7bddd3ada..a9365a3946 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/AllTestsTestSuite.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnf;
+package org.onap.so;
import org.junit.runner.RunWith;
import com.googlecode.junittoolbox.SuiteClasses;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java
new file mode 100644
index 0000000000..d3380a6a33
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java
@@ -0,0 +1,101 @@
+package org.onap.so.adapters.audit;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.audit.beans.AuditInventory;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.db.request.beans.RequestProcessingData;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
+import com.fasterxml.jackson.core.JsonProcessingException;
+
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class AuditDataServiceTest {
+
+ @InjectMocks
+ AuditDataService auditDataService = new AuditDataService();
+
+ @Mock
+ protected RequestsDbClient requestsDbClient;
+
+ AuditInventory auditInventory = new AuditInventory();
+
+ @Before
+ public void before() throws JsonProcessingException {
+ auditInventory.setCloudOwner("testCloudOwner");
+ auditInventory.setCloudRegion("testLcpCloudRegionId");
+ auditInventory.setHeatStackName("testVfModuleName1");
+ auditInventory.setVfModuleId("testVnfModuleId");
+ auditInventory.setTenantId("testTenantId");
+ auditInventory.setGenericVnfId("testVnfId1");
+ }
+
+ @Test
+ public void testWriteStackDataToRequestDb() throws Exception {
+ Mockito.doReturn(new ArrayList<RequestProcessingData>()).when(requestsDbClient)
+ .getRequestProcessingDataByGroupingIdAndNameAndTag(Mockito.any(), Mockito.any(), Mockito.any());
+ Mockito.doNothing().when(requestsDbClient).saveRequestProcessingData(Mockito.any());
+
+ AAIObjectAuditList auditList = new AAIObjectAuditList();
+ auditList.setHeatStackName("testHeatStackName");
+ AAIObjectAudit audit = new AAIObjectAudit();
+ Vserver vserver = new Vserver();
+ vserver.setVserverId("testVserverId");
+ audit.setAaiObject(vserver);
+ auditList.getAuditList().add(audit);
+
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
+ String auditListString = objectMapper.getMapper().writeValueAsString(auditList);;
+
+ RequestProcessingData requestProcessingData = new RequestProcessingData();
+ requestProcessingData.setSoRequestId(auditInventory.getMsoRequestId());
+ requestProcessingData.setGroupingId(auditInventory.getVfModuleId());
+ requestProcessingData.setName(auditInventory.getHeatStackName());
+ requestProcessingData.setTag("AuditStackData");
+ requestProcessingData.setValue(auditListString);
+
+ auditDataService.writeStackDataToRequestDb(auditInventory, auditList);
+ Mockito.verify(requestsDbClient, Mockito.times(1)).saveRequestProcessingData(requestProcessingData);
+ }
+
+ @Test
+ public void testGetStackDataToRequestDb() throws Exception {
+ AAIObjectAuditList auditList = new AAIObjectAuditList();
+ auditList.setHeatStackName("testHeatStackName");
+ AAIObjectAudit audit = new AAIObjectAudit();
+ Vserver vserver = new Vserver();
+ vserver.setVserverId("testVserverId");
+ audit.setAaiObject(vserver);
+ auditList.getAuditList().add(audit);
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
+ String auditListString = objectMapper.getMapper().writeValueAsString(audit);
+
+ List<RequestProcessingData> list = new ArrayList();
+ RequestProcessingData requestProcessingData = new RequestProcessingData();
+ requestProcessingData.setId(234321432);
+ requestProcessingData.setGroupingId("testVfModuleId");
+ requestProcessingData.setName("heatStackName");
+ requestProcessingData.setTag("AuditStackData");
+ requestProcessingData.setValue(auditListString);
+ list.add(requestProcessingData);
+
+ Mockito.doReturn(list).when(requestsDbClient).getRequestProcessingDataByGroupingIdAndNameAndTag(Mockito.any(),
+ Mockito.any(), Mockito.any());
+ auditDataService.getStackDataFromRequestDb(auditInventory);
+ Mockito.verify(requestsDbClient, Mockito.times(1)).getRequestProcessingDataByGroupingIdAndNameAndTag(
+ "testVnfModuleId", "testVfModuleName1", "AuditStackData");
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
index 80b2a21419..3432e4a8b6 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,8 +37,10 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.onap.so.audit.beans.AuditInventory;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.springframework.core.env.Environment;
import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -47,6 +49,9 @@ public class AuditStackServiceDataTest extends AuditCreateStackService {
@InjectMocks
private AuditCreateStackService auditStackService = new AuditCreateStackService();
+ @InjectMocks
+ private AuditQueryStackService auditQueryStackService = new AuditQueryStackService();
+
@Mock
private HeatStackAudit heatStackAuditMock;
@@ -59,6 +64,9 @@ public class AuditStackServiceDataTest extends AuditCreateStackService {
@Mock
private ExternalTaskService mockExternalTaskService;
+ @Mock
+ private AuditDataService auditDataService;
+
private ObjectMapper objectMapper = new ObjectMapper();
private AuditInventory auditInventory = new AuditInventory();
@@ -111,6 +119,20 @@ public class AuditStackServiceDataTest extends AuditCreateStackService {
}
@Test
+ public void executeExternalTaskQueryAuditTest() throws JsonProcessingException {
+ doReturn(auditListOptSuccess).when(heatStackAuditMock).queryHeatStack("cloudOwner", "cloudRegion", "tenantId",
+ "stackName");
+ Mockito.doNothing().when(auditDataService).writeStackDataToRequestDb(Mockito.any(AuditInventory.class),
+ Mockito.any(AAIObjectAuditList.class));
+ auditQueryStackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
+ ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class);
+ ArgumentCaptor<ExternalTask> taskCaptor = ArgumentCaptor.forClass(ExternalTask.class);
+ Mockito.verify(mockExternalTaskService).complete(taskCaptor.capture(), captor.capture());
+ Mockito.verify(auditDataService).writeStackDataToRequestDb(Mockito.any(AuditInventory.class),
+ Mockito.any(AAIObjectAuditList.class));
+ }
+
+ @Test
public void execute_external_task_audit_first_failure_Test() {
doReturn(auditListOptFailure).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId",
"stackName");
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java
new file mode 100644
index 0000000000..c9aef950f7
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.audit;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import org.camunda.bpm.client.ExternalTaskClient;
+import org.camunda.bpm.client.interceptor.ClientRequestInterceptor;
+import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.utils.CryptoUtils;
+import org.springframework.core.env.Environment;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AuditStackServiceTest {
+
+ @Spy
+ @InjectMocks
+ AuditStackService auditStackService;
+
+ @Mock
+ Environment mockEnvironment;
+
+
+ @Before
+ public void before() {
+ Mockito.doReturn("5").when(mockEnvironment).getProperty("workflow.topics.maxClients", "10");
+ Mockito.doReturn("6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436")
+ .when(mockEnvironment).getRequiredProperty("mso.auth");
+ Mockito.doReturn("07a7159d3bf51a0e53be7a8f89699be7").when(mockEnvironment).getRequiredProperty("mso.msoKey");
+ Mockito.doReturn("something").when(mockEnvironment).getRequiredProperty("mso.config.cadi.aafId");
+ Mockito.doReturn("host.com").when(mockEnvironment).getRequiredProperty("mso.workflow.endpoint");
+ }
+
+ @Test
+ public void testGetMaxClients() throws Exception {
+ int actual = auditStackService.getMaxClients();
+ assertEquals(5, actual);
+ }
+
+ @Test
+ public void testCreateClientRequestInterceptor() throws Exception {
+ String auth = CryptoUtils.decrypt(
+ "6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436",
+ "07a7159d3bf51a0e53be7a8f89699be7");
+ ClientRequestInterceptor expected = new BasicAuthProvider("something", auth);
+ ClientRequestInterceptor actual = auditStackService.createClientRequestInterceptor();
+ assertThat(actual, sameBeanAs(expected));
+
+ }
+
+ @Test
+ public void testCreateExternalTaskClient() throws Exception {
+ String auth = CryptoUtils.decrypt(
+ "6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436",
+ "07a7159d3bf51a0e53be7a8f89699be7");
+ ClientRequestInterceptor inter = new BasicAuthProvider("something", auth);
+ Mockito.doReturn(inter).when(auditStackService).createClientRequestInterceptor();
+ ExternalTaskClient actual = auditStackService.createExternalTaskClient();
+ assertNotNull(actual);
+ Mockito.verify(auditStackService, Mockito.times(1)).createClientRequestInterceptor();
+
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
index d43dbd99f9..3d9a128318 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,14 +33,19 @@ import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Stream;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LInterfaces;
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.aai.domain.yang.RelationshipList;
+import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
@@ -48,6 +53,8 @@ import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.skyscreamer.jsonassert.JSONAssert;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonParseException;
@@ -361,6 +368,69 @@ public class AuditVServerTest extends AuditVServer {
JSONAssert.assertEquals(expected, actualString, false);
}
+ @Test
+ public void testAuditVserversWithList() {
+
+ AAIObjectAuditList auditList = new AAIObjectAuditList();
+ AAIObjectAudit obj1 = new AAIObjectAudit();
+ Vserver vserver = new Vserver();
+ vserver.setVserverId("testVserverId");
+ obj1.setAaiObject(vserver);
+ obj1.setResourceURI(AAIUriFactory
+ .createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenantId, "testVserverId").build());
+ auditList.getAuditList().add(obj1);
+
+ doReturn(false).when(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
+ cloudRegion, tenantId, "testVserverId"));
+
+ auditNova.auditVservers(auditList);
+
+ Mockito.verify(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
+ cloudRegion, tenantId, "testVserverId"));
+
+ Assert.assertEquals(false, auditList.getAuditList().get(0).isDoesObjectExist());
+ }
+
+ @Test
+ public void testAuditVserversThroughRelationships() {
+
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("id");
+
+ AAIResultWrapper wrapper = new AAIResultWrapper(vfModule);
+
+ doReturn(wrapper).when(aaiResourcesMock)
+ .get(AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId")
+ .queryParam("vf-module-name", "vfModuleName"));
+
+ Optional<AAIObjectAuditList> auditList =
+ auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName");
+
+ Assert.assertTrue(auditList.get().getAuditList().isEmpty());
+ }
+
+ @Test
+ public void testAuditVserversThroughRelationships_exists() throws IOException {
+
+ String vfModule = getJson("vfModule.json");
+
+ AAIResultWrapper wrapper = new AAIResultWrapper(vfModule);
+ AAIResultWrapper vserverWrapper = new AAIResultWrapper(new Vserver());
+
+ doReturn(wrapper).when(aaiResourcesMock)
+ .get(AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId")
+ .queryParam("vf-module-name", "vfModuleName"));
+
+ doReturn(vserverWrapper).when(aaiResourcesMock).get(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER,
+ "cloud-owner", "cloud-region-id", "tenant-id", "VUSCHGA1"));
+
+ Optional<AAIObjectAuditList> auditList =
+ auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName");
+
+ Assert.assertFalse(auditList.get().getAuditList().isEmpty());
+ }
+
+
private String getJson(String filename) throws IOException {
return new String(Files.readAllBytes(Paths.get("src/test/resources/" + filename)));
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
index bc7ce53b8d..c995064ab2 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
@@ -43,6 +43,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.openstack.utils.MsoNeutronUtils;
import org.skyscreamer.jsonassert.JSONAssert;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java
index 0fd2bd4b7f..8226f4fed8 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java
@@ -38,12 +38,12 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-import org.onap.so.adapters.audit.AAIObjectAuditList;
import org.onap.so.audit.beans.AuditInventory;
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.objects.audit.AAIObjectAuditList;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
index c358d3f34c..8dc9d7fe5c 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.adapters.inventory.create;
import static org.mockito.Mockito.doReturn;
@@ -10,9 +30,9 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-import org.onap.so.adapters.audit.AAIObjectAudit;
-import org.onap.so.adapters.audit.AAIObjectAuditList;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import com.fasterxml.jackson.core.JsonProcessingException;
public class CreateInventoryTaskTest {
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java
index eb8912f56d..830d94cf85 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java
@@ -27,8 +27,8 @@ public class ContrailSubnetHostRoutesTest {
@Test
public void testContrailSubnetHostRoutes() {
- cshr.setHost_routes(host_routes);
- assertEquals(cshr.getHost_routes(), host_routes);
+ cshr.setHostRoutes(host_routes);
+ assertEquals(cshr.getHostRoutes(), host_routes);
assert (cshr.toString() != null);
}
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
index 4dcb7c8710..add1918748 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
@@ -20,18 +20,6 @@
package org.onap.so.adapters.network;
-import org.apache.http.HttpStatus;
-import org.junit.Test;
-import org.onap.so.adapters.vnf.BaseRestTestUtils;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.util.UriComponentsBuilder;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
import static org.junit.Assert.assertEquals;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteNeutronNetwork;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteStack_200;
@@ -52,6 +40,18 @@ import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStack;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackGet;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackPost;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.http.HttpStatus;
+import org.junit.Test;
+import org.onap.so.adapters.vnf.BaseRestTestUtils;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.util.UriComponentsBuilder;
public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@@ -142,12 +142,12 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStack_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc");
+ mockOpenStackGetStack_404(wireMockServer, "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId");
mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json");
mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json",
- "dvspg-VCE_VPE-mtjnj40avbc/stackId");
+ "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId");
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -163,7 +163,7 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json");
mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json",
- "dvspg-VCE_VPE-mtjnj40avbc");
+ "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId");
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java
index e481f0d03f..1a44934187 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java
@@ -67,7 +67,7 @@ public class TenantAdapterRestTest extends BaseRestTestUtils {
public void testCreateTenantCreated() throws JsonParseException, JsonMappingException, IOException {
CreateTenantRequest request = new CreateTenantRequest();
- String cloudSiteId = "MTN13";
+ String cloudSiteId = "mtn13";
String requestId = "62265093-277d-4388-9ba6-449838ade586";
String serviceInstanceId = "4147e06f-1b89-49c5-b21f-4faf8dc9805a";
String tenantName = "testingTenantName";
@@ -117,7 +117,7 @@ public class TenantAdapterRestTest extends BaseRestTestUtils {
public void testCreateTenantExists() throws JsonParseException, JsonMappingException, IOException {
CreateTenantRequest request = new CreateTenantRequest();
- String cloudSiteId = "MTN13";
+ String cloudSiteId = "mtn13";
String requestId = "62265093-277d-4388-9ba6-449838ade586";
String serviceInstanceId = "4147e06f-1b89-49c5-b21f-4faf8dc9805a";
String tenantName = "testingTenantName";
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
index 102d748d56..92bac7a14b 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
@@ -30,7 +30,6 @@ import java.io.IOException;
import javax.ws.rs.core.MediaType;
import org.apache.http.HttpStatus;
import org.junit.Before;
-import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.adapters.openstack.MsoOpenstackAdaptersApplication;
import org.onap.so.cloud.CloudConfig;
@@ -39,7 +38,6 @@ import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.ServerType;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
@@ -70,7 +68,6 @@ public abstract class BaseRestTestUtils {
CloudConfig cloudConfig;
@Autowired
- @Qualifier("JettisonStyle")
protected TestRestTemplate restTemplate;
protected HttpHeaders headers = new HttpHeaders();
@@ -118,9 +115,10 @@ public abstract class BaseRestTestUtils {
wireMockServer.resetAll();
mapper = new ObjectMapper();
CloudIdentity identity = new CloudIdentity();
- identity.setId("MTN13");
+ identity.setId("DEFAULT");
identity.setMsoId("m93945");
- identity.setMsoPass("93937EA01B94A10A49279D4572B48369");
+ identity.setMsoPass(
+ "89C9F27833AC49FE4164F3608CADE7BCF40357977607A7E4B899F9A046C0071C75F7347A47308EF9FB6620214264B1");
identity.setAdminTenant("admin");
identity.setMemberRole("admin");
identity.setTenantMetadata(new Boolean(true));
@@ -137,29 +135,14 @@ public abstract class BaseRestTestUtils {
identity.setIdentityServerType(ServerType.KEYSTONE);
cloudSite.setIdentityService(identity);
- wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/MTN13"))
- .willReturn(aResponse().withBody(getBody(mapper.writeValueAsString(cloudSite), wireMockPort, ""))
- .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .withStatus(HttpStatus.SC_OK)));
wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT"))
.willReturn(aResponse().withBody(getBody(mapper.writeValueAsString(cloudSite), wireMockPort, ""))
.withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
- wireMockServer.stubFor(get(urlPathEqualTo("/cloudIdentity/MTN13"))
- .willReturn(aResponse().withBody(getBody(mapper.writeValueAsString(identity), wireMockPort, ""))
- .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .withStatus(HttpStatus.SC_OK)));
- cloudConfig.getCloudSite("MTN13").get().getIdentityService()
- .setIdentityUrl("http://localhost:" + wireMockPort + cloudEndpoint);
}
protected static String getBody(String body, int port, String urlPath) throws IOException {
return body.replaceAll("port", "http://localhost:" + port + urlPath);
}
- @Test
- public void testNothing() {
-
- }
-
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
index 0c56222558..651e2c9a73 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
@@ -36,12 +36,10 @@ import java.util.Map;
import java.util.Set;
import javax.xml.ws.Holder;
import org.apache.http.HttpStatus;
-import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.mockito.MockitoAnnotations;
import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnf.exceptions.VnfNotFound;
@@ -58,7 +56,6 @@ import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import com.github.tomakehurst.wiremock.client.WireMock;
public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
@@ -92,7 +89,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.createVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "",
+ instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "",
"VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(),
new Holder<Map<String, String>>(), new Holder<VnfRollback>());
@@ -514,7 +511,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>());
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.updateVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
"b4ea86b4-253f-11e7-93ae-92361f002671", map, msoRequest, new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java
index 3e5d4ad29a..16cc2c34de 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java
@@ -62,40 +62,37 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
cloudifyManager.setPassword("93937EA01B94A10A49279D4572B48369");
}
- @Test
- public void queryVnfExceptionTest() throws Exception {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
- Holder<Map<String, String>> outputs = new Holder<>();
- instance.queryVnf("siteid", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(),
- new Holder<>(), outputs);
-
- assertTrue(outputs.value.isEmpty());
- }
-
- @Test
- public void queryVnfTest() throws Exception {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
- wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname"))
- .willReturn(aResponse().withBody("{ \"id\": \"123\" }").withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs"))
- .willReturn(aResponse().withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }")
- .withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
- .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ")
- .withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens"))
- .willReturn(aResponse().withBodyFile("OpenstackResponse_Access.json").withStatus(HttpStatus.SC_OK)));
-
- instance.queryVnf("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(),
- new Holder<>(), new Holder<>());
- }
+ /*
+ * @Test public void queryVnfExceptionTest() throws Exception { MsoRequest msoRequest = new MsoRequest();
+ * msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); Holder<Map<String, String>> outputs =
+ * new Holder<>(); instance.queryVnf("siteid", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new
+ * Holder<>(), new Holder<>(), outputs);
+ *
+ * assertTrue(outputs.value.isEmpty()); }
+ */
+
+ /*
+ * @Test public void queryVnfTest() throws Exception {
+ *
+ *
+ * MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345");
+ * msoRequest.setServiceInstanceId("12345");
+ * wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname"))
+ * .willReturn(aResponse().withBody("{ \"id\": \"123\" }").withStatus(HttpStatus.SC_OK)));
+ *
+ * wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs"))
+ * .willReturn(aResponse().withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }")
+ * .withStatus(HttpStatus.SC_OK)));
+ *
+ * wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
+ * .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ")
+ * .withStatus(HttpStatus.SC_OK)));
+ *
+ * instance.queryVnf("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(), new
+ * Holder<>(), new Holder<>());
+ *
+ * }
+ */
@Test
public void deleteVfModuleTest_ExceptionWhileQueryDeployment() throws Exception {
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
index be565deb9e..7ec8e51892 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
@@ -93,7 +93,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
MsoRequest msoRequest = getMsoRequest();
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- msoVnfPluginAdapter.createVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "",
+ msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "",
vnfName, "", "VFMOD", null, "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(),
new Holder<Map<String, String>>(), new Holder<VnfRollback>());
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
index 0787cef75d..d611322c02 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
diff --git a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml
index b9fc419a65..5ee33ab3dc 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml
+++ b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml
@@ -4,7 +4,7 @@
<cloudSiteId>mtn13</cloudSiteId>
<tenantId>bef254252c5d44e6bcec65c180180ab5</tenantId>
<networkType>CONTRAIL30_GNDIRECT</networkType>
- <networkName>dvspg-VCE_VPE-mtjnj40avbc</networkName>
+ <networkName>DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001</networkName>
<physicalNetworkName>dvs-mtjnj-01</physicalNetworkName>
<vlans>3014</vlans>
<failIfExists>false</failIfExists>
diff --git a/adapters/mso-openstack-adapters/src/test/resources/GetResources.json b/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
index 0d403a62b5..d4e84fb3c9 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
@@ -90,7 +90,7 @@
"resource_status_reason": "state changed",
"resource_type": "OS::Heat::ResourceGroup",
"updated_time": "2019-01-23T19:34:15Z"
- },
+ },
{
"links": [
{
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json
index b78f700fd9..934e075220 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json
@@ -1,11 +1,11 @@
{
"createTenantResponse": {
- "cloudSiteId": "MTN13",
+ "cloudSiteId": "mtn13",
"tenantId": "tenantId",
"tenantCreated": true,
"tenantRollback": {
"tenantId": "tenantId",
- "cloudId": "MTN13",
+ "cloudId": "mtn13",
"tenantCreated": true,
"msoRequest": {
"requestId": "62265093-277d-4388-9ba6-449838ade586",
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json
index 977aa542b3..6f81ebcd36 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json
@@ -1,10 +1,10 @@
{
"createTenantResponse": {
- "cloudSiteId": "MTN13",
+ "cloudSiteId": "mtn13",
"tenantId": "tenantId",
"tenantCreated": false,
"tenantRollback": {
- "cloudId": "MTN13",
+ "cloudId": "mtn13",
"tenantCreated": false,
"msoRequest": {
"requestId": "62265093-277d-4388-9ba6-449838ade586",
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json
index af63ca7de4..be50d09ef6 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json
@@ -1,17 +1,15 @@
{
- "stack": {
- "description": null,
- "links": null,
- "stackStatusReason": null,
- "stackName": null,
- "updatedTime": null,
- "creationTime": null,
- "stackStatus": "NOT_FOUND",
- "id": "stackId",
- "files": null,
- "outputs": null,
- "parameters": {
-
- }
- }
-} \ No newline at end of file
+ "stack": {
+ "creationTime": null,
+ "description": null,
+ "files": null,
+ "id": "stackId",
+ "links": null,
+ "outputs": null,
+ "parameters": {},
+ "stack_name": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001",
+ "stack_status": "CREATE_IN_PROGRESS",
+ "stack_status_reason": null,
+ "updatedTime": null
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json
index 29893ccb7b..e49d407766 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json
@@ -1,17 +1,15 @@
{
- "stack": {
- "description": null,
- "links": null,
- "stack_status_reason": null,
- "stack_name": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001",
- "updated_time": null,
- "creation_time": null,
- "stack_status": "CREATE_COMPLETE",
- "id": "stackId",
- "files": null,
- "outputs": null,
- "parameters": {
-
- }
- }
-} \ No newline at end of file
+ "stack": {
+ "creationTime": null,
+ "description": null,
+ "files": null,
+ "id": "stackId",
+ "links": null,
+ "outputs": null,
+ "parameters": {},
+ "stack_name": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001",
+ "stack_status": "CREATE_COMPLETE",
+ "stack_status_reason": "Create Completed",
+ "updatedTime": null
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json
index 8612258eee..bad85f37c8 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json
@@ -3,7 +3,7 @@
"description": null,
"links": null,
"stackStatusReason": null,
- "stackName": null,
+ "stackName": "stackName",
"updatedTime": null,
"creationTime": null,
"stack_status": "DELETE_COMPLETE",
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json
index f4a3c520ba..70c78a6047 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json
@@ -7,6 +7,7 @@
"rel" : "self"
}
],
- "stack_name": "vnfBaseStack"
+ "stack_name": "vnfBaseStack",
+ "stack_status": "CREATE_COMPLETE"
}
} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml
index d1a5bd9fa3..20384465a1 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml
+++ b/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml
@@ -113,3 +113,20 @@ management:
endpoint:
info:
enabled: true
+
+appc:
+ client:
+ key: iaEMAfjsVsZnraBP
+ response:
+ timeout: '120000'
+ secret: wcivUjsjXzmGFBfxMmyJu9dz
+ poolMembers: localhost
+ service: ueb
+ topic:
+ read:
+ name: APPC-TEST-AMDOCS2
+ timeout: '120000'
+ write: APPC-TEST-AMDOCS1-DEV3
+ sdnc:
+ read: SDNC-LCM-READ
+ write: SDNC-LCM-WRITE \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
index 694aedae10..7cc7697129 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
+++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
@@ -63,6 +63,8 @@ ssl-enable: false
tomcat:
max-threads: 50
mso:
+ audit:
+ lock-time: 240000
logPath: logs
msb-ip: localhost
msb-port: ${wiremock.server.port}
@@ -106,7 +108,6 @@ mariaDB4j:
port: 3308
databaseName: catalogdb
-
#Actuator
management:
endpoints:
@@ -121,3 +122,20 @@ management:
prometheus:
enabled: true # Whether exporting of metrics to Prometheus is enabled.
step: 1m # Step size (i.e. reporting frequency) to use.
+
+appc:
+ client:
+ key: iaEMAfjsVsZnraBP
+ response:
+ timeout: '120000'
+ secret: wcivUjsjXzmGFBfxMmyJu9dz
+ poolMembers: localhost
+ service: ueb
+ topic:
+ read:
+ name: APPC-TEST-AMDOCS2
+ timeout: '120000'
+ write: APPC-TEST-AMDOCS1-DEV3
+ sdnc:
+ read: SDNC-LCM-READ
+ write: SDNC-LCM-WRITE
diff --git a/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml b/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
index 5d6eee746f..8bfa6d83c3 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
+++ b/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
@@ -29,25 +29,15 @@
</appender>
- <logger name="com.att.eelf.audit" level="INFO" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="com.att.eelf.metrics" level="INFO" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
- <logger name="com.att.eelf.error" level="WARN" additivity="false">
+ <logger name="com.woorea.openstack" level="${so.log.level:-DEBUG}" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
<logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
-
- <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
+
<root level="WARN">
<appender-ref ref="STDOUT" />
diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
index dbb3469e77..9406bc445d 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql
+++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
@@ -803,6 +803,9 @@ CREATE TABLE `service` (
`WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL,
`SERVICE_CATEGORY` varchar(200) DEFAULT NULL,
`RESOURCE_ORDER` varchar(200) default NULL,
+ `OVERALL_DISTRIBUTION_STATUS` varchar(45),
+ `ONAP_GENERATED_NAMING` TINYINT(1) DEFAULT NULL,
+ `NAMING_POLICY` varchar(200) DEFAULT NULL,
PRIMARY KEY (`MODEL_UUID`),
KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`),
CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
@@ -1106,6 +1109,8 @@ CREATE TABLE `vnf_resource_customization` (
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
`SERVICE_MODEL_UUID` varchar(200) NOT NULL,
+ `NF_DATA_VALID` tinyint(1) DEFAULT '0',
+ `VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`),
KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`),
@@ -1132,6 +1137,8 @@ CREATE TABLE `vnfc_customization` (
`MODEL_NAME` varchar(200) NOT NULL,
`TOSCA_NODE_TYPE` varchar(200) NOT NULL,
`DESCRIPTION` varchar(1200) DEFAULT NULL,
+ `RESOURCE_INPUT` varchar(20000) DEFAULT NULL,
+ `VNFC_INSTANCE_GROUP_CUSTOMIZATION_ID` integer DEFAULT NULL,
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@@ -1196,6 +1203,14 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization_to_service` (
PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE TABLE IF NOT EXISTS `homing_instances` (
+`SERVICE_INSTANCE_ID` varchar(50) NOT NULL,
+`CLOUD_OWNER` VARCHAR(200) NOT NULL,
+`CLOUD_REGION_ID` VARCHAR(200) NOT NULL,
+`OOF_DIRECTIVES` longtext NULL DEFAULT NULL,
+PRIMARY KEY (`SERVICE_INSTANCE_ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
CREATE TABLE IF NOT EXISTS `workflow` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ARTIFACT_UUID` varchar(200) NOT NULL,
@@ -1226,4 +1241,134 @@ CREATE TABLE IF NOT EXISTS `vnf_resource_to_workflow` (
CONSTRAINT `fk_vnf_resource_to_workflow__workflow1` FOREIGN KEY (`WORKFLOW_ID`) REFERENCES `workflow` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE TABLE IF NOT EXISTS `activity_spec` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `NAME` VARCHAR(200) NOT NULL,
+ `DESCRIPTION` VARCHAR(1200) NOT NULL,
+ `VERSION` DOUBLE NOT NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_activity_spec` (`NAME` ASC, `VERSION` ASC))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `user_parameters` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `NAME` VARCHAR(200) NOT NULL,
+ `PAYLOAD_LOCATION` VARCHAR(500) NULL,
+ `LABEL` VARCHAR(200) NOT NULL,
+ `TYPE` VARCHAR(200) NOT NULL,
+ `DESCRIPTION` VARCHAR(1200) NULL,
+ `IS_REQUIRED` TINYINT(1) NOT NULL,
+ `MAX_LENGTH` INT(11) NULL,
+ `ALLOWABLE_CHARS` VARCHAR(200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_user_parameters` (`NAME` ASC))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `workflow_activity_spec_sequence` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `WORKFLOW_ID` INT(11) NOT NULL,
+ `ACTIVITY_SPEC_ID` INT(11) NOT NULL,
+ `SEQ_NO` INT(11) NOT NULL,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_workflow_activity_spec_sequence` (`WORKFLOW_ID` ASC, `ACTIVITY_SPEC_ID` ASC, `SEQ_NO` ASC),
+ INDEX `fk_workflow_activity_spec_sequence__activity_spec_idx` (`ACTIVITY_SPEC_ID` ASC),
+ INDEX `fk_workflow_activity_spec_sequence__workflow_actifact_uuid_idx` (`WORKFLOW_ID` ASC),
+ CONSTRAINT `fk_workflow_activity_spec_sequence__activity_spec1`
+ FOREIGN KEY (`ACTIVITY_SPEC_ID`)
+ REFERENCES `activity_spec` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT `fk_workflow_activity_spec_sequence__workflow1`
+ FOREIGN KEY (`WORKFLOW_ID`)
+ REFERENCES `workflow` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `activity_spec_parameters` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `NAME` VARCHAR(200) NOT NULL,
+ `TYPE` VARCHAR(200) NOT NULL,
+ `DIRECTION` VARCHAR(200) NULL,
+ `DESCRIPTION` VARCHAR(1200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_activity_spec_parameters` (`NAME` ASC, `DIRECTION` ASC))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+CREATE TABLE IF NOT EXISTS `activity_spec_categories` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `NAME` VARCHAR(200) NOT NULL,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_activity_spec_categories` (`NAME` ASC))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `activity_spec_to_activity_spec_categories` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `ACTIVITY_SPEC_ID` INT(11) NOT NULL,
+ `ACTIVITY_SPEC_CATEGORIES_ID` INT(11) NOT NULL,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_activity_spec_to_activity_spec_categories` (`ACTIVITY_SPEC_ID` ASC, `ACTIVITY_SPEC_CATEGORIES_ID` ASC),
+ INDEX `fk_activity_spec_to_activity_spec_categories__activity_spec_idx` (`ACTIVITY_SPEC_CATEGORIES_ID` ASC),
+ INDEX `fk_activity_spec_to_activity_spec_categories__activity_spec_idx1` (`ACTIVITY_SPEC_ID` ASC),
+ CONSTRAINT `fk_activity_spec_to_activity_spec_categories__activity_spec1`
+ FOREIGN KEY (`ACTIVITY_SPEC_ID`)
+ REFERENCES `activity_spec` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT `fk_activity_spec_to_activity_spec_categories__activity_spec_c1`
+ FOREIGN KEY (`ACTIVITY_SPEC_CATEGORIES_ID`)
+ REFERENCES `activity_spec_categories` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `activity_spec_to_activity_spec_parameters` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `ACTIVITY_SPEC_ID` INT(11) NOT NULL,
+ `ACTIVITY_SPEC_PARAMETERS_ID` INT(11) NOT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_activity_spec_to_activity_spec_params__act_sp_param_id_idx` (`ACTIVITY_SPEC_PARAMETERS_ID` ASC),
+ UNIQUE INDEX `UK_activity_spec_to_activity_spec_parameters` (`ACTIVITY_SPEC_ID` ASC, `ACTIVITY_SPEC_PARAMETERS_ID` ASC),
+ INDEX `fk_activity_spec_to_activity_spec_parameters__act_spec_id_idx` (`ACTIVITY_SPEC_ID` ASC),
+ CONSTRAINT `fk_activity_spec_to_activity_spec_parameters__activity_spec_1`
+ FOREIGN KEY (`ACTIVITY_SPEC_ID`)
+ REFERENCES `activity_spec` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT `fk_activity_spec_to_activity_spec_parameters__activ_spec_param1`
+ FOREIGN KEY (`ACTIVITY_SPEC_PARAMETERS_ID`)
+ REFERENCES `activity_spec_parameters` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `activity_spec_to_user_parameters` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `ACTIVITY_SPEC_ID` INT(11) NOT NULL,
+ `USER_PARAMETERS_ID` INT(11) NOT NULL,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_activity_spec_to_user_parameters` (`ACTIVITY_SPEC_ID` ASC, `USER_PARAMETERS_ID` ASC),
+ INDEX `fk_activity_spec_to_user_parameters__user_parameters1_idx` (`USER_PARAMETERS_ID` ASC),
+ INDEX `fk_activity_spec_to_user_parameters__activity_spec1_idx` (`ACTIVITY_SPEC_ID` ASC),
+ CONSTRAINT `fk_activity_spec_to_user_parameters__activity_spec1`
+ FOREIGN KEY (`ACTIVITY_SPEC_ID`)
+ REFERENCES `activity_spec` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT `fk_activity_spec_to_user_parameters__user_parameters1`
+ FOREIGN KEY (`USER_PARAMETERS_ID`)
+ REFERENCES `user_parameters` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
diff --git a/adapters/mso-openstack-adapters/src/test/resources/vfModule.json b/adapters/mso-openstack-adapters/src/test/resources/vfModule.json
new file mode 100644
index 0000000000..bfdca2c144
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/vfModule.json
@@ -0,0 +1,38 @@
+{
+ "vf-module-id": "a62d14f0-421e-4e64-980a-a368722819db",
+ "vf-module-name": "vig30001vm001vig001_migrated.base.module-0",
+ "is-base-vf-module": false,
+ "resource-version": "1494001780539",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "vserver",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/cloud-owner/cloud-region-id/tenants/tenant/tenant-id/vservers/vserver/VUSCHGA1",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "cloud-owner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "cloud-region-id"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "tenant-id"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "VUSCHGA1"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "VUSCHGA1"
+ }
+ ]
+ }
+ ]
+ }
+ }