summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-adapter-utils/pom.xml5
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java4
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java16
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java4
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java4
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java90
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java18
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java14
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java13
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java6
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvt.java9
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateHeatResponse.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateLinkResponse.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroups.java98
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java14
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java6
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java119
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql7
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.12__Add_Relation_VnfcCustomization.sql2
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroupsTest.java74
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcsTest.java65
-rw-r--r--adapters/mso-openstack-adapters/pom.xml4
-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.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java7
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java9
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java9
-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/CreateInventoryTask.java2
-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.java24
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java29
-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/MsoOpenstackAdaptersApplication.java1
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java14
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java119
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java94
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java31
-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/constants/HeatBridgeConstants.java9
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java8
-rw-r--r--adapters/mso-openstack-adapters/src/main/resources/application.yaml4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java1
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java1
-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.java4
-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/resources/GetResources.json2
-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.yaml18
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/schema.sql142
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.7__Add_OpenStack_Request_Information.sql13
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java25
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java17
-rw-r--r--adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml17
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java13
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml5
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml6
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml6
-rwxr-xr-xadapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java5
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java100
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java57
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java4
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java8
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java36
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java5
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java4
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java11
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/VnfmOperation.java7
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java20
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java95
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java40
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml16
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java58
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java102
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java47
93 files changed, 1371 insertions, 765 deletions
diff --git a/adapters/mso-adapter-utils/pom.xml b/adapters/mso-adapter-utils/pom.xml
index 7918072323..aa9a1cea9e 100644
--- a/adapters/mso-adapter-utils/pom.xml
+++ b/adapters/mso-adapter-utils/pom.xml
@@ -147,5 +147,10 @@
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>mso-requests-db</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
index f717144562..35c928c3b5 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
@@ -72,9 +72,7 @@ public class KeystoneV3Authentication {
OpenStackRequest<Token> v3Request = keystoneTenantClient.tokens().authenticate(v3Credentials);
- KeystoneAuthHolder holder = makeRequest(v3Request, type, region);
-
- return holder;
+ return makeRequest(v3Request, type, region);
}
protected KeystoneAuthHolder makeRequest(OpenStackRequest<Token> v3Request, String type, String region) {
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java
index 02ace5665d..072bf404e7 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java
@@ -72,22 +72,22 @@ public final class DeploymentInfoBuilder {
this.errorMessage = execution.getError();
// Compute the status based on the last workflow
- if (lastAction.equals("install")) {
- if (actionStatus.equals("terminated")) {
+ if (("install").equals(lastAction)) {
+ if (("terminated").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.INSTALLED;
- } else if (actionStatus.equals("failed")) {
+ } else if (("failed").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.FAILED;
- } else if (actionStatus.equals("started") || actionStatus.equals("pending")) {
+ } else if (("started").equals(actionStatus) || ("pending").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.INSTALLING;
} else {
this.deploymentStatus = DeploymentStatus.UNKNOWN;
}
- } else if (lastAction.equals("uninstall")) {
- if (actionStatus.equals("terminated")) {
+ } else if (("uninstall").equals(lastAction)) {
+ if (("terminated").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.CREATED;
- } else if (actionStatus.equals("failed")) {
+ } else if (("failed").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.FAILED;
- } else if (actionStatus.equals("started") || actionStatus.equals("pending")) {
+ } else if (("started").equals(actionStatus) || ("pending").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.UNINSTALLING;
} else {
this.deploymentStatus = DeploymentStatus.UNKNOWN;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java
index 5c2348dffa..2251575671 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java
@@ -38,8 +38,8 @@ public class MsoCloudifyWorkflowException extends MsoCloudifyException {
super(0, "Workflow Exception",
"Workflow " + workflowId + " failed on deployment " + deploymentId + ": " + message);
this.workflowStatus = workflowStatus;
- if (workflowStatus.equals("pending") || workflowStatus.equals("started") || workflowStatus.equals("cancelling")
- || workflowStatus.equals("force_cancelling")) {
+ if (("pending").equals(workflowStatus) || ("started").equals(workflowStatus)
+ || ("cancelling").equals(workflowStatus) || ("force_cancelling").equals(workflowStatus)) {
workflowStillRunning = true;
}
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java
index a21db78cee..723bed17f7 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java
@@ -70,7 +70,7 @@ public class MsoHeatEnvironmentEntry {
logger.debug("Exception:", e);
this.valid = false;
this.errorString = e.getMessage();
- // e.printStackTrace();
+
}
}
@@ -173,7 +173,7 @@ public class MsoHeatEnvironmentEntry {
// Basically give back the envt - but exclude the params that aren't in the HeatTemplate
StringBuilder sb = new StringBuilder();
- ArrayList<String> paramNameList = new ArrayList<String>(params.size());
+ ArrayList<String> paramNameList = new ArrayList<>(params.size());
for (HeatTemplateParam htp : params) {
paramNameList.add(htp.getParamName());
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
index b54301509f..8093f045eb 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
@@ -23,6 +23,7 @@
package org.onap.so.openstack.utils;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.woorea.openstack.base.client.OpenStackConnectException;
@@ -47,6 +48,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vdu.CloudInfo;
import org.onap.so.adapters.vdu.PluginAction;
import org.onap.so.adapters.vdu.VduArtifact;
@@ -67,6 +69,9 @@ import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.HeatTemplate;
import org.onap.so.db.catalog.beans.HeatTemplateParam;
import org.onap.so.db.catalog.beans.ServerType;
+import org.onap.so.db.request.beans.CloudApiRequests;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
@@ -82,6 +87,7 @@ import org.onap.so.openstack.mappers.StackInfoMapper;
import org.onap.so.utils.CryptoUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.core.env.Environment;
@@ -100,6 +106,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
protected static final String HEAT_ERROR = "HeatError";
protected static final String CREATE_STACK = "CreateStack";
+ public static final String FOUND = "Found: {}";
+ public static final String EXCEPTION_ROLLING_BACK_STACK =
+ "{} Create Stack: Nested exception rolling back stack: {} ";
+ public static final String IN_PROGRESS = "in_progress";
// Fetch cloud configuration each time (may be cached in CloudConfig class)
@Autowired
@@ -117,6 +127,9 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
@Autowired
private KeystoneV3Authentication keystoneV3Authentication;
+ @Autowired
+ RequestsDbClient requestDBClient;
+
private static final Logger logger = LoggerFactory.getLogger(MsoHeatUtils.class);
// Properties names and variables (with default values)
@@ -124,8 +137,8 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
private String deletePollIntervalProp = "org.onap.so.adapters.po.pollInterval";
private String deletePollTimeoutProp = "org.onap.so.adapters.po.pollTimeout";
- protected static final String createPollIntervalDefault = "15";
- private static final String deletePollIntervalDefault = "15";
+ protected static final String CREATE_POLL_INTERVAL_DEFAULT = "15";
+ private static final String DELETE_POLL_INTERVAL_DEFAULT = "15";
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
@@ -226,17 +239,18 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
// Obtain the cloud site information where we will create the stack
CloudSite cloudSite =
cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- logger.debug("Found: {}", cloudSite);
+ logger.debug(FOUND, cloudSite);
// Get a Heat client. They are cached between calls (keyed by tenantId:cloudId)
// This could throw MsoTenantNotFound or MsoOpenstackException (both propagated)
Heat heatClient = getHeatClient(cloudSite, tenantId);
- logger.debug("Found: {}", heatClient);
+ logger.debug(FOUND, heatClient);
logger.debug("Ready to Create Stack ({}) with input params: {}", heatTemplate, stackInputs);
Stack heatStack = null;
try {
OpenStackRequest<Stack> request = heatClient.getStacks().create(stack);
+ saveStackRequest(request, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID), stackName);
CloudIdentity cloudIdentity = cloudSite.getIdentityService();
request.header("X-Auth-User", cloudIdentity.getMsoId());
request.header("X-Auth-Key", CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass()));
@@ -272,11 +286,27 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
return new StackInfoMapper(heatStack).map();
}
+ private void saveStackRequest(OpenStackRequest<Stack> request, String requestId, String stackName) {
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ InfraActiveRequests foundRequest = requestDBClient.getInfraActiveRequestbyRequestId(requestId);
+ String stackRequest = mapper.writeValueAsString(request.entity());
+ CloudApiRequests cloudReq = new CloudApiRequests();
+ cloudReq.setCloudIdentifier(stackName);
+ cloudReq.setRequestBody(stackRequest);
+ cloudReq.setRequestId(requestId);
+ foundRequest.getCloudApiRequests().add(cloudReq);
+ requestDBClient.updateInfraActiveRequests(foundRequest);
+ } catch (Exception e) {
+ logger.error("Error updating in flight request with Openstack Create Request", e);
+ }
+ }
+
private Stack pollStackForCompletion(String cloudSiteId, String tenantId, String stackName, int timeoutMinutes,
boolean backout, Heat heatClient, Stack heatStack, String canonicalName)
throws MsoException, MsoOpenstackException {
int createPollInterval =
- Integer.parseInt(this.environment.getProperty(createPollIntervalProp, createPollIntervalDefault));
+ Integer.parseInt(this.environment.getProperty(createPollIntervalProp, CREATE_POLL_INTERVAL_DEFAULT));
int pollTimeout = (timeoutMinutes * 60) + createPollInterval;
int deletePollInterval = createPollInterval;
int deletePollTimeout = pollTimeout;
@@ -361,15 +391,14 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
} catch (Exception e3) {
// Just log this one. We will report the original exception.
- logger.error("{} Create Stack: Nested exception rolling back stack: {} ",
- MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(),
- e3);
+ logger.error(EXCEPTION_ROLLING_BACK_STACK, MessageEnum.RA_CREATE_STACK_ERR,
+ ErrorCode.BusinessProcesssError.getValue(), e3);
}
}
} catch (Exception e2) {
// Just log this one. We will report the original exception.
- logger.error("{} Create Stack: Nested exception rolling back stack: {} ",
- MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), e2);
+ logger.error(EXCEPTION_ROLLING_BACK_STACK, MessageEnum.RA_CREATE_STACK_ERR,
+ ErrorCode.BusinessProcesssError.getValue(), e2);
}
}
@@ -465,8 +494,8 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
}
} catch (Exception e2) {
// shouldn't happen - but handle
- logger.error("{} Create Stack: Nested exception rolling back stack: {} ",
- MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), e2);
+ logger.error(EXCEPTION_ROLLING_BACK_STACK, MessageEnum.RA_CREATE_STACK_ERR,
+ ErrorCode.BusinessProcesssError.getValue(), e2);
}
}
MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString());
@@ -494,14 +523,14 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
// Obtain the cloud site information where we will create the stack
CloudSite cloudSite =
cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- logger.debug("Found: {}", cloudSite.toString());
+ logger.debug(FOUND, cloudSite.toString());
// Get a Heat client. They are cached between calls (keyed by tenantId:cloudId)
Heat heatClient = null;
try {
heatClient = getHeatClient(cloudSite, tenantId);
if (heatClient != null) {
- logger.debug("Found: {}", heatClient.toString());
+ logger.debug(FOUND, heatClient.toString());
}
} catch (MsoTenantNotFound e) {
// Tenant doesn't exist, so stack doesn't either
@@ -553,14 +582,14 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
// Obtain the cloud site information where we will create the stack
CloudSite cloudSite =
cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- logger.debug("Found: {}", cloudSite.toString());
+ logger.debug(FOUND, cloudSite.toString());
// Get a Heat client. They are cached between calls (keyed by tenantId:cloudId)
Heat heatClient = null;
try {
heatClient = getHeatClient(cloudSite, tenantId);
if (heatClient != null) {
- logger.debug("Found: {}", heatClient.toString());
+ logger.debug(FOUND, heatClient.toString());
}
} catch (MsoTenantNotFound e) {
// Tenant doesn't exist, so stack doesn't either
@@ -621,9 +650,9 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
// Set a timeout on polling
int pollInterval = Integer
- .parseInt(this.environment.getProperty(deletePollIntervalProp, "" + deletePollIntervalDefault));
+ .parseInt(this.environment.getProperty(deletePollIntervalProp, "" + DELETE_POLL_INTERVAL_DEFAULT));
int pollTimeout = Integer
- .parseInt(this.environment.getProperty(deletePollTimeoutProp, "" + deletePollIntervalDefault));
+ .parseInt(this.environment.getProperty(deletePollTimeoutProp, "" + DELETE_POLL_INTERVAL_DEFAULT));
// When querying by canonical name, Openstack returns DELETE_COMPLETE status
// instead of "404" (which would result from query by stack name).
@@ -805,14 +834,14 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
// Obtain an MSO token for the tenant
CloudIdentity cloudIdentity = cloudSite.getIdentityService();
- logger.debug("Found: {}", cloudIdentity.toString());
+ logger.debug(FOUND, cloudIdentity.toString());
MsoTenantUtils tenantUtils =
tenantUtilsFactory.getTenantUtilsByServerType(cloudIdentity.getIdentityServerType());
String keystoneUrl = tenantUtils.getKeystoneUrl(cloudId, cloudIdentity);
logger.debug("keystoneUrl={}", keystoneUrl);
String heatUrl = null;
String tokenId = null;
- Calendar expiration = null;
+
try {
if (ServerType.KEYSTONE.equals(cloudIdentity.getIdentityServerType())) {
Keystone keystoneTenantClient = new Keystone(keystoneUrl);
@@ -849,12 +878,12 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
throw new MsoAdapterException(error, e);
}
tokenId = access.getToken().getId();
- expiration = access.getToken().getExpires();
+
} else if (ServerType.KEYSTONE_V3.equals(cloudIdentity.getIdentityServerType())) {
try {
KeystoneAuthHolder holder = keystoneV3Authentication.getToken(cloudSite, tenantId, "orchestration");
tokenId = holder.getId();
- expiration = holder.getexpiration();
+
heatUrl = holder.getServiceUrl();
} catch (ServiceEndpointNotFoundException e) {
// This comes back for not found (probably an incorrect region ID)
@@ -1027,8 +1056,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
private String convertNode(final JsonNode node) {
try {
final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
- final String json = JSON_MAPPER.writeValueAsString(obj);
- return json;
+ return JSON_MAPPER.writeValueAsString(obj);
} catch (Exception e) {
logger.debug("Error converting json to string {} ", e.getMessage(), e);
}
@@ -1321,19 +1349,19 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
* This helpful method added for Valet
*/
public String getCloudSiteKeystoneUrl(String cloudSiteId) throws MsoCloudSiteNotFound {
- String keystone_url = null;
+ String keystoneUrl = null;
try {
CloudSite cloudSite =
cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
CloudIdentity cloudIdentity = cloudSite.getIdentityService();
- keystone_url = cloudIdentity.getIdentityUrl();
+ keystoneUrl = cloudIdentity.getIdentityUrl();
} catch (Exception e) {
throw new MsoCloudSiteNotFound(cloudSiteId);
}
- if (keystone_url == null || keystone_url.isEmpty()) {
+ if (keystoneUrl == null || keystoneUrl.isEmpty()) {
throw new MsoCloudSiteNotFound(cloudSiteId);
}
- return keystone_url;
+ return keystoneUrl;
}
/*
@@ -1550,7 +1578,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
if (heatStatus == HeatStatus.INIT || heatStatus == HeatStatus.BUILDING) {
vduStatus.setState(VduStateType.INSTANTIATING);
- vduStatus.setLastAction((new PluginAction("create", "in_progress", statusMessage)));
+ vduStatus.setLastAction((new PluginAction("create", IN_PROGRESS, statusMessage)));
} else if (heatStatus == HeatStatus.NOTFOUND) {
vduStatus.setState(VduStateType.NOTFOUND);
} else if (heatStatus == HeatStatus.CREATED) {
@@ -1561,10 +1589,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
vduStatus.setLastAction((new PluginAction("update", "complete", statusMessage)));
} else if (heatStatus == HeatStatus.UPDATING) {
vduStatus.setState(VduStateType.UPDATING);
- vduStatus.setLastAction((new PluginAction("update", "in_progress", statusMessage)));
+ vduStatus.setLastAction((new PluginAction("update", IN_PROGRESS, statusMessage)));
} else if (heatStatus == HeatStatus.DELETING) {
vduStatus.setState(VduStateType.DELETING);
- vduStatus.setLastAction((new PluginAction("delete", "in_progress", statusMessage)));
+ vduStatus.setLastAction((new PluginAction("delete", IN_PROGRESS, statusMessage)));
} else if (heatStatus == HeatStatus.FAILED) {
vduStatus.setState(VduStateType.FAILED);
vduStatus.setErrorMessage(stackInfo.getStatusMessage());
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java
index 1bf780f6d3..a2e386adea 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java
@@ -60,6 +60,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
private static final Logger logger = LoggerFactory.getLogger(MsoHeatUtilsWithUpdate.class);
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
+ public static final String EXCEPTION = "Exception :";
@Autowired
private Environment environment;
@@ -221,8 +222,8 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
// Set a time limit on overall polling.
// Use the resource (template) timeout for Openstack (expressed in minutes)
// and add one poll interval to give Openstack a chance to fail on its own.
- int createPollInterval =
- Integer.parseInt(this.environment.getProperty(createPollIntervalProp, createPollIntervalDefault));
+ int createPollInterval = Integer
+ .parseInt(this.environment.getProperty(createPollIntervalProp, CREATE_POLL_INTERVAL_DEFAULT));
int pollTimeout = (timeoutMinutes * 60) + createPollInterval;
boolean loopAgain = true;
@@ -335,7 +336,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
String str = JSON_MAPPER.writeValueAsString(obj);
sb.append(str).append(" (a java.util.LinkedHashMap)");
} catch (Exception e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
sb.append("(a LinkedHashMap value that would not convert nicely)");
}
} else if (obj instanceof Integer) {
@@ -343,7 +344,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
try {
str = obj.toString() + " (an Integer)\n";
} catch (Exception e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
str = "(an Integer unable to call .toString() on)";
}
sb.append(str);
@@ -352,7 +353,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
try {
str = obj.toString() + " (an ArrayList)";
} catch (Exception e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
str = "(an ArrayList unable to call .toString() on?)";
}
sb.append(str);
@@ -361,7 +362,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
try {
str = obj.toString() + " (a Boolean)";
} catch (Exception e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
str = "(an Boolean unable to call .toString() on?)";
}
sb.append(str);
@@ -370,7 +371,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
try {
str = obj.toString() + " (unknown Object type)";
} catch (Exception e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
str = "(a value unable to call .toString() on?)";
}
sb.append(str);
@@ -384,8 +385,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
private String convertNodeWithUpdate(final JsonNode node) {
try {
final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
- final String json = JSON_MAPPER.writeValueAsString(obj);
- return json;
+ return JSON_MAPPER.writeValueAsString(obj);
} catch (Exception e) {
logger.debug("Error converting json to string {} ", e.getMessage(), e);
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
index cfc8c23c5f..ab93a6c4c6 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
@@ -58,6 +58,7 @@ import org.springframework.stereotype.Component;
@Component
public class MsoKeystoneUtils extends MsoTenantUtils {
+ public static final String DELETE_TENANT = "Delete Tenant";
private static Logger logger = LoggerFactory.getLogger(MsoKeystoneUtils.class);
@Autowired
@@ -207,7 +208,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
return null;
}
- Map<String, String> metadata = new HashMap<String, String>();
+ Map<String, String> metadata = new HashMap<>();
if (cloudSite.getIdentityService().getTenantMetadata()) {
OpenStackRequest<Metadata> request = keystoneAdminClient.tenants().showMetadata(tenant.getId());
Metadata tenantMetadata = executeAndRecordOpenstackRequest(request);
@@ -252,7 +253,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
return null;
}
- Map<String, String> metadata = new HashMap<String, String>();
+ Map<String, String> metadata = new HashMap<>();
if (cloudSite.getIdentityService().getTenantMetadata()) {
OpenStackRequest<Metadata> request = keystoneAdminClient.tenants().showMetadata(tenant.getId());
Metadata tenantMetadata = executeAndRecordOpenstackRequest(request);
@@ -304,10 +305,10 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
logger.debug("Deleted Tenant {} ({})", tenant.getId(), tenant.getName());
} catch (OpenStackBaseException e) {
// Convert Keystone OpenStackResponseException to MsoOpenstackException
- throw keystoneErrorToMsoException(e, "Delete Tenant");
+ throw keystoneErrorToMsoException(e, DELETE_TENANT);
} catch (RuntimeException e) {
// Catch-all
- throw runtimeExceptionToMsoException(e, "DeleteTenant");
+ throw runtimeExceptionToMsoException(e, DELETE_TENANT);
}
return true;
@@ -354,10 +355,10 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
} catch (OpenStackBaseException e) {
// Note: It doesn't seem to matter if tenant doesn't exist, no exception is thrown.
// Convert Keystone OpenStackResponseException to MsoOpenstackException
- throw keystoneErrorToMsoException(e, "DeleteTenant");
+ throw keystoneErrorToMsoException(e, DELETE_TENANT);
} catch (RuntimeException e) {
// Catch-all
- throw runtimeExceptionToMsoException(e, "DeleteTenant");
+ throw runtimeExceptionToMsoException(e, DELETE_TENANT);
}
return true;
@@ -379,7 +380,6 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
public Keystone getKeystoneAdminClient(CloudSite cloudSite) throws MsoException {
CloudIdentity cloudIdentity = cloudSite.getIdentityService();
- String cloudId = cloudIdentity.getId();
String adminTenantName = cloudIdentity.getAdminTenant();
String region = cloudSite.getRegionId();
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
index 4b68ddb674..1db0411f7c 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
@@ -28,9 +28,7 @@ import com.woorea.openstack.heat.model.CreateStackParam;
import com.woorea.openstack.heat.model.Stack;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.Arrays;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Scanner;
import javax.ws.rs.core.Response;
@@ -64,6 +62,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+import com.google.common.collect.ImmutableSet;
@Component
public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
@@ -75,8 +74,8 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
public static final String VF_MODULE_ID = "vf_module_id";
public static final String TEMPLATE_TYPE = "template_type";
public static final String MULTICLOUD_QUERY_BODY_NULL = "multicloudQueryBody is null";
- public static final List<String> MULTICLOUD_INPUTS =
- Arrays.asList(OOF_DIRECTIVES, SDNC_DIRECTIVES, USER_DIRECTIVES, TEMPLATE_TYPE);
+ public static final ImmutableSet<String> MULTICLOUD_INPUTS =
+ ImmutableSet.of(OOF_DIRECTIVES, SDNC_DIRECTIVES, USER_DIRECTIVES, TEMPLATE_TYPE);
private static final Logger logger = LoggerFactory.getLogger(MsoMulticloudUtils.class);
@@ -468,7 +467,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
}
int updatePollInterval =
- Integer.parseInt(this.environment.getProperty(createPollIntervalProp, createPollIntervalDefault));
+ Integer.parseInt(this.environment.getProperty(createPollIntervalProp, CREATE_POLL_INTERVAL_DEFAULT));
int pollTimeout = (timeoutMinutes * 60) + updatePollInterval;
boolean updateTimedOut = false;
logger.debug("updatePollInterval=" + updatePollInterval + ", pollTimeout=" + pollTimeout);
@@ -536,8 +535,8 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
// Use the resource (template) timeout for Openstack (expressed in minutes)
// and add one poll interval to give Openstack a chance to fail on its own.s
- int createPollInterval =
- Integer.parseInt(this.environment.getProperty(createPollIntervalProp, createPollIntervalDefault));
+ int createPollInterval = Integer
+ .parseInt(this.environment.getProperty(createPollIntervalProp, CREATE_POLL_INTERVAL_DEFAULT));
int pollTimeout = (timeoutMinutes * 60) + createPollInterval;
// New 1610 - poll on delete if we rollback - use same values for now
int deletePollInterval = createPollInterval;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
index 78db27f65e..6f08afc55f 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
@@ -373,7 +373,7 @@ public class MsoNeutronUtils extends MsoCommonUtils {
final String keystoneUrl = tenantUtils.getKeystoneUrl(cloudId, cloudIdentity);
String neutronUrl = null;
String tokenId = null;
- Calendar expiration = null;
+
try {
if (ServerType.KEYSTONE.equals(cloudIdentity.getIdentityServerType())) {
Keystone keystoneTenantClient = new Keystone(keystoneUrl);
@@ -396,12 +396,12 @@ public class MsoNeutronUtils extends MsoCommonUtils {
throw new MsoAdapterException(error, e);
}
tokenId = access.getToken().getId();
- expiration = access.getToken().getExpires();
+
} else if (ServerType.KEYSTONE_V3.equals(cloudIdentity.getIdentityServerType())) {
try {
KeystoneAuthHolder holder = keystoneV3Authentication.getToken(cloudSite, tenantId, "network");
tokenId = holder.getId();
- expiration = holder.getexpiration();
+
neutronUrl = holder.getServiceUrl();
if (!neutronUrl.endsWith("/")) {
neutronUrl += "/v2.0/";
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvt.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvt.java
index 0541a8f51b..9ee8a09ea6 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvt.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvt.java
@@ -40,6 +40,7 @@ import org.yaml.snakeyaml.Yaml;
public class MsoYamlEditorWithEnvt {
private static final Logger logger = LoggerFactory.getLogger(MsoYamlEditorWithEnvt.class);
+ public static final String EXCEPTION = "Exception:";
private Map<String, Object> yml;
private Yaml yaml = new Yaml();
@@ -68,7 +69,7 @@ public class MsoYamlEditorWithEnvt {
try {
resourceMap = (Map<String, Object>) yml.get("parameters");
} catch (Exception e) {
- logger.debug("Exception:", e);
+ logger.debug(EXCEPTION, e);
return paramSet;
}
if (resourceMap == null) {
@@ -89,7 +90,7 @@ public class MsoYamlEditorWithEnvt {
try {
value = JSON_MAPPER.writeValueAsString(obj);
} catch (Exception e) {
- logger.debug("Exception:", e);
+ logger.debug(EXCEPTION, e);
value = "_BAD_JSON_MAPPING";
}
} else {
@@ -118,7 +119,7 @@ public class MsoYamlEditorWithEnvt {
}
return resourceList;
} catch (Exception e) {
- logger.debug("Exception:", e);
+ logger.debug(EXCEPTION, e);
}
return null;
}
@@ -137,7 +138,7 @@ public class MsoYamlEditorWithEnvt {
try {
value = resourceEntry.get("default");
} catch (ClassCastException cce) {
- logger.debug("Exception:", cce);
+ logger.debug(EXCEPTION, cce);
// This exception only - the value is an integer. For what we're doing
// here - we don't care - so set value to something - and it will
// get marked as not being required - which is correct.
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateHeatResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateHeatResponse.java
index a4cdba22a1..16671bbe50 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateHeatResponse.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateHeatResponse.java
@@ -31,7 +31,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({"id", "links"})
public class MulticloudCreateHeatResponse implements Serializable {
- private final static long serialVersionUID = -5215028275577848311L;
+ private static final long serialVersionUID = -5215028275577848311L;
@JsonProperty("id")
private String id;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateLinkResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateLinkResponse.java
index e8a5b1480e..1f55aa92a2 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateLinkResponse.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateLinkResponse.java
@@ -31,7 +31,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({"href", "rel"})
public class MulticloudCreateLinkResponse implements Serializable {
- private final static long serialVersionUID = -5215028275577848311L;
+ private static final long serialVersionUID = -5215028275577848311L;
@JsonProperty("href")
private String href;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java
index bb15e58c88..fc08201bcb 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java
@@ -30,7 +30,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({"template_type", "workload_id", "template_response"})
public class MulticloudCreateResponse implements Serializable {
- private final static long serialVersionUID = -5215028275577848311L;
+ private static final long serialVersionUID = -5215028275577848311L;
@JsonProperty("template_type")
private String templateType;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java
index 67cb73539d..67d1cbff4e 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java
@@ -30,7 +30,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({"stack"})
public class MulticloudCreateStackResponse implements Serializable {
- private final static long serialVersionUID = -5215028275577848311L;
+ private static final long serialVersionUID = -5215028275577848311L;
@JsonProperty("stack")
private MulticloudCreateHeatResponse stack;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java
index a22937aea3..ad37b39f30 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java
@@ -31,7 +31,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({"template_type", "workload_id", "workload_status", "workload_status_reason"})
public class MulticloudQueryResponse implements Serializable {
- private final static long serialVersionUID = -5215028275577848311L;
+ private static final long serialVersionUID = -5215028275577848311L;
@JsonProperty("template_type")
private String templateType;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java
index b733552a2b..95dd48caa6 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java
@@ -33,7 +33,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
"vf-module-model-customization-id", "oof_directives", "sdnc_directives", "user_directives", "template_type",
"template_data"})
public class MulticloudRequest implements Serializable {
- private final static long serialVersionUID = -5215028275577848311L;
+ private static final long serialVersionUID = -5215028275577848311L;
@JsonProperty("generic-vnf-id")
private String genericVnfId;
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
index e550394931..c1acc319f7 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
@@ -104,7 +104,7 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
first = false;
- boolean arNull = o.getAllottedResource() == null ? true : false;
+ boolean arNull = o.getAllottedResource() == null;
put(valueMap, "MODEL_NAME", arNull ? null : o.getAllottedResource().getModelName());
put(valueMap, "MODEL_UUID", arNull ? null : o.getAllottedResource().getModelUUID());
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroups.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroups.java
new file mode 100644
index 0000000000..c15b0d9df1
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroups.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei 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.catalogdb.catalogrest;
+
+import org.onap.so.db.catalog.beans.InstanceGroup;
+import org.onap.so.db.catalog.beans.VFCInstanceGroup;
+import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@XmlRootElement(name = "groups")
+public class QueryGroups extends CatalogQuery {
+
+ private List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations;
+ private static final String TEMPLATE = "\n" + "\t{ \"modelInfo\" : {\n"
+ + "\t\t\"modelName\" : <MODEL_NAME>,\n" + "\t\t\"modelUuid\" : <MODEL_UUID>,\n"
+ + "\t\t\"modelInvariantUuid\" : <MODEL_INVARIANT_ID>,\n"
+ + "\t\t\"modelVersion\" : <MODEL_VERSION>\n" + "\t\t},\n" + "<_VNFCS_>\n" + "\t}";
+
+ public QueryGroups() {
+ super();
+ vnfcInstanceGroupCustomizations = new ArrayList<>();
+
+ }
+
+ public QueryGroups(List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations) {
+ this.vnfcInstanceGroupCustomizations = new ArrayList<>();
+ if (vnfcInstanceGroupCustomizations != null) {
+ for (VnfcInstanceGroupCustomization g : vnfcInstanceGroupCustomizations) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(g.toString());
+ }
+ this.vnfcInstanceGroupCustomizations.add(g);
+ }
+ }
+ }
+
+ @Override
+ public String JSON2(boolean isArray, boolean isEmbed) {
+ StringBuilder sb = new StringBuilder();
+ if (!isEmbed && isArray)
+ sb.append("{ ");
+ if (isArray)
+ sb.append("\"groups\": [");
+ Map<String, String> valueMap = new HashMap<>();
+ String sep = "";
+ boolean first = true;
+
+ for (VnfcInstanceGroupCustomization o : vnfcInstanceGroupCustomizations) {
+ if (first)
+ sb.append("\n");
+ first = false;
+
+ boolean vnfcCustomizationNull = o.getVnfcCustomizations() == null;
+ InstanceGroup instanceGroup = o.getInstanceGroup();
+
+ if (instanceGroup != null) {
+ put(valueMap, "MODEL_NAME", instanceGroup.getModelName());
+ put(valueMap, "MODEL_UUID", instanceGroup.getModelInvariantUUID());
+ put(valueMap, "MODEL_INVARIANT_ID", instanceGroup.getModelInvariantUUID());
+ put(valueMap, "MODEL_VERSION", instanceGroup.getModelUUID());
+ }
+
+ String subItem = new QueryVnfcs(vnfcCustomizationNull ? null : o.getVnfcCustomizations()).JSON2(true, true);
+ valueMap.put("_VNFCS_", subItem.replaceAll("(?m)^", "\t\t"));
+ sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
+ sep = ",\n";
+ }
+ if (!first)
+ sb.append("\n");
+ if (isArray)
+ sb.append("]");
+ if (!isEmbed && isArray)
+ sb.append("}");
+ return sb.toString();
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
index 96ea797631..5573b23a8d 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
@@ -104,7 +104,7 @@ public class QueryServiceNetworks extends CatalogQuery {
if (first)
sb.append("\n");
first = false;
- boolean nrNull = o.getNetworkResource() == null ? true : false;
+ boolean nrNull = o.getNetworkResource() == null;
put(valueMap, "MODEL_NAME", nrNull ? null : o.getNetworkResource().getModelName());
put(valueMap, "MODEL_UUID", nrNull ? null : o.getNetworkResource().getModelUUID());
put(valueMap, "MODEL_INVARIANT_ID", nrNull ? null : o.getNetworkResource().getModelInvariantUUID());
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
index b1bdeda445..e5241a4e95 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
@@ -25,8 +25,12 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
import javax.xml.bind.annotation.XmlRootElement;
+import org.onap.so.db.catalog.beans.InstanceGroup;
+import org.onap.so.db.catalog.beans.VFCInstanceGroup;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,7 +49,7 @@ public class QueryServiceVnfs extends CatalogQuery {
+ "\t\"nfFunction\" : <NF_FUNCTION>,\n" + "\t\"nfType\" : <NF_TYPE>,\n"
+ "\t\"nfRole\" : <NF_ROLE>,\n" + "\t\"nfNamingCode\" : <NF_NAMING_CODE>,\n"
+ "\t\"multiStageDesign\" : <MULTI_STEP_DESIGN>,\n"
- + "\t\"resourceInput\" : <RESOURCE_INPUT>,\n" + "<_VFMODULES_>\n" + "\t}";
+ + "\t\"resourceInput\" : <RESOURCE_INPUT>,\n" + "<_VFMODULES_>,\n" + "<_GROUPS_>\n" + "\t}";
public QueryServiceVnfs() {
super();
@@ -101,7 +105,7 @@ public class QueryServiceVnfs extends CatalogQuery {
sb.append("\n");
first = false;
- boolean vrNull = o.getVnfResources() == null ? true : false;
+ boolean vrNull = o.getVnfResources() == null;
put(valueMap, "MODEL_NAME", vrNull ? null : o.getVnfResources().getModelName());
put(valueMap, "MODEL_UUID", vrNull ? null : o.getVnfResources().getModelUUID());
@@ -120,6 +124,12 @@ public class QueryServiceVnfs extends CatalogQuery {
String subitem = new QueryVfModule(vrNull ? null : o.getVfModuleCustomizations()).JSON2(true, true);
valueMap.put("_VFMODULES_", subitem.replaceAll("(?m)^", "\t\t"));
+ List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations =
+ o.getVnfcInstanceGroupCustomizations();
+
+ String grpSubItem = new QueryGroups(vrNull ? null : vnfcInstanceGroupCustomizations).JSON2(true, true);
+ valueMap.put("_GROUPS_", grpSubItem.replaceAll("(?m)^", "\t\t"));
+
sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java
index 1dec9cecae..1604e99a72 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java
@@ -97,7 +97,7 @@ public class QueryVfModule extends CatalogQuery {
sb.append("\n");
first = false;
- boolean vfNull = o.getVfModule() == null ? true : false;
+ boolean vfNull = o.getVfModule() == null;
boolean hasVolumeGroup = false;
HeatEnvironment envt = o.getVolumeHeatEnv();
if (envt != null) {
@@ -109,10 +109,10 @@ public class QueryVfModule extends CatalogQuery {
put(valueMap, "MODEL_INVARIANT_ID", vfNull ? null : o.getVfModule().getModelInvariantUUID());
put(valueMap, "MODEL_VERSION", vfNull ? null : o.getVfModule().getModelVersion());
put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
- put(valueMap, "IS_BASE", vfNull ? false : o.getVfModule().getIsBase() ? true : false);
+ put(valueMap, "IS_BASE", !vfNull && (o.getVfModule().getIsBase()));
put(valueMap, "VF_MODULE_LABEL", o.getLabel());
put(valueMap, "INITIAL_COUNT", o.getInitialCount());
- put(valueMap, "HAS_VOLUME_GROUP", new Boolean(hasVolumeGroup));
+ put(valueMap, "HAS_VOLUME_GROUP", hasVolumeGroup);
sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java
new file mode 100644
index 0000000000..0bf82fd8b7
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java
@@ -0,0 +1,119 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei 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.catalogdb.catalogrest;
+
+import org.onap.so.db.catalog.beans.VnfcCustomization;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@XmlRootElement(name = "vnfcs")
+public class QueryVnfcs extends CatalogQuery {
+ private List<VnfcCustomization> vnfcCustomizations;
+ private static final String TEMPLATE =
+ "\t{\n" + "\t\t\"modelInfo\" : { \n" + "\t\t\t\"modelName\" : <MODEL_NAME>,\n"
+ + "\t\t\t\"modelUuid\" : <MODEL_UUID>,\n"
+ + "\t\t\t\"modelInvariantUuid\" : <MODEL_INVARIANT_ID>,\n"
+ + "\t\t\t\"modelVersion\" : <MODEL_VERSION>,\n"
+ + "\t\t\t\"modelCustomizationUuid\" : <MODEL_CUSTOMIZATION_UUID>\n" + "\t\t}" + "\t}";
+
+ public QueryVnfcs() {
+ super();
+ vnfcCustomizations = new ArrayList();
+ }
+
+ public QueryVnfcs(List<VnfcCustomization> vnfcCustomizations) {
+ this.vnfcCustomizations = new ArrayList();
+ if (vnfcCustomizations != null) {
+ for (VnfcCustomization vnfcCustomization : vnfcCustomizations) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(vnfcCustomization.toString());
+ }
+ this.vnfcCustomizations.add(vnfcCustomization);
+ }
+ }
+ }
+
+ public List<VnfcCustomization> getVnfcCustomizations() {
+ return vnfcCustomizations;
+ }
+
+ public void setVnfcCustomizations(List<VnfcCustomization> vnfcCustomizations) {
+ this.vnfcCustomizations = vnfcCustomizations;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ boolean first = true;
+ int i = 1;
+ for (VnfcCustomization o : vnfcCustomizations) {
+ sb.append(i).append("\t");
+ if (!first) {
+ sb.append("\n");
+ }
+ first = false;
+ sb.append(o);
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public String JSON2(boolean isArray, boolean isEmbed) {
+ StringBuilder sb = new StringBuilder();
+ if (!isEmbed && isArray) {
+ sb.append("{");
+ }
+
+ if (isArray) {
+ sb.append("\"vnfcs\": [");
+ }
+
+ Map<String, String> valueMap = new HashMap<>();
+ String sep = "";
+ boolean first = true;
+
+ for (VnfcCustomization o : vnfcCustomizations) {
+ if (first)
+ sb.append("\n");
+ first = false;
+
+ put(valueMap, "MODEL_NAME", o.getModelName());
+ put(valueMap, "MODEL_UUID", o.getModelUUID());
+ put(valueMap, "MODEL_INVARIANT_ID", o.getModelInvariantUUID());
+ put(valueMap, "MODEL_VERSION", o.getModelVersion());
+ put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
+
+ sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
+ sep = ",\n";
+ }
+ if (!first)
+ sb.append("\n");
+ if (isArray)
+ sb.append("]");
+ if (!isEmbed && isArray)
+ sb.append("}");
+ return sb.toString();
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql
new file mode 100644
index 0000000000..16e6ecf4bf
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql
@@ -0,0 +1,7 @@
+use catalogdb;
+
+ALTER TABLE vnf_resource_customization
+ADD VNFCINSTANCEGROUP_ORDER varchar(255);
+
+ALTER TABLE vnfc_customization
+ADD RESOURCE_INPUT varchar(2000); \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.12__Add_Relation_VnfcCustomization.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.12__Add_Relation_VnfcCustomization.sql
new file mode 100644
index 0000000000..95a2c25eb8
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.12__Add_Relation_VnfcCustomization.sql
@@ -0,0 +1,2 @@
+use catalogdb;
+ALTER TABLE vnfc_customization ADD vnfc_instance_group_customization_id INTEGER NULL; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroupsTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroupsTest.java
new file mode 100644
index 0000000000..00db6d5938
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroupsTest.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei 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.catalogdb.catalogrest;
+
+import org.assertj.core.api.Assertions;
+import org.junit.Test;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.VFCInstanceGroup;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfcCustomization;
+import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
+import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder;
+import org.onap.so.jsonpath.JsonPathUtil;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class QueryGroupsTest {
+
+ @Test
+ public void convertToJson_successful() {
+ QueryGroups queryGroups = new QueryGroups(createList());
+ String jsonResult = queryGroups.JSON2(true, false);
+
+ Assertions.assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.groups[0].modelInfo.modelName"))
+ .contains("test");
+ Assertions
+ .assertThat(
+ JsonPathUtil.getInstance().locateResult(jsonResult, "$.groups[0].vnfcs[0].modelInfo.modelName"))
+ .contains("test");
+ }
+
+ private List<VnfcInstanceGroupCustomization> createList() {
+
+ VnfcCustomization vnfcCustomization = new VnfcCustomization();
+ vnfcCustomization.setModelCustomizationUUID("test");
+ vnfcCustomization.setModelVersion("test");
+ vnfcCustomization.setModelInvariantUUID("test");
+ vnfcCustomization.setModelName("test");
+
+ VFCInstanceGroup vfcInstanceGroup = new VFCInstanceGroup();
+ vfcInstanceGroup.setModelName("test");
+ vfcInstanceGroup.setModelUUID("test");
+ vfcInstanceGroup.setModelInvariantUUID("test");
+ vfcInstanceGroup.setModelVersion("test");
+
+ VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = new VnfcInstanceGroupCustomization();
+ vnfcInstanceGroupCustomization.setVnfcCustomizations(Arrays.asList(vnfcCustomization));
+ vnfcInstanceGroupCustomization.setInstanceGroup(vfcInstanceGroup);
+
+
+ vfcInstanceGroup.setVnfcInstanceGroupCustomizations(Arrays.asList(vnfcInstanceGroupCustomization));
+ return Arrays.asList(vnfcInstanceGroupCustomization);
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcsTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcsTest.java
new file mode 100644
index 0000000000..1fd4f19e29
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcsTest.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei 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.catalogdb.catalogrest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import org.junit.Test;
+import org.onap.so.db.catalog.beans.VnfcCustomization;
+import org.onap.so.jsonpath.JsonPathUtil;
+import java.util.ArrayList;
+import java.util.List;
+
+public class QueryVnfcsTest {
+
+ @Test
+ public void convertToJson_successful() {
+ QueryVnfcs queryVnfcs = new QueryVnfcs(createList());
+ String jsonResult = queryVnfcs.JSON2(true, false);
+ System.out.println(jsonResult);
+ assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vnfcs[0].modelInfo.modelName"))
+ .contains("model1");
+ assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vnfcs[1].modelInfo.modelName"))
+ .contains("model2");
+
+ }
+
+ private List<VnfcCustomization> createList() {
+ List<VnfcCustomization> customizations = new ArrayList();
+
+ VnfcCustomization c1 = new VnfcCustomization();
+ c1.setModelName("model1");
+ c1.setModelUUID("uuid1");
+ c1.setModelInvariantUUID("inv1");
+ c1.setModelVersion("v1");
+ c1.setModelCustomizationUUID("cust1");
+
+ VnfcCustomization c2 = new VnfcCustomization();
+ c2.setModelName("model2");
+ c2.setModelUUID("uuid2");
+ c2.setModelInvariantUUID("inv2");
+ c2.setModelVersion("v2");
+ c2.setModelCustomizationUUID("cust2");
+
+ customizations.add(c1);
+ customizations.add(c2);
+ return customizations;
+ }
+}
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index 088f9499ce..d174de7e2f 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>
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..2e62beb083 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
@@ -3,6 +3,8 @@ 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;
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..77229919cd 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.
@@ -29,6 +29,7 @@ import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
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;
@@ -57,6 +58,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);
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..dcf61ed8a4 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.
@@ -27,6 +27,7 @@ import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
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;
@@ -55,9 +56,11 @@ public class AuditDeleteStackService extends AbstractAuditService {
Optional<AAIObjectAuditList> auditListOpt = heatStackAudit.auditHeatStack(auditInventory.getCloudRegion(),
auditInventory.getCloudOwner(), auditInventory.getTenantId(), auditInventory.getHeatStackName());
if (auditListOpt.isPresent()) {
+ auditListOpt.get().setAuditType("delete");
+ auditListOpt.get().setHeatStackName(auditInventory.getHeatStackName());
GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
variables.put("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditListOpt.get()));
- success = didDeleteAuditFail(auditListOpt);
+ success = !didDeleteAuditFail(auditListOpt);
}
} catch (Exception e) {
logger.error("Error during audit of stack", e);
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..e009c0e2fd 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
@@ -28,6 +28,8 @@ 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;
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..2be87ff076 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
@@ -35,6 +35,7 @@ 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.objects.audit.AAIObjectAuditList;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.openstack.utils.MsoNeutronUtils;
import org.slf4j.Logger;
@@ -54,7 +55,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;
@@ -112,10 +113,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 +146,7 @@ public class HeatStackAudit {
addSubInterfaceToVserver(vServersWithLInterface, subinterfaceStack, subinterfaceResources);
}
} else
- throw new Exception(exceptionMsg);
+ throw new Exception(EXCEPTION_MSG);
}
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/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
index 4958bbc7f2..74cf7c38c9 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
@@ -23,8 +23,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;
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..429948cef1 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
@@ -71,6 +71,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 +129,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 +213,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 +270,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
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..029da43f48 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
@@ -88,7 +88,6 @@ 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 Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class);
@@ -115,6 +114,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 +129,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
*
* @see MsoNetworkAdapterImpl#MsoNetworkAdapterImpl(MsoPropertiesFactory)
*/
- public MsoNetworkAdapterImpl() {}
@Override
public void createNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid,
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..b12d2397f9 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
@@ -86,7 +86,8 @@ 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";
@Autowired
private MsoNetworkAdapterImpl adapter;
@@ -170,7 +171,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,8 +193,8 @@ 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();
@@ -218,8 +219,8 @@ 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");
adapter.createNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
@@ -233,7 +234,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()) {
@@ -328,7 +329,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()) {
@@ -467,7 +468,7 @@ public class NetworkAdapterRest {
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());
}
@@ -573,8 +574,8 @@ 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();
@@ -598,8 +599,8 @@ 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");
@@ -614,7 +615,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/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/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
index fe11fa07b4..9236945d37 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
@@ -64,6 +64,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;
@@ -173,7 +175,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 +189,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 +206,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 +219,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;
}
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..bac41a1f8b 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.
@@ -66,7 +67,6 @@ 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.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
@@ -107,7 +107,6 @@ 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,7 +114,7 @@ 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";
@Autowired
private VFModuleCustomizationRepository vfModuleCustomRepo;
@@ -133,7 +132,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 +189,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 +251,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) {
@@ -268,7 +265,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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);
+ tenantId, OPENSTACK, "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryStack", me);
logger.debug(error);
throw new VnfException(me);
}
@@ -311,14 +308,7 @@ 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) {
@@ -328,7 +318,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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(),
+ cloudSiteId, tenantId, OPENSTACK, "DeleteVNF", ErrorCode.DataError.getValue(),
"Exception - DeleteVNF", me);
logger.debug(error);
throw new VnfException(me);
@@ -345,10 +335,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;
}
@@ -373,7 +362,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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(),
+ cloudSiteId, tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(),
"Exception - DeleteStack", me);
logger.debug(error);
throw new VnfException(me);
@@ -438,13 +427,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 +451,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 +579,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;
}
}
@@ -655,7 +643,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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(),
+ cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(),
"Exception - queryStack", me);
logger.debug(error);
// Failed to query the Stack due to an openstack exception.
@@ -674,7 +662,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
+ 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(),
+ cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(),
"Stack " + vfModuleName + " already exists");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
@@ -685,7 +673,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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(),
+ cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(),
"Stack " + vfModuleName + " already exists and is " + "in FAILED state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
@@ -697,7 +685,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
+ 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(),
+ cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(),
"Stack " + vfModuleName + " already exists and is " + "in UPDATED or UNKNOWN state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
@@ -709,7 +697,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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",
+ vfModuleName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack",
ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
@@ -741,7 +729,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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",
+ cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack",
ErrorCode.BusinessProcesssError.getValue(), "MsoException trying to query nested stack", me);
logger.debug("ERROR trying to query nested stack= {}", error);
throw new VnfException(me);
@@ -750,7 +738,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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, error, OPENSTACK, "queryStack",
ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Attached heatStack ID " + "DOES NOT EXIST");
logger.debug(error);
@@ -776,7 +764,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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",
+ cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack",
ErrorCode.BusinessProcesssError.getValue(), "MsoException trying to query nested base stack",
me);
logger.debug("ERROR trying to query nested base stack= {}", error);
@@ -786,7 +774,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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",
+ cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "QueryStack",
ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Attached base heatStack ID DOES NOT EXIST");
logger.debug("Exception occurred", error);
@@ -821,7 +809,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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",
+ "VF Module ModelCustomizationUuid", modelCustomizationUuid, OPENSTACK,
ErrorCode.DataError.getValue(),
"Create VF Module: Unable to find vfModule with " + "modelCustomizationUuid=" + mcu);
logger.debug(error);
@@ -850,7 +838,7 @@ 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");
+ OPENSTACK, ErrorCode.DataError.getValue(), "Create VNF: Unknown VNF Type");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
@@ -923,7 +911,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
+ vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:"
+ maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId
+ " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion();
- logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
+ logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK,
ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -966,7 +954,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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);
+ vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -980,7 +968,7 @@ public class MsoVnfAdapterImpl 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",
- "OpenStack", ErrorCode.DataError.getValue(), error);
+ OPENSTACK, ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -1161,7 +1149,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("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, OPENSTACK,
ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -1227,7 +1215,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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(),
+ cloudOwner, cloudSiteId, tenantId, OPENSTACK, ErrorCode.DataError.getValue(),
"MsoException - createStack", me);
logger.debug(error);
if (isValetEnabled && sendResponseToValet) {
@@ -1246,7 +1234,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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(),
+ cloudOwner, cloudSiteId, tenantId, OPENSTACK, ErrorCode.DataError.getValue(),
"NullPointerException - createStack", npe);
logger.debug(error);
logger.debug("NULL POINTER EXCEPTION at heat.createStack");
@@ -1278,7 +1266,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,7 +1278,6 @@ 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
@@ -1305,7 +1291,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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(),
+ cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(),
"Exception - QueryStack", me);
logger.debug(error);
throw new VnfException(me);
@@ -1324,11 +1310,6 @@ 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) {
@@ -1338,7 +1319,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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(),
+ cloudSiteId, tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(),
"Exception - deleteStack", me);
logger.debug(error);
if (isValetEnabled && valetDeleteRequestSucceeded) {
@@ -1474,7 +1455,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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(),
+ cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(),
"Exception - QueryStack", me);
logger.debug(error);
throw new VnfException(me);
@@ -1486,8 +1467,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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);
+ cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), error);
throw new VnfNotFound(cloudSiteId, cloudOwner, tenantId, vfModuleName);
} else {
logger.debug("Found Existing stack, status={}", heatStack.getStatus());
@@ -1511,7 +1491,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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(),
+ cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(),
"Exception - " + error, me);
logger.debug("ERROR trying to query nested stack= {}", error);
throw new VnfException(me);
@@ -1520,7 +1500,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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",
+ cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "QueryStack",
ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -1545,7 +1525,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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(),
+ cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(),
"Exception - " + error, me);
logger.debug("ERROR trying to query nested base stack= {}", error);
throw new VnfException(me);
@@ -1554,7 +1534,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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",
+ cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "QueryStack",
ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -1585,7 +1565,7 @@ 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);
+ vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
logger.debug("Got VF module definition from Catalog: {}", vf.toString());
@@ -1665,7 +1645,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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",
+ logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK,
ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -1697,7 +1677,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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);
+ vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
logger.debug("Got HEAT Template from DB: {}", heatTemplate.getHeatTemplate());
@@ -1706,7 +1686,7 @@ public class MsoVnfAdapterImpl 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",
- "OpenStack", ErrorCode.DataError.getValue(), error);
+ OPENSTACK, ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
logger.debug("Got Heat Environment from DB: {}", heatEnvironment.getEnvironment());
@@ -1913,7 +1893,7 @@ 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("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, OPENSTACK,
ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
@@ -1936,7 +1916,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
extraParams.removeAll(paramList);
if (!extraParams.isEmpty()) {
logger.warn("{} {} {} {} {} {}", MessageEnum.RA_VNF_EXTRA_PARAM.toString(), vnfType,
- extraParams.toString(), "OpenStack", ErrorCode.DataError.getValue(), "Extra params");
+ extraParams.toString(), OPENSTACK, ErrorCode.DataError.getValue(), "Extra params");
inputs.keySet().removeAll(extraParams);
}
}
@@ -2000,7 +1980,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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);
+ 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 +2015,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
outputs.value = copyStringOutputs(heatStack.getOutputs());
rollback.value = vfRollback;
- return;
}
private String getVfModuleNameFromModuleStackId(String vfModuleStackId) {
@@ -2201,13 +2180,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 {
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..d092b49d8c 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
@@ -79,15 +79,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 = "{} {} {} {} {} {} {} {} {}";
+ private static final String OPENSTACK = "OpenStack";
@Autowired
protected CloudConfig cloudConfig;
@@ -105,16 +102,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 +111,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.
*
*/
@@ -195,9 +192,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
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);
}
@@ -246,7 +242,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
long startTime = System.currentTimeMillis();
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
- logger.info("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
+ logger.info("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), OPENSTACK, "rollbackVnf");
return;
}
@@ -286,8 +282,8 @@ 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);
@@ -612,7 +608,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("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK,
ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -652,9 +648,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 +669,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 +678,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 +688,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 +699,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());
@@ -726,9 +722,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 +734,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);
@@ -776,9 +771,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 +783,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);
@@ -825,7 +820,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType
+ ", reqType=" + requestType;
logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
- vfModuleType, "OpenStack", ErrorCode.DataError.getValue(), error);
+ vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
logger.debug("Got HEAT Template from DB: {}", heatTemplate.getHeatTemplate());
@@ -834,7 +829,7 @@ public class MsoVnfCloudifyAdapterImpl 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",
- "OpenStack", ErrorCode.DataError.getValue(), error);
+ OPENSTACK, ErrorCode.DataError.getValue(), error);
// Alarm on this error, configuration must be fixed
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -1113,9 +1108,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);
}
@@ -1135,8 +1129,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..ed797f10d9 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
@@ -68,7 +68,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 +90,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 +120,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 +129,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.
*
*/
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..7c6d251263 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
@@ -82,6 +82,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 = "{} {} {} {}";
@Autowired
private VnfAdapterRestUtils vnfAdapterRestUtils;
@@ -134,7 +135,7 @@ public class VnfAdapterRestV2 {
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();
}
@@ -178,7 +179,7 @@ public class VnfAdapterRestV2 {
public void run() {
try {
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());
@@ -237,10 +238,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);
@@ -308,7 +309,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();
}
@@ -353,9 +354,9 @@ public class VnfAdapterRestV2 {
logger.debug("CreateVfModuleTask start");
try {
// 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 +424,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();
}
@@ -469,9 +470,9 @@ public class VnfAdapterRestV2 {
// MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory, cloudConfigFactory);
// 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 +536,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();
}
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/constants/HeatBridgeConstants.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
index dd64d53732..933b42e0b2 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
@@ -14,10 +14,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 +66,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/utils/HeatBridgeUtils.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java
index 9726197172..788e038855 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
@@ -20,10 +20,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 +28,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/resources/application.yaml b/adapters/mso-openstack-adapters/src/main/resources/application.yaml
index f66d77db48..1982961ae7 100644
--- a/adapters/mso-openstack-adapters/src/main/resources/application.yaml
+++ b/adapters/mso-openstack-adapters/src/main/resources/application.yaml
@@ -25,10 +25,10 @@ spring:
driver-class-name: org.mariadb.jdbc.Driver
initialization-mode: never
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
org:
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..f23486c45c 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
@@ -37,6 +37,7 @@ 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.databind.JsonMappingException;
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..2075557721 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
@@ -48,6 +48,7 @@ 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.AAIObjectAuditList;
import org.skyscreamer.jsonassert.JSONAssert;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonParseException;
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..8513f30d4b 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
@@ -10,9 +10,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/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/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..ce576f00e1 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
+++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
@@ -106,7 +106,6 @@ mariaDB4j:
port: 3308
databaseName: catalogdb
-
#Actuator
management:
endpoints:
@@ -121,3 +120,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/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
index dbb3469e77..c700e78868 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql
+++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
@@ -717,6 +717,7 @@ CREATE TABLE `northbound_request_ref_lookup` (
`MAX_API_VERSION` double DEFAULT NULL,
`IS_TOPLEVELFLOW` tinyint(1) DEFAULT NULL,
`CLOUD_OWNER` varchar(200) NOT NULL,
+ `service_type` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_northbound_request_ref_lookup` (`MIN_API_VERSION`,`REQUEST_SCOPE`,`ACTION`,`IS_ALACARTE`,`MACRO_ACTION`,`CLOUD_OWNER`)
) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=latin1;
@@ -1106,6 +1107,7 @@ 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,
+ `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 +1134,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 +1200,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 +1238,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-requests-db-adapter/src/main/resources/db/migration/V5.7__Add_OpenStack_Request_Information.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.7__Add_OpenStack_Request_Information.sql
new file mode 100644
index 0000000000..5635a1eb80
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.7__Add_OpenStack_Request_Information.sql
@@ -0,0 +1,13 @@
+use requestdb;
+
+CREATE TABLE IF NOT EXISTS cloud_api_requests(
+`ID` INT(13) NOT NULL AUTO_INCREMENT,
+`REQUEST_BODY` LONGTEXT NOT NULL,
+`CLOUD_IDENTIFIER` VARCHAR(200) NULL,
+`SO_REQUEST_ID` VARCHAR(45) NOT NULL,
+`CREATE_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (`ID`),
+CONSTRAINT fk_cloud_api_req_infra_requests
+ FOREIGN KEY (SO_REQUEST_ID)
+ REFERENCES infra_active_requests (REQUEST_ID))
+ENGINE = InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
index 514e5ad923..9faba0df67 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
@@ -50,35 +50,10 @@ public class HealthCheckHandlerTest extends RequestsAdapterBase {
@Test
public void testHealthcheck() throws JSONException {
- TestAppender.events.clear();
HttpEntity<String> entity = new HttpEntity<String>(null, headers);
-
ResponseEntity<String> response =
restTemplate.exchange(createURLWithPort("/manage/health"), HttpMethod.GET, entity, String.class);
-
assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- for (ILoggingEvent logEvent : TestAppender.events)
- if (logEvent.getLoggerName().equals("org.onap.so.logging.spring.interceptor.LoggingInterceptor")
- && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) {
- Map<String, String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- assertEquals("", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
- assertEquals("/manage/health", mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
- assertEquals("INPROGRESS", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
- } else if (logEvent.getLoggerName().equals("org.onap.so.logging.spring.interceptor.LoggingInterceptor")
- && logEvent.getMarker() != null && logEvent.getMarker() != null
- && logEvent.getMarker().getName().equals("EXIT")) {
- Map<String, String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- assertEquals("200", mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE));
- assertEquals("", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
- assertEquals("/manage/health", mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
- assertEquals("COMPLETED", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
- }
- TestAppender.events.clear();
}
private String createURLWithPort(String uri) {
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java
index 3b737c6768..03df115574 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java
@@ -25,6 +25,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.adapters.requestsdb.RequestsAdapterBase;
import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication;
+import org.onap.so.db.request.beans.CloudApiRequests;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.OperationStatus;
import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
@@ -41,9 +42,9 @@ import java.util.Map;
import java.util.HashMap;
import java.util.ArrayList;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertFalse;
@@ -87,6 +88,14 @@ public class RequestsDbClientTest extends RequestsAdapterBase {
infraActiveRequests.setRequestAction("someaction");
infraActiveRequests
.setRequestUrl("http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances");
+ List<CloudApiRequests> cloudApiRequests = new ArrayList<>();
+ CloudApiRequests cloudRequest = new CloudApiRequests();
+ cloudRequest.setCloudIdentifier("heatstackanme/id");
+ cloudRequest.setId(1);
+ cloudRequest.setRequestBody("requestBody");
+ cloudRequest.setRequestId(infraActiveRequests.getRequestId());
+ cloudApiRequests.add(cloudRequest);
+ infraActiveRequests.setCloudApiRequests(cloudApiRequests);
requestsDbClient.save(infraActiveRequests);
}
@@ -96,7 +105,8 @@ public class RequestsDbClientTest extends RequestsAdapterBase {
private void verifyInfraActiveRequests(InfraActiveRequests infraActiveRequestsResponse) {
- assertThat(infraActiveRequestsResponse, sameBeanAs(infraActiveRequests).ignoring("modifyTime").ignoring("log"));
+ assertThat(infraActiveRequestsResponse, sameBeanAs(infraActiveRequests).ignoring("modifyTime").ignoring("log")
+ .ignoring("cloudApiRequests.created").ignoring("cloudApiRequests.id"));
}
@Test
@@ -113,7 +123,6 @@ public class RequestsDbClientTest extends RequestsAdapterBase {
verifyInfraActiveRequests(infraActiveRequestsResponse);
}
-
@Test
public void checkVnfIdStatusTest() {
InfraActiveRequests infraActiveRequestsResponse =
@@ -182,7 +191,7 @@ public class RequestsDbClientTest extends RequestsAdapterBase {
public void getInfraActiveRequestbyRequestIdWhereRequestUrlNullTest() {
// requestUrl setup to null and save
infraActiveRequests.setRequestUrl(null);
- requestsDbClient.save(infraActiveRequests);
+ requestsDbClient.updateInfraActiveRequests(infraActiveRequests);
InfraActiveRequests infraActiveRequestsResponse =
requestsDbClient.getInfraActiveRequestbyRequestId(infraActiveRequests.getRequestId());
verifyInfraActiveRequests(infraActiveRequestsResponse);
diff --git a/adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml b/adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml
index d1596cd374..a63bd27378 100644
--- a/adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml
+++ b/adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml
@@ -1,18 +1,7 @@
<configuration>
- <property name="p_tim" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}"/>
- <property name="p_lvl" value="%level"/>
- <property name="p_log" value="%logger"/>
- <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}"/>
- <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/>
- <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/>
- <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/>
- <property name="p_thr" value="%thread"/>
- <property name="pattern" value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n"/>
-
-
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
- <pattern>${pattern}</pattern>
+ <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n</pattern>
</encoder>
</appender>
@@ -44,6 +33,10 @@
<logger name="ch.vorburger" level="WARN" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
+
+ <logger name="org.hibernate" level="DEBUG" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
<root level="WARN">
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
index 21ce06eaf1..7d412b77ad 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
@@ -5,7 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
- * Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (C) 2019 IBM.
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -77,13 +77,12 @@ public class SDNCRestClient {
private static Logger logger = LoggerFactory.getLogger(SDNCRestClient.class);
private static final String EXCEPTION_MSG = "Exception while evaluate xpath";
- private static final String MSO_INTERNAL_ERROR = "MsoInternalError";
private static final String CAMUNDA = "Camunda";
@Async
public void executeRequest(SDNCAdapterRequest bpelRequest) {
- logger.debug("BPEL Request:" + bpelRequest.toString());
+ logger.debug("BPEL Request: {}", bpelRequest);
// Added delay to allow completion of create request to SDNC
// before executing activate of create request.
@@ -96,8 +95,6 @@ public class SDNCRestClient {
Thread.currentThread().interrupt();
}
- String action = bpelRequest.getRequestHeader().getSvcAction();
- String operation = bpelRequest.getRequestHeader().getSvcOperation();
String bpelReqId = bpelRequest.getRequestHeader().getRequestId();
String callbackUrl = bpelRequest.getRequestHeader().getCallbackUrl();
@@ -118,12 +115,9 @@ public class SDNCRestClient {
Document reqDoc = node.getOwnerDocument();
sdncReqBody = Utils.genSdncPutReq(reqDoc, rt);
}
- long sdncStartTime = System.currentTimeMillis();
SDNCResponse sdncResp = getSdncResp(sdncReqBody, rt);
logger.debug("Got the SDNC Response: {}", sdncResp.getSdncRespXml());
- long bpelStartTime = System.currentTimeMillis();
sendRespToBpel(callbackUrl, sdncResp);
- return;
}
public SDNCResponse getSdncResp(String sdncReqBody, RequestTunables rt) {
@@ -288,7 +282,6 @@ public class SDNCRestClient {
try {
wsdlUrl = new URL(bpelUrl);
} catch (MalformedURLException e1) {
- error = "Caught exception initializing Callback wsdl " + e1.getMessage();
logger.error("{} {} {} {}", MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA,
ErrorCode.DataError.getValue(), "Exception initializing Callback wsdl", e1);
@@ -317,7 +310,6 @@ public class SDNCRestClient {
reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
headers.put("Authorization", Collections.singletonList(basicAuth));
} catch (Exception e2) {
- error = "Unable to set authorization in callback request " + e2.getMessage();
logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
ErrorCode.BusinessProcesssError.getValue(),
"Exception - Unable to set authorization in callback request", e2);
@@ -333,6 +325,5 @@ public class SDNCRestClient {
MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), error, e);
}
logger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), CAMUNDA);
- return;
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
index 66a1cb1ca7..9d9e33a524 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
@@ -100,5 +100,10 @@
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.squareup.okio</groupId>
+ <artifactId>okio</artifactId>
+ <version>1.13.0</version>
+ </dependency>
</dependencies>
</project>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
index da778d286e..91478e1f8e 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
@@ -62,7 +62,6 @@
<apiPackage>org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.api</apiPackage>
<modelPackage>org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model</modelPackage>
<configOptions>
- <jackson>true</jackson>
<sourceFolder>src/gen/java/main</sourceFolder>
<withXml>true</withXml>
<useRxJava2>true</useRxJava2>
@@ -79,15 +78,16 @@
<inputSpec>${basedir}/src/main/resources/SOL003-VNFLifecycleOperationGranting-API.json
</inputSpec>
<language>java</language>
- <library>retrofit2</library>
+ <library>okhttp-gson</library>
<output>${project.build.directory}/generated-sources/sol003-vnf-grant</output>
- <generateApis>false</generateApis>
+ <apiPackage>org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.api</apiPackage>
<modelPackage>org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model</modelPackage>
<configOptions>
<generateSupportingFiles>false</generateSupportingFiles>
<sourceFolder>src/gen/java/main</sourceFolder>
<withXml>true</withXml>
<useRxJava2>true</useRxJava2>
+ <serializableModel>true</serializableModel>
</configOptions>
</configuration>
</execution>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
index c561721b3e..09c28f93f1 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
@@ -63,6 +63,12 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java
index 30ce0c2253..62d2f7e2a9 100755
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java
@@ -20,11 +20,13 @@
package org.onap.so.adapters.vnfmadapter;
+import static org.slf4j.LoggerFactory.getLogger;
import org.onap.so.adapters.vnfmadapter.rest.VnfmAdapterController;
import org.slf4j.Logger;
import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import static org.slf4j.LoggerFactory.getLogger;
+import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
/**
* The spring boot application for the VNFM (Virtual Network Function Manager) Adapter.
@@ -36,6 +38,7 @@ import static org.slf4j.LoggerFactory.getLogger;
* SOL003 v2.5.1</a>
*/
@SpringBootApplication(scanBasePackages = {"org.onap.so"})
+@EnableAutoConfiguration(exclude = {JacksonAutoConfiguration.class})
public class VnfmAdapterApplication {
private static final Logger logger = getLogger(VnfmAdapterApplication.class);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java
index f1074bcba8..fd92910e36 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java
@@ -22,20 +22,21 @@
package org.onap.so.adapters.vnfmadapter.extclients;
+import static com.google.common.base.Splitter.on;
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.io.ByteStreams.toByteArray;
+import static java.lang.String.format;
+import static org.apache.http.HttpHeaders.ACCEPT;
+import static org.apache.http.HttpHeaders.AUTHORIZATION;
+import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.abortOperation;
+import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.child;
+import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.childElement;
+import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.children;
+import static org.slf4j.LoggerFactory.getLogger;
+import static org.springframework.http.MediaType.APPLICATION_OCTET_STREAM_VALUE;
import com.google.common.io.ByteStreams;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.http.HttpEntity;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.onap.so.utils.CryptoUtils;
-import org.slf4j.Logger;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-import org.yaml.snakeyaml.Yaml;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -48,25 +49,24 @@ import java.util.NoSuchElementException;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
-import static com.google.common.base.Splitter.on;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.io.ByteStreams.toByteArray;
-import static java.lang.String.format;
-import static org.apache.http.HttpHeaders.ACCEPT;
-import static org.apache.http.HttpHeaders.AUTHORIZATION;
-import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.abortOperation;
-import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.child;
-import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.childElement;
-import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.children;
-import static org.slf4j.LoggerFactory.getLogger;
-import static org.springframework.http.MediaType.APPLICATION_OCTET_STREAM_VALUE;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.onap.so.utils.CryptoUtils;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.yaml.snakeyaml.Yaml;
@Component
public class SdcPackageProvider {
- private static final String GET_PACKAGE_URL = "%s/catalog/resources/%s/toscaModel";
+ private static final String GET_PACKAGE_URL = "%s/sdc/v1/catalog/resources/%s/toscaModel";
@Value("${sdc.toscametapath:TOSCA-Metadata/TOSCA.meta}")
private List<String> toscaMetaPaths;
- private final String TOSCA_VNFD_KEY = "Entry-Definitions";
+ private static final String TOSCA_VNFD_KEY = "Entry-Definitions";
private static Logger logger = getLogger(SdcPackageProvider.class);
@Value("${sdc.username}")
@@ -78,7 +78,7 @@ public class SdcPackageProvider {
@Value("${sdc.endpoint}")
private String baseUrl;
- public String getVnfdId(String csarId) {
+ public String getVnfdId(final String csarId) {
return getVnfNodeProperty(csarId, "descriptor_id");
}
@@ -96,7 +96,7 @@ public class SdcPackageProvider {
for (final JsonObject child : children(nodeTemplates)) {
final String type = childElement(child, "type").getAsString();
String propertyValue = null;
- if (type.equals("tosca.nodes.nfv.VNF")) {
+ if ("tosca.nodes.nfv.VNF".equals(type)) {
final JsonObject properties = child(child, "properties");
logger.debug("properties: " + properties.toString());
@@ -119,7 +119,7 @@ public class SdcPackageProvider {
final JsonObject nodeTypes = child(root, "node_types");
final JsonObject nodeType = child(nodeTypes, nodeTypeName);
- if (childElement(nodeType, "derived_from").getAsString().equals("tosca.nodes.nfv.VNF")) {
+ if ("tosca.nodes.nfv.VNF".equals(childElement(nodeType, "derived_from").getAsString())) {
final JsonObject properties = child(nodeType, "properties");
logger.debug("properties: " + properties.toString());
final JsonObject property = child(properties, propertyName);
@@ -130,34 +130,33 @@ public class SdcPackageProvider {
return null;
}
- private byte[] getPackage(String csarId) {
+ private byte[] getPackage(final String csarId) {
final String SERVICE_NAME = "vnfm-adapter";
try (CloseableHttpClient client = HttpClients.createDefault()) {
- HttpGet httpget = new HttpGet(format(GET_PACKAGE_URL, baseUrl, csarId));
+ final HttpGet httpget = new HttpGet(format(GET_PACKAGE_URL, baseUrl, csarId));
httpget.setHeader(ACCEPT, APPLICATION_OCTET_STREAM_VALUE);
httpget.setHeader("X-ECOMP-InstanceID", SERVICE_NAME);
httpget.setHeader("X-FromAppId", SERVICE_NAME);
- String auth = sdcUsername + ":" + CryptoUtils.decrypt(sdcPassword, sdcKey);
- byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1));
- String authHeader = "Basic " + new String(encodedAuth);
+ final String auth = sdcUsername + ":" + CryptoUtils.decrypt(sdcPassword, sdcKey);
+ final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1));
+ final String authHeader = "Basic " + new String(encodedAuth);
httpget.setHeader(AUTHORIZATION, authHeader);
logger.debug("Fetching from SDC: " + httpget);
- CloseableHttpResponse response = client.execute(httpget);
- HttpEntity entity = response.getEntity();
- InputStream is = entity.getContent();
- byte[] bytes = toByteArray(is);
- return bytes;
- } catch (Exception e) {
+ final CloseableHttpResponse response = client.execute(httpget);
+ final HttpEntity entity = response.getEntity();
+ final InputStream is = entity.getContent();
+ return toByteArray(is);
+ } catch (final Exception e) {
throw abortOperation("Unable to download " + csarId + " package from SDC", e);
}
}
- private String getVnfdLocation(InputStream stream) throws IOException {
- Iterator pathIterator = toscaMetaPaths.iterator();
+ private String getVnfdLocation(final InputStream stream) throws IOException {
+ final Iterator<String> pathIterator = toscaMetaPaths.iterator();
while (pathIterator.hasNext()) {
- String toscaMetadata = new String(getFileInZip(stream, pathIterator.next().toString()).toByteArray());
+ final String toscaMetadata = new String(getFileInZip(stream, pathIterator.next()).toByteArray());
if (!toscaMetadata.isEmpty()) {
- String toscaVnfdLine =
+ final String toscaVnfdLine =
filter(on("\n").split(toscaMetadata), line -> line.contains(TOSCA_VNFD_KEY)).iterator().next();
return toscaVnfdLine.replace(TOSCA_VNFD_KEY + ":", "").trim();
}
@@ -165,20 +164,21 @@ public class SdcPackageProvider {
throw abortOperation("Unable to find valid Tosca Path");
}
- private static ByteArrayOutputStream getFileInZip(InputStream zip, String path) throws IOException {
- ZipInputStream zipInputStream = new ZipInputStream(zip);
- ByteArrayOutputStream fileContent = getFileInZip(zipInputStream, path);
+ private static ByteArrayOutputStream getFileInZip(final InputStream zip, final String path) throws IOException {
+ final ZipInputStream zipInputStream = new ZipInputStream(zip);
+ final ByteArrayOutputStream fileContent = getFileInZip(zipInputStream, path);
zipInputStream.close();
return fileContent;
}
- private static ByteArrayOutputStream getFileInZip(ZipInputStream zipInputStream, String path) throws IOException {
+ private static ByteArrayOutputStream getFileInZip(final ZipInputStream zipInputStream, final String path)
+ throws IOException {
ZipEntry zipEntry;
- Set<String> items = new HashSet<>();
+ final Set<String> items = new HashSet<>();
while ((zipEntry = zipInputStream.getNextEntry()) != null) {
items.add(zipEntry.getName());
if (zipEntry.getName().matches(path)) {
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ByteStreams.copy(zipInputStream, byteArrayOutputStream);
return byteArrayOutputStream;
}
@@ -187,7 +187,7 @@ public class SdcPackageProvider {
throw new NoSuchElementException("Unable to find the " + path + " in archive found: " + items);
}
- public String getFlavourId(String csarId) {
+ public String getFlavourId(final String csarId) {
return getVnfNodeProperty(csarId, "flavour_id");
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java
index 50fd5bcf3a..1374e89a19 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java
@@ -20,6 +20,10 @@
package org.onap.so.adapters.vnfmadapter.extclients.aai;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.aai.domain.yang.EsrSystemInfoList;
import org.onap.aai.domain.yang.EsrVnfm;
@@ -40,9 +44,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
/**
* Provides helper methods for interactions with AAI.
@@ -110,7 +111,7 @@ public class AaiHelper {
*/
public String getIdOfAssignedVnfm(final GenericVnf vnf) {
final Relationship relationship = getRelationship(vnf, "esr-vnfm");
- return getRelationshipKey(relationship, "esr-vnfm.vnfm-id");
+ return getRelationshipData(relationship, "esr-vnfm.vnfm-id");
}
/**
@@ -121,9 +122,9 @@ public class AaiHelper {
*/
public Tenant getAssignedTenant(final GenericVnf vnf) {
final Relationship relationship = getRelationship(vnf, "tenant");
- final String cloudOwner = getRelationshipKey(relationship, "cloud-region.cloud-owner");
- final String cloudRegion = getRelationshipKey(relationship, "cloud-region.cloud-region-id");
- final String tenantId = getRelationshipKey(relationship, "tenant.tenant-id");
+ final String cloudOwner = getRelationshipData(relationship, "cloud-region.cloud-owner");
+ final String cloudRegion = getRelationshipData(relationship, "cloud-region.cloud-region-id");
+ final String tenantId = getRelationshipData(relationship, "tenant.tenant-id");
if (cloudOwner == null || cloudRegion == null || tenantId == null) {
throw new TenantNotFoundException("No matching Tenant found in AAI. VNFID: " + vnf.getVnfId());
} else {
@@ -141,10 +142,17 @@ public class AaiHelper {
return null;
}
- private String getRelationshipKey(final Relationship relationship, final String relationshipKey) {
+ /**
+ * Get the value of the relationship data with the given key in the given relationship.
+ *
+ * @param relationship the relationship
+ * @param relationshipDataKey the key for the relationship data
+ * @return the value of the relationship data for the given key
+ */
+ public String getRelationshipData(final Relationship relationship, final String relationshipDataKey) {
if (relationship != null) {
for (final RelationshipData relationshipData : relationship.getRelationshipData()) {
- if (relationshipData.getRelationshipKey().equals(relationshipKey)) {
+ if (relationshipData.getRelationshipKey().equals(relationshipDataKey)) {
return relationshipData.getRelationshipValue();
}
}
@@ -153,6 +161,32 @@ public class AaiHelper {
}
/**
+ * Delete from the given VNF the relationship matching the given criteria.
+ *
+ * @param vnf the VNF
+ * @param relationshipRelatedToValue the related-to value for the relationship
+ * @param dataKey the relationship data key to match on
+ * @param dataValue the value the relationship data with the given key must match
+ * @return the deleted relationship or <code>null</code> if none found matching the given criteria
+ */
+ public Relationship deleteRelationshipWithDataValue(final GenericVnf vnf, final String relationshipRelatedToValue,
+ final String dataKey, final String dataValue) {
+ final Iterator<Relationship> relationships =
+ vnf.getRelationshipList() == null ? Collections.<Relationship>emptyList().iterator()
+ : vnf.getRelationshipList().getRelationship().iterator();
+
+ while (relationships.hasNext()) {
+ final Relationship relationship = relationships.next();
+ if (relationship.getRelatedTo().equals(relationshipRelatedToValue)
+ && dataValue.equals(getRelationshipData(relationship, dataKey))) {
+ relationships.remove();
+ return relationship;
+ }
+ }
+ return null;
+ }
+
+ /**
* Select a VNFM to use for the given generic VNF. Should only be used when no VNFM has already been assigned to the
* VNF.
*
@@ -257,7 +291,12 @@ public class AaiHelper {
relationship.setRelatedTo("tenant");
relationship.setRelatedLink("/aai/" + AAIVersion.LATEST + AAIUriFactory.createResourceUri(AAIObjectType.TENANT,
tenant.getCloudOwner(), tenant.getRegionName(), tenant.getTenantId()).build().toString());
+ relationship.getRelationshipData()
+ .add(createRelationshipData("cloud-region.cloud-owner", tenant.getCloudOwner()));
+ relationship.getRelationshipData()
+ .add(createRelationshipData("cloud-region.cloud-region-id", tenant.getRegionName()));
relationship.getRelationshipData().add(createRelationshipData("tenant.tenant-id", tenant.getTenantId()));
return relationship;
}
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java
index f991ffafba..7021c02511 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java
@@ -24,9 +24,9 @@ import org.onap.aai.domain.yang.EsrSystemInfoList;
import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.aai.domain.yang.EsrVnfmList;
import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.Vserver;
import org.onap.vnfmadapter.v1.model.Tenant;
-import java.util.List;
/**
* Provides methods for invoking REST calls to AAI.
@@ -47,7 +47,7 @@ public interface AaiServiceProvider {
* @param selfLink the selfLink
* @return the matching generic vnfs
*/
- List<GenericVnf> invokeQueryGenericVnf(final String selfLink);
+ GenericVnfs invokeQueryGenericVnf(final String selfLink);
/**
* Invoke a GET request for the VNFMs.
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
index fa07ab5720..50e579dd83 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
@@ -24,6 +24,7 @@ import org.onap.aai.domain.yang.EsrSystemInfoList;
import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.aai.domain.yang.EsrVnfmList;
import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
@@ -32,7 +33,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.List;
@Service
public class AaiServiceProviderImpl implements AaiServiceProvider {
@@ -56,9 +56,9 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
}
@Override
- public List<GenericVnf> invokeQueryGenericVnf(final String selfLink) {
+ public GenericVnfs invokeQueryGenericVnf(final String selfLink) {
return aaiClientProvider.getAaiClient()
- .get(List.class,
+ .get(GenericVnfs.class,
AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNFS).queryParam("selflink", selfLink))
.orElseGet(() -> {
logger.debug("No vnf found in AAI with selflink: {}", selfLink);
@@ -104,7 +104,7 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
@Override
public void invokePutVserver(final String cloudOwner, final String cloudRegion, final String tenant,
final Vserver vserver) {
- aaiClientProvider.getAaiClient().update(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
+ aaiClientProvider.getAaiClient().create(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
cloudRegion, tenant, vserver.getVserverId()), vserver);
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
index 31399f7720..249cf74cb2 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
@@ -20,10 +20,16 @@
package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
+import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
+import static org.onap.so.adapters.vnfmadapter.Constants.OPERATION_NOTIFICATION_ENDPOINT;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
+import java.security.GeneralSecurityException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
import org.onap.so.adapters.vnfmadapter.extclients.vim.model.AccessInfo;
@@ -40,7 +46,7 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilte
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilterVnfInstanceSubscriptionFilter;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.VnfInstancesvnfInstanceIdinstantiateExtVirtualLinks;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.VnfInstancesvnfInstanceIdinstantiateVimConnectionInfo;
-import org.onap.so.security.WebSecurityConfig;
+import org.onap.so.utils.CryptoUtils;
import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
import org.onap.vnfmadapter.v1.model.ExternalVirtualLink;
import org.onap.vnfmadapter.v1.model.Tenant;
@@ -49,11 +55,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
-import static org.onap.so.adapters.vnfmadapter.Constants.OPERATION_NOTIFICATION_ENDPOINT;
/**
* Provides helper methods for interactions with VNFM.
@@ -64,15 +65,19 @@ public class VnfmHelper {
private static final Logger logger = LoggerFactory.getLogger(VnfmHelper.class);
private static final String SEPARATOR = "_";
private final AaiServiceProvider aaiServiceProvider;
- private final WebSecurityConfig webSecurityConfig;
@Value("${vnfmadapter.endpoint}")
private String vnfmAdapterEndoint;
+ @Value("${vnfmadapter.auth:E39823AAB2739CC654C4E92B52C05BC34149342D0A46451B00CA508C8EDC62242CE4E9DA9445D3C01A3F13}")
+ private String vnfmAdapterAuth;
+
+ @Value("${mso.key}")
+ private String msoEncryptionKey;
+
@Autowired
- public VnfmHelper(final AaiServiceProvider aaiServiceProvider, final WebSecurityConfig webSecurityConfig) {
+ public VnfmHelper(final AaiServiceProvider aaiServiceProvider) {
this.aaiServiceProvider = aaiServiceProvider;
- this.webSecurityConfig = webSecurityConfig;
}
/**
@@ -171,8 +176,10 @@ public class VnfmHelper {
*
* @param the ID of the VNF notifications are required for
* @return the request
+ * @throws GeneralSecurityException
*/
- public LccnSubscriptionRequest createNotificationSubscriptionRequest(final String vnfId) {
+ public LccnSubscriptionRequest createNotificationSubscriptionRequest(final String vnfId)
+ throws GeneralSecurityException {
final LccnSubscriptionRequest lccnSubscriptionRequest = new LccnSubscriptionRequest();
lccnSubscriptionRequest.setAuthentication(getSubscriptionsAuthentication());
lccnSubscriptionRequest.setCallbackUri(vnfmAdapterEndoint + BASE_URL + OPERATION_NOTIFICATION_ENDPOINT);
@@ -186,12 +193,11 @@ public class VnfmHelper {
return lccnSubscriptionRequest;
}
- private SubscriptionsAuthentication getSubscriptionsAuthentication() {
+ private SubscriptionsAuthentication getSubscriptionsAuthentication() throws GeneralSecurityException {
final SubscriptionsAuthenticationParamsBasic basicAuthParams = new SubscriptionsAuthenticationParamsBasic();
- basicAuthParams.setUserName("vnfm");
- basicAuthParams.setPassword(webSecurityConfig.getUsercredentials().stream()
- .filter(userCredentials -> "vnfm".equals(userCredentials.getUsername())).findFirst().get()
- .getPassword());
+ final String[] decrypedAuth = CryptoUtils.decrypt(vnfmAdapterAuth, msoEncryptionKey).split(":");
+ basicAuthParams.setUserName(decrypedAuth[0]);
+ basicAuthParams.setPassword(decrypedAuth[1]);
final SubscriptionsAuthentication authentication = new SubscriptionsAuthentication();
authentication.addAuthTypeItem(AuthTypeEnum.BASIC);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java
index 951c6f187b..e66f86b66f 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java
@@ -84,10 +84,12 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
@Override
public InlineResponse2001 subscribeForNotifications(final String vnfmId,
final LccnSubscriptionRequest subscriptionRequest) {
+ logger.info("Subscribing for notifications {}", subscriptionRequest);
final String url = urlProvider.getSubscriptionsUrl(vnfmId);
ResponseEntity<InlineResponse2001> response = null;
try {
response = httpServiceProvider.postHttpRequest(subscriptionRequest, url, InlineResponse2001.class);
+ logger.info("Subscribing for notifications response {}", response);
} catch (final Exception exception) {
final String errorMessage =
"Subscription to VNFM " + vnfmId + " resulted in exception" + subscriptionRequest;
@@ -131,7 +133,7 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
public void deleteVnf(final String vnfSelfLink) {
logger.debug("Sending delete request to : " + vnfSelfLink);
final ResponseEntity<Void> response = httpServiceProvider.deleteHttpRequest(vnfSelfLink, Void.class);
- if (response.getStatusCode() != HttpStatus.OK) {
+ if (response.getStatusCode() != HttpStatus.NO_CONTENT) {
throw new VnfmRequestFailureException(
"Delete request to " + vnfSelfLink + " return status code: " + response.getStatusCode());
}
@@ -146,6 +148,7 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
@Override
public Optional<InlineResponse201> createVnf(final String vnfmId, final CreateVnfRequest createVnfRequest) {
final String url = urlProvider.getCreationUrl(vnfmId);
+ logger.debug("Sending create request {} to : {}", createVnfRequest, url);
try {
return httpServiceProvider.post(createVnfRequest, url, InlineResponse201.class);
} catch (final Exception exception) {
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java
index d4aa65d159..f948f3cfac 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java
@@ -20,6 +20,8 @@
package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
+import static org.slf4j.LoggerFactory.getLogger;
+import java.net.URI;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.aai.domain.yang.EsrSystemInfoList;
import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
@@ -28,8 +30,6 @@ import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.util.UriComponentsBuilder;
-import java.net.URI;
-import static org.slf4j.LoggerFactory.getLogger;
/**
* Provides URLs for REST calls to a VNFM.
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java
index e61bf860b3..345ff5119a 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java
@@ -20,8 +20,11 @@
package org.onap.so.adapters.vnfmadapter.jobmanagement;
+import static org.slf4j.LoggerFactory.getLogger;
import com.google.common.base.Optional;
import com.google.common.collect.Maps;
+import java.util.Map;
+import java.util.UUID;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmServiceProvider;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.JobNotFoundException;
@@ -32,9 +35,6 @@ import org.onap.vnfmadapter.v1.model.QueryJobResponse;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import java.util.Map;
-import java.util.UUID;
-import static org.slf4j.LoggerFactory.getLogger;
/**
* Manages jobs enabling the status of jobs to be queried. A job is associated with an operation on a VNFM.
@@ -123,12 +123,15 @@ public class JobManager {
public void notificationProcessedForOperation(final String operationId,
final boolean notificationProcessingWasSuccessful) {
+ logger.debug("Notification processed for operation ID {} success?: {}", operationId,
+ notificationProcessingWasSuccessful);
final java.util.Optional<VnfmOperation> relatedOperation = mapOfJobIdToVnfmOperation.values().stream()
.filter(operation -> operation.getOperationId().equals(operationId)).findFirst();
if (relatedOperation.isPresent()) {
relatedOperation.get().setNotificationProcessed(notificationProcessingWasSuccessful);
+ } else {
+ logger.debug("No operation found for operation ID " + operationId);
}
- logger.debug("No operation found for operation ID " + operationId);
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/VnfmOperation.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/VnfmOperation.java
index 3ed66ad713..7ce08df52f 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/VnfmOperation.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/VnfmOperation.java
@@ -94,4 +94,11 @@ public class VnfmOperation {
NOTIFICATION_PROCESSING_FAILED;
}
+ @Override
+ public String toString() {
+ return "VnfmOperation [vnfmId=" + vnfmId + ", operationId=" + operationId + ", notificationStatus="
+ + notificationStatus + "]";
+ }
+
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
index e6b787bacc..32bb9b93a4 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
@@ -21,6 +21,7 @@
package org.onap.so.adapters.vnfmadapter.lifecycle;
import com.google.common.base.Optional;
+import java.util.Map;
import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.so.adapters.vnfmadapter.extclients.SdcPackageProvider;
@@ -46,7 +47,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import java.util.Map;
/**
* Manages lifecycle operations towards the VNFMs.
@@ -64,7 +64,7 @@ public class LifecycleManager {
@Autowired
LifecycleManager(final AaiServiceProvider aaiServiceProvider, final AaiHelper aaiHelper,
final VnfmHelper vnfmHelper, final VnfmServiceProvider vnfmServiceProvider, final JobManager jobManager,
- SdcPackageProvider packageProvider) {
+ final SdcPackageProvider packageProvider) {
this.aaiServiceProvider = aaiServiceProvider;
this.vnfmServiceProvider = vnfmServiceProvider;
this.aaiHelper = aaiHelper;
@@ -90,7 +90,11 @@ public class LifecycleManager {
aaiHelper.addRelationshipFromGenericVnfToVnfm(genericVnf, vnfm.getVnfmId());
}
aaiHelper.addRelationshipFromGenericVnfToTenant(genericVnf, request.getTenant());
- InlineResponse201 vnfmResponse = sendCreateRequestToVnfm(request, genericVnf, vnfIdInAai, vnfm.getVnfmId());
+ final InlineResponse201 vnfmResponse =
+ sendCreateRequestToVnfm(request, genericVnf, vnfIdInAai, vnfm.getVnfmId());
+
+ logger.info("Create response: {}", vnfmResponse);
+
genericVnf.setSelflink(vnfmResponse.getLinks().getSelf().getHref());
aaiServiceProvider.invokePutGenericVnf(genericVnf);
final String vnfIdInVnfm = vnfmResponse.getId();
@@ -135,18 +139,18 @@ public class LifecycleManager {
}
}
- private InlineResponse201 sendCreateRequestToVnfm(CreateVnfRequest aaiRequest, GenericVnf genericVnf,
- String vnfIdInAai, String vnfmId) {
+ private InlineResponse201 sendCreateRequestToVnfm(final CreateVnfRequest aaiRequest, final GenericVnf genericVnf,
+ final String vnfIdInAai, final String vnfmId) {
logger.debug("Sending a create request to SVNFM " + aaiRequest);
- org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest vnfmRequest =
+ final org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest vnfmRequest =
new org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest();
- String vnfdId = packageProvider.getVnfdId(genericVnf.getModelVersionId());
+ final String vnfdId = packageProvider.getVnfdId(genericVnf.getModelVersionId());
vnfmRequest.setVnfdId(vnfdId);
vnfmRequest.setVnfInstanceName(aaiRequest.getName().replaceAll(" ", "_"));
vnfmRequest.setVnfInstanceDescription(vnfIdInAai);
- Optional<InlineResponse201> optionalResponse = vnfmServiceProvider.createVnf(vnfmId, vnfmRequest);
+ final Optional<InlineResponse201> optionalResponse = vnfmServiceProvider.createVnf(vnfmId, vnfmRequest);
try {
return optionalResponse.get();
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
index a339b9be70..c09aa0cd48 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
@@ -20,9 +20,14 @@
package org.onap.so.adapters.vnfmadapter.notificationhandling;
+import static org.slf4j.LoggerFactory.getLogger;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiHelper;
import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
@@ -30,16 +35,13 @@ import org.onap.so.adapters.vnfmadapter.extclients.aai.OamIpAddressSource;
import org.onap.so.adapters.vnfmadapter.extclients.aai.OamIpAddressSource.OamIpAddressType;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmServiceProvider;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs.ChangeTypeEnum;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationStateEnum;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201VimConnectionInfo;
import org.onap.so.adapters.vnfmadapter.jobmanagement.JobManager;
import org.slf4j.Logger;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import static org.slf4j.LoggerFactory.getLogger;
/**
* Performs updates to AAI based on a received notification. The updates are executed in a separate thread so as the
@@ -93,15 +95,14 @@ public class NotificationHandler implements Runnable {
}
private void handleVnfInstantiateCompleted() {
- final GenericVnf genericVnf =
- aaiServiceProvider.invokeQueryGenericVnf(vnfInstance.getLinks().getSelf().getHref()).get(0);
+ final GenericVnf genericVnf = aaiServiceProvider
+ .invokeQueryGenericVnf(vnfInstance.getLinks().getSelf().getHref()).getGenericVnf().get(0);
setOamIpAddress(genericVnf, vnfInstance);
genericVnf.setOrchestrationStatus("Created");
aaiServiceProvider.invokePutGenericVnf(genericVnf);
- updateVservers(vnfLcmOperationOccurrenceNotification, genericVnf.getVnfId(),
- vnfInstance.getVimConnectionInfo());
+ addVservers(vnfLcmOperationOccurrenceNotification, genericVnf.getVnfId(), vnfInstance.getVimConnectionInfo());
logger.debug("Finished handling notification for vnfm: " + vnfInstance.getId());
}
@@ -114,16 +115,17 @@ public class NotificationHandler implements Runnable {
}
if (oamIpAddressSource.getType().equals(OamIpAddressType.LITERAL)) {
genericVnf.setIpv4OamAddress(oamIpAddressSource.getValue());
- }
- try {
- logger.debug("ConfigurableProperties: " + vnfInstance.getVnfConfigurableProperties());
- if (vnfInstance.getVnfConfigurableProperties() == null) {
- logger.warn("No ConfigurableProperties, cannot set OAM IP Address");
+ } else {
+ try {
+ logger.debug("ConfigurableProperties: " + vnfInstance.getVnfConfigurableProperties());
+ if (vnfInstance.getVnfConfigurableProperties() == null) {
+ logger.warn("No ConfigurableProperties, cannot set OAM IP Address");
+ }
+ final JSONObject properties = new JSONObject((Map) vnfInstance.getVnfConfigurableProperties());
+ genericVnf.setIpv4OamAddress(properties.get(oamIpAddressSource.getValue()).toString());
+ } catch (final JSONException jsonException) {
+ logger.error("Error getting vnfIpAddress", jsonException);
}
- final JSONObject properties = new JSONObject((Map) vnfInstance.getVnfConfigurableProperties());
- genericVnf.setIpv4OamAddress(properties.get(oamIpAddressSource.getValue()).toString());
- } catch (final JSONException jsonException) {
- logger.error("Error getting vnfIpAddress", jsonException);
}
}
@@ -141,32 +143,31 @@ public class NotificationHandler implements Runnable {
}
private void handleVnfTerminateFailed() {
- final GenericVnf genericVnf =
- aaiServiceProvider.invokeQueryGenericVnf(vnfInstance.getLinks().getSelf().getHref()).get(0);
- updateVservers(vnfLcmOperationOccurrenceNotification, genericVnf.getVnfId(),
- vnfInstance.getVimConnectionInfo());
- jobManager.notificationProcessedForOperation(vnfLcmOperationOccurrenceNotification.getId(), false);
+ final GenericVnf genericVnf = aaiServiceProvider
+ .invokeQueryGenericVnf(vnfInstance.getLinks().getSelf().getHref()).getGenericVnf().get(0);
+ deleteVservers(vnfLcmOperationOccurrenceNotification, genericVnf);
+ jobManager.notificationProcessedForOperation(vnfLcmOperationOccurrenceNotification.getVnfLcmOpOccId(), false);
}
private void handleVnfTerminateCompleted() {
- final GenericVnf genericVnf =
- aaiServiceProvider.invokeQueryGenericVnf(vnfInstance.getLinks().getSelf().getHref()).get(0);
- updateVservers(vnfLcmOperationOccurrenceNotification, genericVnf.getVnfId(),
- vnfInstance.getVimConnectionInfo());
+ final GenericVnf genericVnf = aaiServiceProvider
+ .invokeQueryGenericVnf(vnfInstance.getLinks().getSelf().getHref()).getGenericVnf().get(0);
+ deleteVservers(vnfLcmOperationOccurrenceNotification, genericVnf);
boolean deleteSuccessful = false;
try {
vnfmServiceProvider.deleteVnf(genericVnf.getSelflink());
deleteSuccessful = true;
} finally {
- jobManager.notificationProcessedForOperation(vnfLcmOperationOccurrenceNotification.getId(),
+ jobManager.notificationProcessedForOperation(vnfLcmOperationOccurrenceNotification.getVnfLcmOpOccId(),
deleteSuccessful);
genericVnf.setOrchestrationStatus("Assigned");
+ genericVnf.setSelflink("");
aaiServiceProvider.invokePutGenericVnf(genericVnf);
}
}
- private void updateVservers(final VnfLcmOperationOccurrenceNotification notification, final String vnfId,
+ private void addVservers(final VnfLcmOperationOccurrenceNotification notification, final String vnfId,
final List<InlineResponse201VimConnectionInfo> vnfInstancesVimConnectionInfo) {
final Map<String, InlineResponse201VimConnectionInfo> vimConnectionIdToVimConnectionInfo = new HashMap<>();
for (final InlineResponse201VimConnectionInfo vimConnectionInfo : vnfInstancesVimConnectionInfo) {
@@ -176,22 +177,28 @@ public class NotificationHandler implements Runnable {
for (final LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs vnfc : notification.getAffectedVnfcs()) {
final InlineResponse201VimConnectionInfo vimConnectionInfo =
getVimConnectionInfo(vimConnectionIdToVimConnectionInfo, vnfc);
- switch (vnfc.getChangeType()) {
- case ADDED:
- final Vserver vserver = aaiHelper.createVserver(vnfc);
- aaiHelper.addRelationshipFromVserverVnfToGenericVnf(vserver, vnfId);
-
- aaiServiceProvider.invokePutVserver(getCloudOwner(vimConnectionInfo),
- getCloudRegion(vimConnectionInfo), getTenant(vimConnectionInfo), vserver);
- break;
- case REMOVED:
- aaiServiceProvider.invokeDeleteVserver(getCloudOwner(vimConnectionInfo),
- getCloudRegion(vimConnectionInfo), getTenant(vimConnectionInfo),
- vnfc.getComputeResource().getResourceId());
- break;
- case MODIFIED:
- case TEMPORARY:
- default:
+ if (ChangeTypeEnum.ADDED.equals(vnfc.getChangeType())) {
+ final Vserver vserver = aaiHelper.createVserver(vnfc);
+ aaiHelper.addRelationshipFromVserverVnfToGenericVnf(vserver, vnfId);
+
+ aaiServiceProvider.invokePutVserver(getCloudOwner(vimConnectionInfo), getCloudRegion(vimConnectionInfo),
+ getTenant(vimConnectionInfo), vserver);
+ }
+ }
+ }
+
+ private void deleteVservers(final VnfLcmOperationOccurrenceNotification notification, final GenericVnf vnf) {
+ for (final LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs vnfc : notification.getAffectedVnfcs()) {
+ if (ChangeTypeEnum.REMOVED.equals(vnfc.getChangeType())) {
+
+ final Relationship relationshipToVserver = aaiHelper.deleteRelationshipWithDataValue(vnf, "vserver",
+ "vserver.vserver-id", vnfc.getComputeResource().getResourceId());
+
+ aaiServiceProvider.invokeDeleteVserver(
+ aaiHelper.getRelationshipData(relationshipToVserver, "cloud-region.cloud-owner"),
+ aaiHelper.getRelationshipData(relationshipToVserver, "cloud-region.cloud-region-id"),
+ aaiHelper.getRelationshipData(relationshipToVserver, "tenant.tenant-id"),
+ vnfc.getComputeResource().getResourceId());
}
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java
index 6b8802eed2..3ead98fce2 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java
@@ -20,6 +20,11 @@
package org.onap.so.adapters.vnfmadapter.rest;
+import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import javax.ws.rs.core.MediaType;
import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiHelper;
import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmHelper;
@@ -36,15 +41,10 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
-import javax.ws.rs.core.MediaType;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
+import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping(value = BASE_URL, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@@ -52,9 +52,6 @@ public class Sol003GrantController {
private static final String SEPARATOR = "_";
private static final String VIM_TYPE = "OPENSTACK";
- private static final String CLOUD_OWNER = "myTestCloudOwner";
- private static final String REGION = "myTestRegion";
- private static final String TENANT_ID = "myTestTenantId";
private static final Logger logger = LoggerFactory.getLogger(Sol003GrantController.class);
public final AaiServiceProvider aaiServiceProvider;
public final AaiHelper aaiHelper;
@@ -71,7 +68,7 @@ public class Sol003GrantController {
@GetMapping(value = "/grants/{grantId}")
public ResponseEntity<InlineResponse201> grantsGrantIdGet(@PathVariable("grantId") final String grantId) {
logger.info("Get grant received from VNFM, grant id: " + grantId);
- return new ResponseEntity<InlineResponse201>(HttpStatus.NOT_IMPLEMENTED);
+ return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
@PostMapping(value = "/grants")
@@ -80,7 +77,7 @@ public class Sol003GrantController {
final InlineResponse201 grantResponse = createGrantResponse(grantRequest);
logger.info("Grant request returning to VNFM: " + grantResponse);
- return new ResponseEntity<InlineResponse201>(grantResponse, HttpStatus.CREATED);
+ return new ResponseEntity<>(grantResponse, HttpStatus.CREATED);
}
private InlineResponse201 createGrantResponse(final GrantRequest grantRequest) {
@@ -88,8 +85,9 @@ public class Sol003GrantController {
grantResponse.setId(UUID.randomUUID().toString());
grantResponse.setVnfInstanceId(grantRequest.getVnfInstanceId());
grantResponse.setVnfLcmOpOccId(grantRequest.getVnfLcmOpOccId());
- final Tenant tenant =
- aaiHelper.getAssignedTenant(aaiServiceProvider.invokeGetGenericVnf((grantRequest.getVnfInstanceId())));
+ final String vnfSelfLink = grantRequest.getLinks().getVnfInstance().getHref();
+ final Tenant tenant = aaiHelper
+ .getAssignedTenant(aaiServiceProvider.invokeQueryGenericVnf(vnfSelfLink).getGenericVnf().get(0));
String vimConnectionId = "";
final InlineResponse201VimConnections vimConnection = vnfmHelper.getVimConnections(tenant);
@@ -99,19 +97,11 @@ public class Sol003GrantController {
if (grantRequest.getOperation().equals(GrantRequest.OperationEnum.INSTANTIATE)) {
grantResponse.addResources(getResources(grantRequest.getAddResources(), vimConnectionId));
} else if (grantRequest.getOperation().equals(GrantRequest.OperationEnum.TERMINATE)) {
- grantResponse.addResources(getResources(grantRequest.getRemoveResources(), vimConnectionId));
+ grantResponse.removeResources(getResources(grantRequest.getRemoveResources(), vimConnectionId));
}
return grantResponse;
}
- private InlineResponse201VimConnections getVimConnectionsItem(final Tenant tenant) {
- final InlineResponse201VimConnections vimConnection = new InlineResponse201VimConnections();
- vimConnection.setId(createVimConnectionId(tenant.getCloudOwner(), tenant.getRegionName()));
- vimConnection.setVimId(vimConnection.getId());
- vimConnection.setVimType(VIM_TYPE);
- return vimConnection;
- }
-
private List<InlineResponse201AddResources> getResources(final List<GrantsAddResources> requestResources,
final String vimId) {
final List<InlineResponse201AddResources> resources = new ArrayList<>();
@@ -123,8 +113,4 @@ public class Sol003GrantController {
}
return resources;
}
-
- private String createVimConnectionId(String cloudOwner, String cloudRegionId) {
- return cloudOwner + SEPARATOR + cloudRegionId;
- }
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml
index 4fb110349d..951d4a3bb9 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml
@@ -11,6 +11,19 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+spring:
+ security:
+ usercredentials:
+ - username: test
+ password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu'
+ role: BPEL-Client
+ - username: vnfm
+ password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
+ role: BPEL-Client
+ http:
+ converters:
+ preferred-json-mapper: gson
+
server:
port: 9092
tomcat:
@@ -29,6 +42,9 @@ sdc:
password: sdcPassword
key: adadadadad
endpoint: http://sdc.onap/1234A
+
+vnfmadapter:
+ endpoint: http://so-vnfm-adapter.onap:9092
#Actuator
management:
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java
index b7f5e96eab..69223d7922 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java
@@ -20,7 +20,15 @@
package org.onap.so.adapters.vnfmadapter.rest;
-import com.google.gson.Gson;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.junit.Before;
@@ -30,6 +38,7 @@ import org.mockito.hamcrest.MockitoHamcrest;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.aai.domain.yang.EsrSystemInfoList;
import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipData;
import org.onap.aai.domain.yang.RelationshipList;
@@ -38,6 +47,8 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantRequest
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantRequest.OperationEnum;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources.TypeEnum;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsLinks;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsLinksVnfLcmOpOcc;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201VimConnections;
import org.onap.so.client.aai.AAIResourcesClient;
@@ -54,12 +65,6 @@ import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.web.client.RestTemplate;
-import java.util.Optional;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
@@ -84,7 +89,6 @@ public class Sol003GrantControllerTest {
@Autowired
private Sol003GrantController controller;
- private final Gson gson = new Gson();
@Before
public void setUp() throws Exception {
@@ -94,17 +98,18 @@ public class Sol003GrantControllerTest {
@Test
public void grantRequest_ValidRequestInstantiate_GrantApproved() {
- GrantRequest grantRequest = createGrantRequest("INSTANTIATE");
+ final GrantRequest grantRequest = createGrantRequest("INSTANTIATE");
setUpGenericVnfWithVnfmRelationshipInMockAai("vnfmType", "vnfm1");
final ResponseEntity<InlineResponse201> response = controller.grantsPost(grantRequest);
assertEquals(HttpStatus.CREATED, response.getStatusCode());
assertEquals(1, response.getBody().getAddResources().size());
+ assertNull(response.getBody().getRemoveResources());
assertEquals(vimConnectionId, response.getBody().getAddResources().get(0).getVimConnectionId());
- assertEquals("myTestVnfId", response.getBody().getVnfInstanceId());
+ assertEquals("myTestVnfIdOnVnfm", response.getBody().getVnfInstanceId());
assertEquals("123456", response.getBody().getVnfLcmOpOccId());
- InlineResponse201VimConnections vimConnections = response.getBody().getVimConnections().get(0);
+ final InlineResponse201VimConnections vimConnections = response.getBody().getVimConnections().get(0);
assertEquals(vimConnectionId, vimConnections.getVimId());
assertEquals("OPENSTACK", vimConnections.getVimType());
assertNotNull(vimConnections.getAccessInfo());
@@ -120,17 +125,18 @@ public class Sol003GrantControllerTest {
@Test
public void grantRequest_ValidRequestTerminate_GrantApproved() {
- GrantRequest grantRequest = createGrantRequest("TERMINATE");
+ final GrantRequest grantRequest = createGrantRequest("TERMINATE");
setUpGenericVnfWithVnfmRelationshipInMockAai("vnfmType", "vnfm1");
final ResponseEntity<InlineResponse201> response = controller.grantsPost(grantRequest);
assertEquals(HttpStatus.CREATED, response.getStatusCode());
- assertEquals(1, response.getBody().getAddResources().size());
- assertEquals(vimConnectionId, response.getBody().getAddResources().get(0).getVimConnectionId());
- assertEquals("myTestVnfId", response.getBody().getVnfInstanceId());
+ assertNull(response.getBody().getAddResources());
+ assertEquals(1, response.getBody().getRemoveResources().size());
+ assertEquals(vimConnectionId, response.getBody().getRemoveResources().get(0).getVimConnectionId());
+ assertEquals("myTestVnfIdOnVnfm", response.getBody().getVnfInstanceId());
assertEquals("123456", response.getBody().getVnfLcmOpOccId());
- InlineResponse201VimConnections vimConnections = response.getBody().getVimConnections().get(0);
+ final InlineResponse201VimConnections vimConnections = response.getBody().getVimConnections().get(0);
assertEquals(vimConnectionId, vimConnections.getVimId());
assertEquals("OPENSTACK", vimConnections.getVimType());
assertNotNull(vimConnections.getAccessInfo());
@@ -139,19 +145,21 @@ public class Sol003GrantControllerTest {
}
- private GrantRequest createGrantRequest(String operation) {
- GrantRequest grantRequest = new GrantRequest();
- grantRequest.setVnfInstanceId("myTestVnfId");
+ private GrantRequest createGrantRequest(final String operation) {
+ final GrantRequest grantRequest = new GrantRequest();
+ grantRequest.setVnfInstanceId("myTestVnfIdOnVnfm");
grantRequest.setVnfLcmOpOccId("123456");
+ grantRequest.links(new GrantsLinks()
+ .vnfInstance(new GrantsLinksVnfLcmOpOcc().href("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm")));
if (operation == "INSTANTIATE") {
grantRequest.setOperation(OperationEnum.INSTANTIATE);
- GrantsAddResources resource = new GrantsAddResources();
+ final GrantsAddResources resource = new GrantsAddResources();
resource.setId("123");
resource.setType(TypeEnum.COMPUTE);
grantRequest.addAddResourcesItem(resource);
} else if (operation == "TERMINATE") {
grantRequest.setOperation(OperationEnum.TERMINATE);
- GrantsAddResources resource = new GrantsAddResources();
+ final GrantsAddResources resource = new GrantsAddResources();
resource.setId("123");
resource.setType(TypeEnum.COMPUTE);
grantRequest.addRemoveResourcesItem(resource);
@@ -210,6 +218,14 @@ public class Sol003GrantControllerTest {
doReturn(Optional.of(genericVnf)).when(aaiResourcesClient).get(eq(GenericVnf.class),
MockitoHamcrest.argThat(new AaiResourceUriMatcher("/network/generic-vnfs/generic-vnf/myTestVnfId")));
+
+ final List<GenericVnf> listOfGenericVnfs = new ArrayList<>();
+ listOfGenericVnfs.add(genericVnf);
+ final GenericVnfs genericVnfs = new GenericVnfs();
+ genericVnfs.getGenericVnf().addAll(listOfGenericVnfs);
+ doReturn(Optional.of(genericVnfs)).when(aaiResourcesClient).get(eq(GenericVnfs.class),
+ MockitoHamcrest.argThat(new AaiResourceUriMatcher(
+ "/network/generic-vnfs?selflink=http%3A%2F%2Fvnfm%3A8080%2Fvnfs%2FmyTestVnfIdOnVnfm")));
}
private class AaiResourceUriMatcher extends BaseMatcher<AAIResourceUri> {
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
index 66e8e99f72..aeb7cd3540 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
@@ -20,7 +20,25 @@
package org.onap.so.adapters.vnfmadapter.rest;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.timeout;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
import com.google.gson.Gson;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import javax.inject.Inject;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.junit.Before;
@@ -29,7 +47,10 @@ import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.hamcrest.MockitoHamcrest;
import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.Relationship;
+import org.onap.aai.domain.yang.RelationshipData;
+import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiHelper;
@@ -64,24 +85,6 @@ import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.web.client.RestTemplate;
-import javax.inject.Inject;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.timeout;
-import static org.mockito.Mockito.verifyZeroInteractions;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
-import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
-import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
-import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
@@ -166,9 +169,11 @@ public class Sol003LcnControllerTest {
.andRespond(withSuccess(gson.toJson(vnfInstance), MediaType.APPLICATION_JSON));
final GenericVnf genericVnf = createGenericVnf("vnfmType1");
- final List<GenericVnf> genericVnfs = new ArrayList<>();
- genericVnfs.add(genericVnf);
- doReturn(Optional.of(genericVnfs)).when(aaiResourcesClient).get(eq(List.class),
+ final List<GenericVnf> listOfGenericVnfs = new ArrayList<>();
+ listOfGenericVnfs.add(genericVnf);
+ final GenericVnfs genericVnfs = new GenericVnfs();
+ genericVnfs.getGenericVnf().addAll(listOfGenericVnfs);
+ doReturn(Optional.of(genericVnfs)).when(aaiResourcesClient).get(eq(GenericVnfs.class),
MockitoHamcrest.argThat(new AaiResourceUriMatcher(
"/network/generic-vnfs?selflink=http%3A%2F%2Fvnfm%3A8080%2Fvnfs%2FmyTestVnfIdOnVnfm")));
@@ -176,23 +181,27 @@ public class Sol003LcnControllerTest {
controller.lcnVnfLcmOperationOccurrenceNotificationPost(vnfLcmOperationOccurrenceNotification);
assertEquals(HttpStatus.NO_CONTENT, response.getStatusCode());
- final ArgumentCaptor<Object> bodyArgument = ArgumentCaptor.forClass(Object.class);
- final ArgumentCaptor<AAIResourceUri> uriArgument = ArgumentCaptor.forClass(AAIResourceUri.class);
+ final ArgumentCaptor<Object> bodyArgument1 = ArgumentCaptor.forClass(Object.class);
+ final ArgumentCaptor<AAIResourceUri> uriArgument1 = ArgumentCaptor.forClass(AAIResourceUri.class);
- verify(aaiResourcesClient, timeout(1000).times(2)).update(uriArgument.capture(), bodyArgument.capture());
+ verify(aaiResourcesClient, timeout(1000)).update(uriArgument1.capture(), bodyArgument1.capture());
assertEquals("/network/generic-vnfs/generic-vnf/myTestVnfId",
- uriArgument.getAllValues().get(0).build().toString());
- final GenericVnf updatedGenericVnf = (GenericVnf) bodyArgument.getAllValues().get(0);
+ uriArgument1.getAllValues().get(0).build().toString());
+ final GenericVnf updatedGenericVnf = (GenericVnf) bodyArgument1.getAllValues().get(0);
assertEquals("10.10.10.10", updatedGenericVnf.getIpv4OamAddress());
assertEquals("Created", updatedGenericVnf.getOrchestrationStatus());
+ final ArgumentCaptor<Object> bodyArgument2 = ArgumentCaptor.forClass(Object.class);
+ final ArgumentCaptor<AAIResourceUri> uriArgument2 = ArgumentCaptor.forClass(AAIResourceUri.class);
+ verify(aaiResourcesClient, timeout(1000)).create(uriArgument2.capture(), bodyArgument2.capture());
+
assertEquals(
"/cloud-infrastructure/cloud-regions/cloud-region/" + CLOUD_OWNER + "/" + REGION + "/tenants/tenant/"
+ TENANT_ID + "/vservers/vserver/myVnfc1",
- uriArgument.getAllValues().get(1).build().toString());
+ uriArgument2.getAllValues().get(0).build().toString());
- final Vserver vserver = (Vserver) bodyArgument.getAllValues().get(1);
+ final Vserver vserver = (Vserver) bodyArgument2.getAllValues().get(0);
assertEquals("myVnfc1", vserver.getVserverId());
final Relationship relationship = vserver.getRelationshipList().getRelationship().get(0);
assertEquals("generic-vnf", relationship.getRelatedTo());
@@ -214,13 +223,17 @@ public class Sol003LcnControllerTest {
.andRespond(withSuccess(gson.toJson(vnfInstance), MediaType.APPLICATION_JSON));
mockRestServer.expect(requestTo(new URI("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm")))
- .andRespond(withStatus(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON));
+ .andRespond(withStatus(HttpStatus.NO_CONTENT).contentType(MediaType.APPLICATION_JSON));
final GenericVnf genericVnf = createGenericVnf("vnfmType1");
genericVnf.setSelflink("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm");
- final List<GenericVnf> genericVnfs = new ArrayList<>();
- genericVnfs.add(genericVnf);
- doReturn(Optional.of(genericVnfs)).when(aaiResourcesClient).get(eq(List.class),
+ final List<GenericVnf> listOfGenericVnfs = new ArrayList<>();
+ listOfGenericVnfs.add(genericVnf);
+ final GenericVnfs genericVnfs = new GenericVnfs();
+ genericVnfs.getGenericVnf().addAll(listOfGenericVnfs);
+ addRelationshipFromGenericVnfToVserver(genericVnf, "myVnfc1");
+
+ doReturn(Optional.of(genericVnfs)).when(aaiResourcesClient).get(eq(GenericVnfs.class),
MockitoHamcrest.argThat(new AaiResourceUriMatcher(
"/network/generic-vnfs?selflink=http%3A%2F%2Fvnfm%3A8080%2Fvnfs%2FmyTestVnfIdOnVnfm")));
@@ -310,6 +323,31 @@ public class Sol003LcnControllerTest {
return genericVnf;
}
+ private void addRelationshipFromGenericVnfToVserver(final GenericVnf genericVnf, final String vserverId) {
+ final Relationship relationshipToVserver = new Relationship();
+ relationshipToVserver.setRelatedTo("vserver");
+ final RelationshipData relationshipData1 = new RelationshipData();
+ relationshipData1.setRelationshipKey("vserver.vserver-id");
+ relationshipData1.setRelationshipValue(vserverId);
+ relationshipToVserver.getRelationshipData().add(relationshipData1);
+ final RelationshipData relationshipData2 = new RelationshipData();
+ relationshipData2.setRelationshipKey("cloud-region.cloud-owner");
+ relationshipData2.setRelationshipValue(CLOUD_OWNER);
+ relationshipToVserver.getRelationshipData().add(relationshipData2);
+ final RelationshipData relationshipData3 = new RelationshipData();
+ relationshipData3.setRelationshipKey("cloud-region.cloud-region-id");
+ relationshipData3.setRelationshipValue(REGION);
+ relationshipToVserver.getRelationshipData().add(relationshipData3);
+ final RelationshipData relationshipData4 = new RelationshipData();
+ relationshipData4.setRelationshipKey("tenant.tenant-id");
+ relationshipData4.setRelationshipValue(TENANT_ID);
+ relationshipToVserver.getRelationshipData().add(relationshipData4);
+
+ final RelationshipList relationshipList = new RelationshipList();
+ relationshipList.getRelationship().add(relationshipToVserver);
+ genericVnf.setRelationshipList(relationshipList);
+ }
+
private class AaiResourceUriMatcher extends BaseMatcher<AAIResourceUri> {
final String uriAsString;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
index 20a074b2ba..73a49e9c40 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
@@ -20,7 +20,21 @@
package org.onap.so.adapters.vnfmadapter.rest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.content;
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withBadRequest;
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
import com.google.gson.Gson;
+import java.net.URI;
+import java.util.Optional;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.junit.Before;
@@ -36,24 +50,23 @@ import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipData;
import org.onap.aai.domain.yang.RelationshipList;
+import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
+import org.onap.so.adapters.vnfmadapter.extclients.SdcPackageProvider;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201Links;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201LinksSelf;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmNotFoundException;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
import org.onap.vnfmadapter.v1.model.DeleteVnfResponse;
import org.onap.vnfmadapter.v1.model.OperationEnum;
import org.onap.vnfmadapter.v1.model.OperationStateEnum;
import org.onap.vnfmadapter.v1.model.QueryJobResponse;
-import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
-import org.onap.so.adapters.vnfmadapter.extclients.SdcPackageProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.*;
-import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmNotFoundException;
-import org.onap.so.client.aai.AAIResourcesClient;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
import org.onap.vnfmadapter.v1.model.Tenant;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
@@ -72,18 +85,6 @@ import org.springframework.web.client.RestTemplate;
import org.threeten.bp.LocalDateTime;
import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.ZoneOffset;
-import java.net.URI;
-import java.util.Optional;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
-import static org.springframework.test.web.client.match.MockRestRequestMatchers.content;
-import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
-import static org.springframework.test.web.client.response.MockRestResponseCreators.*;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
@@ -131,7 +132,7 @@ public class VnfmAdapterControllerTest {
setUpVimInMockAai();
final String expectedsubscriptionRequest =
- "{\"filter\":{\"vnfInstanceSubscriptionFilter\":{\"vnfInstanceIds\":[\"vnfId\"]},\"notificationTypes\":[\"VnfLcmOperationOccurrenceNotification\"]},\"callbackUri\":\"https://so-vnfm-adapter.onap:30406/so/vnfm-adapter/v1/lcn/VnfLcmOperationOccurrenceNotification\",\"authentication\":{\"authType\":[\"BASIC\"],\"paramsBasic\":{\"userName\":\"vnfm\",\"password\":\"$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke\"}}}";
+ "{\"filter\":{\"vnfInstanceSubscriptionFilter\":{\"vnfInstanceIds\":[\"vnfId\"]},\"notificationTypes\":[\"VnfLcmOperationOccurrenceNotification\"]},\"callbackUri\":\"https://so-vnfm-adapter.onap:30406/so/vnfm-adapter/v1/lcn/VnfLcmOperationOccurrenceNotification\",\"authentication\":{\"authType\":[\"BASIC\"],\"paramsBasic\":{\"userName\":\"vnfm\",\"password\":\"password1$\"}}}";
final InlineResponse2001 subscriptionResponse = new InlineResponse2001();
final InlineResponse201 createResponse = createCreateResponse();