summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java4
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java47
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java659
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java27
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java27
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java4
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java42
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java57
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java4
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java31
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackCreationException.java31
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackResultWrapper.java82
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackRollbackException.java31
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackStatusHandler.java36
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoCommonUtilsTest.java4
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsITTest.java219
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java620
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java8
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/StackStatusHandlerTest.java89
-rw-r--r--adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_Created.json2
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStateType.java12
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HostRoute.java6
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java10
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java8
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java19
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java14
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/resources/VfRequest-marshalled-with-complex-object.xml16
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql373
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql23
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql6
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.0__AddNamingPolicyToService.sql8
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java20
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java20
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java31
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java12
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java3
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java56
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java7
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java310
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java39
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java73
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java13
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java9
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeException.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java33
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientException.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV2ClientImpl.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV3ClientImpl.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactory.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduStatus.java12
-rw-r--r--adapters/mso-openstack-adapters/src/main/resources/application-local.yaml2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java20
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java20
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java30
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java47
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java20
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml2
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/MulticloudResponse_Stack_Create2.json15
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json30
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json30
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json2
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json3
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/application-test.yaml2
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/logback-test.xml14
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/schema.sql4
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java5
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.10__Add_Column_IS_DATA_INTERNAL.sql3
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.9__Add_Column_Ext_System_Error_Source.sql4
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/RequestsAdapterBase.java20
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java9
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java3
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java13
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java5
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java5
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java21
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java9
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java13
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java9
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java15
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java7
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java5
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java13
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java10
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java156
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java9
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java4
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java3
102 files changed, 2689 insertions, 1380 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java
index 567f849b36..b0c2d9430a 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java
@@ -76,7 +76,7 @@ public class CinderClientImpl extends MsoCommonUtils {
// list is set to false, otherwise an invalid URL is appended
OpenStackRequest<Volumes> request =
cinderClient.volumes().list(false).queryParam("limit", limit).queryParam("marker", marker);
- return executeAndRecordOpenstackRequest(request);
+ return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
logger.error("Error building Cinder Client", e);
throw new CinderClientException("Error building Cinder Client", e);
@@ -90,7 +90,7 @@ public class CinderClientImpl extends MsoCommonUtils {
Cinder cinderClient = getCinderClient(cloudSiteId, tenantId);
// list is set to false, otherwise an invalid URL is appended
OpenStackRequest<Volume> request = cinderClient.volumes().show(volumeId);
- return executeAndRecordOpenstackRequest(request);
+ return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
logger.error("Error building Cinder Client", e);
throw new CinderClientException("Error building Cinder Client", e);
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java
index 57faaac717..698b605be3 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java
@@ -74,7 +74,7 @@ public class GlanceClientImpl extends MsoCommonUtils {
// list is set to false, otherwise an invalid URL is appended
OpenStackRequest<Images> request = glanceClient.images().list(false).queryParam("visibility", visibility)
.queryParam("limit", limit).queryParam("marker", marker).queryParam("name", name);
- return executeAndRecordOpenstackRequest(request);
+ return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
logger.error("Error building Glance Client", e);
throw new GlanceClientException("Error building Glance Client", e);
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
index a6a2f8402f..576784ae3e 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
@@ -98,19 +98,23 @@ public class MsoCommonUtils {
*/
protected <T> T executeAndRecordOpenstackRequest(OpenStackRequest<T> request) {
+ return executeAndRecordOpenstackRequest(request, true);
+ }
- String requestType;
- if (request.getClass().getEnclosingClass() != null) {
- requestType =
- request.getClass().getEnclosingClass().getSimpleName() + "." + request.getClass().getSimpleName();
- } else {
- requestType = request.getClass().getSimpleName();
- }
+ /*
+ * Method to execute an Openstack command and track its execution time. For the metrics log, a category of
+ * "Openstack" is used along with a sub-category that identifies the specific call (using the real
+ * openstack-java-sdk classname of the OpenStackRequest<T> parameter). boolean isNoRetry - true if No retry; and
+ * false if Retry.
+ */
+ protected <T> T executeAndRecordOpenstackRequest(OpenStackRequest<T> request, boolean shouldRetry) {
int retryDelay = poConfig.getRetryDelay();
int retryCount = poConfig.getRetryCount();
String retryCodes = poConfig.getRetryCodes();
-
+ if (!shouldRetry) {
+ retryCodes = null;
+ }
// Run the actual command. All exceptions will be propagated
while (true) {
try {
@@ -127,8 +131,8 @@ public class MsoCommonUtils {
retryCount--;
retry = true;
logger.debug(
- "OpenStackResponseException ResponseCode: {} request:{} Retry indicated. Attempts remaining:{}",
- code, requestType, retryCount);
+ "OpenStackResponseException ResponseCode: {} Retry indicated. Attempts remaining:{}",
+ code, retryCount);
break;
}
} catch (NumberFormatException e1) {
@@ -152,7 +156,7 @@ public class MsoCommonUtils {
// Connection to Openstack failed
if (retryCount > 0) {
retryCount--;
- logger.debug(" request: {} Retry indicated. Attempts remaining:{}", requestType, retryCount);
+ logger.debug("Retry indicated. Attempts remaining:{}", retryCount);
try {
Thread.sleep(retryDelay * 1000L);
} catch (InterruptedException e1) {
@@ -223,40 +227,29 @@ public class MsoCommonUtils {
try {
// Failed Heat calls return an Explanation entity body.
Explanation explanation = re.getResponse().getErrorEntity(Explanation.class);
- logger.error("{} {} Exception - Openstack Error on {} : {}", MessageEnum.RA_CONNECTION_EXCEPTION,
- ErrorCode.DataError.getValue(), context, explanation.toString());
+ logger.error("Exception - Openstack Error on {} : {}", context, explanation);
String fullError = explanation.getExplanation() + ", error.type=" + explanation.getError().getType()
+ ", error.message=" + explanation.getError().getMessage();
- logger.debug(fullError);
- me = new MsoOpenstackException(explanation.getCode(), explanation.getTitle(),
- // explanation.getExplanation ());
- fullError);
+ logger.error(fullError);
+ me = new MsoOpenstackException(explanation.getCode(), explanation.getTitle(), fullError);
} catch (Exception e2) {
// Couldn't parse the body as an "Explanation". Report the original HTTP error.
logger.error("{} {} Exception - HTTP Error on {}: {}, ", MessageEnum.RA_CONNECTION_EXCEPTION,
ErrorCode.DataError.getValue(), context, re.getStatus(), e.getMessage(), e2);
- me = new MsoOpenstackException(re.getStatus(), re.getMessage(), "");
+ me = new MsoOpenstackException(re.getStatus(), re.getMessage(), re.getMessage());
}
// Add the context of the error
me.addContext(context);
- // Generate an alarm for 5XX and higher errors.
- if (re.getStatus() >= 500) {
-
- }
} else if (e instanceof OpenStackConnectException) {
OpenStackConnectException ce = (OpenStackConnectException) e;
-
me = new MsoIOException(ce.getMessage());
me.addContext(context);
-
// Generate an alarm for all connection errors.
-
logger.error("{} {} Openstack Heat connection error on {}: ", MessageEnum.RA_CONNECTION_EXCEPTION,
ErrorCode.DataError.getValue(), context, e);
}
-
return me;
}
@@ -435,7 +428,7 @@ public class MsoCommonUtils {
/**
- * Gets the Nova client
+ * Gets the Keystone Authorization
*
* @param cloudSite the cloud site
* @param tenantId the tenant id
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 376ed20ed0..7174bc0e31 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
@@ -31,6 +31,8 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vdu.CloudInfo;
import org.onap.so.adapters.vdu.PluginAction;
@@ -43,15 +45,11 @@ import org.onap.so.adapters.vdu.VduPlugin;
import org.onap.so.adapters.vdu.VduStateType;
import org.onap.so.adapters.vdu.VduStatus;
import org.onap.so.cloud.CloudConfig;
-import org.onap.so.cloud.authentication.AuthenticationMethodFactory;
import org.onap.so.cloud.authentication.KeystoneAuthHolder;
-import org.onap.so.cloud.authentication.KeystoneV3Authentication;
-import org.onap.so.cloud.authentication.ServiceEndpointNotFoundException;
import org.onap.so.db.catalog.beans.CloudIdentity;
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;
@@ -59,15 +57,12 @@ import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
-import org.onap.so.openstack.exceptions.MsoAdapterException;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
-import org.onap.so.openstack.exceptions.MsoIOException;
import org.onap.so.openstack.exceptions.MsoOpenstackException;
import org.onap.so.openstack.exceptions.MsoStackAlreadyExists;
import org.onap.so.openstack.exceptions.MsoTenantNotFound;
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;
@@ -77,28 +72,31 @@ import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.base.Strings;
import com.woorea.openstack.base.client.OpenStackConnectException;
import com.woorea.openstack.base.client.OpenStackRequest;
import com.woorea.openstack.base.client.OpenStackResponseException;
import com.woorea.openstack.heat.Heat;
import com.woorea.openstack.heat.model.CreateStackParam;
import com.woorea.openstack.heat.model.Events;
+import com.woorea.openstack.heat.model.Resource;
import com.woorea.openstack.heat.model.Resources;
import com.woorea.openstack.heat.model.Stack;
import com.woorea.openstack.heat.model.Stack.Output;
import com.woorea.openstack.heat.model.Stacks;
-import com.woorea.openstack.keystone.Keystone;
-import com.woorea.openstack.keystone.model.Access;
-import com.woorea.openstack.keystone.model.Authentication;
-import com.woorea.openstack.keystone.utils.KeystoneUtils;
+
@Primary
@Component
public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
- private static final String TOKEN_AUTH = "TokenAuth";
+ private static final String CREATE_COMPLETE = "CREATE_COMPLETE";
+
+ private static final String DELETE_COMPLETE = "DELETE_COMPLETE";
+
+ private static final String DELETE_IN_PROGRESS = "DELETE_IN_PROGRESS";
- private static final String QUERY_ALL_STACKS = "QueryAllStacks";
+ private static final String CREATE_IN_PROGRESS = "CREATE_IN_PROGRESS";
private static final String DELETE_STACK = "DeleteStack";
@@ -118,29 +116,25 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
private Environment environment;
@Autowired
- private AuthenticationMethodFactory authenticationMethodFactory;
-
- @Autowired
- private MsoTenantUtilsFactory tenantUtilsFactory;
-
- @Autowired
- private KeystoneV3Authentication keystoneV3Authentication;
-
- @Autowired
RequestsDbClient requestDBClient;
@Autowired
StackStatusHandler statusHandler;
+ @Autowired
+ NovaClientImpl novaClient;
+
private static final Logger logger = LoggerFactory.getLogger(MsoHeatUtils.class);
// Properties names and variables (with default values)
protected String createPollIntervalProp = "org.onap.so.adapters.po.pollInterval";
private String deletePollIntervalProp = "org.onap.so.adapters.po.pollInterval";
private String deletePollTimeoutProp = "org.onap.so.adapters.po.pollTimeout";
+ private String pollingMultiplierProp = "org.onap.so.adapters.po.pollMultiplier";
protected static final String CREATE_POLL_INTERVAL_DEFAULT = "15";
private static final String DELETE_POLL_INTERVAL_DEFAULT = "15";
+ private static final String pollingMultiplierDefault = "60";
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
@@ -225,6 +219,25 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
int timeoutMinutes, String environment, Map<String, Object> files, Map<String, Object> heatFiles,
boolean backout) throws MsoException {
+ stripMultiCloudInputs(stackInputs);
+ CreateStackParam createStack =
+ createStackParam(stackName, heatTemplate, stackInputs, timeoutMinutes, environment, files, heatFiles);
+ Stack currentStack = createStack(createStack, cloudSiteId, tenantId);
+ currentStack.setStackName(stackName);
+ if (pollForCompletion) {
+ currentStack =
+ processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout, currentStack, createStack, true);
+ } else {
+ currentStack =
+ queryHeatStack(currentStack.getStackName() + "/" + currentStack.getId(), cloudSiteId, tenantId);
+ }
+ return new StackInfoMapper(currentStack).map();
+ }
+
+ /**
+ * @param stackInputs
+ */
+ protected void stripMultiCloudInputs(Map<String, ?> stackInputs) {
// Take out the multicloud inputs, if present.
for (String key : MsoMulticloudUtils.MULTICLOUD_INPUTS) {
if (stackInputs.containsKey(key)) {
@@ -234,36 +247,20 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
}
}
}
+ }
- CreateStackParam stack =
- createStackParam(stackName, heatTemplate, stackInputs, timeoutMinutes, environment, files, heatFiles);
-
- // Obtain the cloud site information where we will create the stack
- CloudSite cloudSite =
- cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- 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("Ready to Create Stack ({}) with input params: {}", heatTemplate, stackInputs);
-
- Stack heatStack = null;
+ protected Stack createStack(CreateStackParam stack, String cloudSiteId, String tenantId) throws MsoException {
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()));
- heatStack = executeAndRecordOpenstackRequest(request);
+ OpenStackRequest<Stack> request = getHeatClient(cloudSiteId, tenantId).getStacks().create(stack);
+ saveStackRequest(stack, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID), stack.getStackName());
+ return executeAndRecordOpenstackRequest(request);
} catch (OpenStackResponseException e) {
if (e.getStatus() == 409) {
- MsoStackAlreadyExists me = new MsoStackAlreadyExists(stackName, tenantId, cloudSiteId);
+ MsoStackAlreadyExists me = new MsoStackAlreadyExists(stack.getStackName(), tenantId, cloudSiteId);
me.addContext(CREATE_STACK);
throw me;
} else {
- logger.debug("ERROR STATUS = {},\n{}\n{}", e.getStatus(), e.getMessage(), e.getLocalizedMessage());
+ logger.error("ERROR STATUS = {},\n{}\n{}", e.getStatus(), e.getMessage(), e.getLocalizedMessage());
throw heatExceptionToMsoException(e, CREATE_STACK);
}
} catch (OpenStackConnectException e) {
@@ -271,242 +268,158 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
} catch (RuntimeException e) {
throw runtimeExceptionToMsoException(e, CREATE_STACK);
}
+ }
- // Subsequent access by the canonical name "<stack name>/<stack-id>".
- // Otherwise, simple query by name returns a 302 redirect.
- // NOTE: This is specific to the v1 Orchestration API.
- String canonicalName = stackName + "/" + heatStack.getId();
- if (pollForCompletion) {
- heatStack = pollStackForCompletion(cloudSiteId, tenantId, stackName, timeoutMinutes, backout, heatClient,
- heatStack, canonicalName);
+ protected Stack processCreateStack(String cloudSiteId, String tenantId, int timeoutMinutes, boolean backout,
+ Stack heatStack, CreateStackParam stackCreate, boolean keyPairCleanUp) throws MsoException {
+ Stack latestStack = null;
+ try {
+ latestStack = pollStackForStatus(timeoutMinutes, heatStack, CREATE_IN_PROGRESS, cloudSiteId, tenantId);
+ } catch (MsoException me) {
+ logger.error("Exception in Create Stack", me);
+ }
+ return postProcessStackCreate(latestStack, backout, timeoutMinutes, keyPairCleanUp, cloudSiteId, tenantId,
+ stackCreate);
+ }
+
+ protected Stack postProcessStackCreate(Stack stack, boolean backout, int timeoutMinutes, boolean cleanUpKeyPair,
+ String cloudSiteId, String tenantId, CreateStackParam stackCreate) throws MsoException {
+ if (stack == null) {
+ throw new StackCreationException("Unknown Error in Stack Creation");
} else {
- // Get initial status, since it will have been null after the create.
- heatStack = queryHeatStack(heatClient, canonicalName);
- logger.debug(heatStack.getStackStatus());
+ logger.info("Performing post processing backout: {} cleanUpKeyPair: {}, stack {}", backout, cleanUpKeyPair,
+ stack);
+ if (!CREATE_COMPLETE.equals(stack.getStackStatus())) {
+ if (cleanUpKeyPair && !Strings.isNullOrEmpty(stack.getStackStatusReason())
+ && isKeyPairFailure(stack.getStackStatusReason())) {
+ return handleKeyPairConflict(cloudSiteId, tenantId, stackCreate, timeoutMinutes, backout, stack);
+ }
+ if (!backout) {
+ logger.info("Status is not CREATE_COMPLETE, stack deletion suppressed");
+ throw new StackCreationException("Stack rollback suppressed, stack not deleted");
+ } else {
+ logger.info("Status is not CREATE_COMPLETE, stack deletion will be executed");
+ String errorMessage = "Stack Creation Failed Openstack Status: " + stack.getStackStatus()
+ + " Status Reason: " + stack.getStackStatusReason();
+ try {
+ Stack deletedStack =
+ handleUnknownCreateStackFailure(stack, timeoutMinutes, cloudSiteId, tenantId);
+ errorMessage = errorMessage + " , Rollback of Stack Creation completed with status: "
+ + deletedStack.getStackStatus() + " Status Reason: "
+ + deletedStack.getStackStatusReason();
+ } catch (MsoException e) {
+ logger.error("Sync Error Deleting Stack during rollback", e);
+ if (e instanceof StackRollbackException) {
+ errorMessage = errorMessage + e.getMessage();
+ } else {
+ errorMessage = errorMessage + " , Rollback of Stack Creation failed with sync error: "
+ + e.getMessage();
+ }
+ }
+ throw new StackCreationException(errorMessage);
+ }
+ } else {
+ return stack;
+ }
+ }
+ }
+
+ protected Stack pollStackForStatus(int timeoutMinutes, Stack stack, String stackStatus, String cloudSiteId,
+ String tenantId) throws MsoException {
+ int pollingFrequency =
+ Integer.parseInt(this.environment.getProperty(createPollIntervalProp, CREATE_POLL_INTERVAL_DEFAULT));
+ int pollingMultiplier =
+ Integer.parseInt(this.environment.getProperty(pollingMultiplierProp, pollingMultiplierDefault));
+ int numberOfPollingAttempts = Math.floorDiv((timeoutMinutes * pollingMultiplier), pollingFrequency);
+ Heat heatClient = getHeatClient(cloudSiteId, tenantId);
+ Stack latestStack = null;
+ while (true) {
+ latestStack = queryHeatStack(heatClient, stack.getStackName() + "/" + stack.getId());
+ statusHandler.updateStackStatus(latestStack);
+ logger.debug("Polling: {} ({})", latestStack.getStackStatus(), latestStack.getStackName());
+ if (stackStatus.equals(latestStack.getStackStatus())) {
+ if (numberOfPollingAttempts <= 0) {
+ logger.error("Polling of stack timed out with Status: {}", latestStack.getStackStatus());
+ return latestStack;
+ }
+ sleep(pollingFrequency * 1000L);
+ numberOfPollingAttempts -= 1;
+ } else {
+ return latestStack;
+ }
}
- return new StackInfoMapper(heatStack).map();
}
- private void saveStackRequest(OpenStackRequest<Stack> request, String requestId, String stackName) {
+ protected void saveStackRequest(CreateStackParam request, String requestId, String stackName) {
try {
ObjectMapper mapper = new ObjectMapper();
InfraActiveRequests foundRequest = requestDBClient.getInfraActiveRequestbyRequestId(requestId);
- String stackRequest = mapper.writeValueAsString(request.entity());
+ String stackRequest = mapper.writeValueAsString(request.getParameters());
CloudApiRequests cloudReq = new CloudApiRequests();
cloudReq.setCloudIdentifier(stackName);
cloudReq.setRequestBody(stackRequest);
cloudReq.setRequestId(requestId);
- foundRequest.getCloudApiRequests().add(cloudReq);
+ CloudApiRequests foundCloudReq = foundRequest.getCloudApiRequests().stream()
+ .filter(cloudReqToFind -> stackName.equals(cloudReq.getCloudIdentifier())).findAny().orElse(null);
+ if (foundCloudReq != null) {
+ foundCloudReq.setRequestBody(stackRequest);
+ } else {
+ 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, CREATE_POLL_INTERVAL_DEFAULT));
- int pollTimeout = (timeoutMinutes * 60) + createPollInterval;
- int deletePollInterval = createPollInterval;
- int deletePollTimeout = pollTimeout;
- boolean createTimedOut = false;
- StringBuilder stackErrorStatusReason = new StringBuilder("");
- logger.debug("createPollInterval={}, pollTimeout={}", createPollInterval, pollTimeout);
-
- while (true) {
- try {
- heatStack = queryHeatStack(heatClient, canonicalName);
- statusHandler.updateStackStatus(heatStack, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
- logger.debug("{} ({})", heatStack.getStackStatus(), canonicalName);
- try {
- logger.debug("Current stack {}", this.getOutputsAsStringBuilder(heatStack).toString());
- } catch (Exception e) {
- logger.debug("an error occurred trying to print out the current outputs of the stack", e);
- }
-
- if ("CREATE_IN_PROGRESS".equals(heatStack.getStackStatus())) {
- if (pollTimeout <= 0) {
- logger.error("{} Cloud site: {} Tenant: {} Stack: {} Stack status: {} {} Create stack timeout",
- MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName,
- heatStack.getStackStatus(), ErrorCode.AvailabilityError.getValue());
- createTimedOut = true;
- break;
- }
- sleep(createPollInterval * 1000L);
- pollTimeout -= createPollInterval;
- logger.debug("pollTimeout remaining: {}", pollTimeout);
- } else {
- stackErrorStatusReason.append(
- "Stack error (" + heatStack.getStackStatus() + "): " + heatStack.getStackStatusReason());
- break;
- }
- } catch (MsoException me) {
- // Cannot query the stack status. Something is wrong.
- // Try to roll back the stack
- if (!backout) {
- logger.warn("{} Exception in Create Stack, stack deletion suppressed {}",
- MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue());
- } else {
- try {
- logger.debug(
- "Create Stack error - unable to query for stack status - attempting to delete stack: {}"
- + " - This will likely fail and/or we won't be able to query to see if delete worked",
- canonicalName);
- OpenStackRequest<Void> request = heatClient.getStacks().deleteByName(canonicalName);
- executeAndRecordOpenstackRequest(request);
- boolean deleted = false;
- while (!deleted) {
- try {
- heatStack = queryHeatStack(heatClient, canonicalName);
- statusHandler.updateStackStatus(heatStack, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
- if (heatStack != null) {
- logger.debug(heatStack.getStackStatus());
- if ("DELETE_IN_PROGRESS".equals(heatStack.getStackStatus())) {
- if (deletePollTimeout <= 0) {
- logger.error(
- "{} Cloud site: {} Tenant: {} Stack: {} Stack status: {} {} Rollback: DELETE stack timeout",
- MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId,
- stackName, heatStack.getStackStatus(),
- ErrorCode.AvailabilityError.getValue());
- break;
- } else {
- sleep(deletePollInterval * 1000L);
- deletePollTimeout -= deletePollInterval;
- }
- } else if ("DELETE_COMPLETE".equals(heatStack.getStackStatus())) {
- logger.debug("DELETE_COMPLETE for {}", canonicalName);
- deleted = true;
- continue;
- } else {
- // got a status other than DELETE_IN_PROGRESS or DELETE_COMPLETE - so break and
- // evaluate
- break;
- }
- } else {
- // assume if we can't find it - it's deleted
- logger.debug("heatStack returned null - assume the stack {} has been deleted",
- canonicalName);
- deleted = true;
- continue;
- }
-
- } catch (Exception e3) {
- // Just log this one. We will report the original exception.
- 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(EXCEPTION_ROLLING_BACK_STACK, MessageEnum.RA_CREATE_STACK_ERR,
- ErrorCode.BusinessProcesssError.getValue(), e2);
- }
- }
+ protected boolean isKeyPairFailure(String errorMessage) {
+ return Pattern.compile(".*Key pair.*already exists.*").matcher(errorMessage).matches();
+ }
- // Propagate the original exception from Stack Query.
- me.addContext(CREATE_STACK);
- throw me;
- }
+ protected Stack handleUnknownCreateStackFailure(Stack stack, int timeoutMinutes, String cloudSiteId,
+ String tenantId) throws MsoException {
+ if (stack != null && !Strings.isNullOrEmpty(stack.getStackName()) && !Strings.isNullOrEmpty(stack.getId())) {
+ OpenStackRequest<Void> request = getHeatClient(cloudSiteId, tenantId).getStacks()
+ .deleteByName(stack.getStackName() + "/" + stack.getId());
+ executeAndRecordOpenstackRequest(request);
+ Stack currentStack = pollStackForStatus(timeoutMinutes, stack, DELETE_IN_PROGRESS, cloudSiteId, tenantId);
+ postProcessStackDelete(currentStack);
+ return currentStack;
+ } else {
+ throw new StackCreationException("Cannot Find Stack Name or Id");
}
+ }
- if (!"CREATE_COMPLETE".equals(heatStack.getStackStatus())) {
- logger.error("{} Create Stack error: Polling complete with non-success status: {}, {} {} ",
- MessageEnum.RA_CREATE_STACK_ERR, heatStack.getStackStatus(), heatStack.getStackStatusReason(),
- ErrorCode.BusinessProcesssError.getValue());
+ protected void postProcessStackDelete(Stack stack) throws MsoException {
+ logger.info("Performing post processing on delete stack {}", stack);
+ if (stack != null && !Strings.isNullOrEmpty(stack.getStackStatus())) {
+ if (!DELETE_COMPLETE.equals(stack.getStackStatus()))
+ throw new StackRollbackException("Stack Deletion completed with status: " + stack.getStackStatus()
+ + " Status Reason: " + stack.getStackStatusReason());
+ } else {
+ throw new StackRollbackException("Cannot Find Stack Name or Id");
+ }
+ }
- // Rollback the stack creation, since it is in an indeterminate state.
- if (!backout) {
- logger.warn(
- "{} Create Stack errored, stack deletion suppressed {} Create Stack error, stack deletion suppressed",
- MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue());
- } else {
- try {
- logger.debug("Create Stack errored - attempting to DELETE stack: {}", canonicalName);
- logger.debug("deletePollInterval={}, deletePollTimeout={}", deletePollInterval, deletePollTimeout);
- OpenStackRequest<Void> request = heatClient.getStacks().deleteByName(canonicalName);
- executeAndRecordOpenstackRequest(request);
- boolean deleted = false;
- while (!deleted) {
- try {
- heatStack = queryHeatStack(heatClient, canonicalName);
- if (heatStack != null) {
- logger.debug("{} ({})", heatStack.getStackStatus(), canonicalName);
- if ("DELETE_IN_PROGRESS".equals(heatStack.getStackStatus())) {
- if (deletePollTimeout <= 0) {
- logger.error(
- "{} Cloud site: {} Tenant: {} Stack: {} Stack status: {} {} Rollback: DELETE stack timeout",
- MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName,
- heatStack.getStackStatus(), ErrorCode.AvailabilityError.getValue());
- break;
- } else {
- sleep(deletePollInterval * 1000L);
- deletePollTimeout -= deletePollInterval;
- logger.debug("deletePollTimeout remaining: {}", deletePollTimeout);
- }
- } else if ("DELETE_COMPLETE".equals(heatStack.getStackStatus())) {
- logger.debug("DELETE_COMPLETE for {}", canonicalName);
- deleted = true;
- continue;
- } else if ("DELETE_FAILED".equals(heatStack.getStackStatus())) {
- // Warn about this (?) - but still throw the original exception
- logger.warn(
- "{} Create Stack errored, stack deletion FAILED {} Create Stack error, stack deletion FAILED",
- MessageEnum.RA_CREATE_STACK_ERR,
- ErrorCode.BusinessProcesssError.getValue());
- logger.debug(
- "Stack deletion FAILED on a rollback of a create - {}, status={}, reason={}",
- canonicalName, heatStack.getStackStatus(),
- heatStack.getStackStatusReason());
- break;
- } else {
- // got a status other than DELETE_IN_PROGRESS or DELETE_COMPLETE - so break and
- // evaluate
- break;
- }
- } else {
- // assume if we can't find it - it's deleted
- logger.debug("heatStack returned null - assume the stack {} has been deleted",
- canonicalName);
- deleted = true;
- continue;
- }
-
- } catch (MsoException me2) {
- // We got an exception on the delete - don't throw this exception - throw the original -
- // just log.
- logger.debug("Exception thrown trying to delete {} on a create->rollback: {} ",
- canonicalName, me2.getContextMessage(), me2);
- logger.warn("{} Create Stack errored, then stack deletion FAILED - exception thrown {} {}",
- MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(),
- me2.getContextMessage());
- }
+ protected Stack handleKeyPairConflict(String cloudSiteId, String tenantId, CreateStackParam stackCreate,
+ int timeoutMinutes, boolean backout, Stack stack) throws MsoException {
+ logger.info("Keypair conflict found on stack, attempting to clean up");
- } // end while !deleted
- StringBuilder errorContextMessage;
- if (createTimedOut) {
- errorContextMessage = new StringBuilder("Stack Creation Timeout");
- } else {
- errorContextMessage = stackErrorStatusReason;
- }
- if (deleted) {
- errorContextMessage.append(" - stack successfully deleted");
- } else {
- errorContextMessage.append(" - encountered an error trying to delete the stack");
- }
- } catch (Exception e2) {
- // shouldn't happen - but handle
- logger.error(EXCEPTION_ROLLING_BACK_STACK, MessageEnum.RA_CREATE_STACK_ERR,
- ErrorCode.BusinessProcesssError.getValue(), e2);
- }
+ Resources resources = queryStackResources(cloudSiteId, tenantId, stackCreate.getStackName(), 2);
+ List<Resource> keyPairs = resources.getList().stream()
+ .filter(p -> "OS::Nova::KeyPair".equalsIgnoreCase(p.getType())).collect(Collectors.toList());
+ keyPairs.stream().forEach(keyPair -> {
+ try {
+ novaClient.deleteKeyPair(cloudSiteId, tenantId, keyPair.getLogicalResourceId());
+ } catch (MsoCloudSiteNotFound | NovaClientException e) {
+ logger.warn("Could not delete keypair", e);
}
- MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString());
- me.addContext(CREATE_STACK);
- throw me;
- }
- return heatStack;
+ });
+ handleUnknownCreateStackFailure(stack, timeoutMinutes, cloudSiteId, tenantId);
+ Stack newStack = createStack(stackCreate, cloudSiteId, tenantId);
+ newStack.setStackName(stackCreate.getStackName());
+ return processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout, newStack, stackCreate, false);
}
/**
@@ -523,19 +436,9 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
public StackInfo queryStack(String cloudSiteId, String cloudOwner, String tenantId, String stackName)
throws MsoException {
logger.debug("Query HEAT stack: {} in tenant {}", stackName, tenantId);
-
- // 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());
-
- // 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());
- }
+ heatClient = getHeatClient(cloudSiteId, tenantId);
} catch (MsoTenantNotFound e) {
// Tenant doesn't exist, so stack doesn't either
logger.debug("Tenant with id " + tenantId + "not found.", e);
@@ -583,11 +486,9 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
*/
public StackInfo deleteStack(String tenantId, String cloudOwner, String cloudSiteId, String stackName,
boolean pollForCompletion) throws MsoException {
- CloudSite cloudSite =
- cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
Heat heatClient = null;
try {
- heatClient = getHeatClient(cloudSite, tenantId);
+ heatClient = getHeatClient(cloudSiteId, tenantId);
} catch (MsoTenantNotFound e) {
logger.debug("Tenant with id " + tenantId + "not found.", e);
return new StackInfo(stackName, HeatStatus.NOTFOUND);
@@ -600,7 +501,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
// OK if stack not found, perform a query first
Stack heatStack = queryHeatStack(heatClient, stackName);
- if (heatStack == null || "DELETE_COMPLETE".equals(heatStack.getStackStatus())) {
+ if (heatStack == null || DELETE_COMPLETE.equals(heatStack.getStackStatus())) {
// Not found. Return a StackInfo with status NOTFOUND
return new StackInfo(stackName, HeatStatus.NOTFOUND);
}
@@ -637,16 +538,16 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
// Requery the stack for current status.
// It will probably still exist with "DELETE_IN_PROGRESS" status.
heatStack = queryHeatStack(heatClient, canonicalName);
- statusHandler.updateStackStatus(heatStack, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ statusHandler.updateStackStatus(heatStack);
if (pollForCompletion) {
int pollInterval = Integer
.parseInt(this.environment.getProperty(deletePollIntervalProp, "" + DELETE_POLL_INTERVAL_DEFAULT));
int pollTimeout = Integer
.parseInt(this.environment.getProperty(deletePollTimeoutProp, "" + DELETE_POLL_INTERVAL_DEFAULT));
- statusHandler.updateStackStatus(heatStack, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ statusHandler.updateStackStatus(heatStack);
// When querying by canonical name, Openstack returns DELETE_COMPLETE status
// instead of "404" (which would result from query by stack name).
- while (heatStack != null && !"DELETE_COMPLETE".equals(heatStack.getStackStatus())) {
+ while (heatStack != null && !DELETE_COMPLETE.equals(heatStack.getStackStatus())) {
logger.debug("Stack status: {}", heatStack.getStackStatus());
if ("DELETE_FAILED".equals(heatStack.getStackStatus())) {
@@ -695,58 +596,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
}
/**
- * Query for all stacks in a tenant site. This call will return a List of StackInfo objects, one for each deployed
- * stack.
- *
- * Note that this is limited to a single site. To ensure that a tenant is truly empty would require looping across
- * all tenant endpoints.
- *
- * @param tenantId The Openstack ID of the tenant to query
- * @param cloudSiteId The cloud identifier (may be a region) in which to query.
- * @return A List of StackInfo objects
- * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception.
- * @throws MsoCloudSiteNotFound
- */
- public List<StackInfo> queryAllStacks(String tenantId, String cloudSiteId) throws MsoException {
- // Obtain the cloud site information where we will create the stack
- CloudSite cloudSite =
- cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId)
- Heat heatClient = getHeatClient(cloudSite, tenantId);
-
- try {
- OpenStackRequest<Stacks> request = heatClient.getStacks().list();
- Stacks stacks = executeAndRecordOpenstackRequest(request);
-
- List<StackInfo> stackList = new ArrayList<>();
-
- // Not sure if returns an empty list or null if no stacks exist
- if (stacks != null) {
- for (Stack stack : stacks) {
- stackList.add(new StackInfoMapper(stack).map());
- }
- }
-
- return stackList;
- } catch (OpenStackResponseException e) {
- if (e.getStatus() == 404) {
- // Not sure if this can happen, but return an empty list
- logger.debug("queryAllStacks - stack not found: ");
- return new ArrayList<>();
- } else {
- // Convert the OpenStackResponseException to an MsoOpenstackException
- throw heatExceptionToMsoException(e, QUERY_ALL_STACKS);
- }
- } catch (OpenStackConnectException e) {
- // Error connecting to Openstack instance. Convert to an MsoException
- throw heatExceptionToMsoException(e, QUERY_ALL_STACKS);
- } catch (RuntimeException e) {
- // Catch-all
- throw runtimeExceptionToMsoException(e, QUERY_ALL_STACKS);
- }
- }
-
- /**
* Validate parameters to be passed to Heat template. This method performs three functions: 1. Apply default values
* to parameters which have them defined 2. Report any required parameters that are missing. This will generate an
* exception in the caller, since stack create/update operations would fail. 3. Report and remove any extraneous
@@ -802,8 +651,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
return updatedParams;
}
- // ---------------------------------------------------------------
- // PRIVATE FUNCTIONS FOR USE WITHIN THIS CLASS
/**
* Get a Heat client for the Openstack Identity service. This requires a 'member'-level userId + password, which
@@ -815,76 +662,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
*
* @return an authenticated Heat object
*/
- public Heat getHeatClient(CloudSite cloudSite, String tenantId) throws MsoException {
- String cloudId = cloudSite.getId();
- // For DCP/LCP, the region should be the cloudId.
- String region = cloudSite.getRegionId();
-
- // Obtain an MSO token for the tenant
- CloudIdentity cloudIdentity = cloudSite.getIdentityService();
- 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;
- try {
- if (ServerType.KEYSTONE.equals(cloudIdentity.getIdentityServerType())) {
- Keystone keystoneTenantClient = new Keystone(keystoneUrl);
- Access access = null;
-
- Authentication credentials = authenticationMethodFactory.getAuthenticationFor(cloudIdentity);
-
- OpenStackRequest<Access> request =
- keystoneTenantClient.tokens().authenticate(credentials).withTenantId(tenantId);
-
- access = executeAndRecordOpenstackRequest(request);
-
- try {
- logger.debug("access={}", access.toString());
- heatUrl = KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "orchestration", region,
- "public");
- logger.debug("heatUrl={}, region={}", heatUrl, region);
- } catch (RuntimeException e) {
- // This comes back for not found (probably an incorrect region ID)
- String error = "AIC did not match an orchestration service for: region=" + region + ",cloud="
- + cloudIdentity.getIdentityUrl();
- throw new MsoAdapterException(error, e);
- }
- tokenId = access.getToken().getId();
- } else if (ServerType.KEYSTONE_V3.equals(cloudIdentity.getIdentityServerType())) {
- try {
- KeystoneAuthHolder holder = keystoneV3Authentication.getToken(cloudSite, tenantId, "orchestration");
- tokenId = holder.getId();
- heatUrl = holder.getServiceUrl();
- } catch (ServiceEndpointNotFoundException e) {
- // This comes back for not found (probably an incorrect region ID)
- String error = "cloud did not match an orchestration service for: region=" + region + ",cloud="
- + cloudIdentity.getIdentityUrl();
- throw new MsoAdapterException(error, e);
- }
- }
- } catch (OpenStackResponseException e) {
- if (e.getStatus() == 401) {
- // Authentication error.
- String error = "Authentication Failure: tenant=" + tenantId + ",cloud=" + cloudIdentity.getId();
-
- throw new MsoAdapterException(error);
- } else {
- throw keystoneErrorToMsoException(e, TOKEN_AUTH);
- }
- } catch (OpenStackConnectException e) {
- // Connection to Openstack failed
- MsoIOException me = new MsoIOException(e.getMessage(), e);
- me.addContext(TOKEN_AUTH);
- throw me;
- } catch (RuntimeException e) {
- // Catch-all
- throw runtimeExceptionToMsoException(e, TOKEN_AUTH);
- }
- Heat heatClient = new Heat(heatUrl);
- heatClient.token(tokenId);
+ public Heat getHeatClient(String cloudSiteId, String tenantId) throws MsoException {
+ KeystoneAuthHolder keystone = getKeystoneAuthHolder(cloudSiteId, tenantId, "orchestration");
+ Heat heatClient = new Heat(keystone.getServiceUrl());
+ heatClient.token(keystone.getId());
return heatClient;
}
@@ -928,6 +709,13 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
}
}
+ public Stack queryHeatStack(String stackName, String cloudSiteId, String tenantId) throws MsoException {
+ if (stackName == null) {
+ return null;
+ }
+ return queryHeatStack(getHeatClient(cloudSiteId, tenantId), stackName);
+ }
+
public Map<String, Object> queryStackForOutputs(String cloudSiteId, String cloudOwner, String tenantId,
String stackName) throws MsoException {
@@ -990,42 +778,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
return;
}
- public StringBuilder requestToStringBuilder(CreateStackParam stack) {
- StringBuilder sb = new StringBuilder();
- sb.append("Stack:\n");
- sb.append("\tStackName: " + stack.getStackName());
- sb.append("\tTemplateUrl: " + stack.getTemplateUrl());
- sb.append("\tTemplate: " + stack.getTemplate());
- sb.append("\tEnvironment: " + stack.getEnvironment());
- sb.append("\tTimeout: " + stack.getTimeoutMinutes());
- sb.append("\tParameters:\n");
- Map<String, Object> params = stack.getParameters();
- if (params == null || params.size() < 1) {
- sb.append("\nNONE");
- } else {
- for (String key : params.keySet()) {
- if (params.get(key) instanceof String) {
- sb.append("\n").append(key).append("=").append((String) params.get(key));
- } else if (params.get(key) instanceof JsonNode) {
- String jsonStringOut = this.convertNode((JsonNode) params.get(key));
- sb.append("\n").append(key).append("=").append(jsonStringOut);
- } else if (params.get(key) instanceof Integer) {
- String integerOut = "" + params.get(key);
- sb.append("\n").append(key).append("=").append(integerOut);
-
- } else {
- try {
- String str = params.get(key).toString();
- sb.append("\n").append(key).append("=").append(str);
- } catch (Exception e) {
- logger.debug("Exception :", e);
- }
- }
- }
- }
- return sb;
- }
-
private String convertNode(final JsonNode node) {
try {
final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
@@ -1193,44 +945,32 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
HashMap<String, HeatTemplateParam> paramAliases = new HashMap<>();
if (inputs == null) {
- logger.debug("convertInputMap - inputs is null - nothing to do here");
return new HashMap<>();
}
-
- logger.debug("convertInputMap in MsoHeatUtils called, with {} inputs, and template {}", inputs.size(),
- template.getArtifactUuid());
try {
- logger.debug(template.toString());
Set<HeatTemplateParam> paramSet = template.getParameters();
- logger.debug("paramSet has {} entries", paramSet.size());
} catch (Exception e) {
logger.debug("Exception occurred in convertInputMap {} :", e.getMessage(), e);
}
for (HeatTemplateParam htp : template.getParameters()) {
- logger.debug("Adding {}", htp.getParamName());
params.put(htp.getParamName(), htp);
if (htp.getParamAlias() != null && !"".equals(htp.getParamAlias())) {
logger.debug("\tFound ALIAS {} -> {}", htp.getParamName(), htp.getParamAlias());
paramAliases.put(htp.getParamAlias(), htp);
}
}
- logger.debug("Now iterate through the inputs...");
+
for (String key : inputs.keySet()) {
- logger.debug("key={}", key);
boolean alias = false;
String realName = null;
if (!params.containsKey(key)) {
- logger.debug("{} is not a parameter in the template! - check for an alias", key);
// add check here for an alias
if (!paramAliases.containsKey(key)) {
- logger.debug("The parameter {} is in the inputs, but it's not a parameter for this template - omit",
- key);
continue;
} else {
alias = true;
realName = paramAliases.get(key).getParamName();
- logger.debug("FOUND AN ALIAS! Will use {} in lieu of give key/alias {}", realName, key);
}
}
String type = params.get(key).getParamType();
@@ -1238,7 +978,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
logger.debug("**PARAM_TYPE is null/empty for {}, will default to string", key);
type = "string";
}
- logger.debug("Parameter: {} is of type {}", key, type);
if ("string".equalsIgnoreCase(type)) {
// Easiest!
String str = inputs.get(key) != null ? inputs.get(key).toString() : null;
@@ -1507,47 +1246,39 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
public Resources queryStackResources(String cloudSiteId, String tenantId, String stackName, int nestedDepth)
throws MsoException {
- CloudSite cloudSite =
- cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- Heat heatClient = getHeatClient(cloudSite, tenantId);
+ Heat heatClient = getHeatClient(cloudSiteId, tenantId);
OpenStackRequest<Resources> request =
heatClient.getResources().listResources(stackName).queryParam("nested_depth", nestedDepth);
- return executeAndRecordOpenstackRequest(request);
+ return executeAndRecordOpenstackRequest(request, false);
}
public Events queryStackEvents(String cloudSiteId, String tenantId, String stackName, String stackId,
int nestedDepth) throws MsoException {
- CloudSite cloudSite =
- cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- Heat heatClient = getHeatClient(cloudSite, tenantId);
+ Heat heatClient = getHeatClient(cloudSiteId, tenantId);
OpenStackRequest<Events> request =
heatClient.getEvents().listEvents(stackName, stackId).queryParam("nested_depth", nestedDepth);
- return executeAndRecordOpenstackRequest(request);
+ return executeAndRecordOpenstackRequest(request, false);
}
public Stacks queryStacks(String cloudSiteId, String tenantId, int limit, String marker)
throws MsoCloudSiteNotFound, HeatClientException {
- CloudSite cloudSite =
- cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
Heat heatClient;
try {
- heatClient = getHeatClient(cloudSite, tenantId);
+ heatClient = getHeatClient(cloudSiteId, tenantId);
} catch (MsoException e) {
logger.error("Error Creating Heat Client", e);
throw new HeatClientException("Error Creating Heat Client", e);
}
OpenStackRequest<Stacks> request =
heatClient.getStacks().list().queryParam("limit", limit).queryParam("marker", marker);
- return executeAndRecordOpenstackRequest(request);
+ return executeAndRecordOpenstackRequest(request, false);
}
public <R> R executeHeatClientRequest(String url, String cloudSiteId, String tenantId, Class<R> returnType)
throws MsoException {
- CloudSite cloudSite =
- cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- Heat heatClient = getHeatClient(cloudSite, tenantId);
+ Heat heatClient = getHeatClient(cloudSiteId, tenantId);
OpenStackRequest<R> request = heatClient.get(url, returnType);
- return executeAndRecordOpenstackRequest(request);
+ return executeAndRecordOpenstackRequest(request, false);
}
protected void sleep(long time) {
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 a2e386adea..684fe98bf3 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
@@ -24,25 +24,14 @@
package org.onap.so.openstack.utils;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.woorea.openstack.base.client.OpenStackBaseException;
-import com.woorea.openstack.base.client.OpenStackRequest;
-import com.woorea.openstack.heat.Heat;
-import com.woorea.openstack.heat.model.Stack;
-import com.woorea.openstack.heat.model.Stack.Output;
-import com.woorea.openstack.heat.model.UpdateStackParam;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.StackInfo;
-import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.exceptions.MsoOpenstackException;
import org.onap.so.openstack.exceptions.MsoStackNotFound;
@@ -52,6 +41,15 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.woorea.openstack.base.client.OpenStackBaseException;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.heat.Heat;
+import com.woorea.openstack.heat.model.Stack;
+import com.woorea.openstack.heat.model.Stack.Output;
+import com.woorea.openstack.heat.model.UpdateStackParam;
@Component
public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
@@ -138,12 +136,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
haveHeatFiles = false;
}
- // Obtain the cloud site information where we will create the stack
- CloudSite cloudSite =
- cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- // 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);
+ Heat heatClient = getHeatClient(cloudSiteId, tenantId);
// Perform a query first to get the current status
Stack heatStack = queryHeatStack(heatClient, stackName);
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 ab93a6c4c6..f74a3f5f53 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
@@ -23,19 +23,6 @@
package org.onap.so.openstack.utils;
-import com.woorea.openstack.base.client.OpenStackBaseException;
-import com.woorea.openstack.base.client.OpenStackConnectException;
-import com.woorea.openstack.base.client.OpenStackRequest;
-import com.woorea.openstack.base.client.OpenStackResponseException;
-import com.woorea.openstack.keystone.Keystone;
-import com.woorea.openstack.keystone.model.Access;
-import com.woorea.openstack.keystone.model.Authentication;
-import com.woorea.openstack.keystone.model.Metadata;
-import com.woorea.openstack.keystone.model.Role;
-import com.woorea.openstack.keystone.model.Roles;
-import com.woorea.openstack.keystone.model.Tenant;
-import com.woorea.openstack.keystone.model.User;
-import com.woorea.openstack.keystone.utils.KeystoneUtils;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
@@ -54,6 +41,19 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.woorea.openstack.base.client.OpenStackBaseException;
+import com.woorea.openstack.base.client.OpenStackConnectException;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.base.client.OpenStackResponseException;
+import com.woorea.openstack.keystone.Keystone;
+import com.woorea.openstack.keystone.model.Access;
+import com.woorea.openstack.keystone.model.Authentication;
+import com.woorea.openstack.keystone.model.Metadata;
+import com.woorea.openstack.keystone.model.Role;
+import com.woorea.openstack.keystone.model.Roles;
+import com.woorea.openstack.keystone.model.Tenant;
+import com.woorea.openstack.keystone.model.User;
+import com.woorea.openstack.keystone.utils.KeystoneUtils;
@Component
public class MsoKeystoneUtils extends MsoTenantUtils {
@@ -414,7 +414,6 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
// Get the Identity service URL. Throws runtime exception if not found per region.
String adminUrl = null;
try {
- // TODO: FOR TESTING!!!!
adminUrl = KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "identity", region, "public");
adminUrl = adminUrl.replaceFirst("5000", "35357");
} catch (RuntimeException e) {
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 1db0411f7c..49ba336e3f 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
@@ -157,7 +157,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
sdncDirectives = (String) stackInputs.get(key);
}
if (key == USER_DIRECTIVES) {
- sdncDirectives = (String) stackInputs.get(key);
+ userDirectives = (String) stackInputs.get(key);
}
if (key == TEMPLATE_TYPE) {
templateType = (String) stackInputs.get(key);
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 6f08afc55f..069c6c7c5b 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
@@ -382,7 +382,7 @@ public class MsoNeutronUtils extends MsoCommonUtils {
Authentication credentials = authenticationMethodFactory.getAuthenticationFor(cloudIdentity);
OpenStackRequest<Access> request =
keystoneTenantClient.tokens().authenticate(credentials).withTenantId(tenantId);
- access = executeAndRecordOpenstackRequest(request);
+ access = executeAndRecordOpenstackRequest(request, true);
try {
@@ -499,7 +499,7 @@ public class MsoNeutronUtils extends MsoCommonUtils {
try {
OpenStackRequest<Port> request = neutronClient.ports().show(neutronPortId);
- Port port = executeAndRecordOpenstackRequest(request);
+ Port port = executeAndRecordOpenstackRequest(request, false);
return port;
} catch (OpenStackResponseException e) {
if (e.getStatus() == 404) {
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 fc08201bcb..9fa4557a45 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
@@ -22,13 +22,16 @@ package org.onap.so.openstack.utils;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.databind.JsonNode;
import org.apache.commons.lang.builder.ToStringBuilder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"template_type", "workload_id", "template_response"})
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonPropertyOrder({"template_type", "workload_id", "template_response", "workload_status_reason", "workload_status"})
public class MulticloudCreateResponse implements Serializable {
private static final long serialVersionUID = -5215028275577848311L;
@@ -37,12 +40,16 @@ public class MulticloudCreateResponse implements Serializable {
@JsonProperty("workload_id")
private String workloadId;
@JsonProperty("template_response")
- private MulticloudCreateStackResponse templateResponse;
+ private JsonNode templateResponse;
+ @JsonProperty("workload_status_reason")
+ private JsonNode workloadStatusReason;
+ @JsonProperty("workload_status")
+ private String workloadStatus;
@JsonCreator
public MulticloudCreateResponse(@JsonProperty("template_type") String templateType,
@JsonProperty("workload_id") String workloadId,
- @JsonProperty("template_response") MulticloudCreateStackResponse templateResponse) {
+ @JsonProperty("template_response") JsonNode templateResponse) {
this.templateType = templateType;
this.workloadId = workloadId;
this.templateResponse = templateResponse;
@@ -69,18 +76,41 @@ public class MulticloudCreateResponse implements Serializable {
}
@JsonProperty("template_response")
- public void setTemplateResponse(MulticloudCreateStackResponse templateResponse) {
+ public void setTemplateResponse(JsonNode templateResponse) {
this.templateResponse = templateResponse;
}
@JsonProperty("template_response")
- public MulticloudCreateStackResponse getTemplateResponse() {
+ public JsonNode getTemplateResponse() {
return templateResponse;
}
+ @JsonProperty("workload_status_reason")
+ public void setWorkloadStatusReason(JsonNode workloadStatusReason) {
+ this.workloadStatusReason = workloadStatusReason;
+ }
+
+ @JsonProperty("workload_status_reason")
+ public JsonNode getWorkloadStatusReason() {
+ return workloadStatusReason;
+ }
+
+ @JsonProperty("workload_status")
+ public String getWorkloadSstatus() {
+ return workloadStatus;
+ }
+
+ @JsonProperty("workload_status")
+ public void setWorkloadStatus(String workloadStatus) {
+ this.workloadStatus = workloadStatus;
+ }
+
+
@Override
public String toString() {
return new ToStringBuilder(this).append("templateType", templateType).append("workloadId", workloadId)
- .append("templateResponse", templateResponse).toString();
+ .append("templateResponse", templateResponse)
+ .append("workload_status_reason", workloadStatusReason.toString())
+ .append("workload_status", workloadStatus).toString();
}
}
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
deleted file mode 100644
index 67d1cbff4e..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.openstack.utils;
-
-import java.io.Serializable;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"stack"})
-public class MulticloudCreateStackResponse implements Serializable {
- private static final long serialVersionUID = -5215028275577848311L;
-
- @JsonProperty("stack")
- private MulticloudCreateHeatResponse stack;
-
- @JsonCreator
- public MulticloudCreateStackResponse(@JsonProperty("stack") MulticloudCreateHeatResponse stack) {
- this.stack = stack;
- }
-
- @JsonProperty("stack")
- public MulticloudCreateHeatResponse getStack() {
- return stack;
- }
-
- @JsonProperty("stack")
- public void setStack(MulticloudCreateHeatResponse stack) {
- this.stack = stack;
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("stack", stack).toString();
- }
-}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java
index 93745de54a..938a888bbd 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java
@@ -75,7 +75,7 @@ public class NeutronClientImpl extends MsoCommonUtils {
Quantum neutronClient = getNeutronClient(cloudSiteId, tenantId);
OpenStackRequest<Networks> request = neutronClient.networks().list().queryParam("id", id)
.queryParam("limit", limit).queryParam("marker", marker).queryParam("name", name);
- return executeAndRecordOpenstackRequest(request);
+ return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
logger.error("Error building Neutron Client", e);
throw new NeutronClientException("Error building Neutron Client", e);
@@ -103,7 +103,7 @@ public class NeutronClientImpl extends MsoCommonUtils {
Quantum neutronClient = getNeutronClient(cloudSiteId, tenantId);
OpenStackRequest<Subnets> request = neutronClient.subnets().list().queryParam("id", id)
.queryParam("limit", limit).queryParam("marker", marker).queryParam("name", name);
- return executeAndRecordOpenstackRequest(request);
+ return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
logger.error("Error building Neutron Client", e);
throw new NeutronClientException("Error building Neutron Client", e);
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java
index a342f770ef..99e8b589b1 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java
@@ -78,7 +78,7 @@ public class NovaClientImpl extends MsoCommonUtils {
Nova novaClient = getNovaClient(cloudSiteId, tenantId);
OpenStackRequest<Flavors> request =
novaClient.flavors().list(false).queryParam("limit", limit).queryParam("marker", marker);
- return executeAndRecordOpenstackRequest(request);
+ return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
logger.error("Error building Nova Client", e);
throw new NovaClientException("Error building Nova Client", e);
@@ -103,7 +103,7 @@ public class NovaClientImpl extends MsoCommonUtils {
Nova novaClient = getNovaClient(cloudSiteId, tenantId);
novaClient = getNovaClient(cloudSiteId, tenantId);
OpenStackRequest<Flavor> request = novaClient.flavors().show(id);
- return executeAndRecordOpenstackRequest(request);
+ return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
logger.error("Error building Nova Client", e);
throw new NovaClientException("Error building Nova Client", e);
@@ -128,7 +128,7 @@ public class NovaClientImpl extends MsoCommonUtils {
Nova novaClient = getNovaClient(cloudSiteId, tenantId);
OpenStackRequest<HostAggregates> request =
novaClient.aggregates().list().queryParam("limit", limit).queryParam("marker", marker);
- return executeAndRecordOpenstackRequest(request);
+ return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
logger.error("Error building Nova Client", e);
throw new NovaClientException("Error building Nova Client", e);
@@ -152,7 +152,7 @@ public class NovaClientImpl extends MsoCommonUtils {
try {
Nova novaClient = getNovaClient(cloudSiteId, tenantId);
OpenStackRequest<HostAggregate> request = novaClient.aggregates().showAggregate(id);
- return executeAndRecordOpenstackRequest(request);
+ return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
logger.error("Error building Nova Client", e);
throw new NovaClientException("Error building Nova Client", e);
@@ -176,11 +176,32 @@ public class NovaClientImpl extends MsoCommonUtils {
try {
Nova novaClient = getNovaClient(cloudSiteId, tenantId);
OpenStackRequest<QuotaSet> request = novaClient.quotaSets().showQuota(tenantId);
- return executeAndRecordOpenstackRequest(request);
+ return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
logger.error("Error building Nova Client", e);
throw new NovaClientException("Error building Nova Client", e);
}
}
+ /**
+ * Deletes a keypair inside openstack
+ *
+ *
+ * @param cloudSiteId the cloud site id
+ * @param tenantId the tenant id
+ * @param keyPairName name of the keypair to be deleted
+ * @throws MsoCloudSiteNotFound the mso cloud site not found
+ * @throws NeutronClientException if the client cannot be built this is thrown
+ */
+ public void deleteKeyPair(String cloudSiteId, String tenantId, String keyPairName)
+ throws MsoCloudSiteNotFound, NovaClientException {
+ try {
+ Nova novaClient = getNovaClient(cloudSiteId, tenantId);
+ OpenStackRequest<Void> request = novaClient.keyPairs().delete(keyPairName);
+ executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Nova Client", e);
+ throw new NovaClientException("Error building Nova Client", e);
+ }
+ }
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackCreationException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackCreationException.java
new file mode 100644
index 0000000000..e3936e31f7
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackCreationException.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.openstack.utils;
+
+import org.onap.so.openstack.exceptions.MsoException;
+
+public class StackCreationException extends MsoException {
+
+ public StackCreationException(String error) {
+ super(error);
+ }
+
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackResultWrapper.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackResultWrapper.java
new file mode 100644
index 0000000000..5e52a0a2ae
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackResultWrapper.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.openstack.utils;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import com.woorea.openstack.heat.model.Stack;
+
+public class StackResultWrapper {
+
+ private Stack stack;
+ private boolean stackTimedOutPolling;
+ private boolean stackNotFound;
+ private String errorMessage;
+ private String errorCode;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("stack", stack).append("stackTimedOutPolling", stackTimedOutPolling)
+ .append("stackNotFound", stackNotFound).append("errorMessage", errorMessage)
+ .append("errorCode", errorCode).toString();
+ }
+
+ public Stack getStack() {
+ return stack;
+ }
+
+ public void setStack(Stack stack) {
+ this.stack = stack;
+ }
+
+ public boolean isStackTimedOutPolling() {
+ return stackTimedOutPolling;
+ }
+
+ public void setStackTimedOutPolling(boolean stackTimedOutPolling) {
+ this.stackTimedOutPolling = stackTimedOutPolling;
+ }
+
+ public boolean isStackNotFound() {
+ return stackNotFound;
+ }
+
+ public void setStackNotFound(boolean stackNotFound) {
+ this.stackNotFound = stackNotFound;
+ }
+
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+ public String getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
+
+
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackRollbackException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackRollbackException.java
new file mode 100644
index 0000000000..ee284b11fe
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackRollbackException.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.openstack.utils;
+
+import org.onap.so.openstack.exceptions.MsoException;
+
+public class StackRollbackException extends MsoException {
+
+ public StackRollbackException(String error) {
+ super(error);
+ }
+
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackStatusHandler.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackStatusHandler.java
index 990e9a4543..bf29c39f99 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackStatusHandler.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackStatusHandler.java
@@ -1,10 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.openstack.utils;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.db.request.beans.RequestProcessingData;
import org.onap.so.db.request.client.RequestsDbClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
@@ -21,21 +43,25 @@ public class StackStatusHandler {
private RequestsDbClient requestDBClient;
@Async
- public void updateStackStatus(Stack stack, String requestId) {
+ public void updateStackStatus(Stack stack) {
try {
+ String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
String stackStatus = mapper.writeValueAsString(stack);
RequestProcessingData requestProcessingData =
- requestDBClient.getRequestProcessingDataBySoRequestIdAndNameAndGrouping(requestId, stack.getId(),
- stack.getStackName());
+ requestDBClient.getRequestProcessingDataBySoRequestIdAndNameAndGrouping(requestId,
+ stack.getStackName(), stack.getId());
if (requestProcessingData == null) {
requestProcessingData = new RequestProcessingData();
requestProcessingData.setGroupingId(stack.getId());
requestProcessingData.setName(stack.getStackName());
requestProcessingData.setTag("StackInformation");
requestProcessingData.setSoRequestId(requestId);
+ requestProcessingData.setValue(stackStatus);
+ requestDBClient.saveRequestProcessingData(requestProcessingData);
+ } else {
+ requestProcessingData.setValue(stackStatus);
+ requestDBClient.updateRequestProcessingData(requestProcessingData);
}
- requestProcessingData.setValue(stackStatus);
- requestDBClient.saveRequestProcessingData(requestProcessingData);
} catch (Exception e) {
logger.warn("Error adding stack status to request database", e);
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoCommonUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoCommonUtilsTest.java
index 5cf7c86522..622ad4f94f 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoCommonUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoCommonUtilsTest.java
@@ -69,6 +69,7 @@ public class MsoCommonUtilsTest extends BaseTest {
Mockito.when(openstackRequest.path()).thenReturn("/test");
// TODO:Must try a real connection
assertNull(commonUtils.executeAndRecordOpenstackRequest(openstackRequest));
+ assertNull(commonUtils.executeAndRecordOpenstackRequest(openstackRequest, true));
}
@Test
@@ -78,6 +79,7 @@ public class MsoCommonUtilsTest extends BaseTest {
doThrow(OpenStackResponseException.class).when(openstackRequest).execute();
commonUtils.executeAndRecordOpenstackRequest(openstackRequest);
+ commonUtils.executeAndRecordOpenstackRequest(openstackRequest, true);
}
@Test
@@ -86,7 +88,7 @@ public class MsoCommonUtilsTest extends BaseTest {
doThrow(OpenStackConnectException.class).when(openstackRequest).execute();
- commonUtils.executeAndRecordOpenstackRequest(openstackRequest);
+ commonUtils.executeAndRecordOpenstackRequest(openstackRequest, true);
}
@Test
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsITTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsITTest.java
new file mode 100644
index 0000000000..7e783aa7a4
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsITTest.java
@@ -0,0 +1,219 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.openstack.utils;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertNotNull;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.http.HttpStatus;
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.BaseTest;
+import org.onap.so.StubOpenStack;
+import org.onap.so.adapters.vdu.CloudInfo;
+import org.onap.so.adapters.vdu.PluginAction;
+import org.onap.so.adapters.vdu.VduArtifact;
+import org.onap.so.adapters.vdu.VduArtifact.ArtifactType;
+import org.onap.so.adapters.vdu.VduInstance;
+import org.onap.so.adapters.vdu.VduModelInfo;
+import org.onap.so.adapters.vdu.VduStateType;
+import org.onap.so.adapters.vdu.VduStatus;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.openstack.beans.StackInfo;
+import org.onap.so.openstack.exceptions.MsoAdapterException;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.exceptions.MsoOpenstackException;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.woorea.openstack.heat.Heat;
+
+public class MsoHeatUtilsITTest extends BaseTest {
+
+ @Autowired
+ private MsoHeatUtils heatUtils;
+
+ @Test
+ public void instantiateVduTest() throws MsoException, IOException {
+ VduInstance expected = new VduInstance();
+ expected.setVduInstanceId("name/da886914-efb2-4917-b335-c8381528d90b");
+ expected.setVduInstanceName("name");
+ VduStatus status = new VduStatus();
+ status.setState(VduStateType.INSTANTIATED);
+ status.setLastAction((new PluginAction("create", "complete", null)));
+ expected.setStatus(status);
+
+ CloudInfo cloudInfo = new CloudInfo();
+ cloudInfo.setCloudSiteId("MTN13");
+ cloudInfo.setTenantId("tenantId");
+ VduModelInfo vduModel = new VduModelInfo();
+ vduModel.setModelCustomizationUUID("blueprintId");
+ vduModel.setTimeoutMinutes(1);
+ VduArtifact artifact = new VduArtifact();
+ artifact.setName("name");
+ artifact.setType(ArtifactType.MAIN_TEMPLATE);
+ byte[] content = new byte[1];
+ artifact.setContent(content);
+ List<VduArtifact> artifacts = new ArrayList<>();
+ artifacts.add(artifact);
+ vduModel.setArtifacts(artifacts);
+ Map<String, byte[]> blueprintFiles = new HashMap<>();
+ blueprintFiles.put(artifact.getName(), artifact.getContent());
+ String instanceName = "stackname";
+ Map<String, Object> inputs = new HashMap<>();
+ boolean rollbackOnFailure = true;
+
+ StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
+
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/stackname/stackId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK)));
+
+ VduInstance actual = heatUtils.instantiateVdu(cloudInfo, instanceName, inputs, vduModel, rollbackOnFailure);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+
+ @Test
+ public void queryVduTest() throws Exception {
+ VduInstance expected = new VduInstance();
+ expected.setVduInstanceId("name/da886914-efb2-4917-b335-c8381528d90b");
+ expected.setVduInstanceName("name");
+ VduStatus status = new VduStatus();
+ status.setState(VduStateType.INSTANTIATED);
+ status.setLastAction((new PluginAction("create", "complete", null)));
+ expected.setStatus(status);
+
+ CloudInfo cloudInfo = new CloudInfo();
+ cloudInfo.setCloudSiteId("mtn13");
+ cloudInfo.setTenantId("tenantId");
+ String instanceId = "instanceId";
+
+ StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
+
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK)));
+
+ VduInstance actual = heatUtils.queryVdu(cloudInfo, instanceId);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void deleteVduTest() throws Exception {
+ VduInstance expected = new VduInstance();
+ expected.setVduInstanceId("instanceId");
+ expected.setVduInstanceName("instanceId");
+ VduStatus status = new VduStatus();
+ status.setState(VduStateType.DELETED);
+ expected.setStatus(status);
+
+ CloudInfo cloudInfo = new CloudInfo();
+ cloudInfo.setCloudSiteId("mtn13");
+ cloudInfo.setTenantId("tenantId");
+ String instanceId = "instanceId";
+
+ int timeoutInMinutes = 1;
+
+ StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId"))
+ .willReturn(aResponse().withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK)));
+ StubOpenStack.mockOpenStackDelete(wireMockServer, "name/da886914-efb2-4917-b335-c8381528d90b");
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/name/da886914-efb2-4917-b335-c8381528d90b"))
+ .willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_DeleteComplete.json")
+ .withStatus(HttpStatus.SC_OK)));
+
+ VduInstance actual = heatUtils.deleteVdu(cloudInfo, instanceId, timeoutInMinutes);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public final void copyBaseOutputsToInputsTest() {
+ Map<String, Object> inputs = new HashMap<>();
+ inputs.put("str1", "str");
+ Map<String, Object> otherStackOutputs = new HashMap<>();
+ otherStackOutputs.put("str", "str");
+ List<String> paramNames = new ArrayList<>();
+ Map<String, String> aliases = new HashMap<>();
+ aliases.put("str", "str");
+ heatUtils.copyBaseOutputsToInputs(inputs, otherStackOutputs, null, aliases);
+ Assert.assertEquals("str", otherStackOutputs.get("str"));
+ }
+
+ @Test
+ public final void getHeatClientSuccessTest() throws MsoException, IOException {
+ CloudSite cloudSite = getCloudSite(getCloudIdentity());
+ StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ Heat heatClient = heatUtils.getHeatClient("MTN13", "TEST-tenant");
+ assertNotNull(heatClient);
+ }
+
+ @Test(expected = MsoOpenstackException.class)
+ public final void getHeatClientOpenStackResponseException404Test() throws MsoException, IOException {
+ CloudSite cloudSite = getCloudSite(getCloudIdentity());
+ // mo mocks setup will cause 404 response from wiremock
+ heatUtils.getHeatClient("MTN13", "TEST-tenant");
+ }
+
+ @Test(expected = MsoAdapterException.class)
+ public final void getHeatClientOpenStackResponseException401Test() throws MsoException, IOException {
+ CloudSite cloudSite = getCloudSite(getCloudIdentity());
+ StubOpenStack.mockOpenStackResponseUnauthorized(wireMockServer, wireMockPort);
+ heatUtils.getHeatClient("MTN13", "TEST-tenant");
+ }
+
+ @Test(expected = MsoOpenstackException.class)
+ public final void getHeatClientOpenStackConnectExceptionTest() throws MsoException, IOException {
+ CloudIdentity identity = getCloudIdentity();
+ identity.setIdentityUrl("http://unreachable");
+ CloudSite cloudSite = getCloudSite(identity);
+ // mo mocks setup will cause 404 response from wiremock
+ heatUtils.getHeatClient("MTN13", "TEST-tenant");
+ }
+
+ @Test
+ public final void createStackSuccessTest() throws MsoException, IOException {
+ CloudSite cloudSite = getCloudSite(getCloudIdentity());
+ StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
+ StubOpenStack.mockOpenStackGet(wireMockServer, "TEST-stack/stackId");
+ StackInfo stackInfo = heatUtils.createStack(cloudSite.getId(), "CloudOwner", "tenantId", "TEST-stack",
+ "TEST-heat", new HashMap<>(), false, 1, "TEST-env", new HashMap<>(), new HashMap<>());
+ assertNotNull(stackInfo);
+ }
+
+
+
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
index 3f5402cc99..de55e85ad6 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
@@ -2,16 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,214 +20,520 @@
package org.onap.so.openstack.utils;
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static com.shazam.shazamcrest.MatcherAssert.assertThat;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isA;
+import static org.mockito.ArgumentMatchers.isNull;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.http.HttpStatus;
-import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
-import org.onap.so.BaseTest;
-import org.onap.so.StubOpenStack;
-import org.onap.so.adapters.vdu.CloudInfo;
-import org.onap.so.adapters.vdu.PluginAction;
-import org.onap.so.adapters.vdu.VduArtifact;
-import org.onap.so.adapters.vdu.VduArtifact.ArtifactType;
-import org.onap.so.adapters.vdu.VduInstance;
-import org.onap.so.adapters.vdu.VduModelInfo;
-import org.onap.so.adapters.vdu.VduStateType;
-import org.onap.so.adapters.vdu.VduStatus;
-import org.onap.so.db.catalog.beans.CloudIdentity;
-import org.onap.so.db.catalog.beans.CloudSite;
-import org.onap.so.openstack.beans.StackInfo;
-import org.onap.so.openstack.exceptions.MsoAdapterException;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.db.request.beans.CloudApiRequests;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.openstack.exceptions.MsoException;
-import org.onap.so.openstack.exceptions.MsoIOException;
import org.onap.so.openstack.exceptions.MsoOpenstackException;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.onap.so.openstack.exceptions.MsoStackAlreadyExists;
+import org.springframework.core.env.Environment;
+import com.woorea.openstack.base.client.OpenStackResponseException;
import com.woorea.openstack.heat.Heat;
+import com.woorea.openstack.heat.StackResource;
+import com.woorea.openstack.heat.StackResource.CreateStack;
+import com.woorea.openstack.heat.StackResource.DeleteStack;
import com.woorea.openstack.heat.model.CreateStackParam;
+import com.woorea.openstack.heat.model.Resource;
+import com.woorea.openstack.heat.model.Resources;
+import com.woorea.openstack.heat.model.Stack;
-public class MsoHeatUtilsTest extends BaseTest {
+@RunWith(MockitoJUnitRunner.class)
+public class MsoHeatUtilsTest extends MsoHeatUtils {
- @Autowired
+ @Rule
+ public ExpectedException exceptionRule = ExpectedException.none();
+
+ @Spy
+ @InjectMocks
private MsoHeatUtils heatUtils;
- @Test
- public void instantiateVduTest() throws MsoException, IOException {
- VduInstance expected = new VduInstance();
- expected.setVduInstanceId("name/da886914-efb2-4917-b335-c8381528d90b");
- expected.setVduInstanceName("name");
- VduStatus status = new VduStatus();
- status.setState(VduStateType.INSTANTIATED);
- status.setLastAction((new PluginAction("create", "complete", null)));
- expected.setStatus(status);
+ @Mock
+ private RequestsDbClient requestDbClient;
- CloudInfo cloudInfo = new CloudInfo();
- cloudInfo.setCloudSiteId("MTN13");
- cloudInfo.setTenantId("tenantId");
- VduModelInfo vduModel = new VduModelInfo();
- vduModel.setModelCustomizationUUID("blueprintId");
- vduModel.setTimeoutMinutes(1);
- VduArtifact artifact = new VduArtifact();
- artifact.setName("name");
- artifact.setType(ArtifactType.MAIN_TEMPLATE);
- byte[] content = new byte[1];
- artifact.setContent(content);
- List<VduArtifact> artifacts = new ArrayList<>();
- artifacts.add(artifact);
- vduModel.setArtifacts(artifacts);
- Map<String, byte[]> blueprintFiles = new HashMap<>();
- blueprintFiles.put(artifact.getName(), artifact.getContent());
- String instanceName = "instanceName";
- Map<String, Object> inputs = new HashMap<>();
- boolean rollbackOnFailure = true;
+ @Mock
+ private Heat heatClient;
- StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
+ @Mock
+ private StackStatusHandler stackStatusHandler;
- wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceName/stackId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK)));
+ @Mock
+ private Environment env;
- VduInstance actual = heatUtils.instantiateVdu(cloudInfo, instanceName, inputs, vduModel, rollbackOnFailure);
+ @Mock
+ private StackResource stackResource;
- assertThat(actual, sameBeanAs(expected));
- }
+ @Mock
+ private NovaClientImpl novaClient;
+ @Mock
+ private DeleteStack mockDeleteStack;
+
+ @Mock
+ private Resources mockResources;
+
+ @Mock
+ private CreateStack mockCreateStack;
+
+ private String cloudSiteId = "cloudSiteId";
+ private String tenantId = "tenantId";
+
+ @Before
+ public void setup() {
+ doReturn("15").when(env).getProperty("org.onap.so.adapters.po.pollInterval", "15");
+ doReturn("1").when(env).getProperty("org.onap.so.adapters.po.pollMultiplier", "60");
+ }
@Test
- public void queryVduTest() throws Exception {
- VduInstance expected = new VduInstance();
- expected.setVduInstanceId("name/da886914-efb2-4917-b335-c8381528d90b");
- expected.setVduInstanceName("name");
- VduStatus status = new VduStatus();
- status.setState(VduStateType.INSTANTIATED);
- status.setLastAction((new PluginAction("create", "complete", null)));
- expected.setStatus(status);
+ public final void pollStackForStatus_Create_Complete_Test() throws MsoException, IOException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_IN_PROGRESS");
+ stack.setStackStatusReason("Stack Finished");
+
+ Stack latestStack = new Stack();
+ latestStack.setId("id");
+ latestStack.setStackName("stackName");
+ latestStack.setStackStatus("CREATE_COMPLETE");
+ latestStack.setStackStatusReason("Stack Finished");
+ doReturn(latestStack).when(heatUtils).queryHeatStack(isA(Heat.class), eq("stackName/id"));
+ doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
+ Stack actual = heatUtils.pollStackForStatus(1, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ Mockito.verify(stackStatusHandler, times(1)).updateStackStatus(latestStack);
+ Mockito.verify(heatUtils, times(1)).queryHeatStack(isA(Heat.class), eq("stackName/id"));
+ assertEquals(true, actual != null);
+ }
- CloudInfo cloudInfo = new CloudInfo();
- cloudInfo.setCloudSiteId("mtn13");
- cloudInfo.setTenantId("tenantId");
- String instanceId = "instanceId";
- StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
+ @Test
+ public final void pollStackForStatus_Polling_Exhausted_Test() throws MsoException, IOException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_IN_PROGRESS");
+ stack.setStackStatusReason("Stack Finished");
+ doNothing().when(stackStatusHandler).updateStackStatus(stack);
+ doReturn(stack).when(heatUtils).queryHeatStack(isA(Heat.class), eq("stackName/id"));
+ doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
+ Stack actual = heatUtils.pollStackForStatus(1, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ Mockito.verify(stackStatusHandler, times(1)).updateStackStatus(stack);
+ Mockito.verify(heatUtils, times(1)).queryHeatStack(isA(Heat.class), eq("stackName/id"));
+ assertEquals(true, actual != null);
+ }
+
+ @Test
+ public final void postProcessStackCreate_CREATE_IN_PROGRESS_Test() throws MsoException, IOException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_IN_PROGRESS");
+ stack.setStackStatusReason("Stack Finished");
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+
+ exceptionRule.expect(StackCreationException.class);
+ exceptionRule.expectMessage("Stack rollback suppressed, stack not deleted");
+ heatUtils.postProcessStackCreate(stack, false, 120, false, cloudSiteId, tenantId, createStackParam);
+ }
- wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK)));
+ @Test
+ public final void postProcessStackCreate_Backout_True_Test() throws MsoException, IOException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_IN_PROGRESS");
+ stack.setStackStatusReason("Stack Finished");
+
+ Stack deletedStack = new Stack();
+ deletedStack.setId("id");
+ deletedStack.setStackName("stackName");
+ deletedStack.setStackStatus("DELETE_COMPLETE");
+ deletedStack.setStackStatusReason("Stack Deleted");
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+ doReturn(deletedStack).when(heatUtils).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ exceptionRule.expect(StackCreationException.class);
+ exceptionRule.expectMessage(
+ "Stack Creation Failed Openstack Status: CREATE_IN_PROGRESS Status Reason: Stack Finished , Rollback of Stack Creation completed with status: DELETE_COMPLETE Status Reason: Stack Deleted");
+ heatUtils.postProcessStackCreate(stack, true, 120, false, cloudSiteId, tenantId, createStackParam);
+ Mockito.verify(heatUtils, times(1)).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ }
- VduInstance actual = heatUtils.queryVdu(cloudInfo, instanceId);
+ @Test
+ public final void postProcessStackCreate_Backout_True_Delete_Fail_Test() throws MsoException, IOException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_IN_PROGRESS");
+ stack.setStackStatusReason("Stack Finished");
+
+ Stack deletedStack = new Stack();
+ deletedStack.setId("id");
+ deletedStack.setStackName("stackName");
+ deletedStack.setStackStatus("DELETE_COMPLETE");
+ deletedStack.setStackStatusReason("Stack Deleted");
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+ doThrow(new MsoOpenstackException(500, "Error In Delete", "Error In Delete")).when(heatUtils)
+ .handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ exceptionRule.expect(MsoException.class);
+ exceptionRule.expectMessage(
+ "Stack Creation Failed Openstack Status: CREATE_IN_PROGRESS Status Reason: Stack Finished , Rollback of Stack Creation failed with sync error: Error In Delete");
+ heatUtils.postProcessStackCreate(stack, true, 120, false, cloudSiteId, tenantId, createStackParam);
+ Mockito.verify(heatUtils, times(1)).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ }
- assertThat(actual, sameBeanAs(expected));
+ @Test
+ public final void postProcessStackCreate_Keypair_True_Test() throws MsoException, IOException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_IN_PROGRESS");
+ stack.setStackStatusReason(
+ "Resource CREATE failed: Conflict: resources.my_keypair: Key pair 'hst3bbfnm0011vm001' already exists. (HTTP 409) (Request-ID: req-941b0af6-63ae-4d6a-afbc-90b728bacf82");
+
+ Stack createdStack = new Stack();
+ createdStack.setId("id");
+ createdStack.setStackName("stackName");
+ createdStack.setStackStatus("CREATE_COMPLETE");
+ createdStack.setStackStatusReason("Stack Created");
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+ doReturn(createdStack).when(heatUtils).handleKeyPairConflict(cloudSiteId, tenantId, createStackParam, 120, true,
+ stack);
+ heatUtils.postProcessStackCreate(stack, true, 120, true, cloudSiteId, tenantId, createStackParam);
+ Mockito.verify(heatUtils, times(1)).handleKeyPairConflict(cloudSiteId, tenantId, createStackParam, 120, true,
+ stack);
}
@Test
- public void deleteVduTest() throws Exception {
- VduInstance expected = new VduInstance();
- expected.setVduInstanceId("instanceId");
- expected.setVduInstanceName("instanceId");
- VduStatus status = new VduStatus();
- status.setState(VduStateType.DELETED);
- expected.setStatus(status);
+ public final void handleUnknownCreateStackFailure_Test() throws MsoException, IOException {
+
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_FAILED");
+ stack.setStackStatusReason(
+ "Resource CREATE failed: Conflict: resources.my_keypair: Key pair 'hst3bbfnm0011vm001' already exists. (HTTP 409) (Request-ID: req-941b0af6-63ae-4d6a-afbc-90b728bacf82");
+
+ Stack deletedStack = new Stack();
+ deletedStack.setId("id");
+ deletedStack.setStackName("stackName");
+ deletedStack.setStackStatus("DELETE_COMPLETE");
+ deletedStack.setStackStatusReason("Stack Deleted");
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+ doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
+ doNothing().when(heatUtils).postProcessStackDelete(deletedStack);
+ doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(mockDeleteStack);
+ doReturn(stackResource).when(heatClient).getStacks();
+ doReturn(mockDeleteStack).when(stackResource).deleteByName("stackName/id");
+ doReturn(deletedStack).when(heatUtils).pollStackForStatus(120, stack, "DELETE_IN_PROGRESS", cloudSiteId,
+ tenantId);
+
+ heatUtils.handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(1)).executeAndRecordOpenstackRequest(mockDeleteStack);
+ Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "DELETE_IN_PROGRESS", cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(1)).postProcessStackDelete(deletedStack);
+ }
- CloudInfo cloudInfo = new CloudInfo();
- cloudInfo.setCloudSiteId("mtn13");
- cloudInfo.setTenantId("tenantId");
- String instanceId = "instanceId";
- int timeoutInMinutes = 1;
+ @Test
+ public final void handleUnknownCreateStackFailure_Null_Stack_Test() throws MsoException, IOException {
+ Stack stack = null;
+ exceptionRule.expect(StackCreationException.class);
+ exceptionRule.expectMessage("Cannot Find Stack Name or Id");
+ heatUtils.handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ }
- StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId"))
- .willReturn(aResponse().withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK)));
- StubOpenStack.mockOpenStackDelete(wireMockServer, "name/da886914-efb2-4917-b335-c8381528d90b");
- wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/name/da886914-efb2-4917-b335-c8381528d90b"))
- .willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_DeleteComplete.json")
- .withStatus(HttpStatus.SC_OK)));
+ @Test
+ public final void postProcessStackDelete_Stack_Test() throws MsoException, IOException {
+ Stack deletedStack = new Stack();
+ deletedStack.setId("id");
+ deletedStack.setStackName("stackName");
+ deletedStack.setStackStatus("DELETE_FAILED");
+ deletedStack.setStackStatusReason("Stack DID NOT DELETE");
+ exceptionRule.expect(StackRollbackException.class);
+ exceptionRule.expectMessage(
+ "Stack Deletion completed with status: DELETE_FAILED Status Reason: Stack DID NOT DELETE");
+ heatUtils.postProcessStackDelete(deletedStack);
+ }
- VduInstance actual = heatUtils.deleteVdu(cloudInfo, instanceId, timeoutInMinutes);
+ @Test
+ public final void postProcessStackDelete__Null_Stack_Test() throws MsoException, IOException {
+ Stack stack = null;
+ exceptionRule.expect(StackRollbackException.class);
+ exceptionRule.expectMessage("Cannot Find Stack Name or Id");
+ heatUtils.postProcessStackDelete(stack);
+ }
- assertThat(actual, sameBeanAs(expected));
+ @Test
+ public final void isKeyPairFailure_Test() throws MsoException, IOException {
+ boolean actual = heatUtils.isKeyPairFailure(
+ "Exception during create VF 0 : Stack error (CREATE_FAILED): Resource CREATE failed: Conflict: resources.bfnm_my_keypair: Key pair 'hst3bbfnm0011vm001' already exists. (HTTP 409) (Request-ID:req-941b0af6-63ae-4d6a-afbc-90b728bacf82) - stack successfully deleted'rolledBack='true'");
+ assertEquals(true, actual);
}
@Test
- public final void requestToStringBuilderTest() {
- CreateStackParam param = new CreateStackParam();
- param.setDisableRollback(false);
- param.setEnvironment("environment");
- param.setFiles(new HashMap<String, Object>());
- param.setParameters(new HashMap<>());
- param.setStackName("stackName");
- param.setTemplate("template");
- param.setTemplateUrl("http://templateUrl");
- param.setTimeoutMinutes(1);
+ public final void handleKeyPairConflict_Test() throws MsoException, IOException, NovaClientException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_FAILED");
+ stack.setStackStatusReason(
+ "Resource CREATE failed: Conflict: resources.my_keypair: Key pair 'hst3bbfnm0011vm001' already exists. (HTTP 409) (Request-ID: req-941b0af6-63ae-4d6a-afbc-90b728bacf82");
+
+ Stack createdStack = new Stack();
+ createdStack.setId("id");
+ createdStack.setStackName("stackName");
+ createdStack.setStackStatus("CREATE_COMPLETE");
+ createdStack.setStackStatusReason("Stack Created");
+
+
+
+ List<Resource> resources = new ArrayList<>();
+ Resource resource = new Resource();
+ resource.setName("KeypairName");
+ resource.setLogicalResourceId("KeypairName");
+ resource.setType("OS::Nova::KeyPair");
+ resources.add(resource);
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+
+ doReturn(resources).when(mockResources).getList();
+ doReturn(mockResources).when(heatUtils).queryStackResources(cloudSiteId, tenantId, "stackName", 2);
+ doNothing().when(novaClient).deleteKeyPair(cloudSiteId, tenantId, "KeypairName");
+ doReturn(null).when(heatUtils).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ doReturn(createdStack).when(heatUtils).createStack(createStackParam, cloudSiteId, tenantId);
+ doReturn(createdStack).when(heatUtils).processCreateStack(cloudSiteId, tenantId, 120, true, createdStack,
+ createStackParam, false);
+
+ heatUtils.handleKeyPairConflict(cloudSiteId, tenantId, createStackParam, 120, true, stack);
+ Mockito.verify(heatUtils, times(1)).queryStackResources(cloudSiteId, tenantId, "stackName", 2);
+ Mockito.verify(novaClient, times(1)).deleteKeyPair(cloudSiteId, tenantId, "KeypairName");
+ Mockito.verify(heatUtils, times(1)).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(1)).createStack(createStackParam, cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(1)).processCreateStack(cloudSiteId, tenantId, 120, true, createdStack,
+ createStackParam, false);
+ }
- StringBuilder stringBuilder = heatUtils.requestToStringBuilder(param);
+ @Test
+ public final void processCreateStack_Test() throws MsoException, IOException, NovaClientException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_FAILED");
+ stack.setStackStatusReason(
+ "Resource CREATE failed: Conflict: resources.my_keypair: Key pair 'hst3bbfnm0011vm001' already exists. (HTTP 409) (Request-ID: req-941b0af6-63ae-4d6a-afbc-90b728bacf82");
+
+ Stack createdStack = new Stack();
+ createdStack.setId("id");
+ createdStack.setStackName("stackName");
+ createdStack.setStackStatus("CREATE_COMPLETE");
+ createdStack.setStackStatusReason("Stack Created");
+
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+
+ doReturn(createdStack).when(heatUtils).pollStackForStatus(120, stack, "CREATE_IN_PROGRESS", cloudSiteId,
+ tenantId);
+ doReturn(createdStack).when(heatUtils).postProcessStackCreate(createdStack, true, 120, true, cloudSiteId,
+ tenantId, createStackParam);
+
+ heatUtils.processCreateStack(cloudSiteId, tenantId, 120, true, stack, createStackParam, true);
+ Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(1)).postProcessStackCreate(createdStack, true, 120, true, cloudSiteId, tenantId,
+ createStackParam);
+ }
- Assert.assertTrue(stringBuilder.toString().contains("StackName:"));
+ @Test
+ public final void processCreateStack_Exception_Backout_Test()
+ throws MsoException, IOException, NovaClientException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_FAILED");
+ stack.setStackStatusReason(
+ "Resource CREATE failed: Conflict: resources.my_keypair: Key pair 'hst3bbfnm0011vm001' already exists. (HTTP 409) (Request-ID: req-941b0af6-63ae-4d6a-afbc-90b728bacf82");
+
+ Stack deletedStack = new Stack();
+ deletedStack.setId("id");
+ deletedStack.setStackName("stackName");
+ deletedStack.setStackStatus("DELETE_COMPLETE");
+ deletedStack.setStackStatusReason("Stack Deleted");
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+
+ doThrow(new StackCreationException("Error")).when(heatUtils).pollStackForStatus(120, stack,
+ "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ exceptionRule.expect(MsoException.class);
+ exceptionRule.expectMessage("Error");
+ heatUtils.processCreateStack(cloudSiteId, tenantId, 120, true, stack, createStackParam, true);
+ Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(1)).postProcessStackCreate(stack, true, 120, true, cloudSiteId, tenantId,
+ createStackParam);
}
+
@Test
- public final void copyBaseOutputsToInputsTest() {
- Map<String, Object> inputs = new HashMap<>();
- inputs.put("str1", "str");
- Map<String, Object> otherStackOutputs = new HashMap<>();
- otherStackOutputs.put("str", "str");
- List<String> paramNames = new ArrayList<>();
- Map<String, String> aliases = new HashMap<>();
- aliases.put("str", "str");
- heatUtils.copyBaseOutputsToInputs(inputs, otherStackOutputs, null, aliases);
- Assert.assertEquals("str", otherStackOutputs.get("str"));
+ public final void createStack_Test() throws MsoException, IOException, NovaClientException {
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+
+ doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
+ doReturn(stackResource).when(heatClient).getStacks();
+ doReturn(mockCreateStack).when(stackResource).create(createStackParam);
+
+ doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(mockCreateStack);
+
+ heatUtils.createStack(createStackParam, cloudSiteId, tenantId);
+ Mockito.verify(stackResource, times(1)).create(createStackParam);
+ Mockito.verify(heatUtils, times(1)).saveStackRequest(eq(createStackParam), isNull(), eq("stackName"));
+ Mockito.verify(heatClient, times(1)).getStacks();
+ Mockito.verify(stackResource, times(1)).create(createStackParam);
}
@Test
- public final void getHeatClientSuccessTest() throws MsoException, IOException {
- CloudSite cloudSite = getCloudSite(getCloudIdentity());
- StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- Heat heatClient = heatUtils.getHeatClient(cloudSite, "TEST-tenant");
- assertNotNull(heatClient);
+ public final void saveStack_Test() throws MsoException, IOException, NovaClientException {
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+ Map<String, Object> parameters = new HashMap<String, Object>();
+ parameters.put("test", "value");
+ createStackParam.setParameters(parameters);
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId("requestId");
+ doReturn(request).when(requestDbClient).getInfraActiveRequestbyRequestId("requestId");
+ doNothing().when(requestDbClient).updateInfraActiveRequests(request);
+ heatUtils.saveStackRequest(createStackParam, "requestId", "stackName");
+ Mockito.verify(requestDbClient, times(1)).updateInfraActiveRequests(request);
+ assertNotNull(request.getCloudApiRequests().get(0));
+ assertEquals(request.getCloudApiRequests().get(0).getRequestId(), "requestId");
}
- @Test(expected = MsoOpenstackException.class)
- public final void getHeatClientOpenStackResponseException404Test() throws MsoException, IOException {
- CloudSite cloudSite = getCloudSite(getCloudIdentity());
- // mo mocks setup will cause 404 response from wiremock
- heatUtils.getHeatClient(cloudSite, "TEST-tenant");
+ @Test
+ public final void saveStack__Exists_Test() throws MsoException, IOException, NovaClientException {
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+ Map<String, Object> parameters = new HashMap<String, Object>();
+ parameters.put("test", "value");
+ createStackParam.setParameters(parameters);
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId("requestId");
+ CloudApiRequests cloudRequest = new CloudApiRequests();
+ cloudRequest.setCloudIdentifier("stackName");
+ cloudRequest.setRequestBody("testMe");
+ cloudRequest.setRequestId("requestId");
+ request.getCloudApiRequests().add(cloudRequest);
+ doReturn(request).when(requestDbClient).getInfraActiveRequestbyRequestId("requestId");
+ doNothing().when(requestDbClient).updateInfraActiveRequests(request);
+ heatUtils.saveStackRequest(createStackParam, "requestId", "stackName");
+ Mockito.verify(requestDbClient, times(1)).updateInfraActiveRequests(request);
+ assertNotNull(request.getCloudApiRequests().get(0));
+ assertEquals("requestId", request.getCloudApiRequests().get(0).getRequestId());
+ assertNotEquals("testMe", request.getCloudApiRequests().get(0).getRequestBody());
}
- @Test(expected = MsoAdapterException.class)
- public final void getHeatClientOpenStackResponseException401Test() throws MsoException, IOException {
- CloudSite cloudSite = getCloudSite(getCloudIdentity());
- StubOpenStack.mockOpenStackResponseUnauthorized(wireMockServer, wireMockPort);
- heatUtils.getHeatClient(cloudSite, "TEST-tenant");
+ @Test
+ public final void createStack_Error_Test() throws MsoException, IOException, NovaClientException {
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+
+ doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
+ doReturn(stackResource).when(heatClient).getStacks();
+ doReturn(mockCreateStack).when(stackResource).create(createStackParam);
+
+ doThrow(new OpenStackResponseException("Unknown Error", 500)).when(heatUtils)
+ .executeAndRecordOpenstackRequest(mockCreateStack);
+ exceptionRule.expect(MsoOpenstackException.class);
+ exceptionRule.expectMessage("Unknown Error");
+ heatUtils.createStack(createStackParam, cloudSiteId, tenantId);
+ Mockito.verify(stackResource, times(1)).create(createStackParam);
+ Mockito.verify(heatUtils, times(1)).saveStackRequest(eq(createStackParam), isNull(), eq("stackName"));
+ Mockito.verify(heatClient, times(1)).getStacks();
+ Mockito.verify(stackResource, times(1)).create(createStackParam);
}
- @Test(expected = MsoIOException.class)
- public final void getHeatClientOpenStackConnectExceptionTest() throws MsoException, IOException {
- CloudIdentity identity = getCloudIdentity();
- identity.setIdentityUrl("http://unreachable");
- CloudSite cloudSite = getCloudSite(identity);
- // mo mocks setup will cause 404 response from wiremock
- heatUtils.getHeatClient(cloudSite, "TEST-tenant");
+ @Test
+ public final void createStack_Error_404_Test() throws MsoException, IOException, NovaClientException {
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+
+ doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
+ doReturn(stackResource).when(heatClient).getStacks();
+ doReturn(mockCreateStack).when(stackResource).create(createStackParam);
+
+ doThrow(new OpenStackResponseException("Not Found", 409)).when(heatUtils)
+ .executeAndRecordOpenstackRequest(mockCreateStack);
+ exceptionRule.expect(MsoStackAlreadyExists.class);
+ exceptionRule.expectMessage("Stack stackName already exists in Tenant tenantId in Cloud cloudSiteId");
+ heatUtils.createStack(createStackParam, cloudSiteId, tenantId);
+ Mockito.verify(stackResource, times(1)).create(createStackParam);
+ Mockito.verify(heatUtils, times(1)).saveStackRequest(eq(createStackParam), isNull(), eq("stackName"));
+ Mockito.verify(heatClient, times(1)).getStacks();
+ Mockito.verify(stackResource, times(1)).create(createStackParam);
}
@Test
- public final void createStackSuccessTest() throws MsoException, IOException {
- CloudSite cloudSite = getCloudSite(getCloudIdentity());
- StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
- StubOpenStack.mockOpenStackGet(wireMockServer, "TEST-stack/stackId");
- StackInfo stackInfo = heatUtils.createStack(cloudSite.getId(), "CloudOwner", "tenantId", "TEST-stack", null,
- "TEST-heat", new HashMap<>(), false, 1, "TEST-env", new HashMap<>(), new HashMap<>(), false);
- assertNotNull(stackInfo);
+ public final void processCreateStack_Exception_No_Backout_Test()
+ throws MsoException, IOException, NovaClientException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_FAILED");
+ stack.setStackStatusReason(
+ "Resource CREATE failed: Conflict: resources.my_keypair: Key pair 'hst3bbfnm0011vm001' already exists. (HTTP 409) (Request-ID: req-941b0af6-63ae-4d6a-afbc-90b728bacf82");
+
+ Stack deletedStack = new Stack();
+ deletedStack.setId("id");
+ deletedStack.setStackName("stackName");
+ deletedStack.setStackStatus("DELETE_COMPLETE");
+ deletedStack.setStackStatusReason("Stack Deleted");
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+
+ doThrow(new StackCreationException("Error")).when(heatUtils).pollStackForStatus(120, stack,
+ "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+
+ exceptionRule.expect(MsoException.class);
+ exceptionRule.expectMessage("Error");
+ heatUtils.processCreateStack(cloudSiteId, tenantId, 120, false, stack, createStackParam, true);
+ Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(0)).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
}
+
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java
index 8951f8a304..acd42dd8da 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java
@@ -22,10 +22,8 @@ package org.onap.so.openstack.utils;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertThat;
-import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
@@ -98,7 +96,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
expectedStackInfo.setCanonicalName("stackName/id");
doReturn(Optional.of(cloudSite)).when(cloudConfig).getCloudSite(isA(String.class));
- doReturn(heatClient).when(heatUtils).getHeatClient(isA(CloudSite.class), isA(String.class));
+ doReturn(heatClient).when(heatUtils).getHeatClient(isA(String.class), isA(String.class));
doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(isA(OpenStackRequest.class));
doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class));
doReturn(updateStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class));
@@ -123,7 +121,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
expectedStackInfo.setCanonicalName("stackName/id");
doReturn(Optional.of(cloudSite)).when(cloudConfig).getCloudSite(isA(String.class));
- doReturn(heatClient).when(heatUtils).getHeatClient(isA(CloudSite.class), isA(String.class));
+ doReturn(heatClient).when(heatUtils).getHeatClient(isA(String.class), isA(String.class));
doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(isA(OpenStackRequest.class));
doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class));
@@ -150,7 +148,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
expectedStackInfo.setCanonicalName("stackName/id");
doReturn(Optional.of(cloudSite)).when(cloudConfig).getCloudSite(isA(String.class));
- doReturn(heatClient).when(heatUtils).getHeatClient(isA(CloudSite.class), isA(String.class));
+ doReturn(heatClient).when(heatUtils).getHeatClient(isA(String.class), isA(String.class));
doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(isA(OpenStackRequest.class));
doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class));
doReturn(updateStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class));
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/StackStatusHandlerTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/StackStatusHandlerTest.java
new file mode 100644
index 0000000000..985a39a76b
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/StackStatusHandlerTest.java
@@ -0,0 +1,89 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.openstack.utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import java.io.IOException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.db.request.beans.RequestProcessingData;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.openstack.exceptions.MsoException;
+import com.woorea.openstack.heat.model.Stack;
+
+@RunWith(MockitoJUnitRunner.class)
+public class StackStatusHandlerTest {
+
+ @InjectMocks
+ StackStatusHandler statusHandler;
+
+ @Mock
+ RequestsDbClient requestDBClient;
+
+ @Test
+ public final void recordExists_Test() throws MsoException, IOException {
+ RequestProcessingData requestProcessingData = new RequestProcessingData();
+ requestProcessingData.setValue("testMe");
+
+ doReturn(requestProcessingData).when(requestDBClient)
+ .getRequestProcessingDataBySoRequestIdAndNameAndGrouping(null, "stackName", "id");
+ Stack latestStack = new Stack();
+ latestStack.setId("id");
+ latestStack.setStackName("stackName");
+ latestStack.setStackStatus("CREATE_COMPLETE");
+ latestStack.setStackStatusReason("Stack Finished");
+
+ statusHandler.updateStackStatus(latestStack);
+ Mockito.verify(requestDBClient, times(1)).updateRequestProcessingData(requestProcessingData);
+ assertNotEquals("testMe", requestProcessingData.getValue());
+ }
+
+ @Test
+ public final void record_Not_Exists_Test() throws MsoException, IOException {
+ ArgumentCaptor<RequestProcessingData> requestCaptor = ArgumentCaptor.forClass(RequestProcessingData.class);
+ doReturn(null).when(requestDBClient).getRequestProcessingDataBySoRequestIdAndNameAndGrouping(null, "stackName",
+ "id");
+ Stack latestStack = new Stack();
+ latestStack.setId("id");
+ latestStack.setStackName("stackName");
+ latestStack.setStackStatus("CREATE_COMPLETE");
+ latestStack.setStackStatusReason("Stack Finished");
+ statusHandler.updateStackStatus(latestStack);
+ Mockito.verify(requestDBClient, times(1)).saveRequestProcessingData(requestCaptor.capture());
+ RequestProcessingData actualRequest = requestCaptor.getValue();
+ assertEquals("id", actualRequest.getGroupingId());
+ assertEquals("StackInformation", actualRequest.getTag());
+ assertEquals("stackName", actualRequest.getName());
+ assertNotNull(actualRequest.getValue());
+
+ }
+
+
+}
diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_Created.json b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_Created.json
index 477acadf81..7eae6d14a4 100644
--- a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_Created.json
+++ b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_Created.json
@@ -2,7 +2,7 @@
"stack": {
"description": null,
"links": null,
- "stack_status_reason": null,
+ "stack_status_reason": "Stack Created",
"stack_name": "stackname",
"updated_time": null,
"creation_time": null,
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStateType.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStateType.java
index 8870f5c7b5..d20e0494ae 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStateType.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStateType.java
@@ -25,7 +25,13 @@ package org.onap.so.adapters.vdu;
* Enum status values to capture the state of a generic (cloud-agnostic) VDU.
*/
public enum VduStateType {
- NOTFOUND, INSTANTIATING, INSTANTIATED, DELETING, DELETED, // Note - only returned in success response to deleteVdu
- // call.
- UPDATING, FAILED, UNKNOWN
+ NOTFOUND,
+ INSTANTIATING,
+ INSTANTIATED,
+ DELETING,
+ DELETED, // Note - only returned in success response to deleteVdu
+ // call.
+ UPDATING,
+ FAILED,
+ UNKNOWN
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HostRoute.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HostRoute.java
index 431870ba9e..afe9d71e92 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HostRoute.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HostRoute.java
@@ -20,16 +20,16 @@
package org.onap.so.openstack.beans;
-
-
+import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {"prefix", "nextHop"})
-public class HostRoute {
+public class HostRoute implements Serializable {
+ private static final long serialVersionUID = 2468793257174064133L;
private String prefix;
private String nextHop;
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java
index ef5d4316d7..90b8024c18 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -36,8 +38,8 @@ public class MapAdapter extends XmlAdapter<MapEntry, Map<String, Object>> {
MapEntry map = new MapEntry();
- for (String key : v.keySet()) {
- map.addEntry(key, v.get(key));
+ for (Map.Entry<String, Object> entry : v.entrySet()) {
+ map.addEntry(entry.getKey(), entry.getValue());
}
return map;
@@ -49,9 +51,9 @@ public class MapAdapter extends XmlAdapter<MapEntry, Map<String, Object>> {
return null;
}
- Map<String, Object> map = new HashMap<>(v.entry.size());
+ Map<String, Object> map = new HashMap<>(v.getEntry().size());
- for (MapElements entry : v.entry) {
+ for (MapElements entry : v.getEntry()) {
if (entry.value instanceof Element) {
map.put(entry.key, ((Element) entry.value).getTextContent());
} else {
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java
index 0327fd67a3..3dd339dc68 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -35,7 +37,9 @@ public class MapElements {
@XmlElement
public Object value;
- public MapElements() {} // Required by JAXB
+ public MapElements() {
+ // Required by JAXB
+ }
public MapElements(String key, Object value) {
this.key = key;
@@ -46,7 +50,7 @@ public class MapElements {
try {
this.value = new ObjectMapper().writeValueAsString(value);
} catch (JsonProcessingException e) {
- logger.warn("could not marshal value to json, calling toString");
+ logger.warn("could not marshal value to json, calling toString", e);
this.value = value.toString();
}
} else {
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java
index 489e11e111..b6b121c820 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -25,12 +27,23 @@ import java.util.List;
public class MapEntry {
- public List<MapElements> entry = new ArrayList<>();
+ private List<MapElements> entry = new ArrayList<>();
- public MapEntry() {} // Required by JAXB
+ public MapEntry() {
+ // Required by JAXB
+ }
- public void addEntry(String key, Object value) {
+ void addEntry(String key, Object value) {
entry.add(new MapElements(key, value));
}
+ public List<MapElements> getEntry() {
+ // Required by JAXB
+ return entry;
+ }
+
+ public void setEntry(List<MapElements> entry) {
+ // Required by JAXB
+ this.entry = entry;
+ }
}
diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java
index 189d4cca3e..5089ba1301 100644
--- a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java
+++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -24,12 +26,13 @@ import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import org.junit.Test;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
-import com.fasterxml.jackson.databind.ObjectMapper;
public class JAXBMarshallingTest {
@@ -53,11 +56,16 @@ public class JAXBMarshallingTest {
CreateVfModuleRequest request = new CreateVfModuleRequest();
request.getVfModuleParams().put("test-null", null);
+ request.getVfModuleParams().put("vcpe_image_name", "ubuntu-16-04-cloud-amd64");
+ request.getVfModuleParams().put("test-empty", "");
request.getVfModuleParams().put("test array", Arrays.asList("a", "b", "c"));
+ request.getVfModuleParams().put("test map", Collections.singletonMap("d", "e"));
+ request.getVfModuleParams().put("marshalling error", new ArrayList());
- assertEquals("documents are equal",
+ assertEquals("documents should be equal",
new String(Files
- .readAllBytes(Paths.get("src/test/resources/VfRequest-marshalled-with-complex-object.xml"))),
+ .readAllBytes(Paths.get("src/test/resources/VfRequest-marshalled-with-complex-object.xml")))
+ .replaceAll("\\R", "\n"),
request.toXmlString());
}
diff --git a/adapters/mso-adapters-rest-interface/src/test/resources/VfRequest-marshalled-with-complex-object.xml b/adapters/mso-adapters-rest-interface/src/test/resources/VfRequest-marshalled-with-complex-object.xml
index ce175127df..d4955f1b18 100644
--- a/adapters/mso-adapters-rest-interface/src/test/resources/VfRequest-marshalled-with-complex-object.xml
+++ b/adapters/mso-adapters-rest-interface/src/test/resources/VfRequest-marshalled-with-complex-object.xml
@@ -4,12 +4,28 @@
<backout>true</backout>
<vfModuleParams>
<entry>
+ <key>vcpe_image_name</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">ubuntu-16-04-cloud-amd64</value>
+ </entry>
+ <entry>
<key>test array</key>
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">["a","b","c"]</value>
</entry>
<entry>
+ <key>test map</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">{"d":"e"}</value>
+ </entry>
+ <entry>
<key>test-null</key>
</entry>
+ <entry>
+ <key>marshalling error</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">[]</value>
+ </entry>
+ <entry>
+ <key>test-empty</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string"></value>
+ </entry>
</vfModuleParams>
<msoRequest/>
</createVfModuleRequest>
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
index 0f46e91311..4d11858960 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
@@ -7,147 +7,147 @@ DELETE FROM building_block_detail;
DELETE FROM orchestration_status_state_transition_directive;
-INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE,IS_TOPLEVELFLOW, MIN_API_VERSION, MAX_API_VERSION, CLOUD_OWNER) VALUES
-('Service-Create', 'createInstance', 'Service', true,true, '7','7', 'cloudOwner'),
-('Service-Delete', 'deleteInstance', 'Service', true,true, '7','7', 'cloudOwner'),
-('Service-Macro-Assign', 'assignInstance', 'Service', false,true, '7','7', 'cloudOwner'),
-('Service-Macro-Activate', 'activateInstance', 'Service', false,true, '7','7', 'cloudOwner'),
-('Service-Macro-Unassign', 'unassignInstance', 'Service', false,true, '7','7', 'cloudOwner'),
-('Service-Macro-Create', 'createInstance', 'Service', false,true, '7','7', 'cloudOwner'),
-('Service-Macro-Delete', 'deleteInstance', 'Service', false,true, '7','7', 'cloudOwner'),
-('Network-Create', 'createInstance', 'Network', true,true, '7','7', 'cloudOwner'),
-('Network-Delete', 'deleteInstance', 'Network', true,true, '7','7', 'cloudOwner'),
-('VNF-Macro-Recreate', 'recreateInstance', 'Vnf', false,true, '7','7', 'cloudOwner'),
-('VNF-Macro-Replace', 'replaceInstance', 'Vnf', false,true, '7','7', 'cloudOwner'),
-('VNF-Create', 'createInstance', 'Vnf', true,true, '7', '7', 'cloudOwner'),
-('VNF-Delete', 'deleteInstance', 'Vnf', true,true, '7', '7', 'cloudOwner'),
-('VolumeGroup-Create', 'createInstance', 'VolumeGroup', true,true, '7','7', 'cloudOwner'),
-('VolumeGroup-Delete', 'deleteInstance', 'VolumeGroup', true,true, '7','7', 'cloudOwner'),
-('VFModule-Create', 'createInstance', 'VfModule', true,true, '7','7', 'cloudOwner'),
-('VFModule-Delete', 'deleteInstance', 'VfModule', true,true, '7','7', 'cloudOwner'),
-('NetworkCollection-Macro-Create', 'createInstance', 'NetworkCollection', false,true, '7','7', 'cloudOwner'),
-('NetworkCollection-Macro-Delete', 'deleteInstance', 'NetworkCollection', false,true, '7','7', 'cloudOwner'),
-('VFModule-ScaleOut', 'createInstance', 'VfModule', true, true, '7','7', 'cloudOwner');
+INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE,IS_TOPLEVELFLOW, MIN_API_VERSION, MAX_API_VERSION, CLOUD_OWNER, SERVICE_TYPE) VALUES
+('Service-Create', 'createInstance', 'Service', true,true, '7','7', 'CloudOwner', '*'),
+('Service-Delete', 'deleteInstance', 'Service', true,true, '7','7', 'CloudOwner', '*'),
+('Service-Macro-Assign', 'assignInstance', 'Service', false,true, '7','7', 'CloudOwner', '*'),
+('Service-Macro-Activate', 'activateInstance', 'Service', false,true, '7','7', 'CloudOwner', '*'),
+('Service-Macro-Unassign', 'unassignInstance', 'Service', false,true, '7','7', 'CloudOwner', '*'),
+('Service-Macro-Create', 'createInstance', 'Service', false,true, '7','7', 'CloudOwner', '*'),
+('Service-Macro-Delete', 'deleteInstance', 'Service', false,true, '7','7', 'CloudOwner', '*'),
+('Network-Create', 'createInstance', 'Network', true,true, '7','7', 'CloudOwner', '*'),
+('Network-Delete', 'deleteInstance', 'Network', true,true, '7','7', 'CloudOwner', '*'),
+('VNF-Macro-Recreate', 'recreateInstance', 'Vnf', false,true, '7','7', 'CloudOwner', '*'),
+('VNF-Macro-Replace', 'replaceInstance', 'Vnf', false,true, '7','7', 'CloudOwner', '*'),
+('VNF-Create', 'createInstance', 'Vnf', true,true, '7', '7', 'CloudOwner', '*'),
+('VNF-Delete', 'deleteInstance', 'Vnf', true,true, '7', '7', 'CloudOwner', '*'),
+('VolumeGroup-Create', 'createInstance', 'VolumeGroup', true,true, '7','7', 'CloudOwner', '*'),
+('VolumeGroup-Delete', 'deleteInstance', 'VolumeGroup', true,true, '7','7', 'CloudOwner', '*'),
+('VFModule-Create', 'createInstance', 'VfModule', true,true, '7','7', 'CloudOwner', '*'),
+('VFModule-Delete', 'deleteInstance', 'VfModule', true,true, '7','7', 'CloudOwner', '*'),
+('NetworkCollection-Macro-Create', 'createInstance', 'NetworkCollection', false,true, '7','7', 'CloudOwner', '*'),
+('NetworkCollection-Macro-Delete', 'deleteInstance', 'NetworkCollection', false,true, '7','7', 'CloudOwner', '*'),
+('VFModule-ScaleOut', 'scaleOut', 'VfModule', true, true, '7','7', 'CloudOwner', '*');
INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES
-('Service-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Create', '2', 'ActivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Delete', '1', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Delete', '2', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Assign', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Assign', '2', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Assign', '3', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Assign', '4', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Assign', '5', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Assign', '6', 'ConfigAssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Activate', '1', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Activate', '2', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Activate', '3', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Activate', '4', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Activate', '5', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Activate', '6', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Activate', '7', 'ConfigDeployVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Activate', '8', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Activate', '9', 'ActivateServiceInstance', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Unassign', '1', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Unassign', '2', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Unassign', '3', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Unassign', '4', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Unassign', '5', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Create', '2', 'CreateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Create', '3', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Create', '4', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Create', '5', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Create', '6', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Create', '7', 'ConfigAssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Create', '8', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Create', '9', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Create', '10', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Create', '11', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Create', '12', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Create', '13', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Create', '14', 'ConfigDeployVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Create', '15', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Create', '16', 'ActivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Create', '17', 'ActivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Delete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Delete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Delete', '3', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Delete', '4', 'DeleteVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Delete', '5', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Delete', '6', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Delete', '7', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Delete', '8', 'DeactivateNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Delete', '9', 'DeleteNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Delete', '10', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Delete', '11', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Delete', '12', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Delete', '13', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Delete', '14', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Service-Macro-Delete', '15', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Network-Create', '1', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Network-Create', '2', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Network-Create', '3', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'cloudOwner')),
-('Network-Delete', '1', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Network-Delete', '2', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('Network-Delete', '3', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Create', '1', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Create' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Create', '2', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Create' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Delete', '1', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Delete', '2', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Recreate', '1', 'AAICheckVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Recreate', '2', 'AAISetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Recreate', '3', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Recreate', '4', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Recreate', '5', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Recreate', '6', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Recreate', '7', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Recreate', '8', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Recreate', '9', 'SDNOVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Recreate', '10', 'AAIUnsetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Replace', '1', 'AAICheckVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Replace', '2', 'AAISetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Replace', '5', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Replace', '6', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Replace', '7', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Replace', '8', 'ChangeModelVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Replace', '9', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Replace', '10', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Replace', '13', 'ChangeModelVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Replace', '14', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Replace', '15', 'ChangeModelServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Replace', '16', 'SDNOVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')),
-('VNF-Macro-Replace', '17', 'AAIUnsetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')),
-('VolumeGroup-Create', '1', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create' and CLOUD_OWNER = 'cloudOwner')),
-('VolumeGroup-Create', '2', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create' and CLOUD_OWNER = 'cloudOwner')),
-('VolumeGroup-Create', '3', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create' and CLOUD_OWNER = 'cloudOwner')),
-('VolumeGroup-Delete', '1', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('VolumeGroup-Delete', '2', 'DeleteVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('VolumeGroup-Delete', '3', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('VFModule-Create', '1', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create' and CLOUD_OWNER = 'cloudOwner')),
-('VFModule-Create', '2', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create' and CLOUD_OWNER = 'cloudOwner')),
-('VFModule-Create', '3', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create' and CLOUD_OWNER = 'cloudOwner')),
-('VFModule-Delete', '3', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('VFModule-Delete', '4', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('VFModule-Delete', '5', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('NetworkCollection-Macro-Create', '1', 'CreateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('NetworkCollection-Macro-Create', '2', 'AssignNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('NetworkCollection-Macro-Create', '3', 'CreateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('NetworkCollection-Macro-Create', '4', 'ActivateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('NetworkCollection-Macro-Create', '5', 'ActivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'cloudOwner')),
-('NetworkCollection-Macro-Delete', '1', 'DeactivateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('NetworkCollection-Macro-Delete', '2', 'DeleteNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('NetworkCollection-Macro-Delete', '3', 'UnassignNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('NetworkCollection-Macro-Delete', '4', 'DeactivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('NetworkCollection-Macro-Delete', '5', 'DeleteNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')),
-('VFModule-ScaleOut', '1', 'GenericVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner')),
-('VFModule-ScaleOut', '2', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner')),
-('VFModule-ScaleOut', '3', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner')),
-('VFModule-ScaleOut', '4', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner')),
-('VFModule-ScaleOut', '5', 'ConfigurationScaleOutBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner')),
-('VFModule-ScaleOut', '6', 'GenericVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner'));
+('Service-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Create', '2', 'ActivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Delete', '1', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Delete', '2', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Assign', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Assign', '2', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Assign', '3', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Assign', '4', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Assign', '5', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Assign', '6', 'ConfigAssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Activate', '1', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Activate', '2', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Activate', '3', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Activate', '4', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Activate', '5', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Activate', '6', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Activate', '7', 'ConfigDeployVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Activate', '8', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Activate', '9', 'ActivateServiceInstance', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Unassign', '1', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Unassign', '2', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Unassign', '3', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Unassign', '4', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Unassign', '5', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Create', '2', 'CreateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Create', '3', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Create', '4', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Create', '5', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Create', '6', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Create', '7', 'ConfigAssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Create', '8', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Create', '9', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Create', '10', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Create', '11', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Create', '12', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Create', '13', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Create', '14', 'ConfigDeployVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Create', '15', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Create', '16', 'ActivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Create', '17', 'ActivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Delete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Delete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Delete', '3', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Delete', '4', 'DeleteVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Delete', '5', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Delete', '6', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Delete', '7', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Delete', '8', 'DeactivateNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Delete', '9', 'DeleteNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Delete', '10', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Delete', '11', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Delete', '12', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Delete', '13', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Delete', '14', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Service-Macro-Delete', '15', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Network-Create', '1', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Network-Create', '2', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Network-Create', '3', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'CloudOwner')),
+('Network-Delete', '1', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Network-Delete', '2', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('Network-Delete', '3', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Create', '1', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Create' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Create', '2', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Create' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Delete', '1', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Delete', '2', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Recreate', '1', 'AAICheckVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Recreate', '2', 'AAISetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Recreate', '3', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Recreate', '4', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Recreate', '5', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Recreate', '6', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Recreate', '7', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Recreate', '8', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Recreate', '9', 'SDNOVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Recreate', '10', 'AAIUnsetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Replace', '1', 'AAICheckVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Replace', '2', 'AAISetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Replace', '5', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Replace', '6', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Replace', '7', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Replace', '8', 'ChangeModelVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Replace', '9', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Replace', '10', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Replace', '13', 'ChangeModelVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Replace', '14', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Replace', '15', 'ChangeModelServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Replace', '16', 'SDNOVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')),
+('VNF-Macro-Replace', '17', 'AAIUnsetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')),
+('VolumeGroup-Create', '1', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create' and CLOUD_OWNER = 'CloudOwner')),
+('VolumeGroup-Create', '2', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create' and CLOUD_OWNER = 'CloudOwner')),
+('VolumeGroup-Create', '3', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create' and CLOUD_OWNER = 'CloudOwner')),
+('VolumeGroup-Delete', '1', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('VolumeGroup-Delete', '2', 'DeleteVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('VolumeGroup-Delete', '3', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('VFModule-Create', '1', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create' and CLOUD_OWNER = 'CloudOwner')),
+('VFModule-Create', '2', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create' and CLOUD_OWNER = 'CloudOwner')),
+('VFModule-Create', '3', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create' and CLOUD_OWNER = 'CloudOwner')),
+('VFModule-Delete', '3', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('VFModule-Delete', '4', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('VFModule-Delete', '5', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('NetworkCollection-Macro-Create', '1', 'CreateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('NetworkCollection-Macro-Create', '2', 'AssignNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('NetworkCollection-Macro-Create', '3', 'CreateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('NetworkCollection-Macro-Create', '4', 'ActivateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('NetworkCollection-Macro-Create', '5', 'ActivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'CloudOwner')),
+('NetworkCollection-Macro-Delete', '1', 'DeactivateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('NetworkCollection-Macro-Delete', '2', 'DeleteNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('NetworkCollection-Macro-Delete', '3', 'UnassignNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('NetworkCollection-Macro-Delete', '4', 'DeactivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('NetworkCollection-Macro-Delete', '5', 'DeleteNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')),
+('VFModule-ScaleOut', '1', 'GenericVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'CloudOwner')),
+('VFModule-ScaleOut', '2', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'CloudOwner')),
+('VFModule-ScaleOut', '3', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'CloudOwner')),
+('VFModule-ScaleOut', '4', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'CloudOwner')),
+('VFModule-ScaleOut', '5', 'ConfigurationScaleOutBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'CloudOwner')),
+('VFModule-ScaleOut', '6', 'GenericVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'CloudOwner'));
INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY)
VALUES
@@ -234,8 +234,8 @@ VALUES
('DeleteNetworkBB', 'NETWORK', 'DELETE'),
('DeleteNetworkCollectionBB', 'NETWORK', 'DELETE'),
-('ConfigurationScaleOutBB', 'VF_MODULE', 'CREATE'),
-('GenericVnfHealthCheckBB', 'VF_MODULE', 'CREATE');
+('ConfigurationScaleOutBB', 'NO_VALIDATE', 'CUSTOM'),
+('GenericVnfHealthCheckBB', 'NO_VALIDATE', 'CUSTOM');
INSERT INTO orchestration_status_state_transition_directive (resource_type, orchestration_status, target_action, flow_directive)
VALUES
@@ -597,40 +597,40 @@ WHERE TARGET_ACTION = 'CHANGEMODEL';
INSERT INTO building_block_detail(BUILDING_BLOCK_NAME, RESOURCE_TYPE, TARGET_ACTION)
VALUES
('UnassignVfModuleBB', 'VF_MODULE', 'UNASSIGN'),
-('SniroHoming', 'CUSTOM', 'CUSTOM'),
-('DeactivateAndUnassignVpnBondingLinksBB', 'CUSTOM', 'CUSTOM'),
-('DeactivateNetworkCollectionBB', 'CUSTOM', 'CUSTOM'),
-('AAICheckVnfInMaintBB', 'CUSTOM', 'CUSTOM'),
-('AAISetVnfInMaintBB', 'CUSTOM', 'CUSTOM'),
-('AAIUnsetVnfInMaintBB', 'CUSTOM', 'CUSTOM'),
-('SDNOVnfHealthCheckBB', 'CUSTOM', 'CUSTOM'),
-('VNF-Macro-Replace', 'CUSTOM', 'CUSTOM'),
-('HomingBB', 'CUSTOM', 'CUSTOM');
+('SniroHoming', 'NO_VALIDATE', 'CUSTOM'),
+('DeactivateAndUnassignVpnBondingLinksBB', 'NO_VALIDATE', 'CUSTOM'),
+('DeactivateNetworkCollectionBB', 'NO_VALIDATE', 'CUSTOM'),
+('AAICheckVnfInMaintBB', 'NO_VALIDATE', 'CUSTOM'),
+('AAISetVnfInMaintBB', 'NO_VALIDATE', 'CUSTOM'),
+('AAIUnsetVnfInMaintBB', 'NO_VALIDATE', 'CUSTOM'),
+('SDNOVnfHealthCheckBB', 'NO_VALIDATE', 'CUSTOM'),
+('VNF-Macro-Replace', 'NO_VALIDATE', 'CUSTOM'),
+('HomingBB', 'NO_VALIDATE', 'CUSTOM');
INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE)
VALUES
-('CUSTOM', 'ACTIVE', 'CUSTOM', 'CONTINUE'),
-('CUSTOM', 'ASSIGNED', 'CUSTOM', 'CONTINUE'),
-('CUSTOM', 'CREATED', 'CUSTOM', 'CONTINUE'),
-('CUSTOM', 'INVENTORIED', 'CUSTOM', 'CONTINUE'),
-('CUSTOM', 'PENDING', 'CUSTOM', 'CONTINUE'),
-('CUSTOM', 'PENDING_ACTIVATION', 'CUSTOM', 'CONTINUE'),
-('CUSTOM', 'PENDING_CREATE', 'CUSTOM', 'CONTINUE'),
-('CUSTOM', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE'),
-('CUSTOM', 'PRECREATED', 'CUSTOM', 'CONTINUE');
-
-INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER) VALUES
-('VFModule-DeactivateAndCloudDelete', 'deactivateAndCloudDelete', 'VfModule', true, '7','7', true, 'cloudOwner');
+('NO_VALIDATE', 'ACTIVE', 'CUSTOM', 'CONTINUE'),
+('NO_VALIDATE', 'ASSIGNED', 'CUSTOM', 'CONTINUE'),
+('NO_VALIDATE', 'CREATED', 'CUSTOM', 'CONTINUE'),
+('NO_VALIDATE', 'INVENTORIED', 'CUSTOM', 'CONTINUE'),
+('NO_VALIDATE', 'PENDING', 'CUSTOM', 'CONTINUE'),
+('NO_VALIDATE', 'PENDING_ACTIVATION', 'CUSTOM', 'CONTINUE'),
+('NO_VALIDATE', 'PENDING_CREATE', 'CUSTOM', 'CONTINUE'),
+('NO_VALIDATE', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE'),
+('NO_VALIDATE', 'PRECREATED', 'CUSTOM', 'CONTINUE');
+
+INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER, SERVICE_TYPE) VALUES
+('VFModule-DeactivateAndCloudDelete', 'deactivateAndCloudDelete', 'VfModule', true, '7','7', true, 'CloudOwner', '*');
INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES
-('VFModule-DeactivateAndCloudDelete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-DeactivateAndCloudDelete' and CLOUD_OWNER = 'cloudOwner')),
-('VFModule-DeactivateAndCloudDelete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-DeactivateAndCloudDelete' and CLOUD_OWNER = 'cloudOwner'));
+('VFModule-DeactivateAndCloudDelete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-DeactivateAndCloudDelete' and CLOUD_OWNER = 'CloudOwner')),
+('VFModule-DeactivateAndCloudDelete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-DeactivateAndCloudDelete' and CLOUD_OWNER = 'CloudOwner'));
-INSERT INTO northbound_request_ref_lookup (REQUEST_SCOPE, MACRO_ACTION, ACTION, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER)
-values ( 'Service', 'Service-Macro-Deactivate', 'deactivateInstance', '0', '7', '7', '1', 'cloudOwner');
+INSERT INTO northbound_request_ref_lookup (REQUEST_SCOPE, MACRO_ACTION, ACTION, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER, SERVICE_TYPE)
+values ( 'Service', 'Service-Macro-Deactivate', 'deactivateInstance', '0', '7', '7', '1', 'CloudOwner', '*');
INSERT INTO orchestration_flow_reference (COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID)
-values ( 'Service-Macro-Deactivate', '1', 'DeactivateServiceInstanceBB', '1', (SELECT id FROM northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Deactivate' and CLOUD_OWNER = 'cloudOwner'));
+values ( 'Service-Macro-Deactivate', '1', 'DeactivateServiceInstanceBB', '1', (SELECT id FROM northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Deactivate' and CLOUD_OWNER = 'CloudOwner'));
UPDATE northbound_request_ref_lookup SET MIN_API_VERSION = 5 WHERE MACRO_ACTION = 'Service-Macro-Create';
@@ -639,10 +639,10 @@ UPDATE northbound_request_ref_lookup SET MIN_API_VERSION = 5 WHERE MACRO_ACTION
UPDATE northbound_request_ref_lookup SET MIN_API_VERSION = 5 WHERE MACRO_ACTION = 'Service-Macro-Deactivate';
-INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER) VALUES
-('Network-Update', 'updateInstance', 'Network', true, '7','7','1', 'cloudOwner');
+INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER, SERVICE_TYPE) VALUES
+('Network-Update', 'updateInstance', 'Network', true, '7','7','1', 'CloudOwner', '*');
INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES
-('Network-Update', '1', 'UpdateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Update' and CLOUD_OWNER = 'cloudOwner'));
+('Network-Update', '1', 'UpdateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Update' and CLOUD_OWNER = 'CloudOwner'));
INSERT INTO building_block_detail(BUILDING_BLOCK_NAME,RESOURCE_TYPE,TARGET_ACTION) VALUES
('UpdateNetworkBB','NETWORK','UPDATE');
@@ -778,5 +778,38 @@ VALUES
('GenericVnfHealthCheckBB', '*', '*', '*', "*" , 'Retry'),
('ConfigurationScaleOutBB', '*', '*', '*', "*" , 'Retry');
+INSERT INTO building_block_detail(BUILDING_BLOCK_NAME, RESOURCE_TYPE, TARGET_ACTION)
+VALUES
+('VNFSetInMaintFlagActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFCheckPserversLockedFlagActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFCheckInMaintFlagActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFCheckClosedLoopDisabledFlagActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFSetClosedLoopDisabledFlagActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFUnsetClosedLoopDisabledFlagActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFLockActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFUnlockActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFStopActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFStartActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFSnapShotActivity', 'NO_VALIDATE', 'CUSTOM'),
+('FlowCompleteActivity', 'NO_VALIDATE', 'CUSTOM'),
+('PauseForManualTaskActivity', 'NO_VALIDATE', 'CUSTOM'),
+('DistributeTrafficActivity', 'NO_VALIDATE', 'CUSTOM'),
+('DistributeTrafficCheckActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFHealthCheckActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFQuiesceTrafficActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFResumeTrafficActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFUnsetInMaintFlagActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFUpgradeBackupActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFUpgradePostCheckActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFUpgradePreCheckActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VNFUpgradeSoftwareActivity', 'NO_VALIDATE', 'CUSTOM'),
+('VnfInPlaceSoftwareUpdate', 'NO_VALIDATE', 'CUSTOM');
+
+UPDATE northbound_request_ref_lookup SET SERVICE_TYPE = '*' WHERE SERVICE_TYPE IS NULL;
+
+INSERT INTO building_block_detail(BUILDING_BLOCK_NAME, RESOURCE_TYPE, TARGET_ACTION)
+VALUES
+('ConfigAssignVnfBB', 'NO_VALIDATE', 'CUSTOM'),
+('ConfigDeployVnfBB', 'NO_VALIDATE', 'CUSTOM');
-UPDATE rainy_day_handler_macro SET reg_ex_error_message = '*' WHERE reg_ex_error_message IS null; \ No newline at end of file
+UPDATE rainy_day_handler_macro SET reg_ex_error_message = '*' WHERE reg_ex_error_message IS null;
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql
index 054fb1af57..3f76334bd9 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql
@@ -148,6 +148,9 @@ VALUES
('existing_software_version','userParams','Existing Software Version','text','',1,50,''),
('tenantId','cloudConfiguration','Tenant/Project ID','text','',1,36,''),
('new_software_version','userParams','New Software Version','text','',1,50,''),
+('book_name','userParams','Name of Commands Book Set','text','',1,50,''),
+('node_list','userParams','List of Nodes','text','',1,200,''),
+('file_parameter_content','userParams','Configuration File Content','text','',1,50000,''),
('lcpCloudRegionId','cloudConfiguration','Cloud Region ID','text','',1,7,'');
INSERT INTO `activity_spec_to_user_parameters`(`ACTIVITY_SPEC_ID`,`USER_PARAMETERS_ID`)
@@ -166,6 +169,18 @@ VALUES
(select ID from user_parameters where NAME='tenantId')),
((select ID from activity_spec where NAME='VNFQuiesceTrafficActivity' and VERSION=1.0),
(select ID from user_parameters where NAME='operations_timeout')),
+((select ID from activity_spec where NAME='DistributeTrafficActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='book_name')),
+((select ID from activity_spec where NAME='DistributeTrafficActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='node_list')),
+((select ID from activity_spec where NAME='DistributeTrafficActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='file_parameter_content')),
+((select ID from activity_spec where NAME='DistributeTrafficCheckActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='book_name')),
+((select ID from activity_spec where NAME='DistributeTrafficCheckActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='node_list')),
+((select ID from activity_spec where NAME='DistributeTrafficCheckActivity' and VERSION=1.0),
+(select ID from user_parameters where NAME='file_parameter_content')),
((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0),
(select ID from user_parameters where NAME='existing_software_version')),
((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0),
@@ -181,4 +196,10 @@ VALUES
((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0),
(select ID from user_parameters where NAME='existing_software_version')),
((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0),
-(select ID from user_parameters where NAME='new_software_version')); \ No newline at end of file
+(select ID from user_parameters where NAME='new_software_version'));
+
+INSERT INTO `workflow` (`ARTIFACT_UUID`,`ARTIFACT_NAME`,`NAME`,`OPERATION_NAME`,`VERSION`,`DESCRIPTION`,`RESOURCE_TARGET`,`SOURCE`)
+VALUES
+('9d45cd30-1a89-4993-87c1-6dd09c1696cf','VFModule-ScaleOut','VNF Scale Out','ScaleOut',1.0,'native static workflow to support ScaleOut','vfModule','native'),
+('da6478e4-ea33-3346-ac12-ab121284a333','VnfInPlaceUpdate.bpmn','VNF In Place Software Update','inPlaceSoftwareUpdate',1.0,'native static workflow to support inPlaceSoftwareUpdate','vnf','native'),
+('fdb3ac48-70f9-4584-bd92-253bdbdec1e1','VnfConfigUpdate.bpmn','VNF Config Update','applyConfigModify',1.0,'native static workflow to support applyConfigModify','vnf','native'); \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql
index 3d8f68408d..5d940fb9ea 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql
@@ -11,9 +11,9 @@ parameters:
description: Name of the Neutron Network
default: ONAP-NW1
shared:
- type: boolean
- description: Shared amongst tenants
- default: False
+ type: boolean
+ description: Shared amongst tenants
+ default: False
outputs:
network_id:
description: Openstack network identifier
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.0__AddNamingPolicyToService.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.0__AddNamingPolicyToService.sql
new file mode 100644
index 0000000000..3c45507b81
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.0__AddNamingPolicyToService.sql
@@ -0,0 +1,8 @@
+USE catalogdb;
+
+ALTER TABLE service
+ADD IF NOT EXISTS ONAP_GENERATED_NAMING tinyint(1) DEFAULT NULL;
+
+ALTER TABLE service
+ADD IF NOT EXISTS NAMING_POLICY varchar(200) DEFAULT NULL;
+
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java
index 3fb156d68a..499310748e 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.adapters.catalogdb;
import org.junit.Test;
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java
index b8161de6b2..8decd77656 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.adapters.catalogdb.catalogrest;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index 31cb1248d6..f65f521605 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -77,8 +77,12 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Before
public void initialize() {
client.wiremockPort = String.valueOf(port);
+ client.setEndpoint(getEndpoint(port));
}
+ protected String getEndpoint(int port) {
+ return "http://localhost:" + port;
+ }
@Test
public void testGetRainyDayHandler_Regex() {
@@ -88,6 +92,14 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
}
@Test
+ public void testGetRainyDayHandler__Encoding_Regex() {
+ RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatus("AssignServiceInstanceBB", "*",
+ "*", "*", "*",
+ "resources.lba_0_dmz_vmi_0: Unknown id: Error: oper 1 url /fqname-to-id body {\"fq_name\": [\"zrdm6bvota05-dmz_sec_group\"], \"type\": \"security-group\"} response Name ['zrdm6bvota05-dmz_sec_group'] not found");
+ Assert.assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
+ }
+
+ @Test
public void testGetCloudSiteHappyPath() throws Exception {
CloudSite cloudSite = client.getCloudSite(MTN13);
Assert.assertNotNull(cloudSite);
@@ -640,7 +652,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void getWorkflowByArtifactUUID_validUuid_expectedOutput() {
Workflow workflow = client.findWorkflowByArtifactUUID("5b0c4322-643d-4c9f-b184-4516049e99b1");
- assertEquals("artifactName", "testingWorkflow", workflow.getArtifactName());
+ assertEquals("artifactName", "testingWorkflow.bpmn", workflow.getArtifactName());
}
@Test
@@ -655,7 +667,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
assertTrue(workflows != null);
assertTrue(workflows.size() != 0);
- assertEquals("testingWorkflow", workflows.get(0).getArtifactName());
+ assertEquals("testingWorkflow.bpmn", workflows.get(0).getArtifactName());
}
@Test
@@ -664,4 +676,19 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
Assert.assertNull(workflow);
}
+ @Test
+ public void getWorkflowBySource_validSource_expectedOutput() {
+ List<Workflow> workflows = client.findWorkflowBySource("sdc");
+ assertTrue(workflows != null);
+ assertTrue(workflows.size() != 0);
+
+ assertEquals("testingWorkflow.bpmn", workflows.get(0).getArtifactName());
+ }
+
+ @Test
+ public void getWorkflowBySource_invalidSource_nullOutput() {
+ List<Workflow> workflow = client.findWorkflowBySource("abc");
+ Assert.assertNull(workflow);
+ }
+
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index 0e981f2b70..58b2983f82 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -228,7 +228,7 @@ insert into pnf_resource_customization_to_service(service_model_uuid, resource_m
('5df8b6de-2083-11e7-93ae-92361f002676', '68dc9a92-214c-11e7-93ae-92361f002680');
insert into workflow(artifact_uuid, artifact_name, name, operation_name, version, description, body, resource_target, source) values
-('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc');
+('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow.bpmn', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc');
insert into vnf_resource_to_workflow(vnf_resource_model_uuid, workflow_id) values
('ff2ae348-214a-11e7-93ae-92361f002671', '1');
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
index 57d31bf308..576acb1fd8 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
@@ -53,8 +53,9 @@ public class AuditStackService {
public void auditAddAAIInventory() throws Exception {
for (int i = 0; i < getMaxClients(); i++) {
ExternalTaskClient client = createExternalTaskClient();
- client.subscribe("InventoryAddAudit").lockDuration(60000).handler(auditCreateStack::executeExternalTask)
- .open();
+ client.subscribe("InventoryAddAudit")
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
+ .handler(auditCreateStack::executeExternalTask).open();
}
}
@@ -62,8 +63,9 @@ public class AuditStackService {
public void auditDeleteAAIInventory() throws Exception {
for (int i = 0; i < getMaxClients(); i++) {
ExternalTaskClient client = createExternalTaskClient();
- client.subscribe("InventoryDeleteAudit").lockDuration(60000).handler(auditDeleteStack::executeExternalTask)
- .open();
+ client.subscribe("InventoryDeleteAudit")
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
+ .handler(auditDeleteStack::executeExternalTask).open();
}
}
@@ -71,7 +73,7 @@ public class AuditStackService {
ClientRequestInterceptor interceptor = createClientRequestInterceptor();
ExternalTaskClient client = ExternalTaskClient.create()
.baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
- .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(10000, 2, 120000)).build();
+ .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
return client;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
index 8bd813026f..49a9e7e171 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
@@ -59,7 +59,9 @@ public class CreateInventoryService {
ExternalTaskClient client = ExternalTaskClient.create()
.baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
.asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
- client.subscribe("InventoryCreate").lockDuration(60000).handler(createInventory::executeExternalTask).open();
+ client.subscribe("InventoryCreate")
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
+ .handler(createInventory::executeExternalTask).open();
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java
index 24fa9af7f9..ed31c1c67e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.adapters.inventory.create;
public class InventoryException extends Exception {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
index 429948cef1..a9af3683f5 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
@@ -47,6 +47,7 @@ import org.onap.so.adapters.network.async.client.UpdateNetworkNotification;
import org.onap.so.adapters.network.exceptions.NetworkException;
import org.onap.so.entity.MsoRequest;
import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.NetworkRollback;
import org.onap.so.openstack.beans.NetworkStatus;
@@ -404,7 +405,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
return;
}
- logger.info("{} {}", MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId());
+ logger.info(LoggingAnchor.TWO, MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId());
// Use the synchronous method to perform the actual Create
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
index 029da43f48..d2c0d9cabd 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
@@ -33,6 +33,7 @@ import java.util.Map;
import java.util.Optional;
import javax.jws.WebService;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.network.beans.ContrailPolicyRef;
import org.onap.so.adapters.network.beans.ContrailPolicyRefSeq;
import org.onap.so.adapters.network.beans.ContrailSubnet;
@@ -205,7 +206,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String error = String.format(
"Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration",
networkName, cloudSiteId, tenantId);
- logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
// Set the detailed error as the Exception 'message'
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -240,8 +241,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (failIfExists != null && failIfExists) {
String error = String.format("Create Nework: Network %s already exists in %s/%s with ID %s",
networkName, cloudSiteId, tenantId, netInfo.getId());
- logger.error("{} {} {}", MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(),
- error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_ALREADY_EXIST,
+ ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
} else {
// Populate the outputs from the existing network.
@@ -285,7 +286,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
HeatTemplate heatTemplate = networkResource.getHeatTemplate();
if (heatTemplate == null) {
String error = String.format("Network error - undefined Heat Template. Network Type = %s", networkType);
- logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(),
+ error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
@@ -322,8 +324,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (failIfExists != null && failIfExists) {
String error = String.format("CreateNetwork: Stack %s already exists in %s/%s as %s", networkName,
cloudSiteId, tenantId, heatStack.getCanonicalName());
- logger.error("{} {} {}", MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(),
- error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_ALREADY_EXIST,
+ ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
} else {
// Populate the outputs from the existing stack.
@@ -371,7 +373,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
stackParams = heat.validateStackParams(stackParams, heatTemplate);
} catch (IllegalArgumentException e) {
String error = "Create Network: Configuration Error: " + e.getMessage();
- logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error, e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error, e);
// Input parameters were not valid
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
@@ -537,7 +539,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String error = String.format(
"UpdateNetwork: Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration",
networkName, cloudSiteId, tenantId);
- logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
// Set the detailed error as the Exception 'message'
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -569,8 +571,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (netInfo == null) {
String error = String.format("Update Nework: Network %s does not exist in %s/%s", networkId,
cloudSiteId, tenantId);
- logger.error("{} {} {}", MessageEnum.RA_NETWORK_NOT_FOUND, ErrorCode.BusinessProcesssError.getValue(),
- error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_NOT_FOUND,
+ ErrorCode.BusinessProcesssError.getValue(), error);
// Does not exist. Throw an exception (can't update a non-existent network)
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -613,7 +615,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (heatStack == null || (heatStack.getStatus() == HeatStatus.NOTFOUND)) {
String error = String.format("UpdateNetwork: Stack %s does not exist in %s/%s", networkName,
cloudSiteId, tenantId);
- logger.error("{} {} {}", MessageEnum.RA_NETWORK_NOT_FOUND, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_NOT_FOUND, ErrorCode.DataError.getValue(),
+ error);
// Network stack does not exist. Return an error
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -644,7 +647,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
HeatTemplate heatTemplate = networkResource.getHeatTemplate();
if (heatTemplate == null) {
String error = "Network error - undefined Heat Template. Network Type=" + networkType;
- logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(),
+ error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
@@ -672,7 +676,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
stackParams = heat.validateStackParams(stackParams, heatTemplate);
} catch (IllegalArgumentException e) {
String error = "UpdateNetwork: Configuration Error: Network Type=" + networkType;
- logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL, e);
}
@@ -802,7 +806,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String error = String.format(
"Create/UpdateNetwork: Unable to get network resource with NetworkType: %s or ModelCustomizationUUID:%s",
networkType, modelCustomizationUuid);
- logger.error("{} {} {} ", MessageEnum.RA_UNKOWN_PARAM, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_UNKOWN_PARAM, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -814,8 +818,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// All Networks are orchestrated via HEAT or Neutron
if (!("HEAT".equals(mode) || NEUTRON_MODE.equals(mode))) {
String error = "CreateNetwork: Configuration Error: Network Type = " + networkType;
- logger.error("{} {} {}", MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT, ErrorCode.DataError.getValue(),
- error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT,
+ ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
@@ -836,7 +840,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
"Network Type:%s Version_Min:%s Version_Max:%s not supported on Cloud:%s with AIC_Version:%s",
networkType, networkType, networkResource.getAicVersionMin(), networkResource.getAicVersionMax(),
cloudSiteId, cloudSite.getCloudVersion());
- logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -845,7 +849,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
validateNetworkParams(neutronNetworkType, networkName, physicalNetworkName, vlans, routeTargets);
if (!missing.isEmpty()) {
String error = "Create Network: Missing parameters: " + missing;
- logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -890,7 +894,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
|| commonUtils.isNullOrEmpty(networkNameOrId)) {
String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId";
- logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -899,7 +903,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String error = String.format(
"Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration",
networkNameOrId, cloudSiteId, tenantId);
- logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
// Set the detailed error as the Exception 'message'
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -1017,7 +1021,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (commonUtils.isNullOrEmpty(cloudSiteId) || commonUtils.isNullOrEmpty(tenantId)
|| commonUtils.isNullOrEmpty(networkId)) {
String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId";
- logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -1309,8 +1313,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
logger.debug("Json PolicyRefs Data:{}", jsonString);
} catch (Exception e) {
String error = "Error creating JsonNode for policyRefs Data";
- logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, ErrorCode.BusinessProcesssError.getValue(), error,
- e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MARSHING_ERROR, ErrorCode.BusinessProcesssError.getValue(),
+ error, e);
throw new MsoAdapterException(error);
}
// update parameters
@@ -1386,7 +1390,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
logger.debug("Json Subnet List:{}", jsonString);
} catch (Exception e) {
String error = "Error creating JsonNode from input subnets";
- logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, ErrorCode.DataError.getValue(), error, e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MARSHING_ERROR, ErrorCode.DataError.getValue(), error, e);
throw new MsoAdapterException(error);
}
// update parameters
@@ -1432,7 +1436,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
curR = curR.replace("%subnetId%", subnet.getSubnetId());
} else {
String error = "Missing Required AAI SubnetId for subnet in HEAT Template";
- logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new MsoAdapterException(error);
}
@@ -1446,7 +1450,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
curR = curR.replace("%cidr%", subnet.getCidr());
} else {
String error = "Missing Required cidr for subnet in HEAT Template";
- logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new MsoAdapterException(error);
}
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 9236945d37..b81efa38e5 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
@@ -45,6 +45,7 @@ import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify_Service;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.entity.MsoRequest;
import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
@@ -153,7 +154,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
ErrorCode.BusinessProcesssError.getValue(), e1);
}
- logger.info("{}", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
+ logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
return;
}
logger.debug("Async Create VNF: {} VnfId:{}", vnfName, vnfId.value);
@@ -245,7 +246,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
MsoRequest msoRequest, String notificationUrl) {
String serviceName = "QueryVnfA";
- logger.info("{}", MessageEnum.RA_ASYNC_QUERY_VNF);
+ logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_QUERY_VNF);
// Use the synchronous method to perform the actual query
MsoVnfAdapter vnfAdapter = vnfImpl;
@@ -323,7 +324,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
MsoRequest msoRequest, String notificationUrl) {
String serviceName = "DeleteVnfA";
- logger.info("{}", MessageEnum.RA_ASYNC_DELETE_VNF);
+ logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_DELETE_VNF);
// Use the synchronous method to perform the actual delete
MsoVnfAdapter vnfAdapter = vnfImpl;
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 bac41a1f8b..8511f3cb49 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
@@ -36,6 +36,7 @@ import java.util.Optional;
import java.util.concurrent.TimeUnit;
import javax.jws.WebService;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.commons.collections.CollectionUtils;
import org.onap.so.adapters.valet.GenericValetResponse;
import org.onap.so.adapters.valet.ValetClient;
@@ -64,9 +65,9 @@ import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
import org.onap.so.db.catalog.utils.MavenLikeVersioning;
import org.onap.so.entity.MsoRequest;
-import org.onap.so.logger.ErrorCode;
import org.onap.so.heatbridge.HeatBridgeApi;
import org.onap.so.heatbridge.HeatBridgeImpl;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
@@ -79,10 +80,6 @@ import org.onap.so.openstack.exceptions.MsoHeatNotFoundException;
import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.openstack.utils.MsoHeatUtilsWithUpdate;
-import org.openstack4j.model.compute.Flavor;
-import org.openstack4j.model.compute.Image;
-import org.openstack4j.model.compute.Server;
-import org.openstack4j.model.heat.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -92,6 +89,10 @@ import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.openstack4j.model.compute.Flavor;
+import org.openstack4j.model.compute.Image;
+import org.openstack4j.model.compute.Server;
+import org.openstack4j.model.heat.Resource;
@WebService(serviceName = "VnfAdapter", endpointInterface = "org.onap.so.adapters.vnf.MsoVnfAdapter",
targetNamespace = "http://org.onap.so/vnf")
@@ -107,6 +108,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
private static final Logger logger = LoggerFactory.getLogger(MsoVnfAdapterImpl.class);
+
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,14 +117,19 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
private static final String FAIL_REQUESTS_ON_VALET_FAILURE =
"org.onap.so.adapters.vnf.fail_requests_on_valet_failure";
private static final String OPENSTACK = "OpenStack";
+ private static final String DELETE_VNF = "DeleteVNF";
+ private static final String QUERY_STACK = "QueryStack";
+ private static final String CREATE_VFM_MODULE = "CreateVFModule";
+ private static final String CREATE_VF_STACK = "Create VF: Stack";
+ private static final String STACK = "Stack";
+ private static final String USER_ERROR = "USER ERROR";
+ private static final String VERSION_MIN = "VersionMin";
+ private static final String VERSION_MAX = "VersionMax";
@Autowired
private VFModuleCustomizationRepository vfModuleCustomRepo;
-
-
@Autowired
private VnfResourceRepository vnfResourceRepo;
-
@Autowired
private MsoHeatUtilsWithUpdate heatU;
@Autowired
@@ -264,8 +271,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Convert to a generic VnfException
String error =
"Query VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId,
- tenantId, OPENSTACK, "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryStack", me);
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, tenantId,
+ OPENSTACK, "QueryVNF", ErrorCode.DataError.getValue(), "Exception - " + QUERY_STACK, me);
logger.debug(error);
throw new VnfException(me);
}
@@ -312,14 +319,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
try {
heat.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true);
} catch (MsoException me) {
- me.addContext("DeleteVNF");
+ me.addContext(DELETE_VNF);
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
String error =
"Delete VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner,
- cloudSiteId, tenantId, OPENSTACK, "DeleteVNF", ErrorCode.DataError.getValue(),
- "Exception - DeleteVNF", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, OPENSTACK, DELETE_VNF, ErrorCode.DataError.getValue(), "Exception - " + DELETE_VNF, me);
logger.debug(error);
throw new VnfException(me);
}
@@ -361,9 +367,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("RollbackVNF");
String error =
"Rollback VNF: " + vnfId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfId, cloudOwner,
- cloudSiteId, tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(),
- "Exception - DeleteStack", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfId, cloudOwner, cloudSiteId,
+ tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(), "Exception - DeleteStack", me);
logger.debug(error);
throw new VnfException(me);
}
@@ -606,7 +611,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
requestTypeString = requestTypeString.substring(1);
}
- // 1607 - let's parse out the request type we're being sent
+ // let's parse out the request type we're being sent
boolean isBaseRequest = false;
boolean isVolumeRequest = false;
if (requestTypeString.startsWith("VOLUME")) {
@@ -615,8 +620,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("requestTypeString = " + requestTypeString + ", nestedStackId = " + nestedStackId
+ ", nestedBaseStackId = " + nestedBaseStackId);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
// Build a default rollback object (no actions performed)
VnfRollback vfRollback = new VnfRollback();
@@ -636,57 +639,56 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
StackInfo heatStack = null;
- long subStartTime1 = System.currentTimeMillis();
try {
heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vfModuleName);
} catch (MsoException me) {
String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(),
- "Exception - queryStack", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ "Exception - " + QUERY_STACK, me);
logger.debug(error);
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
- me.addContext("CreateVFModule");
+ me.addContext(CREATE_VFM_MODULE);
throw new VnfException(me);
}
- // New with 1607 - more precise handling/messaging if the stack already exists
+ // more precise handling/messaging if the stack already exists
if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) {
// INIT, CREATED, NOTFOUND, FAILED, BUILDING, DELETING, UNKNOWN, UPDATING, UPDATED
HeatStatus status = heatStack.getStatus();
if (status == HeatStatus.INIT || status == HeatStatus.BUILDING || status == HeatStatus.DELETING
|| status == HeatStatus.UPDATING) {
// fail - it's in progress - return meaningful error
- String error = "Create VF: Stack " + vfModuleName + " already exists and has status "
+ String error = CREATE_VF_STACK + " " + vfModuleName + " already exists and has status "
+ status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ "; please wait for it to complete, or fix manually.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(),
- "Stack " + vfModuleName + " already exists");
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ STACK + " " + vfModuleName + " already exists");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
heatStack.getCanonicalName());
}
if (status == HeatStatus.FAILED) {
// fail - it exists and is in a FAILED state
- String error = "Create VF: Stack " + vfModuleName + " already exists and is in FAILED state in "
+ String error = CREATE_VF_STACK + " " + vfModuleName + " already exists and is in FAILED state in "
+ cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(),
- "Stack " + vfModuleName + " already exists and is " + "in FAILED state");
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ STACK + " " + vfModuleName + " already exists and is " + "in FAILED state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
heatStack.getCanonicalName());
}
if (status == HeatStatus.UNKNOWN || status == HeatStatus.UPDATED) {
// fail - it exists and is in a FAILED state
- String error = "Create VF: Stack " + vfModuleName + " already exists and has status "
+ String error = CREATE_VF_STACK + " " + vfModuleName + " already exists and has status "
+ status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(),
- "Stack " + vfModuleName + " already exists and is " + "in UPDATED or UNKNOWN state");
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ STACK + " " + vfModuleName + " already exists and is " + "in UPDATED or UNKNOWN state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
heatStack.getCanonicalName());
@@ -694,11 +696,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (status == HeatStatus.CREATED) {
// fail - it exists
if (failIfExists != null && failIfExists) {
- String error = "Create VF: Stack " + vfModuleName + " already exists in " + cloudOwner + "/"
+ String error = CREATE_VF_STACK + " " + vfModuleName + " already exists in " + cloudOwner + "/"
+ cloudSiteId + "/" + tenantId;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(),
- vfModuleName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack",
- ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists");
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ STACK + " " + vfModuleName + " already exists");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
heatStack.getCanonicalName());
@@ -716,7 +718,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// handle a nestedStackId if sent- this one would be for the volume - so applies to both Vf and Vnf
StackInfo nestedHeatStack = null;
- long subStartTime2 = System.currentTimeMillis();
+
Map<String, Object> nestedVolumeOutputs = null;
if (nestedStackId != null) {
try {
@@ -725,20 +727,20 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
- me.addContext("CreateVFModule");
+ me.addContext(CREATE_VFM_MODULE);
String error = "Create VFModule: Attached heatStack ID Query " + nestedStackId + " in " + cloudOwner
+ "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack",
- ErrorCode.BusinessProcesssError.getValue(), "MsoException trying to query nested stack", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.BusinessProcesssError.getValue(),
+ "MsoException trying to query nested stack", me);
logger.debug("ERROR trying to query nested stack= {}", error);
throw new VnfException(me);
}
if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) {
String error = "Create VFModule: Attached heatStack ID DOES NOT EXIST " + nestedStackId + " in "
- + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "queryStack",
+ + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " " + USER_ERROR;
+ logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, error, OPENSTACK, QUERY_STACK,
ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Attached heatStack ID " + "DOES NOT EXIST");
logger.debug(error);
@@ -751,7 +753,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// handle a nestedBaseStackId if sent- this is the stack ID of the base. Should be null for VNF requests
StackInfo nestedBaseHeatStack = null;
- long subStartTime3 = System.currentTimeMillis();
Map<String, Object> baseStackOutputs = null;
if (nestedBaseStackId != null) {
try {
@@ -760,21 +761,20 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
- me.addContext("CreateVFModule");
+ me.addContext(CREATE_VFM_MODULE);
String error = "Create VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in "
+ cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack",
- ErrorCode.BusinessProcesssError.getValue(), "MsoException trying to query nested base stack",
- me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.BusinessProcesssError.getValue(),
+ "MsoException trying to query nested base stack", me);
logger.debug("ERROR trying to query nested base stack= {}", error);
throw new VnfException(me);
}
if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) {
String error = "Create VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId
- + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "QueryStack",
+ + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " " + USER_ERROR;
+ logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, error, OPENSTACK, QUERY_STACK,
ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Attached base heatStack ID DOES NOT EXIST");
logger.debug("Exception occurred", error);
@@ -785,30 +785,24 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
}
- // Ready to deploy the new VNF
-
-
-
try {
// Retrieve the VF
VfModule vf = null;
VnfResource vnfResource = null;
VfModuleCustomization vfmc = null;
- logger.debug("version: {}", vfVersion);
if (useMCUuid) {
- // 1707 - db refactoring
vfmc = vfModuleCustomRepo.findFirstByModelCustomizationUUIDOrderByCreatedDesc(mcu);
if (vfmc != null)
vf = vfmc.getVfModule();
else
vf = null;
- // 1702 - this will be the new way going forward. We find the vf by mcu - otherwise, code is the same.
+ // this will be the new way going forward. We find the vf by mcu - otherwise, code is the same.
if (vf == null) {
logger.debug("Unable to find vfModuleCust with modelCustomizationUuid={}", mcu);
String error =
"Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + mcu;
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
"VF Module ModelCustomizationUuid", modelCustomizationUuid, OPENSTACK,
ErrorCode.DataError.getValue(),
"Create VF Module: Unable to find vfModule with " + "modelCustomizationUuid=" + mcu);
@@ -818,7 +812,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.trace("Found vfModuleCust entry {}", vfmc.toString());
}
if (vf.getIsBase()) {
- isBaseRequest = true;
logger.debug("This is a BASE VF request!");
} else {
logger.debug("This is *not* a BASE VF request!");
@@ -837,7 +830,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,
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VNF Type", vnfType,
OPENSTACK, ErrorCode.DataError.getValue(), "Create VNF: Unknown VNF Type");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -846,7 +839,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
// By here - we have either a vf or vnfResource
- // 1607 - Add version check
+ // Add version check
// First - see if it's in the VnfResource record
// if we have a vf Module - then we have to query to get the VnfResource record.
if (!oldWay && vf.getVnfResources() != null) {
@@ -894,7 +887,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
equalToMax = aicV.isTheSameVersion(maxVersionVnf);
} catch (Exception e) {
logger.debug(
- "An exception occurred while trying to test AIC Version {} - will default to not check",
+ "An exception occurred while trying to test Cloud Version {} - will default to not check",
e.getMessage(), e);
doNotTest = true;
}
@@ -902,35 +895,28 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if ((moreThanMin || equalToMin) // aic >= min
&& (equalToMax || !(moreThanMax))) { // aic <= max
logger.debug("VNF Resource " + vnfResource.getModelName() + ", ModelUuid="
- + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:"
- + maxVersionVnf + " supported on Cloud: " + cloudSiteId + " with AIC_Version:"
- + cloudSiteOpt.get().getCloudVersion());
+ + vnfResource.getModelUUID() + " " + VERSION_MIN + " =" + minVersionVnf + " "
+ + VERSION_MAX + " :" + maxVersionVnf + " supported on Cloud: " + cloudSiteId
+ + " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion());
} else {
// ERROR
String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid="
- + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:"
- + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId
+ + vnfResource.getModelUUID() + " " + VERSION_MIN + " =" + minVersionVnf + " "
+ + VERSION_MAX + " :" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId
+ " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion();
- logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK,
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK,
ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
} else {
- logger.debug("bypassing testing AIC version...");
+ logger.debug("bypassing testing Cloud version...");
}
} // let this error out downstream to avoid introducing uncertainty at this stage
} else {
logger.debug("cloudConfig is NULL - cannot check cloud site version");
}
- } else {
- logger.debug(
- "AIC Version not set in VNF_Resource - this is expected thru 1607 - do not error here - not checked"
- + ".");
}
- // End Version check 1607
-
-
// By the time we get here - heatTemplateId and heatEnvtId should be populated (or null)
HeatTemplate heatTemplate = null;
@@ -952,8 +938,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (heatTemplate == null) {
String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType
- + ", reqType=" + requestTypeString;
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
+ + ", modelCustomizationUuid=" + mcu + ", vfModuleUuid=" + vf.getModelUUID()
+ + ", vnfResourceModelUuid=" + vnfResource.getModelUUID() + ", reqType=" + requestTypeString;
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template " + "ID",
vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
@@ -966,9 +953,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("No environment parameter found for this Type " + vfModuleType);
} else {
if (heatEnvironment == null) {
- String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
- logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
- OPENSTACK, ErrorCode.DataError.getValue(), error);
+ String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType
+ + ", modelCustomizationUuid=" + mcu + ", vfModuleUuid=" + vf.getModelUUID()
+ + ", vnfResourceModelUuid=" + vnfResource.getModelUUID() + ", reqType=" + requestTypeString;
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ "Heat " + "Environment ID", OPENSTACK, ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -994,7 +983,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
nestedTemplatesChecked = null;
}
- // 1510 - Also add the files: for any get_files associated with this vnf_resource_id
+ // Also add the files: for any get_files associated with this vnf_resource_id
// *if* there are any
List<HeatFiles> heatFiles = null;
@@ -1015,11 +1004,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (!isVolumeRequest || addGetFilesOnVolumeReq) {
if (oldWay) {
- logger.debug(
- "In MsoVnfAdapterImpl createVfModule, this should not happen - old way is gamma only - no heat "
- + "files!");
+ logger.debug("In MsoVnfAdapterImpl createVfModule, this should not happen, no heat files!");
} else {
- // 1607 - now use VF_MODULE_TO_HEAT_FILES table
+ // now use VF_MODULE_TO_HEAT_FILES table
logger.debug(
"In MsoVnfAdapterImpl createVfModule, about to call db.getHeatFilesForVfModule avec vfModuleId="
+ vf.getModelUUID());
@@ -1046,9 +1033,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
String missingParams = null;
List<String> paramList = new ArrayList<>();
- // New for 1510 - consult the PARAM_ALIAS field to see if we've been
+ // consult the PARAM_ALIAS field to see if we've been
// supplied an alias. Only check if we don't find it initially.
- // Also new in 1510 - don't flag missing parameters if there's an environment - because they might be there.
+ // don't flag missing parameters if there's an environment - because they might be there.
// And also new - add parameter to turn off checking all together if we find we're blocking orders we
// shouldn't
boolean checkRequiredParameters = true;
@@ -1063,7 +1050,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// No problem - default is true
logger.debug("An exception occured trying to get property {}", MsoVnfAdapterImpl.CHECK_REQD_PARAMS, e);
}
- // 1604 - Add enhanced environment & parameter checking
// Part 1: parse envt entries to see if reqd parameter is there (before used a simple grep
// Part 2: only submit to openstack the parameters in the envt that are in the heat template
// Note this also removes any comments
@@ -1071,7 +1057,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (heatEnvironment != null && heatEnvironment.getEnvironment() != null
&& heatEnvironment.getEnvironment().contains("parameters:")) {
- logger.debug("Enhanced environment checking enabled - 1604");
StringBuilder sb = new StringBuilder(heatEnvironment.getEnvironment());
mhee = new MsoHeatEnvironmentEntry(sb);
@@ -1089,10 +1074,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
} else {
logger.debug("NO ENVIRONMENT for this entry");
}
- // New with 1707 - all variables converted to their native object types
+ // all variables converted to their native object types
Map<String, Object> goldenInputs = null;
- logger.debug("Now handle the inputs....first convert");
ArrayList<String> parameterNames = new ArrayList<>();
HashMap<String, String> aliasToParam = new HashMap<>();
StringBuilder sb = new StringBuilder("\nTemplate Parameters:\n");
@@ -1149,7 +1133,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (checkRequiredParameters) {
// Problem - missing one or more required parameters
String error = "Create VFModule: Missing Required inputs: " + missingParams;
- logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, OPENSTACK,
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams, OPENSTACK,
ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -1193,31 +1177,21 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Have the tenant. Now deploy the stack itself
// Ignore MsoTenantNotFound and MsoStackAlreadyExists exceptions
// because we already checked for those.
- long createStackStarttime = System.currentTimeMillis();
try {
- // heatStack = heat.createStack(cloudSiteId, tenantId, vnfName, template, inputs, true,
- // heatTemplate.getTimeoutMinutes());
if (backout == null) {
backout = true;
}
if (heat != null) {
- logger.debug("heat is not null!!");
heatStack = heat.createStack(cloudSiteId, cloudOwner, tenantId, vfModuleName, null, template,
goldenInputs, true, heatTemplate.getTimeoutMinutes(), newEnvironmentString,
nestedTemplatesChecked, heatFilesObjects, backout.booleanValue());
} else {
- logger.debug("heat is null!");
throw new MsoHeatNotFoundException();
}
} catch (MsoException me) {
- me.addContext("CreateVFModule");
- String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/"
- + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType,
- cloudOwner, cloudSiteId, tenantId, OPENSTACK, ErrorCode.DataError.getValue(),
- "MsoException - createStack", me);
- logger.debug(error);
+ me.addContext(CREATE_VFM_MODULE);
+ logger.error("Error creating Stack", me);
if (isValetEnabled && sendResponseToValet) {
logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
try {
@@ -1231,17 +1205,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
throw new VnfException(me);
} catch (NullPointerException npe) {
- String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/"
- + tenantId + ": " + npe;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType,
- cloudOwner, cloudSiteId, tenantId, OPENSTACK, ErrorCode.DataError.getValue(),
- "NullPointerException - createStack", npe);
- logger.debug(error);
- logger.debug("NULL POINTER EXCEPTION at heat.createStack");
- // npe.addContext ("CreateVNF");
+ logger.error("Error creating Stack", npe);
throw new VnfException("NullPointerException during heat.createStack");
} catch (Exception e) {
- logger.debug("unhandled exception at heat.createStack", e);
+ logger.error("Error creating Stack", e);
throw new VnfException("Exception during heat.createStack! " + e.getMessage());
}
// Reach this point if createStack is successful.
@@ -1281,7 +1248,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// 1702 capture the output parameters on a delete
// so we'll need to query first
- Map<String, Object> stackOutputs = null;
+ Map<String, Object> stackOutputs;
try {
stackOutputs = heat.queryStackForOutputs(cloudSiteId, cloudOwner, tenantId, vnfName);
} catch (MsoException me) {
@@ -1290,9 +1257,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("DeleteVFModule");
String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId
+ "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner,
- cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(),
- "Exception - QueryStack", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(), "Exception - " + QUERY_STACK, me);
logger.debug(error);
throw new VnfException(me);
}
@@ -1313,14 +1279,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
try {
heat.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true);
} catch (MsoException me) {
- me.addContext("DeleteVNF");
+ me.addContext(DELETE_VNF);
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
String error =
"Delete VF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner,
- cloudSiteId, tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(),
- "Exception - deleteStack", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(), "Exception - deleteStack", me);
logger.debug(error);
if (isValetEnabled && valetDeleteRequestSucceeded) {
logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
@@ -1427,9 +1392,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("requestTypeString = " + requestTypeString + ", nestedVolumeStackId = " + nestedStackId
+ ", nestedBaseStackId = " + nestedBaseStackId);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
-
// Build a default rollback object (no actions performed)
VnfRollback vfRollback = new VnfRollback();
vfRollback.setCloudSiteId(cloudSiteId);
@@ -1443,8 +1405,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
vfRollback.setVfModuleStackId(vfModuleStackId);
vfRollback.setModelCustomizationUuid(mcu);
- StackInfo heatStack = null;
- long queryStackStarttime = System.currentTimeMillis();
+ StackInfo heatStack;
logger.debug("UpdateVfModule - querying for {}", vfModuleName);
try {
heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vfModuleName);
@@ -1454,9 +1415,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("UpdateVFModule");
String error = "Update VFModule: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(),
- "Exception - QueryStack", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ "Exception - " + QUERY_STACK, me);
logger.debug(error);
throw new VnfException(me);
}
@@ -1466,8 +1427,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Not Found
String error = "Update VF: Stack " + vfModuleName + " does not exist in " + cloudOwner + "/" + cloudSiteId
+ "/" + tenantId;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_NOT_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_NOT_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(), error);
throw new VnfNotFound(cloudSiteId, cloudOwner, tenantId, vfModuleName);
} else {
logger.debug("Found Existing stack, status={}", heatStack.getStatus());
@@ -1478,7 +1439,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// 1604 Cinder Volume support - handle a nestedStackId if sent (volumeGroupHeatStackId):
StackInfo nestedHeatStack = null;
- long queryStackStarttime2 = System.currentTimeMillis();
Map<String, Object> nestedVolumeOutputs = null;
if (nestedStackId != null) {
try {
@@ -1490,18 +1450,17 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("UpdateVFModule");
String error = "Update VF: Attached heatStack ID Query " + nestedStackId + " in " + cloudOwner + "/"
+ cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner,
- cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
"Exception - " + error, me);
logger.debug("ERROR trying to query nested stack= {}", error);
throw new VnfException(me);
}
if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) {
String error = "Update VFModule: Attached volume heatStack ID DOES NOT EXIST " + nestedStackId + " in "
- + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName,
- cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "QueryStack",
- ErrorCode.DataError.getValue(), error);
+ + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " " + USER_ERROR;
+ logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner,
+ cloudSiteId, tenantId, error, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
@@ -1514,7 +1473,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
StackInfo nestedBaseHeatStack = null;
Map<String, Object> baseStackOutputs = null;
if (nestedBaseStackId != null) {
- long queryStackStarttime3 = System.currentTimeMillis();
try {
logger.debug("Querying for nestedBaseStackId = {}", nestedBaseStackId);
nestedBaseHeatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, nestedBaseStackId);
@@ -1524,18 +1482,17 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("UpdateVfModule");
String error = "Update VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in "
+ cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
"Exception - " + error, me);
logger.debug("ERROR trying to query nested base stack= {}", error);
throw new VnfException(me);
}
if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) {
String error = "Update VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId
- + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "QueryStack",
- ErrorCode.DataError.getValue(), error);
+ + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " " + USER_ERROR;
+ logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, error, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
@@ -1564,8 +1521,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
if (vf == null) {
String error = "Update VfModule: unable to find vfModule with modelCustomizationUuid=" + mcu;
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module Type",
- vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module Type", vfModuleType,
+ OPENSTACK, ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
logger.debug("Got VF module definition from Catalog: {}", vf.toString());
@@ -1637,15 +1594,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (!doNotTest) {
if ((moreThanMin || equalToMin) // aic >= min
&& ((equalToMax) || !(moreThanMax))) { // aic <= max
- logger.debug("VNF Resource " + vnfResource.getModelName() + " VersionMin=" + minVersionVnf
- + " VersionMax:" + maxVersionVnf + " supported on Cloud: " + cloudSiteId
- + " with AIC_Version:" + aicV);
+ logger.debug("VNF Resource " + vnfResource.getModelName() + " " + VERSION_MIN + " ="
+ + minVersionVnf + " " + VERSION_MAX + " :" + maxVersionVnf + " supported on Cloud: "
+ + cloudSiteId + " with AIC_Version:" + aicV);
} else {
// ERROR
- String error = "VNF Resource type: " + vnfResource.getModelName() + " VersionMin="
- + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: "
- + cloudSiteId + " with AIC_Version:" + aicV;
- logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK,
+ String error = "VNF Resource type: " + vnfResource.getModelName() + " " + VERSION_MIN + " ="
+ + minVersionVnf + " " + VERSION_MAX + " :" + maxVersionVnf
+ + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + aicV;
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK,
ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -1675,8 +1632,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (heatTemplate == null) {
String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType
- + ", reqType=" + requestTypeString;
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
+ + ", modelCustomizationUuid=" + mcu + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType="
+ + requestTypeString;
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -1684,8 +1642,9 @@ 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",
+ String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid="
+ + mcu + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType=" + requestTypeString;
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
OPENSTACK, ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -1893,14 +1852,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Problem - missing one or more required parameters
if (checkRequiredParameters) {
String error = "Update VNF: Missing Required inputs: " + missingParams;
- logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, OPENSTACK,
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams, OPENSTACK,
ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
logger.debug("found missing parameters - but checkRequiredParameters is false - will not block");
}
- } else {
- logger.debug("No missing parameters found - ok to proceed");
}
// Just submit the envt entry as received from the database
@@ -1915,7 +1872,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// This is not a valid parameter for this template
extraParams.removeAll(paramList);
if (!extraParams.isEmpty()) {
- logger.warn("{} {} {} {} {} {}", MessageEnum.RA_VNF_EXTRA_PARAM.toString(), vnfType,
+ logger.warn(LoggingAnchor.SIX, MessageEnum.RA_VNF_EXTRA_PARAM.toString(), vnfType,
extraParams.toString(), OPENSTACK, ErrorCode.DataError.getValue(), "Extra params");
inputs.keySet().removeAll(extraParams);
}
@@ -1969,7 +1926,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Have the tenant. Now deploy the stack itself
// Ignore MsoTenantNotFound and MsoStackAlreadyExists exceptions
// because we already checked for those.
- long updateStackStarttime = System.currentTimeMillis();
try {
heatStack = heatU.updateStack(cloudSiteId, cloudOwner, tenantId, vfModuleName, template, goldenInputs, true,
heatTemplate.getTimeoutMinutes(), newEnvironmentString,
@@ -1979,7 +1935,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("UpdateVFModule");
String error = "Update VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_UPDATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
cloudSiteId, tenantId, OPENSTACK, ErrorCode.DataError.getValue(), "Exception - " + error, me);
if (isValetEnabled && sendResponseToValet) {
logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
@@ -2062,7 +2018,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Map<String, Object> nestedTemplates) {
boolean haveGetFiles = true;
boolean haveNestedTemplates = true;
- Map<String, Object> files = new HashMap<String, Object>();
+ Map<String, Object> files = new HashMap<>();
if (getFiles == null || getFiles.isEmpty()) {
haveGetFiles = false;
}
@@ -2118,7 +2074,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (newInputs != null) {
Map<String, Object> oldGold = goldenInputs;
logger.debug("parameters before being modified by valet:{}", oldGold.toString());
- goldenInputs = new HashMap<String, Object>();
+ goldenInputs = new HashMap<>();
for (String key : newInputs.keySet()) {
goldenInputs.put(key, newInputs.get(key));
}
@@ -2254,7 +2210,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
valetDeleteRequestSucceeded = false;
valetErrorMessage = e.getMessage();
}
- if (valetDeleteRequestSucceeded == false && failRequestOnValetFailure == true) {
+ if (!valetDeleteRequestSucceeded && failRequestOnValetFailure) {
logger.error("ValetDeleteRequestFailed - del req still will be sent to openstack",
new VnfException("ValetDeleteRequestFailedError"));
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
index 344daa83bc..96e5db7ce7 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
@@ -32,6 +32,8 @@ import java.util.Optional;
import java.util.Set;
import javax.jws.WebService;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
+import com.woorea.openstack.heat.Heat;
import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.cloud.CloudConfig;
@@ -83,7 +85,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
private static final String CLOUDIFY = "Cloudify";
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
- private static final String BRACKETS = "{} {} {} {} {} {} {} {} {}";
+ private static final String BRACKETS = LoggingAnchor.NINE;
private static final String OPENSTACK = "OpenStack";
@Autowired
@@ -237,7 +239,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
public void rollbackVnf(VnfRollback rollback) throws VnfException {
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
- logger.info("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), OPENSTACK, "rollbackVnf");
+ logger.info(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_NULL.toString(), OPENSTACK, "rollbackVnf");
return;
}
@@ -499,7 +501,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) {
logger.debug("Missing required input: modelCustomizationUuid");
String error = "Create vfModule error: Missing required input: modelCustomizationUuid";
- logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
"VF Module ModelCustomizationUuid", CLOUDIFY, ErrorCode.DataError.getValue(),
"Create VF Module: Missing required input: modelCustomizationUuid");
logger.debug(error);
@@ -562,7 +564,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid="
+ modelCustomizationUuid;
logger.debug(error);
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
"VF Module " + "ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb",
ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -598,7 +600,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid="
+ vnfResource.getModelUUID() + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax
+ " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion();
- logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK,
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK,
ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -616,7 +618,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Failed to query the Deployment due to a cloudify exception.
String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
"Exception - queryDeployment", me);
logger.debug(error);
@@ -805,8 +807,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (heatTemplate == null) {
String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType
+ + ", modelCustomizationUuid=" + modelCustomizationUuid + ", vfModuleUuid=" + vf.getModelUUID()
+ ", reqType=" + requestType;
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -814,8 +817,9 @@ 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",
+ String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid="
+ + modelCustomizationUuid + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType=" + requestType;
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
OPENSTACK, ErrorCode.DataError.getValue(), error);
// Alarm on this error, configuration must be fixed
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
@@ -951,8 +955,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (checkRequiredParameters) {
// Problem - missing one or more required parameters
String error = "Create VFModule: Missing Required inputs: " + missingParams;
- logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, CLOUDIFY,
- ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams,
+ CLOUDIFY, ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
@@ -1014,9 +1018,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
catch (MsoException me) {
me.addContext("CreateVFModule");
String error = "Create VF Module: Upload blueprint failed. Blueprint=" + blueprintName + ": " + me;
- logger.error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType,
- cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(),
- "MsoException - uploadBlueprint", me);
+ logger.error(LoggingAnchor.SEVEN, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
+ tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), "MsoException - uploadBlueprint", me);
logger.debug(error);
throw new VnfException(me);
}
@@ -1040,16 +1043,16 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
me.addContext("CreateVFModule");
String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType,
- cloudOwner, cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(),
"MsoException - createDeployment", me);
logger.debug(error);
throw new VnfException(me);
} catch (NullPointerException npe) {
String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + npe;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType,
- cloudOwner, cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(),
"NullPointerException - createDeployment", npe);
logger.debug(error);
logger.debug("NULL POINTER EXCEPTION at cloudify.createAndInstallDeployment");
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 ed797f10d9..c22bb327d4 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
@@ -42,6 +42,7 @@ import java.util.Optional;
import java.util.Set;
import javax.jws.WebService;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.vdu.CloudInfo;
import org.onap.so.adapters.vdu.VduException;
import org.onap.so.adapters.vdu.VduInstance;
@@ -203,7 +204,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
e.addContext("QueryVNF");
String error = "Query VNF (VDU): " + vnfNameOrId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ ": " + e;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudOwner,
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudOwner,
cloudSiteId, tenantId, "VDU", "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryVDU",
e);
logger.debug(error);
@@ -254,7 +255,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
long startTime = System.currentTimeMillis();
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
- logger.info("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
+ logger.info(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
return;
}
@@ -291,7 +292,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
ve.addContext("RollbackVFModule");
String error = "Rollback VF Module: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + ve;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner,
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner,
cloudSiteId, tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(), "Exception - DeleteVdu",
ve);
logger.debug(error);
@@ -546,7 +547,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) {
logger.debug("Missing required input: modelCustomizationUuid");
String error = "Create vfModule error: Missing required input: modelCustomizationUuid";
- logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
"VF Module ModelCustomizationUuid", "VDU", ErrorCode.DataError,
"Create VF Module: " + "Missing required input: modelCustomizationUuid");
logger.debug(error);
@@ -610,7 +611,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid="
+ modelCustomizationUuid;
logger.debug(error);
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
"VF Module ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb", ErrorCode.DataError,
error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -649,7 +650,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
"VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID()
+ " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: "
+ cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion();
- logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -671,9 +672,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Failed to query the VDU due to a plugin exception.
String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
- "Exception - queryVdu", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "Exception - queryVdu",
+ me);
logger.debug(error);
// Convert to a generic VnfException
me.addContext("CreateVFModule");
@@ -690,9 +691,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// fail - it exists
String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudOwner + "/"
+ cloudSiteId + "/" + tenantId;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(),
- vfModuleName, cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu",
- ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists");
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ "VF Module " + vfModuleName + " already exists");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
vduInstance.getVduInstanceId());
@@ -712,8 +713,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String error = "Create VF: Deployment " + vfModuleName + " already exists and has status "
+ status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ "; please wait for it to complete, or fix manually.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"VF Module " + vfModuleName + " already exists");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
@@ -722,8 +723,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// fail - it exists and is in a FAILED state
String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in "
+ cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"VF Module " + vfModuleName + " already exists and is in FAILED state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
@@ -733,8 +734,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String error = "Create VF: Deployment " + vfModuleName + " already exists and has status "
+ status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"VF Module " + vfModuleName + " already exists and is in " + status.toString() + " state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
@@ -744,8 +745,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String error = "Create VF: Deployment " + vfModuleName + " already exists with unexpected status "
+ status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"VF Module " + vfModuleName + " already exists and is in an unknown state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
@@ -768,8 +769,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Failed to query the Volume Group VDU due to a plugin exception.
String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudOwner + "/"
+ cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
- cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu(volume)", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu(volume)", ErrorCode.DataError.getValue(),
"Exception - queryVdu(volume)", me);
logger.debug(error);
// Convert to a generic VnfException
@@ -780,8 +781,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (volumeVdu == null || volumeVdu.getStatus().getState() == VduStateType.NOTFOUND) {
String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in "
+ cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
- cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)",
+ logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudOwner,
+ cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)",
ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Attached Volume Group " + "DOES NOT EXIST");
logger.debug(error);
@@ -818,7 +819,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Failed to query the Base VF Module due to a Vdu Plugin exception.
String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudOwner + "/"
+ cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu(Base)", ErrorCode.DataError.getValue(),
"Exception - queryVdu(Base)", me);
logger.debug(error);
@@ -830,8 +831,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (baseVdu == null || baseVdu.getStatus().getState() == VduStateType.NOTFOUND) {
String error = "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudOwner
+ "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(),
- baseVfModuleId, cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)",
+ logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudOwner,
+ cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)",
ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Base Module DOES NOT EXIST");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -862,8 +863,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (heatTemplate == null) {
String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType
+ + ", modelCustomizationUuid=" + modelCustomizationUuid + ", vfModuleUuid=" + vfModule.getModelUUID()
+ ", reqType=" + requestType;
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
vfModuleType, "VNF", ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
@@ -872,8 +874,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
if (heatEnvironment == null) {
- String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
- logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
+ String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid="
+ + modelCustomizationUuid + ", vfModuleUuid=" + vfModule.getModelUUID() + ", reqType=" + requestType;
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
"OpenStack", ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -1007,7 +1010,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (checkRequiredParameters) {
// Problem - missing one or more required parameters
String error = "Create VFModule: Missing Required inputs: " + missingParams;
- logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "VDU",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "VDU",
ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -1044,7 +1047,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
me.addContext("CreateVFModule");
String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
cloudSiteId, tenantId, "VDU", ErrorCode.DataError.getValue(), "MsoException - instantiateVdu", me);
logger.debug(error);
// Convert to a generic VnfException
@@ -1052,7 +1055,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
} catch (NullPointerException npe) {
String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ ": " + npe;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
cloudSiteId, tenantId, "VDU", ErrorCode.DataError.getValue(),
"NullPointerException - instantiateVdu", npe);
logger.debug(error);
@@ -1103,7 +1106,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
e.addContext("QueryVFModule");
String error = "Query VfModule (VDU): " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + e;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudOwner,
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudOwner,
cloudSiteId, tenantId, "VDU", "QueryVFModule", ErrorCode.DataError.getValue(),
"Exception - queryVDU", e);
logger.debug(error);
@@ -1129,7 +1132,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Convert to a generic VnfException
String error =
"Delete VF: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner,
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner,
cloudSiteId, tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(),
"Exception - DeleteVdu: " + me.getMessage());
logger.debug(error);
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
index 686410f14c..8c871c742e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
@@ -40,6 +40,7 @@ import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpStatus;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vnf.exceptions.VnfException;
@@ -183,7 +184,7 @@ public class VnfAdapterRest {
response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE,
req.getMessageId(), outputs.value);
} catch (VnfException e) {
- logger.error("{} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(),
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_DELETE_VNF_ERR.toString(),
ErrorCode.BusinessProcesssError.getValue(), "VnfException - Delete VNF Module", e);
eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE,
req.getMessageId());
@@ -241,7 +242,7 @@ public class VnfAdapterRest {
logger.debug("Query vfModule exit");
return Response.status(respStatus).entity(new GenericEntity<QueryVfModuleResponse>(qryResp) {}).build();
} catch (VnfException e) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e);
VfModuleExceptionResponse excResp =
new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null);
@@ -288,7 +289,7 @@ public class VnfAdapterRest {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR, "createVfModule",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_CREATE_VNF_ERR, "createVfModule",
ErrorCode.BusinessProcesssError, "Exception - createVfModule", e);
return Response.serverError().build();
}
@@ -403,7 +404,7 @@ public class VnfAdapterRest {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule",
ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e);
return Response.serverError().build();
}
@@ -507,7 +508,7 @@ public class VnfAdapterRest {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule",
ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e);
return Response.serverError().build();
}
@@ -559,7 +560,7 @@ public class VnfAdapterRest {
vnfAdapter.rollbackVnf(vrb);
response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId());
} catch (VnfException e) {
- logger.error("{} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR, ErrorCode.BusinessProcesssError,
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_VNF_ERR, ErrorCode.BusinessProcesssError,
"Exception" + " - " + "rollbackVfModule", e);
eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false,
req.getMessageId());
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
index 5b831047ad..9a7354c40c 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
@@ -39,6 +39,7 @@ import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpStatus;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vnf.exceptions.VnfException;
@@ -84,7 +85,7 @@ public class VnfAdapterRestV2 {
private static Logger logger = LoggerFactory.getLogger(VnfAdapterRestV2.class);
private static final String TESTING_KEYWORD = "___TESTING___";
private static final String RESP = ", resp=";
- private static final String BRACKETS = "{} {} {} {}";
+ private static final String BRACKETS = LoggingAnchor.FOUR;
@Autowired
private VnfAdapterRestUtils vnfAdapterRestUtils;
@@ -199,7 +200,7 @@ public class VnfAdapterRestV2 {
response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE,
req.getMessageId(), outputs.value);
} catch (VnfException e) {
- logger.error("{} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(),
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_DELETE_VNF_ERR.toString(),
ErrorCode.BusinessProcesssError.getValue(), "VnfException - " + "Delete VNF Module", e);
eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE,
req.getMessageId());
@@ -269,7 +270,7 @@ public class VnfAdapterRestV2 {
logger.debug("Query vfModule exit");
return Response.status(respStatus).entity(new GenericEntity<QueryVfModuleResponse>(qryResp) {}).build();
} catch (VnfException e) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e);
VfModuleExceptionResponse excResp =
new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null);
@@ -610,7 +611,7 @@ public class VnfAdapterRestV2 {
response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId());
} catch (VnfException e) {
- logger.error("{} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(),
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_VNF_ERR.toString(),
ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e);
eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false,
req.getMessageId());
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
index c6fd73d9cb..aebd04f32c 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeException.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeException.java
index 9bf2ec73f4..60dfded1f8 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeException.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeException.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index a5e6a4558f..ae15b70b00 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
@@ -50,16 +70,17 @@ import org.onap.so.heatbridge.helpers.AaiHelper;
import org.onap.so.heatbridge.openstack.api.OpenstackClient;
import org.onap.so.heatbridge.openstack.factory.OpenstackClientFactoryImpl;
import org.onap.so.heatbridge.utils.HeatBridgeUtils;
-import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.ErrorCode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.so.logger.LoggingAnchor;
+import org.onap.so.logger.MessageEnum;
import org.openstack4j.model.compute.Server;
import org.openstack4j.model.heat.Resource;
import org.openstack4j.model.network.IP;
import org.openstack4j.model.network.Network;
import org.openstack4j.model.network.NetworkType;
import org.openstack4j.model.network.Port;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
@@ -323,9 +344,9 @@ public class HeatBridgeImpl implements HeatBridgeApi {
}
} catch (WebApplicationException e) {
// Silently log that we failed to update the Pserver p-interface with PCI-ID
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.GENERAL_EXCEPTION, pserverHostName,
- matchingPifName.get(), cloudOwner, tenantId, "OpenStack", "Heatbridge",
- ErrorCode.DataError.getValue(), "Exception - Failed to add sriov-pf object to pserver", e);
+ logger.error(LoggingAnchor.NINE, MessageEnum.GENERAL_EXCEPTION, pserverHostName, matchingPifName.get(),
+ cloudOwner, tenantId, "OpenStack", "Heatbridge", ErrorCode.DataError.getValue(),
+ "Exception - Failed to add sriov-pf object to pserver", e);
}
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
index 933b42e0b2..f2d61d2587 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java
index edf5e2d339..018a4eac8d 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java
index bd74bf6aa0..f0c5a0b434 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
index 515f2dc0e5..137aaa9f41 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada.
*
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java
index fd5dabc784..69c76fad84 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java
index 1fa41ee2a0..7184ec1e93 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientException.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientException.java
index a062ca826d..26d92ebb80 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientException.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientException.java
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java
index 2843eb226e..5a2b0732dc 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV2ClientImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV2ClientImpl.java
index 760be72b3f..95b4cd7cfd 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV2ClientImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV2ClientImpl.java
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV3ClientImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV3ClientImpl.java
index dddd82ce6a..a0c05b4dba 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV3ClientImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV3ClientImpl.java
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactory.java
index 5019eec09b..b00f926e52 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactory.java
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java
index 25b3f1dbeb..bbcd54e6f8 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java
index 788e038855..be086677db 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduStatus.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduStatus.java
index 0c4b9e01b9..66b2e52570 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduStatus.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduStatus.java
@@ -25,8 +25,14 @@ package org.onap.so.vdu.utils;
* Enum status values to capture the state of a generic (cloud-agnostic) VDU.
*/
public enum VduStatus {
- NOTFOUND, INSTANTIATING, INSTANTIATED, DELETING, DELETED, // Note - only returned in success response to deleteVdu
- // call.
- UPDATING, FAILED, UNKNOWN
+ NOTFOUND,
+ INSTANTIATING,
+ INSTANTIATED,
+ DELETING,
+ DELETED, // Note - only returned in success response to deleteVdu
+ // call.
+ UPDATING,
+ FAILED,
+ UNKNOWN
}
diff --git a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml b/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml
index 2ec5be7448..66d63d436b 100644
--- a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml
+++ b/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml
@@ -51,6 +51,8 @@ tomcat:
mso:
msoKey: 07a7159d3bf51a0e53be7a8f89699be7
auth: 6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436
+ audit:
+ lock-time: 240000
logPath: logs
msb-ip: localhost
msb-port: ${wiremock.server.port}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java
index 2eb8d8ef39..c9aef950f7 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.adapters.audit;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
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 8513f30d4b..8dc9d7fe5c 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.adapters.inventory.create;
import static org.mockito.Mockito.doReturn;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
index 4dcb7c8710..add1918748 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
@@ -20,18 +20,6 @@
package org.onap.so.adapters.network;
-import org.apache.http.HttpStatus;
-import org.junit.Test;
-import org.onap.so.adapters.vnf.BaseRestTestUtils;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.util.UriComponentsBuilder;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
import static org.junit.Assert.assertEquals;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteNeutronNetwork;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteStack_200;
@@ -52,6 +40,18 @@ import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStack;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackGet;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackPost;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.http.HttpStatus;
+import org.junit.Test;
+import org.onap.so.adapters.vnf.BaseRestTestUtils;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.util.UriComponentsBuilder;
public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@@ -142,12 +142,12 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStack_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc");
+ mockOpenStackGetStack_404(wireMockServer, "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId");
mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json");
mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json",
- "dvspg-VCE_VPE-mtjnj40avbc/stackId");
+ "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId");
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -163,7 +163,7 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json");
mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json",
- "dvspg-VCE_VPE-mtjnj40avbc");
+ "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId");
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java
index 5f2057524f..48ca0fd79c 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java
@@ -55,8 +55,6 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils {
@Autowired
private CloudConfig cloudConfig;
- private static final String CREATE_STACK_RESPONSE = "{\"template_type\": \"TEST-template\", \"workload_id\": "
- + "\"workload-id\", \"template_response\": {\"stack\": {\"id\": \"TEST-stack\", \"links\": []}}}";
private static final String UPDATE_STACK_RESPONSE =
"{\"template_type\": \"heat\", \"workload_id\": " + "\"workload-id\"}";
private static final String GET_CREATE_STACK_RESPONSE = "{\"template_type\": \"heat\", \"workload_id\": "
@@ -125,6 +123,51 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils {
}
@Test
+ public void createVfModule2() throws Exception {
+
+ Map<String, Object> stackInputs = new HashMap<>();
+ stackInputs.put("oof_directives", "{}");
+ stackInputs.put("sdnc_directives", "{}");
+ stackInputs.put("user_directives", "{}");
+ stackInputs.put("generic_vnf_id", "genVNFID");
+ stackInputs.put("vf_module_id", "vfMODULEID");
+
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH_BY_NAME)).willReturn(
+ aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND)));
+
+ wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH_BY_ID)).inScenario("CREATE")
+ .whenScenarioStateIs("CREATING").willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(GET_CREATE_STACK_RESPONSE).withStatus(HttpStatus.SC_OK)));
+
+ wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH_BY_ID)).inScenario("CREATE")
+ .whenScenarioStateIs("UPDATING").willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(GET_UPDATE_STACK_RESPONSE).withStatus(HttpStatus.SC_OK)));
+
+ wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_CREATE_PATH)).inScenario("CREATE")
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("MulticloudResponse_Stack_Create2.json").withStatus(HttpStatus.SC_CREATED))
+ .willSetStateTo("CREATING"));
+
+ wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_UPDATE_PATH))
+ .inScenario("CREATE").willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(UPDATE_STACK_RESPONSE).withStatus(HttpStatus.SC_ACCEPTED))
+ .willSetStateTo("UPDATING"));
+
+ try {
+ instance.createVfModule("MTN13", "CloudOwner", "123", "vf", "v1", "genericVnfId", "vfname", "vfModuleId",
+ "create", null, "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", stackInputs, true, true, true,
+ msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
+ } catch (VnfException e) {
+ fail("createVfModule success expected, failed with exception: " + e.toString());
+ }
+ wireMockServer.resetScenarios();
+ }
+
+ @Test
public void createVfModuleAlreadyExists() throws Exception {
Map<String, Object> stackInputs = new HashMap<>();
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
index 0787cef75d..d611322c02 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
diff --git a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml
index b9fc419a65..5ee33ab3dc 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml
+++ b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml
@@ -4,7 +4,7 @@
<cloudSiteId>mtn13</cloudSiteId>
<tenantId>bef254252c5d44e6bcec65c180180ab5</tenantId>
<networkType>CONTRAIL30_GNDIRECT</networkType>
- <networkName>dvspg-VCE_VPE-mtjnj40avbc</networkName>
+ <networkName>DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001</networkName>
<physicalNetworkName>dvs-mtjnj-01</physicalNetworkName>
<vlans>3014</vlans>
<failIfExists>false</failIfExists>
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/MulticloudResponse_Stack_Create2.json b/adapters/mso-openstack-adapters/src/test/resources/__files/MulticloudResponse_Stack_Create2.json
new file mode 100644
index 0000000000..8532fae97c
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/MulticloudResponse_Stack_Create2.json
@@ -0,0 +1,15 @@
+{
+ "template_type": "HEAT",
+ "workload_id": "workload-id",
+ "workload_status_reason":
+ {
+ "id": "workload-id",
+ "links": [
+ {
+ "href": "http://localhost:1234/v1/id12345678/stacks/workload-id/abcdef00-1234-abcd-5678-ef9123456789",
+ "rel": "self"
+ }
+ ]
+ },
+ "workload_status": "CREATE_IN_PROGRESS"
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json
index af63ca7de4..be50d09ef6 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json
@@ -1,17 +1,15 @@
{
- "stack": {
- "description": null,
- "links": null,
- "stackStatusReason": null,
- "stackName": null,
- "updatedTime": null,
- "creationTime": null,
- "stackStatus": "NOT_FOUND",
- "id": "stackId",
- "files": null,
- "outputs": null,
- "parameters": {
-
- }
- }
-} \ No newline at end of file
+ "stack": {
+ "creationTime": null,
+ "description": null,
+ "files": null,
+ "id": "stackId",
+ "links": null,
+ "outputs": null,
+ "parameters": {},
+ "stack_name": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001",
+ "stack_status": "CREATE_IN_PROGRESS",
+ "stack_status_reason": null,
+ "updatedTime": null
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json
index 29893ccb7b..e49d407766 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json
@@ -1,17 +1,15 @@
{
- "stack": {
- "description": null,
- "links": null,
- "stack_status_reason": null,
- "stack_name": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001",
- "updated_time": null,
- "creation_time": null,
- "stack_status": "CREATE_COMPLETE",
- "id": "stackId",
- "files": null,
- "outputs": null,
- "parameters": {
-
- }
- }
-} \ No newline at end of file
+ "stack": {
+ "creationTime": null,
+ "description": null,
+ "files": null,
+ "id": "stackId",
+ "links": null,
+ "outputs": null,
+ "parameters": {},
+ "stack_name": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001",
+ "stack_status": "CREATE_COMPLETE",
+ "stack_status_reason": "Create Completed",
+ "updatedTime": null
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json
index 8612258eee..bad85f37c8 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json
@@ -3,7 +3,7 @@
"description": null,
"links": null,
"stackStatusReason": null,
- "stackName": null,
+ "stackName": "stackName",
"updatedTime": null,
"creationTime": null,
"stack_status": "DELETE_COMPLETE",
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json
index f4a3c520ba..70c78a6047 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json
@@ -7,6 +7,7 @@
"rel" : "self"
}
],
- "stack_name": "vnfBaseStack"
+ "stack_name": "vnfBaseStack",
+ "stack_status": "CREATE_COMPLETE"
}
} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
index ce576f00e1..7cc7697129 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
+++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
@@ -63,6 +63,8 @@ ssl-enable: false
tomcat:
max-threads: 50
mso:
+ audit:
+ lock-time: 240000
logPath: logs
msb-ip: localhost
msb-port: ${wiremock.server.port}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml b/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
index 5d6eee746f..8bfa6d83c3 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
+++ b/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
@@ -29,25 +29,15 @@
</appender>
- <logger name="com.att.eelf.audit" level="INFO" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="com.att.eelf.metrics" level="INFO" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
- <logger name="com.att.eelf.error" level="WARN" additivity="false">
+ <logger name="com.woorea.openstack" level="${so.log.level:-DEBUG}" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
<logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
-
- <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
+
<root level="WARN">
<appender-ref ref="STDOUT" />
diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
index 83023e53db..7b3ffd7d30 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql
+++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
@@ -803,7 +803,9 @@ CREATE TABLE `service` (
`WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL,
`SERVICE_CATEGORY` varchar(200) DEFAULT NULL,
`RESOURCE_ORDER` varchar(200) default NULL,
- OVERALL_DISTRIBUTION_STATUS varchar(45),
+ `OVERALL_DISTRIBUTION_STATUS` varchar(45),
+ `ONAP_GENERATED_NAMING` TINYINT(1) DEFAULT NULL,
+ `NAMING_POLICY` varchar(200) DEFAULT NULL,
PRIMARY KEY (`MODEL_UUID`),
KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`),
CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
index 02b44efe1c..8c4150cd50 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.db.request.beans.ArchivedInfraRequests;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.data.repository.ArchivedInfraRequestsRepository;
@@ -145,8 +146,8 @@ public class ArchiveInfraRequestsScheduler {
newArchivedReqs.add(archivedInfra);
oldInfraReqs.add(iar);
} catch (Exception e) {
- logger.error("{} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), ErrorCode.UnknownError.getValue(),
- e);
+ logger.error(LoggingAnchor.TWO, MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ ErrorCode.UnknownError.getValue(), e);
}
}
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.10__Add_Column_IS_DATA_INTERNAL.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.10__Add_Column_IS_DATA_INTERNAL.sql
new file mode 100644
index 0000000000..2196d11e07
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.10__Add_Column_IS_DATA_INTERNAL.sql
@@ -0,0 +1,3 @@
+use requestdb;
+
+ALTER TABLE request_processing_data ADD COLUMN IF NOT EXISTS IS_DATA_INTERNAL TINYINT NOT NULL DEFAULT '0'; \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.9__Add_Column_Ext_System_Error_Source.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.9__Add_Column_Ext_System_Error_Source.sql
new file mode 100644
index 0000000000..e76dbbe883
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.9__Add_Column_Ext_System_Error_Source.sql
@@ -0,0 +1,4 @@
+use requestdb;
+
+ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS EXT_SYSTEM_ERROR_SOURCE varchar(80);
+ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS EXT_SYSTEM_ERROR_SOURCE varchar(80); \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/RequestsAdapterBase.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/RequestsAdapterBase.java
index cb6feacfb2..6ef228ef79 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/RequestsAdapterBase.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/RequestsAdapterBase.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.adapters.requestsdb;
import org.junit.runner.RunWith;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
index d48013b80d..b96a564b1a 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
@@ -30,6 +30,7 @@ import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -59,18 +60,18 @@ public class SDNCAdapterService extends Service {
try {
wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCAdapter.wsdl");
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
ErrorCode.DataError.getValue(), "Exception - WSDL not found", e);
}
if (wsdlUrl == null) {
- logger.error("{} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
ErrorCode.DataError.getValue(), "WSDL not found");
} else {
try {
- logger.info("{} {} {}", MessageEnum.RA_PRINT_URL.toString(), SDNC_ADAPTER_WSDL,
+ logger.info(LoggingAnchor.THREE, MessageEnum.RA_PRINT_URL.toString(), SDNC_ADAPTER_WSDL,
wsdlUrl.toURI().toString());
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), SDNC_ADAPTER_WSDL,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), SDNC_ADAPTER_WSDL,
ErrorCode.DataError.getValue(), "Exception - print URL", e);
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
index 97a6860dfe..577b550be6 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
@@ -31,6 +31,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -122,7 +123,7 @@ public class SDNCAdapterCallbackRequest {
m.marshal(this, w);
return w.toString();
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.RA_MARSHING_ERROR.toString(), ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MARSHING_ERROR.toString(), ErrorCode.DataError.getValue(),
"Exception - MARSHING_ERROR", e);
}
return "";
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
index 72d18bd1ce..87620743d7 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
@@ -29,6 +29,7 @@ import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -57,18 +58,18 @@ public class SDNCCallbackAdapterService extends Service {
wsdlUrl = Thread.currentThread().getContextClassLoader()
.getResource("main/resources/SDNCCallbackAdapter.wsdl");
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC",
- ErrorCode.DataError.getValue(), "Exception - WSDL not found", e);
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL,
+ "SDNC", ErrorCode.DataError.getValue(), "Exception - WSDL not found", e);
}
if (wsdlUrl == null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC",
- ErrorCode.DataError.getValue(), "WSDL not found");
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL,
+ "SDNC", ErrorCode.DataError.getValue(), "WSDL not found");
} else {
try {
- logger.info("{} {} {} {}", MessageEnum.RA_PRINT_URL.toString(), SDNC_CALLBACK_ADAPTER_WSDL,
+ logger.info(LoggingAnchor.FOUR, MessageEnum.RA_PRINT_URL.toString(), SDNC_CALLBACK_ADAPTER_WSDL,
wsdlUrl.toURI().toString(), "SDNC");
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(),
SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", ErrorCode.DataError.getValue(),
"Exception - URL convention problem", e);
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
index 2d43385700..880ef0a7b0 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
@@ -23,6 +23,7 @@
package org.onap.so.adapters.sdnc.impl;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -69,7 +70,7 @@ public class MapRequestTunables {
String[] parts = value.split("\\|"); // escape pipe
if (parts.length < 3) {
- logger.warn("{} {} {} {} {} {}", MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), key, value, "SDNC",
+ logger.warn(LoggingAnchor.SIX, MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), key, value, "SDNC",
ErrorCode.DataError.getValue(), "Invalid config");
}
@@ -105,7 +106,7 @@ public class MapRequestTunables {
error = "Missing configuration for:" + key;
}
if (error != null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), key, "SDNC",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), key, "SDNC",
ErrorCode.DataError.getValue(), "Missing config param");
}
logger.debug("RequestTunables Key:{} Value:{} Tunables:{}", key, value, this.toString());
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
index 3e3ec6f9bb..2b023f4c15 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
@@ -25,6 +25,7 @@ package org.onap.so.adapters.sdnc.impl;
import javax.annotation.PostConstruct;
import javax.jws.WebService;
import javax.servlet.http.HttpServletResponse;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.sdnc.SDNCAdapterPortType;
import org.onap.so.adapters.sdnc.SDNCAdapterRequest;
import org.onap.so.adapters.sdnc.SDNCAdapterResponse;
@@ -51,7 +52,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
@PostConstruct
public void init() {
- logger.info("{} {} {}", MessageEnum.RA_INIT_SDNC_ADAPTER.toString(), "SDNC", "SDNCAdapterPortType");
+ logger.info(LoggingAnchor.THREE, MessageEnum.RA_INIT_SDNC_ADAPTER.toString(), "SDNC", "SDNCAdapterPortType");
}
/**
@@ -71,7 +72,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
sdncClient.executeRequest(bpelRequest);
} catch (Exception e) {
String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage();
- logger.error("{} {} {} {}", MessageEnum.RA_SEND_REQUEST_SDNC_ERR.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_SEND_REQUEST_SDNC_ERR.toString(), "SDNC",
ErrorCode.DataError.getValue(), respMsg, e);
SDNCResponse sdncResp = new SDNCResponse(bpelReqId);
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 7d412b77ad..012a19f1a9 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
@@ -45,6 +45,7 @@ import javax.xml.ws.handler.MessageContext;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.ErrorCode;
import org.onap.so.utils.CryptoUtils;
import org.onap.so.adapters.sdnc.SDNCAdapterRequest;
@@ -89,7 +90,7 @@ public class SDNCRestClient {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "SDNC",
ErrorCode.UnknownError.getValue(), "Exception processing request to SDNC", e);
Thread.currentThread().interrupt();
@@ -176,7 +177,7 @@ public class SDNCRestClient {
logger.info("{} :\n {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.name(), sdncResp.toString(), "SDNC");
return (sdncResp);
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
ErrorCode.BusinessProcesssError.getValue(), "Exception processing request to SDNC", e);
// default
sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR);
@@ -213,7 +214,7 @@ public class SDNCRestClient {
eType = xpath.evaluate("error-type", error);
sdncErrMsg = new StringBuilder(". SDNC Returned-[error-type:" + eType);
} catch (Exception e3) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(),
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(),
"error-type", error.toString(), "SDNC", ErrorCode.DataError.getValue(),
EXCEPTION_MSG, e3);
}
@@ -223,7 +224,7 @@ public class SDNCRestClient {
eTag = xpath.evaluate("error-tag", error);
sdncErrMsg.append(", error-tag:").append(eTag);
} catch (Exception e3) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(),
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(),
"error-tag", error.toString(), "SDNC", ErrorCode.DataError.getValue(),
EXCEPTION_MSG, e3);
}
@@ -233,18 +234,18 @@ public class SDNCRestClient {
eMsg = xpath.evaluate("error-message", error);
sdncErrMsg.append(", error-message:").append(eMsg).append("]");
} catch (Exception e3) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(),
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(),
"error-message", error.toString(), "SDNC", ErrorCode.DataError.getValue(),
EXCEPTION_MSG, e3);
}
}
} catch (Exception e2) {
- logger.error("{} {} {} {}", MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
ErrorCode.DataError.getValue(), "Exception while analyse error", e2);
}
} // is != null
} catch (Exception e1) {
- logger.error("{} {} {} {}", MessageEnum.RA_ERROR_GET_RESPONSE_SDNC.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ERROR_GET_RESPONSE_SDNC.toString(), "SDNC",
ErrorCode.BusinessProcesssError.getValue(), "Exception while get SDNC response", e1);
}
} // con != null
@@ -256,7 +257,7 @@ public class SDNCRestClient {
sdncResp.setRespMsg(respMsg);
- logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
ErrorCode.AvailabilityError.getValue(), "Exception while communicate with SDNC", e);
return sdncResp;
@@ -282,7 +283,7 @@ public class SDNCRestClient {
try {
wsdlUrl = new URL(bpelUrl);
} catch (MalformedURLException e1) {
- logger.error("{} {} {} {}", MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA,
ErrorCode.DataError.getValue(), "Exception initializing Callback wsdl", e1);
}
@@ -310,7 +311,7 @@ public class SDNCRestClient {
reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
headers.put("Authorization", Collections.singletonList(basicAuth));
} catch (Exception e2) {
- logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
ErrorCode.BusinessProcesssError.getValue(),
"Exception - Unable to set authorization in callback request", e2);
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
index 52164bdac7..1c47a2d6b0 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
@@ -31,6 +31,7 @@ import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -97,7 +98,7 @@ public class Utils {
return s;
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e);
}
return null;
@@ -131,7 +132,7 @@ public class Utils {
return s;
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
ErrorCode.DataError.getValue(), "Exception in genSdncPutReq", e);
}
return null;
@@ -166,7 +167,7 @@ public class Utils {
return s;
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE.toString(), "SDNC",
ErrorCode.DataError.getValue(), "Exception in genMsoFailResp", e);
}
return null;
@@ -191,7 +192,7 @@ public class Utils {
s = s.replaceAll("xmlns=\"\"", "");
return s;
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(),
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(),
ErrorCode.DataError.getValue(), "Exception - domToStr", e);
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
index 6808230474..b50662a832 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
@@ -25,6 +25,7 @@
package org.onap.so.adapters.sdnc.sdncrest;
import javax.xml.bind.DatatypeConverter;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
@@ -92,8 +93,8 @@ public class BPRestCallback {
public boolean send(String url, String message) {
logger.debug(getClass().getSimpleName() + ".send(" + "url=" + url + " message=" + message + ")");
- logger.info("{} {} {}", MessageEnum.RA_CALLBACK_BPEL.toString(), message == null ? "[no content]" : message,
- CAMUNDA);
+ logger.info(LoggingAnchor.THREE, MessageEnum.RA_CALLBACK_BPEL.toString(),
+ message == null ? "[no content]" : message, CAMUNDA);
HttpPost method = null;
HttpResponse httpResponse = null;
@@ -123,7 +124,7 @@ public class BPRestCallback {
method.setHeader(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID));
method.setHeader(ONAPLogConstants.Headers.PARTNER_NAME, "SO-SDNCAdapter");
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
ErrorCode.BusinessProcesssError.getValue(), "Unable to set authorization in callback request",
e);
error = true;
@@ -141,14 +142,14 @@ public class BPRestCallback {
if (httpResponse.getStatusLine().getStatusCode() >= 300) {
String msg = "Received error response to callback request: " + httpResponse.getStatusLine();
- logger.error("{} {} {} {}", MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA,
ErrorCode.BusinessProcesssError.getValue(), msg);
}
}
return true;
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA,
ErrorCode.BusinessProcesssError.getValue(), "Error sending callback request", e);
return false;
} finally {
@@ -168,7 +169,7 @@ public class BPRestCallback {
logger.debug("Exception:", e);
}
}
- logger.info("{} {}", MessageEnum.RA_CALLBACK_BPEL_COMPLETE.toString(), CAMUNDA);
+ logger.info(LoggingAnchor.TWO, MessageEnum.RA_CALLBACK_BPEL_COMPLETE.toString(), CAMUNDA);
}
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
index 70943c206f..ad99d0da36 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
@@ -23,6 +23,7 @@
package org.onap.so.adapters.sdnc.sdncrest;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.sdnc.exception.SDNCAdapterException;
import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.logger.ErrorCode;
@@ -54,7 +55,7 @@ public class MapTypedRequestTunablesData {
if ("".equals(value)) {
error = MISSING_CONFIGURATION_ERROR_MSG + reqTunable.getKey();
- logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), reqTunable.getKey(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), reqTunable.getKey(),
"SDNC", ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
throw new SDNCAdapterException(error);
@@ -64,7 +65,7 @@ public class MapTypedRequestTunablesData {
if (parts.length != 5) {
error = "Invalid configuration for: " + reqTunable.getKey();
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), reqTunable.getKey(), value,
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), reqTunable.getKey(), value,
"SDNC", ErrorCode.DataError.getValue(), "Invalid config");
throw new SDNCAdapterException(error);
}
@@ -80,7 +81,7 @@ public class MapTypedRequestTunablesData {
if ("".equals(reqTunable.getSdncUrl())) {
error = MISSING_CONFIGURATION_ERROR_MSG + urlPropKey;
- logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), urlPropKey, "SDNC",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), urlPropKey, "SDNC",
ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
throw new SDNCAdapterException(error);
@@ -98,7 +99,7 @@ public class MapTypedRequestTunablesData {
if ("".equals(reqTunable.getMyUrl())) {
error = MISSING_CONFIGURATION_ERROR_MSG + Constants.MY_URL_PROP;
- logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), Constants.MY_URL_PROP,
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), Constants.MY_URL_PROP,
"SDNC", ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
throw new SDNCAdapterException(error);
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
index a7c65d87a4..e184bbd110 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
@@ -34,6 +34,7 @@ import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
@@ -159,7 +160,7 @@ public abstract class SDNCConnector {
method = null;
- logger.info("{} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), responseContent, "SDNC");
+ logger.info(LoggingAnchor.THREE, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), responseContent, "SDNC");
return createResponseFromContent(statusCode, statusMessage, responseContent, rt);
} catch (SocketTimeoutException | ConnectTimeoutException e) {
@@ -192,12 +193,12 @@ public abstract class SDNCConnector {
}
protected void logError(String errMsg) {
- logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
ErrorCode.AvailabilityError.getValue(), errMsg);
}
protected void logError(String errMsg, Throwable t) {
- logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
ErrorCode.AvailabilityError.getValue(), errMsg, t);
}
@@ -283,7 +284,7 @@ public abstract class SDNCConnector {
String errorType = xpath.evaluate("error-type", error);
info += "error-type:" + errorType;
} catch (XPathExpressionException e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type",
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type",
error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
@@ -294,7 +295,7 @@ public abstract class SDNCConnector {
}
info += "error-tag:" + errorTag;
} catch (XPathExpressionException e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag",
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag",
error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
@@ -305,7 +306,7 @@ public abstract class SDNCConnector {
}
info += "error-message:" + errorMessage;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message",
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message",
error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
@@ -318,7 +319,7 @@ public abstract class SDNCConnector {
}
}
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
ErrorCode.DataError.getValue(), "Exception while analyzing errors", e);
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
index 7e82adf064..a68bd3e0be 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
@@ -31,6 +31,7 @@ import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpStatus;
import org.onap.so.adapters.sdnc.exception.SDNCAdapterException;
import org.onap.so.adapters.sdncrest.RequestInformation;
@@ -185,7 +186,7 @@ public class SDNCServiceRequestTask {
addTextChild(agnosticServiceInformation, "content-type", contentType);
addTextChild(agnosticServiceInformation, "anydata", anydata);
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e);
return null;
}
@@ -204,8 +205,8 @@ public class SDNCServiceRequestTask {
transformer.transform(new DOMSource(doc), new StreamResult(writer));
xml = writer.toString();
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), ErrorCode.DataError.getValue(),
- "Exception - domToStr", e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(),
+ ErrorCode.DataError.getValue(), "Exception - domToStr", e);
return null;
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
index 3921891ced..5f80c20b97 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
@@ -31,6 +31,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
@@ -61,14 +62,14 @@ public class SNIROResponse {
@Consumes("*/*")
@Produces({MediaType.TEXT_PLAIN})
public Response serviceNotification(@PathParam("correlator") String correlator, String content) {
- logger.info("{} {} {} {}", MessageEnum.RA_RECEIVE_SDNC_NOTIF.toString(), content, "SDNC",
+ logger.info(LoggingAnchor.FOUR, MessageEnum.RA_RECEIVE_SDNC_NOTIF.toString(), content, "SDNC",
"SDNCNotify/SNIROResponse");
String bpUrl = env.getProperty(Constants.BPEL_REST_URL_PROP, "");
if (bpUrl == null || ("").equals(bpUrl)) {
String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP;
- logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(),
Constants.BPEL_REST_URL_PROP, "SDNC", ErrorCode.DataError.getValue(), "Missing config param");
return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build();
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
index cefaadbb63..e8b4cfd997 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
@@ -24,6 +24,7 @@
package org.onap.so.adapters.vfc.util;
import java.io.IOException;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.vfc.constant.HttpCode;
import org.onap.so.adapters.vfc.exceptions.ApplicationException;
import org.onap.so.logger.ErrorCode;
@@ -83,8 +84,8 @@ public class JsonUtil {
try {
return MAPPER.readValue(jsonstr, type);
} catch (IOException e) {
- logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(),
- UNMARSHAL_FAIL_MSG, e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NS_EXC.toString(),
+ ErrorCode.BusinessProcesssError.getValue(), UNMARSHAL_FAIL_MSG, e);
throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG);
}
}
@@ -101,8 +102,8 @@ public class JsonUtil {
try {
return MAPPER.readValue(jsonstr, type);
} catch (IOException e) {
- logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(),
- UNMARSHAL_FAIL_MSG, e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NS_EXC.toString(),
+ ErrorCode.BusinessProcesssError.getValue(), UNMARSHAL_FAIL_MSG, e);
throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG);
}
}
@@ -118,8 +119,8 @@ public class JsonUtil {
try {
return MAPPER.writeValueAsString(srcObj);
} catch (IOException e) {
- logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(),
- "fail to marshal json", e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NS_EXC.toString(),
+ ErrorCode.BusinessProcesssError.getValue(), "fail to marshal json", e);
throw new ApplicationException(HttpCode.BAD_REQUEST, "srcObj marshal failed!");
}
}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
index 3419e6d20c..647fcafa66 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
@@ -27,6 +27,7 @@ package org.onap.so.adapters.vfc.util;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
import javax.ws.rs.core.UriBuilder;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
@@ -79,6 +80,9 @@ public class RestfulUtil {
@Autowired
private Environment env;
+ @Autowired
+ private HttpClient client;
+
public String getMsbHost() {
// MSB_IP will be set as ONAP_IP environment parameter in install flow.
String msbIp = System.getenv().get(ONAP_IP);
@@ -111,8 +115,6 @@ public class RestfulUtil {
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout)
.setConnectionRequestTimeout(timeout).build();
- HttpClient client = HttpClientBuilder.create().build();
-
if ("POST".equalsIgnoreCase(methodType)) {
HttpPost httpPost = new HttpPost(msbUrl);
httpPost.setConfig(requestConfig);
@@ -193,12 +195,12 @@ public class RestfulUtil {
}
private static void logError(String errMsg, Throwable t) {
- logger.error("{} {} {} {}", MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
ErrorCode.AvailabilityError.getValue(), errMsg, t);
}
private static void logError(String errMsg) {
- logger.error("{} {} {} {}", MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
ErrorCode.AvailabilityError.toString(), errMsg);
}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java
new file mode 100644
index 0000000000..c388016ab4
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java
@@ -0,0 +1,156 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2019 Samsung. 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.vfc.util;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.StatusLine;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.adapters.vfc.model.RestfulResponse;
+import org.springframework.http.HttpStatus;
+import javax.ws.rs.HttpMethod;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public class RestfulUtilTest {
+
+ @InjectMocks
+ @Spy
+ private RestfulUtil restfulUtil;
+
+ @Mock
+ private HttpClient client;
+
+ private HttpEntity httpEntity;
+ private HttpResponse httpResponse;
+ private StatusLine statusLine;
+
+ @Before
+ public void setUp() {
+ httpEntity = mock(HttpEntity.class);
+ httpResponse = mock(HttpResponse.class);
+ statusLine = mock(StatusLine.class);
+ }
+
+ private void sendInit() throws IOException {
+
+ doReturn("https://testHost/").when(restfulUtil).getMsbHost();
+
+ when(statusLine.getStatusCode()).thenReturn(HttpStatus.OK.value());
+ when(httpResponse.getStatusLine()).thenReturn(statusLine);
+ when(httpResponse.getEntity()).thenReturn(httpEntity);
+ }
+
+ @Test
+ public void sendGet() throws Exception {
+
+ sendInit();
+
+ ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("GET").getBytes());
+ when(client.execute(any(HttpGet.class))).thenReturn(httpResponse);
+ when(httpEntity.getContent()).thenReturn(responseStream);
+
+ RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.GET, "some request content");
+
+ assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus());
+ assertEquals("GET", restfulResponse.getResponseContent());
+
+ }
+
+ @Test
+ public void sendPost() throws Exception {
+
+ sendInit();
+
+
+ ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("POST").getBytes());
+ when(client.execute(any(HttpPost.class))).thenReturn(httpResponse);
+ when(httpEntity.getContent()).thenReturn(responseStream);
+
+ RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.POST, "some request content");
+
+ assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus());
+ assertEquals("POST", restfulResponse.getResponseContent());
+
+ }
+
+ @Test
+ public void sendPut() throws Exception {
+
+ sendInit();
+
+ ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("PUT").getBytes());
+ when(client.execute(any(HttpPut.class))).thenReturn(httpResponse);
+ when(httpEntity.getContent()).thenReturn(responseStream);
+
+ RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.PUT, "some request content");
+
+ assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus());
+ assertEquals("PUT", restfulResponse.getResponseContent());
+
+ }
+
+ @Test
+ public void sendDelete() throws Exception {
+
+ sendInit();
+
+ ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("DELETE").getBytes());
+ when(client.execute(any(HttpDelete.class))).thenReturn(httpResponse);
+ when(httpEntity.getContent()).thenReturn(responseStream);
+
+ RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.DELETE, "some request content");
+
+ assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus());
+ assertEquals("DELETE", restfulResponse.getResponseContent());
+
+ }
+
+ @Test
+ public void sendOptions() throws Exception {
+
+ doReturn("https://testHost/").when(restfulUtil).getMsbHost();
+
+ RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.OPTIONS, "some request content");
+
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), restfulResponse.getStatus());
+ assertEquals("Error processing request to VFC", restfulResponse.getResponseContent());
+
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
index 164f12ea29..2aee1c06e3 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
@@ -20,6 +20,10 @@
package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
+import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import com.google.gson.Gson;
+import java.util.Iterator;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.JSON;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.configuration.rest.HttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
@@ -32,8 +36,6 @@ import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.client.RestTemplate;
-import java.util.Iterator;
-import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
/**
* Configures the HttpRestServiceProvider for REST call to a VNFM.
@@ -60,7 +62,8 @@ public class VnfmServiceProviderConfiguration {
iterator.remove();
}
}
- restTemplate.getMessageConverters().add(new GsonHttpMessageConverter());
+ final Gson gson = new JSON().getGson();
+ restTemplate.getMessageConverters().add(new GsonHttpMessageConverter(gson));
}
}
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 345ff5119a..b3552c780e 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
@@ -93,6 +93,10 @@ public class JobManager {
logger.debug("Job Id: " + jobId + ", operationId: " + operation.getId() + ", operation details: " + operation);
+ if (operation.getOperationState() == null) {
+ return response.operationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS);
+ }
+
response.setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
response.setId(operation.getId());
response.setOperation(OperationEnum.fromValue(operation.getOperation().getValue()));
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 73a49e9c40..b48de30f88 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
@@ -52,6 +52,7 @@ 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.lcn.JSON;
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;
@@ -115,7 +116,7 @@ public class VnfmAdapterControllerTest {
@Autowired
VnfmAdapterController controller;
- Gson gson = new Gson();
+ Gson gson = new JSON().getGson();
@Before
public void setUp() throws Exception {