diff options
219 files changed, 2900 insertions, 609 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java index 9042095e84..446c725e48 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java @@ -85,7 +85,7 @@ import org.onap.so.config.beans.PoConfig; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.CloudifyManager; import org.onap.so.db.catalog.beans.HeatTemplateParam; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.exceptions.MsoAdapterException; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; 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 576784ae3e..0a3c6acd84 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 @@ -37,7 +37,7 @@ import org.onap.so.config.beans.PoConfig; import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.ServerType; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.exceptions.MsoAdapterException; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; 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 f06d2a2452..62b9c04e3f 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 @@ -52,7 +52,7 @@ import org.onap.so.db.catalog.beans.HeatTemplateParam; import org.onap.so.db.request.beans.CloudApiRequests; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.CreateStackRequest; import org.onap.so.openstack.beans.HeatStatus; 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 684fe98bf3..f001565baf 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 @@ -29,7 +29,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.StackInfo; import org.onap.so.openstack.exceptions.MsoException; 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 f74a3f5f53..b875c2c8bb 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 @@ -29,7 +29,7 @@ import java.util.Optional; import org.onap.so.cloud.authentication.AuthenticationMethodFactory; import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.db.catalog.beans.CloudSite; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.MsoTenant; import org.onap.so.openstack.exceptions.MsoAdapterException; 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 ca0180ae4b..1df5fe36ab 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 @@ -43,7 +43,7 @@ import org.onap.so.adapters.vdu.VduStatus; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; import org.onap.so.client.RestClient; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; @@ -81,7 +81,9 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin { private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); private static final Integer DEFAULT_MSB_PORT = 80; private static final String DEFAULT_MSB_IP = "127.0.0.1"; + private static final String DEFAULT_MSB_SCHEME = "http"; private static final String ONAP_IP = "ONAP_IP"; + private static final String MSB_SCHEME = "MSB_SCHEME"; private final HttpClientFactory httpClientFactory = new HttpClientFactory(); @Autowired @@ -795,10 +797,14 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin { msbIp = environment.getProperty("mso.msb-ip", DEFAULT_MSB_IP); } Integer msbPort = environment.getProperty("mso.msb-port", Integer.class, DEFAULT_MSB_PORT); + String msbScheme = System.getenv().get(MSB_SCHEME); + if (null == msbScheme || msbScheme.isEmpty()) { + msbScheme = environment.getProperty("mso.msb-scheme", DEFAULT_MSB_SCHEME); + } String path = "/api/multicloud/v1/" + cloudOwner + "/" + cloudSiteId + "/infra_workload"; - String endpoint = UriBuilder.fromPath(path).host(msbIp).port(msbPort).scheme("http").build().toString(); + String endpoint = UriBuilder.fromPath(path).host(msbIp).port(msbPort).scheme(msbScheme).build().toString(); if (workloadId != null) { String middlepart = null; if (isName) { 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 44fc620b07..3e28e5c45a 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 @@ -35,7 +35,7 @@ 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.ServerType; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.NetworkInfo; import org.onap.so.openstack.exceptions.MsoAdapterException; diff --git a/adapters/mso-adapter-utils/src/test/resources/application-test.yaml b/adapters/mso-adapter-utils/src/test/resources/application-test.yaml index 32a4db6b80..117d616cd4 100644 --- a/adapters/mso-adapter-utils/src/test/resources/application-test.yaml +++ b/adapters/mso-adapter-utils/src/test/resources/application-test.yaml @@ -53,6 +53,7 @@ mso: logPath: logs msb-ip: localhost msb-port: ${wiremock.server.port} + msb-scheme: http catalog: db: spring: diff --git a/adapters/mso-nssmf-adapter/pom.xml b/adapters/mso-nssmf-adapter/pom.xml index b6b52ce7c5..3e9c2fe6d7 100644 --- a/adapters/mso-nssmf-adapter/pom.xml +++ b/adapters/mso-nssmf-adapter/pom.xml @@ -28,6 +28,7 @@ <artifactId>adapters</artifactId> <version>1.6.0-SNAPSHOT</version> </parent> + <groupId>org.onap.so.adapters</groupId> <artifactId>mso-nssmf-adapter</artifactId> <packaging>jar</packaging> <name>mso-nssmf-adapter</name> diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/RestUtil.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/RestUtil.java index 3592d4f6a3..dcc6f5ba72 100644 --- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/RestUtil.java +++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/RestUtil.java @@ -59,7 +59,7 @@ import static org.onap.so.adapters.nssmf.rest.HttpMethod.POST; import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.BAD_REQUEST; import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.marshal; import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.unMarshal; -import static org.onap.so.logger.ErrorCode.AvailabilityError; +import static org.onap.logging.filter.base.ErrorCode.AvailabilityError; import static org.onap.so.logger.LoggingAnchor.FOUR; import static org.onap.so.logger.MessageEnum.RA_NS_EXC; diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/NssmfAdapterUtil.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/NssmfAdapterUtil.java index b0b84d822b..3a7c2f19df 100644 --- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/NssmfAdapterUtil.java +++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/NssmfAdapterUtil.java @@ -25,7 +25,7 @@ import java.io.IOException; import org.onap.so.adapters.nssmf.exceptions.ApplicationException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import static org.onap.so.logger.LoggingAnchor.THREE; import static org.onap.so.logger.MessageEnum.RA_NS_EXC; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java index 9d7eafbf82..214cebb338 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java @@ -26,7 +26,7 @@ package org.onap.so.adapters.network; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java index 25667efc71..ba4e93fa93 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java @@ -27,7 +27,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.ArrayList; import java.util.List; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.HostRoute; import org.onap.so.openstack.beans.Pool; 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 e95e9a3a83..8d75212f4e 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 @@ -46,7 +46,7 @@ import org.onap.so.adapters.network.async.client.QueryNetworkNotification; 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.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.NetworkRollback; 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 ef04ee9c13..5530fad298 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 @@ -47,7 +47,7 @@ import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationReposi import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; import org.onap.so.entity.MsoRequest; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.HeatStatus; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java index 0c37837880..09356d02c8 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java @@ -62,7 +62,7 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest; import org.onap.so.adapters.nwrest.UpdateNetworkResponse; import org.onap.so.adapters.vnf.BpelRestClient; import org.onap.so.entity.MsoRequest; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.NetworkRollback; import org.onap.so.openstack.beans.NetworkStatus; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java index 04b90b444f..4b02595074 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java @@ -33,7 +33,7 @@ import org.onap.so.adapters.tenant.exceptions.TenantAlreadyExists; import org.onap.so.adapters.tenant.exceptions.TenantException; import org.onap.so.adapters.tenantrest.TenantRollback; import org.onap.so.entity.MsoRequest; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.MsoTenant; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java index 662ce33022..5b0370b25e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java @@ -37,7 +37,7 @@ import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.utils.CryptoUtils; import org.slf4j.Logger; 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 e925e6037c..68d1bebc51 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 @@ -44,7 +44,7 @@ import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify; 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.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.VnfRollback; 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 65d5523709..0dc0d1c290 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 @@ -53,7 +53,7 @@ import org.onap.so.entity.MsoRequest; import org.onap.so.heatbridge.HeatBridgeApi; import org.onap.so.heatbridge.HeatBridgeException; import org.onap.so.heatbridge.HeatBridgeImpl; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.HeatStatus; 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 abaf881ba5..ba837a9718 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 @@ -52,7 +52,7 @@ import org.onap.so.db.catalog.beans.VnfResource; import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; import org.onap.so.entity.MsoRequest; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.MsoTenant; import org.onap.so.openstack.beans.VnfRollback; 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 b1f4055b3b..0ecfd15dde 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 @@ -65,7 +65,7 @@ import org.onap.so.db.catalog.beans.VnfResource; import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; import org.onap.so.entity.MsoRequest; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; 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 0fb11ebbf3..0836f69ba7 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 @@ -56,7 +56,7 @@ import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse; import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse; import org.onap.so.adapters.vnfrest.VfModuleRollback; import org.onap.so.entity.MsoRequest; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; 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 fcb570f3f5..18ed9872a0 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 @@ -55,7 +55,7 @@ import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse; import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse; import org.onap.so.adapters.vnfrest.VfModuleRollback; import org.onap.so.entity.MsoRequest; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java index c9e046ca43..7e12735e05 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java @@ -56,7 +56,7 @@ import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse; import org.onap.so.adapters.vnfrest.VolumeGroupExceptionResponse; import org.onap.so.adapters.vnfrest.VolumeGroupRollback; import org.onap.so.entity.MsoRequest; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java index 2b7234aca6..cfddbba34e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java @@ -55,7 +55,7 @@ import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse; import org.onap.so.adapters.vnfrest.VolumeGroupExceptionResponse; import org.onap.so.adapters.vnfrest.VolumeGroupRollback; import org.onap.so.entity.MsoRequest; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; 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 e2022c9a6e..6d3b0ab680 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 @@ -76,7 +76,7 @@ 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.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.openstack4j.model.compute.Server; 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 20fd812ab9..6171e7a624 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml +++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml @@ -66,6 +66,7 @@ mso: logPath: logs msb-ip: localhost msb-port: ${wiremock.server.port} + msb-scheme: http catalog: db: spring: 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 24dab2fc5b..a092099bfb 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,19 +27,15 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; -import org.onap.logging.filter.base.ONAPComponents; -import org.onap.logging.ref.slf4j.ONAPLogConstants; 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; import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository; -import org.onap.so.logger.ErrorCode; -import org.onap.so.logger.LoggingAnchor; -import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.ScheduledTasksMDCSetup; +import org.onap.logging.filter.base.ErrorCode; +import org.onap.logging.filter.base.ScheduledLogging; +import org.onap.logging.filter.base.ScheduledTaskException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.domain.PageRequest; @@ -56,8 +52,6 @@ public class ArchiveInfraRequestsScheduler { private InfraActiveRequestsRepository infraActiveRepo; @Autowired private ArchivedInfraRequestsRepository archivedInfraRepo; - @Autowired - private ScheduledTasksMDCSetup scheduledMDCSetup; @Value("${mso.infra-requests.archived.period}") @@ -65,11 +59,13 @@ public class ArchiveInfraRequestsScheduler { /** * Runs the scheduler nightly [Seconds] [Minutes] [Hours] [Day of month] [Month] [Day of week] [Year] + * + * @throws ScheduledTaskException */ + @ScheduledLogging @Scheduled(cron = "0 0 1 * * ?") @SchedulerLock(name = "archiveInfraRequestsScheduler") - public void infraRequestsScheduledTask() { - scheduledMDCSetup.mdcSetup(ONAPComponents.REQUEST_DB, "infraRequestsScheduledTask"); + public void infraRequestsScheduledTask() throws ScheduledTaskException { logger.debug("Start of archiveInfraRequestsScheduler"); Date currentDate = new Date(); @@ -97,10 +93,9 @@ public class ArchiveInfraRequestsScheduler { } while (!requestsByStartTime.isEmpty()); logger.debug("End of archiveInfraRequestsScheduler"); - scheduledMDCSetup.exitAndClearMDC(); } - protected void archiveInfraRequests(List<InfraActiveRequests> requests) { + protected void archiveInfraRequests(List<InfraActiveRequests> requests) throws ScheduledTaskException { List<ArchivedInfraRequests> newArchivedReqs = new ArrayList<>(); List<InfraActiveRequests> oldInfraReqs = new ArrayList<>(); @@ -151,10 +146,7 @@ public class ArchiveInfraRequestsScheduler { newArchivedReqs.add(archivedInfra); oldInfraReqs.add(iar); } catch (Exception e) { - scheduledMDCSetup.errorMDCSetup(ErrorCode.UnknownError, e.getMessage()); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.ERROR.toString()); - logger.error(LoggingAnchor.TWO, MessageEnum.RA_GENERAL_EXCEPTION.toString(), - ErrorCode.UnknownError.getValue(), e); + throw new ScheduledTaskException(ErrorCode.UnknownError, e.getMessage(), e); } } diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java index 052a53bb1f..b262cb21cb 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java @@ -39,7 +39,7 @@ import org.onap.so.db.request.data.repository.OperationStatusRepository; import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; import org.onap.so.db.request.data.repository.SiteStatusRepository; import org.onap.so.db.request.data.repository.InstanceNfvoMappingRepository; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.requestsdb.RequestsDbConstant; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java index 27580977b8..e1e629008d 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java @@ -24,7 +24,7 @@ package org.onap.so.adapters.requestsdb.exceptions; import javax.xml.ws.WebFault; import org.onap.so.exceptions.MSOException; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; /** * This class simply extends Exception (without addition additional functionality) to provide an identifier for 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 b96a564b1a..f8daf69965 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 @@ -31,7 +31,7 @@ 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.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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 577b550be6..3de95b338b 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 @@ -32,7 +32,7 @@ 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.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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 87620743d7..978cd44b56 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 @@ -30,7 +30,7 @@ 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.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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 b15831ff03..0535b3de2d 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 @@ -24,7 +24,7 @@ package org.onap.so.adapters.sdnc.impl; import org.onap.so.logger.LoggingAnchor; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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 2b023f4c15..7c35be02a4 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 @@ -29,7 +29,7 @@ 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; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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 bcd1db7929..f3bf8c2108 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 @@ -46,7 +46,7 @@ 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.logging.filter.base.ErrorCode; import org.onap.so.utils.CryptoUtils; import org.onap.so.adapters.sdnc.SDNCAdapterRequest; import org.onap.so.adapters.sdnc.client.CallbackHeader; 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 56c38f8891..2f6ec00283 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 @@ -34,7 +34,7 @@ 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.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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 631be2f9ff..62f45f88b1 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 @@ -28,7 +28,7 @@ import java.net.URI; import javax.xml.bind.DatatypeConverter; import org.onap.logging.filter.spring.SpringClientPayloadFilter; import org.onap.so.adapters.sdnc.impl.Constants; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter; 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 979238fe2f..776251a20b 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 @@ -26,7 +26,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; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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 e184bbd110..431e9db87b 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 @@ -51,7 +51,7 @@ import org.apache.http.util.EntityUtils; import org.onap.so.adapters.sdnc.impl.Constants; import org.onap.so.adapters.sdncrest.SDNCErrorCommon; import org.onap.so.adapters.sdncrest.SDNCResponseCommon; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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 50c8a089df..305abe2762 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 @@ -38,7 +38,7 @@ import org.onap.so.adapters.sdncrest.RequestInformation; import org.onap.so.adapters.sdncrest.SDNCResponseCommon; import org.onap.so.adapters.sdncrest.SDNCServiceError; import org.onap.so.adapters.sdncrest.SDNCServiceRequest; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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 5f80c20b97..9f7760a0d8 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 @@ -33,7 +33,7 @@ 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.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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 5b50f776cc..04109bd89d 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 @@ -27,7 +27,7 @@ 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; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.type.TypeReference; 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 984cdb8016..a708c2641c 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 @@ -47,7 +47,7 @@ import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import org.onap.so.adapters.vfc.model.RestfulResponse; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java index ecffb683ca..fe166f7942 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java @@ -24,15 +24,13 @@ package org.onap.so.asdc; import java.security.SecureRandom; import javax.annotation.PreDestroy; -import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.asdc.client.ASDCController; import org.onap.so.asdc.client.exceptions.ASDCControllerException; -import org.onap.so.logger.ErrorCode; -import org.onap.so.logger.ScheduledTasksMDCSetup; -import org.onap.so.utils.Components; +import org.onap.logging.filter.base.ErrorCode; +import org.onap.logging.filter.base.ScheduledLogging; +import org.onap.logging.filter.base.ScheduledTaskException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Profile; import org.springframework.scheduling.annotation.Scheduled; @@ -47,16 +45,13 @@ public class ASDCControllerSingleton { private final ASDCController asdcController; @Autowired - private ScheduledTasksMDCSetup scheduledMDCSetup; - - @Autowired public ASDCControllerSingleton(final ASDCController asdcController) { this.asdcController = asdcController; } + @ScheduledLogging @Scheduled(fixedRate = 50000) - public void periodicControllerTask() { - scheduledMDCSetup.mdcSetup(Components.ASDC_CONTROLLER, "periodicControllerTask"); + public void periodicControllerTask() throws ScheduledTaskException { try { final int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE); asdcController.setControllerName("mso-controller" + randomNumber); @@ -66,11 +61,9 @@ public class ASDCControllerSingleton { asdcController.initASDC(); } } catch (final ASDCControllerException controllerException) { - scheduledMDCSetup.errorMDCSetup(ErrorCode.UnknownError, controllerException.getMessage()); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.ERROR.toString()); - logger.error("Exception occurred", controllerException); + throw new ScheduledTaskException(ErrorCode.UnknownError, controllerException.getMessage(), + controllerException); } - scheduledMDCSetup.exitAndClearMDC(); } @PreDestroy diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java index e084cfec18..ad96e1be4b 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java @@ -74,7 +74,7 @@ import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; import org.onap.so.db.request.beans.WatchdogDistributionStatus; import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository; import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java index d0f86c722e..d59984bb52 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java @@ -6,12 +6,14 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * Licensed under the Apache License, Version 2.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. @@ -52,21 +54,25 @@ public final class ASDCStatusCallBack implements IStatusCallback { try { - if (iStatus.getStatus() != null) { - if (iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_OK) - || iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_ERROR)) { - WatchdogDistributionStatus watchdogDistributionStatus = watchdogDistributionStatusRepository - .findById(iStatus.getDistributionID()).orElseGet(() -> null); - if (watchdogDistributionStatus == null) { - watchdogDistributionStatus = new WatchdogDistributionStatus(); - watchdogDistributionStatus.setDistributionId(iStatus.getDistributionID()); - watchdogDistributionStatusRepository.save(watchdogDistributionStatus); - } - logger.debug(event); - toscaInstaller.installTheComponentStatus(iStatus); - - } + if (iStatus.getStatus() == null) { + logger.info("Missing status on Status Object. "); + return; + } + if (!iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_OK) + && !iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_ERROR)) { + logger.info("Status is not 'Component Done OK' or 'Component Done Error'"); + return; } + WatchdogDistributionStatus watchdogDistributionStatus = + watchdogDistributionStatusRepository.findById(iStatus.getDistributionID()).orElseGet(() -> null); + if (watchdogDistributionStatus == null) { + watchdogDistributionStatus = new WatchdogDistributionStatus(); + watchdogDistributionStatus.setDistributionId(iStatus.getDistributionID()); + watchdogDistributionStatusRepository.save(watchdogDistributionStatus); + } + logger.debug(event); + toscaInstaller.installTheComponentStatus(iStatus); + } catch (ArtifactInstallerException e) { logger.error("Error in ASDCStatusCallback {}", e.getMessage(), e); logger.debug("Error in ASDCStatusCallback {}", e.getMessage()); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java index 13cace404e..0a1b1c531e 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java @@ -4,12 +4,14 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,7 +39,6 @@ public class FinalDistributionStatusMessage implements IFinalDistrStatusMessage public FinalDistributionStatusMessage(String distributionId, final DistributionStatusEnum distributionStatusEnum, final long timestampL, String consumerId) { - // componentName = componentname; consumerID = consumerId; distributionID = distributionId; status = distributionStatusEnum; @@ -68,6 +69,7 @@ public class FinalDistributionStatusMessage implements IFinalDistrStatusMessage this.timestamp = timestamp; } + @Override public String getComponentName() { return componentName; } @@ -76,6 +78,7 @@ public class FinalDistributionStatusMessage implements IFinalDistrStatusMessage this.componentName = componentName; } + @Override public String getConsumerID() { return consumerID; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java index 7bd9c752a4..34f21ab813 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java @@ -4,12 +4,14 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * Licensed under the Apache License, Version 2.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. @@ -50,43 +52,37 @@ public class JsonStatusData implements IStatusData { @Override public String getDistributionID() { - // return (String)this.attributesMap.get("distributionID"); return "35120a87-1f82-4276-9735-f6de5a244d65"; } @Override public String getConsumerID() { - // return (String)this.attributesMap.get("consumerID"); return "mso.123456"; } @Override public String getComponentName() { - // return (String)this.attributesMap.get("componentName"); return "SDN-C"; } @Override public Long getTimestamp() { - // return (String)this.attributesMap.get("timestamp"); return null; } @Override public String getArtifactURL() { - // return (String)this.attributesMap.get("artifactURL"); return "/sdc/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml"; } @Override public DistributionStatusEnum getStatus() { - // return (DistributionStatusEnum)this.attributesMap.get(DistributionStatusEnum.DEPLOY_OK); return DistributionStatusEnum.COMPONENT_DONE_OK; } /** * Method instantiate a INotificationData implementation from a JSON file. - * + * * @param notifFilePath The file path in String * @return A JsonNotificationData instance * @throws IOException in case of the file is not readable or not accessible @@ -96,19 +92,6 @@ public class JsonStatusData implements IStatusData { InputStream is = Thread.currentThread().getContextClassLoader() .getResourceAsStream(notifFilePath + "status-structure.json"); - // String fileLocation = System.getProperty("mso.config.path") + "notif-structure.json"; - - // String source = fileLocation; - // InputStream is = IOUtils.toInputStream(source, "UTF-8"); - - // String myString = IOUtils.toString(is, "UTF-8"); - - - // System.out.println(myString); - - if (is == null) { - // throw new FileExistsException("Resource Path does not exist: "+notifFilePath); - } return mapper.readValue(is, JsonStatusData.class); } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java index a9d06d8e82..42778507f0 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java @@ -36,7 +36,7 @@ import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator; import org.onap.so.asdc.client.test.emulators.JsonStatusData; import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; import org.onap.so.asdc.installer.heat.ToscaResourceInstaller; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java index dcb49478f4..04d4b0c2dc 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java @@ -50,7 +50,7 @@ import org.onap.so.db.catalog.beans.ToscaCsar; import org.onap.so.db.catalog.beans.VfModule; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java index 36d6ab96c0..11c1cc33cf 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * Licensed under the Apache License, Version 2.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,8 +27,6 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; -import org.onap.sdc.api.notification.IVfModuleMetadata; -import org.onap.so.asdc.client.ASDCConfiguration; import org.onap.so.asdc.client.exceptions.ArtifactInstallerException; import org.onap.so.db.catalog.beans.VfModule; @@ -73,23 +73,6 @@ public final class VfModuleStructure { } } - public List<VfModuleArtifact> getOrderedArtifactList() { - - List<VfModuleArtifact> artifactsList = new LinkedList<>(); - - artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT)); - artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_ENV)); - artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_VOL)); - - artifactsList.addAll((artifactsMap.get(ASDCConfiguration.HEAT_NESTED))); - - artifactsList.addAll((artifactsMap.get(ASDCConfiguration.HEAT_ARTIFACT))); - - artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_VOL)); - - return null; - } - public IVfModuleData getVfModuleMetadata() { return vfModuleMetadata; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java index f954fe0c5a..f5b0e17cf5 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java @@ -7,6 +7,8 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -77,39 +79,38 @@ public class VfResourceStructure extends ResourceStructure { private Service catalogService; - public VfResourceStructure(INotificationData notificationdata, IResourceInstance resourceinstance) { - super(notificationdata, resourceinstance); + public VfResourceStructure(INotificationData notificationData, IResourceInstance resourceInstance) { + super(notificationData, resourceInstance); this.resourceType = ResourceType.VF_RESOURCE; vfModulesStructureList = new LinkedList<>(); vfModulesMetadataList = new ArrayList<>(); } - public void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactinfo, + public void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactInfo, IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException { - this.addArtifactToStructure(distributionClient, artifactinfo, clientResult, null); + this.addArtifactToStructure(artifactInfo, clientResult, null); } - public void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactinfo, - IDistributionClientDownloadResult clientResult, String modifiedHeatTemplate) - throws UnsupportedEncodingException { - VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactinfo, clientResult, modifiedHeatTemplate); - addArtifactByType(artifactinfo, clientResult, vfModuleArtifact); - if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifactinfo.getArtifactType())) { + public void addArtifactToStructure(IArtifactInfo artifactInfo, IDistributionClientDownloadResult clientResult, + String modifiedHeatTemplate) throws UnsupportedEncodingException { + VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactInfo, clientResult, modifiedHeatTemplate); + addArtifactByType(artifactInfo, clientResult, vfModuleArtifact); + if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifactInfo.getArtifactType())) { logger.debug("VF_MODULE_ARTIFACT: " + new String(clientResult.getArtifactPayload(), "UTF-8")); logger.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(vfModulesMetadataList)); } } - public void addWorkflowArtifactToStructure(IArtifactInfo artifactinfo, + public void addWorkflowArtifactToStructure(IArtifactInfo artifactInfo, IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException { - WorkflowArtifact workflowArtifact = new WorkflowArtifact(artifactinfo, clientResult); - workflowArtifactsMapByUUID.put(artifactinfo.getArtifactUUID(), workflowArtifact); + WorkflowArtifact workflowArtifact = new WorkflowArtifact(artifactInfo, clientResult); + workflowArtifactsMapByUUID.put(artifactInfo.getArtifactUUID(), workflowArtifact); } - protected void addArtifactByType(IArtifactInfo artifactinfo, IDistributionClientDownloadResult clientResult, + protected void addArtifactByType(IArtifactInfo artifactInfo, IDistributionClientDownloadResult clientResult, VfModuleArtifact vfModuleArtifact) { - switch (artifactinfo.getArtifactType()) { + switch (artifactInfo.getArtifactType()) { case ASDCConfiguration.HEAT: case ASDCConfiguration.HEAT_ENV: case ASDCConfiguration.HEAT_VOL: @@ -118,7 +119,7 @@ public class VfResourceStructure extends ResourceStructure { case ASDCConfiguration.HEAT_NET: case ASDCConfiguration.OTHER: case ASDCConfiguration.CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT: - artifactsMapByUUID.put(artifactinfo.getArtifactUUID(), vfModuleArtifact); + artifactsMapByUUID.put(artifactInfo.getArtifactUUID(), vfModuleArtifact); break; case ASDCConfiguration.VF_MODULES_METADATA: vfModulesMetadataList = this.decodeVfModuleArtifact(clientResult.getArtifactPayload()); @@ -196,9 +197,7 @@ public class VfResourceStructure extends ResourceStructure { public List<IVfModuleData> decodeVfModuleArtifact(byte[] arg0) { try { - List<IVfModuleData> listVFModuleMetaData = - new ObjectMapper().readValue(arg0, new TypeReference<List<VfModuleMetaData>>() {}); - return listVFModuleMetaData; + return new ObjectMapper().readValue(arg0, new TypeReference<List<VfModuleMetaData>>() {}); } catch (JsonParseException e) { logger.debug("JsonParseException : ", e); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java index 195aa7e302..4253521dff 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java @@ -6,6 +6,8 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -27,6 +29,7 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.net.URI; +import java.net.URISyntaxException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Enumeration; @@ -47,7 +50,7 @@ import org.apache.http.entity.mime.content.ByteArrayBody; import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.HttpClientBuilder; import org.onap.so.asdc.client.ASDCConfiguration; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -107,18 +110,15 @@ public class BpmnInstaller { logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), csarFilePath, ex.getMessage(), ErrorCode.DataError.getValue(), "ASDC reading CSAR with workflows failed"); } - return; } public boolean containsWorkflows(String csarFilePath) { - boolean workflowsInCsar = false; try (ZipFile zipFile = new ZipFile(csarFilePath)) { Enumeration<? extends ZipEntry> zipEntries = zipFile.entries(); while (zipEntries.hasMoreElements()) { String fileName = zipEntries.nextElement().getName(); if (fileName.endsWith(BPMN_SUFFIX)) { - workflowsInCsar = true; - break; + return true; } } } catch (Exception e) { @@ -126,10 +126,11 @@ public class BpmnInstaller { logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), csarFilePath, e.getMessage(), ErrorCode.DataError.getValue(), "ASDC Unable to check CSAR entries"); } - return workflowsInCsar; + return false; } - protected HttpResponse sendDeploymentRequest(String bpmnFileName, String version) throws Exception { + protected HttpResponse sendDeploymentRequest(String bpmnFileName, String version) + throws IOException, URISyntaxException { HttpClient client = HttpClientBuilder.create().build(); URI deploymentUri = new URI(this.env.getProperty(CAMUNDA_URL) + CREATE_DEPLOYMENT_PATH); HttpPost post = new HttpPost(deploymentUri); @@ -141,7 +142,7 @@ public class BpmnInstaller { return client.execute(post); } - protected HttpEntity buildMimeMultipart(String bpmnFileName, String version) throws Exception { + protected HttpEntity buildMimeMultipart(String bpmnFileName, String version) throws IOException { FileInputStream bpmnFileStream = new FileInputStream( Paths.get(getMsoConfigPath(), "ASDC", version, bpmnFileName).normalize().toString()); @@ -182,17 +183,14 @@ public class BpmnInstaller { return requestEntity; } - /* protected void extractBpmnFileFromCsar(ZipInputStream zipIn, String fileName) throws IOException */ protected void extractBpmnFileFromCsar(ZipInputStream zipIn, String fileName) { String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", fileName).normalize().toString(); - /* BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filePath)); */ try (BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filePath))) { byte[] bytesIn = new byte[4096]; - int read = 0; + int read; while ((read = zipIn.read(bytesIn)) != -1) { outputStream.write(bytesIn, 0, read); } - /* outputStream.close(); */ } catch (IOException e) { logger.error("Unable to open file.", e); } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java index ef4dfa24aa..1f111ba7a0 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java @@ -40,7 +40,7 @@ import org.onap.so.db.catalog.beans.WorkflowActivitySpecSequence; import org.onap.so.db.catalog.data.repository.ActivitySpecRepository; import org.onap.so.db.catalog.data.repository.VnfResourceRepository; import org.onap.so.db.catalog.data.repository.WorkflowRepository; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 1c7ebb7d9a..423c1a7ed6 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -83,7 +83,7 @@ import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup; import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository; import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository; import org.onap.so.db.request.data.repository.WatchdogServiceModVerIdLookupRepository; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy index ee70dcc89c..ecd90165c2 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy @@ -24,7 +24,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor import org.onap.so.client.HttpClientFactory -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import java.util.regex.Matcher import java.util.regex.Pattern diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy index 976ad1466d..e83e7e2ea2 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy @@ -32,6 +32,7 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.client.HttpClientFactory import org.onap.so.client.aai.AAIResourcesClient import org.springframework.web.util.UriUtils import org.slf4j.Logger @@ -677,4 +678,8 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess public AAIResourcesClient getAAIClient(){ return new AAIResourcesClient(); } + + HttpClientFactory getHttpClientFactory(){ + return new HttpClientFactory() + } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy index 4df38edcc3..e5fff9c100 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy @@ -24,7 +24,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import static org.apache.commons.lang3.StringUtils.isBlank; diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy index c843cc35fe..6b021834b3 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy @@ -28,7 +28,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.json.JsonUtils import org.onap.appc.client.lcm.model.Action import org.onap.so.client.appc.ApplicationControllerAction -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy index 83784e1960..7b49fa06b3 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy @@ -32,7 +32,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy index 841fe9f50e..48a8e60095 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy @@ -27,7 +27,7 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.db.request.beans.InfraActiveRequests import org.onap.so.db.request.client.RequestsDbClient -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy index b666c8d19d..9c8d8bfa12 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy @@ -30,7 +30,7 @@ import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy index 569d4b75b9..24375e59cc 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy @@ -32,7 +32,7 @@ import org.onap.so.client.aai.entities.Relationships import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy index 163e914238..b43a153acb 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy @@ -33,7 +33,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.db.catalog.beans.OrchestrationStatus -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy index 4d57b1b26f..4b33676955 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy @@ -29,7 +29,7 @@ import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.graphinventory.entities.uri.Depth -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy index 195b1fc0d6..38f7bf445f 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy @@ -23,7 +23,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import static org.apache.commons.lang3.StringUtils.* diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy index 8306f33592..c294f1b8c3 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy @@ -26,7 +26,7 @@ import org.onap.so.logger.LoggingAnchor import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.db.request.beans.InfraActiveRequests import org.onap.so.db.request.client.RequestsDbClient -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.bpmn.core.UrnPropertiesReader; import java.text.SimpleDateFormat diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy index 6d4b50f690..203ccb97f6 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy @@ -25,7 +25,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.client.HttpClientFactory -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import java.io.Serializable; diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy index 615964b2a9..a1e3576d86 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy @@ -23,7 +23,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import static org.apache.commons.lang3.StringUtils.*; diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy index a2f5dfbffe..eea476a278 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy @@ -23,7 +23,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import java.text.SimpleDateFormat diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy index 39e6db4d3f..f012eabe5e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy @@ -30,7 +30,7 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtil.groovy index ce474fa713..b35042e3c0 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtil.groovy @@ -49,8 +49,8 @@ class RequestDBUtil { String operationType = operationStatus.getOperation() String result = operationStatus.getResult() String progress = operationStatus.getProgress() - String operationContent = operationStatus.getOperationContent() - String reason = operationStatus.getReason() + String operationContent = operationStatus.getOperationContent()?: "" + String reason = operationStatus.getReason()?: "" String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy index db39358ccd..f9119dcb1d 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy @@ -24,7 +24,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import java.text.SimpleDateFormat diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy index 52d6758b2b..ebaf65ff81 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy @@ -24,7 +24,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor import org.onap.so.client.HttpClientFactory -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import java.text.SimpleDateFormat import javax.ws.rs.core.Response diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy index ba5145d19b..753d4403f3 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy @@ -23,7 +23,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import java.text.SimpleDateFormat import java.net.URLEncoder diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy index f24eda813d..2455305b4e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy @@ -28,7 +28,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.L3Network import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.springframework.web.util.UriUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MessageEnum diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy index 30964aa4ec..8075944c8c 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy @@ -25,7 +25,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy index 8f409fa13e..f19933fa8b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy @@ -31,7 +31,7 @@ import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.graphinventory.entities.uri.Depth -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy index 20aeb11c5f..cfa384dc50 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy @@ -23,7 +23,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy index 803a3f71de..a6aacc7ea5 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy @@ -24,7 +24,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor import org.onap.so.client.HttpClientFactory -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import javax.ws.rs.core.Response import org.apache.commons.lang3.* diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy index 6cfa2a1a64..91b29d3867 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy @@ -26,7 +26,7 @@ import org.onap.so.logger.LoggingAnchor import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java index d9356306b7..bd31c552d3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java @@ -34,7 +34,7 @@ import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; import org.onap.so.bpmn.core.UrnPropertiesReader; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.utils.CryptoUtils; import org.slf4j.Logger; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java index 047b1f3930..204611cb8f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java @@ -26,7 +26,7 @@ package org.onap.so.bpmn.common.workflow.context; import java.util.concurrent.DelayQueue; import java.util.concurrent.TimeUnit; import org.onap.so.logger.LoggingAnchor; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index 0a6ce05a06..2e9d4b0117 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -40,7 +40,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.onap.so.objects.audit.AAIObjectAudit; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/SDNCLcmPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/SDNCLcmPropertiesImpl.java index eb2567d47c..9b46611468 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/SDNCLcmPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/SDNCLcmPropertiesImpl.java @@ -31,12 +31,14 @@ public class SDNCLcmPropertiesImpl implements SDNCLcmProperties { public static final String SDNC_HOST = "sdnc.host"; public static final String SDNC_AUTH = "sdnc.auth"; public static final String LCM_PATH = "sdnc.lcm.path"; + public static final String LCM_ACTION_TIMEOUT = "sdnc.lcm.actionTimeout"; public static final String DMAAP_HOST = "sdnc.dmaap.host"; public static final String DMAAP_AUTH = "sdnc.dmaap.auth"; - public static final String DMAAP_PARTITION = "sdnc.dmaap.partition"; public static final String DMAAP_TIMEOUT = "sdnc.dmaap.timeout"; public static final String DMAAP_ENVIRONMENT = "sdnc.dmaap.environment"; + + public static final String LCM_DMAAP_PARTITION = "sdnc.lcm.dmaap.partition"; public static final String LCM_DMAAP_READ_TOPIC = "sdnc.lcm.dmapp.readTopic"; public static final String LCM_DMAAP_WRITE_TOPIC = "sdnc.lcm.dmaap.writeTopic"; @@ -56,6 +58,12 @@ public class SDNCLcmPropertiesImpl implements SDNCLcmProperties { } @Override + public long getActionTimeout() { + String actionTimeout = UrnPropertiesReader.getVariable(LCM_ACTION_TIMEOUT); + return (actionTimeout != null) ? Long.parseLong(actionTimeout) : SDNCConstants.LCM_ACTION_TIMEOUT; + } + + @Override public String getBasicAuth() { return UrnPropertiesReader.getVariable(SDNC_AUTH); } @@ -72,7 +80,7 @@ public class SDNCLcmPropertiesImpl implements SDNCLcmProperties { @Override public String getDmaapPartition() { - String partition = UrnPropertiesReader.getVariable(DMAAP_PARTITION); + String partition = UrnPropertiesReader.getVariable(LCM_DMAAP_PARTITION); return (partition != null) ? partition : SDNCConstants.LCM_DMAAP_PARTITION; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SDNCConstants.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SDNCConstants.java index fd9412e70e..dcbb120c69 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SDNCConstants.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SDNCConstants.java @@ -45,5 +45,6 @@ public interface SDNCConstants { String LCM_DMAAP_READ_TOPIC = "SDNC-LCM-WRITE"; String LCM_DMAAP_WRITE_TOPIC = "SDNC-LCM-READ"; - int LCM_TIMEOUT = 300; + long LCM_ACTION_TIMEOUT = 300000; // Millisecond + int LCM_OUTPUT_SUCCESS_CODE = 400; } diff --git a/common/src/main/java/org/onap/so/logger/ErrorCode.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmActionConstants.java index a57ed99f2b..8ab40cb08d 100644 --- a/common/src/main/java/org/onap/so/logger/ErrorCode.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmActionConstants.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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. @@ -18,23 +18,11 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.logger; +package org.onap.so.client.sdnc.lcm; -public enum ErrorCode { - PermissionError(100), - AvailabilityError(200), - DataError(300), - SchemaError(400), - BusinessProcessError(500), - UnknownError(900); - - private int value; - - ErrorCode(int value) { - this.value = value; - } - - public int getValue() { - return this.value; - } +public interface SDNCLcmActionConstants { + String ACTIVATE_N_E_SW = "ActivateNESw"; + String DOWNLOAD_N_E_SW = "DownloadNESw"; + String UPGRADE_POST_CHECK = "UpgradePostCheck"; + String UPGRADE_PRE_CHECK = "UpgradePreCheck"; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilder.java index 5616db3577..0f17c547b5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilder.java @@ -39,6 +39,10 @@ public class SDNCLcmClientBuilder { sdncLcmProperties = pros; } + public SDNCLcmProperties getSDNCLcmProperties() { + return sdncLcmProperties; + } + public SDNCLcmRestClient newSDNCLcmRestClient(String operation) throws SDNCLcmClientBuilderException { URI pathUri; try { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmProperties.java index df5fb3be0b..a21196e08f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmProperties.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmProperties.java @@ -27,6 +27,8 @@ public interface SDNCLcmProperties extends RestProperties { String getPath(); + long getActionTimeout(); + String getBasicAuth(); String getDmaapHost(); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayload.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayload.java new file mode 100644 index 0000000000..d86d114a9f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayload.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans.payload; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"ipaddressV4Oam", "playbookName", "swVersionToBeActivated"}) +public class ActivateNESwPayload { + + @JsonProperty(value = "ipaddress-v4-oam", required = true) + private String ipaddressV4Oam; + + @JsonProperty(value = "playbook-name") + private String playbookName; + + @JsonProperty(value = "swVersionToBeActivated", required = true) + private String swVersionToBeActivated; + + public String getIpaddressV4Oam() { + return ipaddressV4Oam; + } + + public void setIpaddressV4Oam(String value) { + this.ipaddressV4Oam = value; + } + + public String getPlaybookName() { + return playbookName; + } + + public void setPlaybookName(String value) { + this.playbookName = value; + } + + public String getSwVersionToBeActivated() { + return swVersionToBeActivated; + } + + public void setSwVersionToBeActivated(String value) { + this.swVersionToBeActivated = value; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayload.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayload.java new file mode 100644 index 0000000000..5dc5cf503d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayload.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans.payload; + +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"ipaddressV4Oam", "playbookName", "swToBeDownloaded"}) +public class DownloadNESwPayload { + + @JsonProperty(value = "ipaddress-v4-oam", required = true) + private String ipaddressV4Oam; + + @JsonProperty(value = "playbook-name") + private String playbookName; + + @JsonProperty(value = "swToBeDownloaded", required = true) + private List<SwToBeDownloadedElement> swToBeDownloaded = new ArrayList<>(); + + public String getIpaddressV4Oam() { + return ipaddressV4Oam; + } + + public void setIpaddressV4Oam(String value) { + this.ipaddressV4Oam = value; + } + + public String getPlaybookName() { + return playbookName; + } + + public void setPlaybookName(String value) { + this.playbookName = value; + } + + public List<SwToBeDownloadedElement> getSwToBeDownloaded() { + return swToBeDownloaded; + } + + public void setSwToBeDownloaded(List<SwToBeDownloadedElement> value) { + this.swToBeDownloaded = value; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/SwToBeDownloadedElement.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/SwToBeDownloadedElement.java new file mode 100644 index 0000000000..1a3529d7c4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/SwToBeDownloadedElement.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans.payload; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"swLocation", "swFileSize", "swFileCompression", "swFileFormat"}) +public class SwToBeDownloadedElement { + + @JsonProperty(value = "swLocation", required = true) + private String swLocation; + + @JsonProperty(value = "swFileSize") + private long swFileSize; + + @JsonProperty(value = "swFileCompression") + private String swFileCompression; + + @JsonProperty(value = "swFileFormat") + private String swFileFormat; + + public String getSwLocation() { + return swLocation; + } + + public void setSwLocation(String value) { + this.swLocation = value; + } + + public long getSwFileSize() { + return swFileSize; + } + + public void setSwFileSize(long value) { + this.swFileSize = value; + } + + public String getSwFileCompression() { + return swFileCompression; + } + + public void setSwFileCompression(String value) { + this.swFileCompression = value; + } + + public String getSwFileFormat() { + return swFileFormat; + } + + public void setSwFileFormat(String value) { + this.swFileFormat = value; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePostCheckPayload.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePostCheckPayload.java new file mode 100644 index 0000000000..76937d262c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePostCheckPayload.java @@ -0,0 +1,96 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans.payload; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"ipaddressV4Oam", "playbookName", "oldSwVersion", "targetSwVersion", "ruleName", "additionalData"}) +public class UpgradePostCheckPayload { + + @JsonProperty(value = "ipaddress-v4-oam", required = true) + private String ipaddressV4Oam; + + @JsonProperty(value = "playbook-name") + private String playbookName; + + @JsonProperty(value = "oldSwVersion", required = true) + private String oldSwVersion; + + @JsonProperty(value = "targetSwVersion", required = true) + private String targetSwVersion; + + @JsonProperty(value = "ruleName", required = true) + private String ruleName; + + @JsonProperty(value = "additionalData") + private String additionalData; + + public String getIpaddressV4Oam() { + return ipaddressV4Oam; + } + + public void setIpaddressV4Oam(String value) { + this.ipaddressV4Oam = value; + } + + public String getPlaybookName() { + return playbookName; + } + + public void setPlaybookName(String value) { + this.playbookName = value; + } + + public String getOldSwVersion() { + return oldSwVersion; + } + + public void setOldSwVersion(String value) { + this.oldSwVersion = value; + } + + public String getTargetSwVersion() { + return targetSwVersion; + } + + public void setTargetSwVersion(String value) { + this.targetSwVersion = value; + } + + public String getRuleName() { + return ruleName; + } + + public void setRuleName(String value) { + this.ruleName = value; + } + + public String getAdditionalData() { + return additionalData; + } + + public void setAdditionalData(String value) { + this.additionalData = value; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayload.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayload.java new file mode 100644 index 0000000000..d1a95b8418 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayload.java @@ -0,0 +1,96 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans.payload; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"ipaddressV4Oam", "playbookName", "oldSwVersion", "targetSwVersion", "ruleName", "additionalData"}) +public class UpgradePreCheckPayload { + + @JsonProperty(value = "ipaddress-v4-oam", required = true) + private String ipaddressV4Oam; + + @JsonProperty(value = "playbook-name") + private String playbookName; + + @JsonProperty(value = "oldSwVersion", required = true) + private String oldSwVersion; + + @JsonProperty(value = "targetSwVersion", required = true) + private String targetSwVersion; + + @JsonProperty(value = "ruleName", required = true) + private String ruleName; + + @JsonProperty(value = "additionalData") + private String additionalData; + + public String getIpaddressV4Oam() { + return ipaddressV4Oam; + } + + public void setIpaddressV4Oam(String value) { + this.ipaddressV4Oam = value; + } + + public String getPlaybookName() { + return playbookName; + } + + public void setPlaybookName(String value) { + this.playbookName = value; + } + + public String getOldSwVersion() { + return oldSwVersion; + } + + public void setOldSwVersion(String value) { + this.oldSwVersion = value; + } + + public String getTargetSwVersion() { + return targetSwVersion; + } + + public void setTargetSwVersion(String value) { + this.targetSwVersion = value; + } + + public String getRuleName() { + return ruleName; + } + + public void setRuleName(String value) { + this.ruleName = value; + } + + public String getAdditionalData() { + return additionalData; + } + + public void setAdditionalData(String value) { + this.additionalData = value; + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtilTest.groovy new file mode 100644 index 0000000000..6b63bbe56c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtilTest.groovy @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # Licensed under the Apache License, Version 2.0 (the "License") + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.common.scripts + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.onap.so.db.request.beans.OperationStatus + +import static org.junit.Assert.assertNotNull +import static org.mockito.ArgumentMatchers.eq +import static org.mockito.Mockito.times +import static org.mockito.Mockito.when + +class RequestDBUtilTest extends MsoGroovyTest { + + @Before + void init() throws IOException { + super.init("DoDeleteSliceServiceTest") + } + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + void prepareUpdateOperationStatus(){ + when(mockExecution.getVariable("mso.adapters.openecomp.db.endpoint")).thenReturn("http://sdc-wfd-be:8080") + OperationStatus operationStatus = new OperationStatus() + operationStatus.setServiceId("testServiceId") + operationStatus.setOperationId("testOperationId") + operationStatus.setUserId("testUserId") + operationStatus.setOperation("testOpertation") + operationStatus.setResult("testResult") + operationStatus.setProgress("testProgress") + operationStatus.setOperationContent("testOperationContent") + operationStatus.setReason("testReason") + + RequestDBUtil requestDBUtil = new RequestDBUtil() + requestDBUtil.prepareUpdateOperationStatus(mockExecution, operationStatus) + + Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String updateOperationStatus = captor.getAllValues() + assertNotNull(updateOperationStatus) + } + + @Test + void testGetOperationStatus(){ + when(mockExecution.getVariable("mso.adapters.openecomp.db.endpoint")).thenReturn("http://sdc-wfd-be:8080") + + RequestDBUtil requestDBUtil = new RequestDBUtil() + requestDBUtil.getOperationStatus(mockExecution, "testServiceId","testOperationId") + + Mockito.verify(mockExecution,times(1)).setVariable(eq("getOperationStatus"), captor.capture()) + String getOperationStatus = captor.getAllValues() + assertNotNull(getOperationStatus) + + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClientTest.java index 5483792a84..3757769769 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClientTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClientTest.java @@ -42,7 +42,7 @@ public class SDNCLcmDmaapClientTest extends BaseTest { protected static final String DMAAP_HOST_PROP = SDNCLcmPropertiesImpl.DMAAP_HOST; protected static final String DMAAP_WRITE_TOPIC_PROP = SDNCLcmPropertiesImpl.LCM_DMAAP_WRITE_TOPIC; protected static final String DMAAP_READ_TOPIC_PROP = SDNCLcmPropertiesImpl.LCM_DMAAP_READ_TOPIC; - protected static final String DMAAP_PARTITION_PROP = SDNCLcmPropertiesImpl.DMAAP_PARTITION; + protected static final String DMAAP_PARTITION_PROP = SDNCLcmPropertiesImpl.LCM_DMAAP_PARTITION; protected String testWriteTopic = "TEST-WRITE-TOPIC"; protected String testReadTopic = "TEST-READ-TOPIC"; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayloadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayloadTest.java new file mode 100644 index 0000000000..bee07f2022 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayloadTest.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans.payload; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class ActivateNESwPayloadTest extends LcmBasePayloadTest { + private static String expectedActivateNESwPayload = "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\"," + + "\"playbook-name\":\"test_playbook\"," + "\"swVersionToBeActivated\":\"v2\"" + "}"; + + public ActivateNESwPayload buildActivateNESwPayload() { + ActivateNESwPayload activateNESwPayload = new ActivateNESwPayload(); + + activateNESwPayload.setIpaddressV4Oam(ipaddressV4Oam); + activateNESwPayload.setPlaybookName(playbookName); + activateNESwPayload.setSwVersionToBeActivated("v2"); + + return activateNESwPayload; + } + + @Test + public final void testActivateNESwPayload() { + ActivateNESwPayload activateNESwPayload = buildActivateNESwPayload(); + + try { + String activateNESwPayloadString = convertToSting(activateNESwPayload); + assertEquals(expectedActivateNESwPayload, activateNESwPayloadString); + } catch (Exception e) { + fail("Convert ActivateNESwPayload to String error: " + e.toString()); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayloadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayloadTest.java new file mode 100644 index 0000000000..f9fa679790 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayloadTest.java @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans.payload; + +import java.util.Collections; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class DownloadNESwPayloadTest extends LcmBasePayloadTest { + private static String expectedSwToBeDownloadedElement = "{" + "\"swLocation\":\"http://192.168.1.20/test.zip\"," + + "\"swFileSize\":123456," + "\"swFileCompression\":\"ZIP\"," + "\"swFileFormat\":\"binary\"" + "}"; + + private static String expectedDownloadNESwPayload = + "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\"," + "\"playbook-name\":\"test_playbook\"," + + "\"swToBeDownloaded\":[" + expectedSwToBeDownloadedElement + "]" + "}"; + + public SwToBeDownloadedElement buildSwToBeDownloadedElement() { + SwToBeDownloadedElement swToBeDownloadedElement = new SwToBeDownloadedElement(); + + swToBeDownloadedElement.setSwLocation("http://192.168.1.20/test.zip"); + swToBeDownloadedElement.setSwFileSize(123456); + swToBeDownloadedElement.setSwFileCompression("ZIP"); + swToBeDownloadedElement.setSwFileFormat("binary"); + + return swToBeDownloadedElement; + } + + public DownloadNESwPayload buildDownloadNESwPayload() { + DownloadNESwPayload downloadNESwPayload = new DownloadNESwPayload(); + + downloadNESwPayload.setIpaddressV4Oam(ipaddressV4Oam); + downloadNESwPayload.setPlaybookName(playbookName); + + SwToBeDownloadedElement swToBeDownloadedElement = buildSwToBeDownloadedElement(); + downloadNESwPayload.setSwToBeDownloaded(Collections.singletonList(swToBeDownloadedElement)); + + return downloadNESwPayload; + } + + @Test + public final void testSwToBeDownloadedElement() { + SwToBeDownloadedElement swToBeDownloadedElement = buildSwToBeDownloadedElement(); + + try { + String swToBeDownloadedElementString = convertToSting(swToBeDownloadedElement); + assertEquals(expectedSwToBeDownloadedElement, swToBeDownloadedElementString); + } catch (Exception e) { + fail("Convert SwToBeDownloadedElement to String error: " + e.toString()); + } + } + + @Test + public final void testDownloadNESwPayload() { + DownloadNESwPayload downloadNESwPayload = buildDownloadNESwPayload(); + + try { + String downloadNESwPayloadString = convertToSting(downloadNESwPayload); + assertEquals(expectedDownloadNESwPayload, downloadNESwPayloadString); + } catch (Exception e) { + fail("Convert DownloadNESwPayload to String error: " + e.toString()); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/LcmBasePayloadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/LcmBasePayloadTest.java new file mode 100644 index 0000000000..5452166d03 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/LcmBasePayloadTest.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans.payload; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class LcmBasePayloadTest { + private static Logger logger = LoggerFactory.getLogger(LcmBasePayloadTest.class); + + protected String ipaddressV4Oam = "192.168.1.10"; + protected String playbookName = "test_playbook"; + + public String convertToSting(Object msgObject) throws JsonProcessingException { + ObjectMapper mapper = new ObjectMapper(); + + String msgString = mapper.writeValueAsString(msgObject); + logger.debug(msgObject.getClass().getSimpleName() + "\n" + msgString); + + return msgString; + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePostCheckPayloadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePostCheckPayloadTest.java new file mode 100644 index 0000000000..acd447e890 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePostCheckPayloadTest.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans.payload; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class UpgradePostCheckPayloadTest extends LcmBasePayloadTest { + private static String expectedUpgradePostCheckPayload = "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\"," + + "\"playbook-name\":\"test_playbook\"," + "\"oldSwVersion\":\"v1\"," + "\"targetSwVersion\":\"v2\"," + + "\"ruleName\":\"r102\"," + "\"additionalData\":\"{}\"" + "}"; + + public UpgradePostCheckPayload buildUpgradePostCheckPayload() { + UpgradePostCheckPayload upgradePostCheckPayload = new UpgradePostCheckPayload(); + + upgradePostCheckPayload.setIpaddressV4Oam(ipaddressV4Oam); + upgradePostCheckPayload.setPlaybookName(playbookName); + upgradePostCheckPayload.setOldSwVersion("v1"); + upgradePostCheckPayload.setTargetSwVersion("v2"); + upgradePostCheckPayload.setRuleName("r102"); + upgradePostCheckPayload.setAdditionalData("{}"); + + return upgradePostCheckPayload; + } + + @Test + public final void testUpgradePostCheckPayload() { + UpgradePostCheckPayload upgradePostCheckPayload = buildUpgradePostCheckPayload(); + + try { + String upgradePostCheckPayloadString = convertToSting(upgradePostCheckPayload); + assertEquals(expectedUpgradePostCheckPayload, upgradePostCheckPayloadString); + } catch (Exception e) { + fail("Convert UpgradePostCheckPayload to String error: " + e.toString()); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayloadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayloadTest.java new file mode 100644 index 0000000000..8bc0714fff --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayloadTest.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.client.sdnc.lcm.beans.payload; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class UpgradePreCheckPayloadTest extends LcmBasePayloadTest { + private static String expectedUpgradePreCheckPayload = "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\"," + + "\"playbook-name\":\"test_playbook\"," + "\"oldSwVersion\":\"v1\"," + "\"targetSwVersion\":\"v2\"," + + "\"ruleName\":\"r101\"," + "\"additionalData\":\"{}\"" + "}"; + + public UpgradePreCheckPayload buildUpgradePreCheckPayload() { + UpgradePreCheckPayload upgradePreCheckPayload = new UpgradePreCheckPayload(); + + upgradePreCheckPayload.setIpaddressV4Oam(ipaddressV4Oam); + upgradePreCheckPayload.setPlaybookName(playbookName); + upgradePreCheckPayload.setOldSwVersion("v1"); + upgradePreCheckPayload.setTargetSwVersion("v2"); + upgradePreCheckPayload.setRuleName("r101"); + upgradePreCheckPayload.setAdditionalData("{}"); + + return upgradePreCheckPayload; + } + + @Test + public final void testUpgradePreCheckPayload() { + UpgradePreCheckPayload upgradePreCheckPayload = buildUpgradePreCheckPayload(); + + try { + String upgradePreCheckPayloadString = convertToSting(upgradePreCheckPayload); + assertEquals(expectedUpgradePreCheckPayload, upgradePreCheckPayloadString); + } catch (Exception e) { + fail("Convert UpgradePreCheckPayload to String error: " + e.toString()); + } + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java index 13ba46a852..4e6396c4be 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java @@ -33,7 +33,7 @@ import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.runtime.Execution; import org.camunda.bpm.engine.runtime.MessageCorrelationResult; import org.onap.so.bpmn.core.UrnPropertiesReader; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java index f76fde9ef1..2eb9d175f2 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java @@ -35,7 +35,7 @@ import javax.ws.rs.core.Response; import org.onap.so.logger.LoggingAnchor; import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError; import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java index 6debcfbff6..731e9d8703 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java @@ -49,7 +49,7 @@ import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats; import org.camunda.bpm.engine.variable.impl.VariableMapImpl; import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; import org.onap.so.bpmn.core.WorkflowException; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy index 630148e899..5570842149 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy @@ -38,7 +38,7 @@ import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.db.request.beans.OperationStatus -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy index cae629fdf0..650f79b633 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy @@ -39,7 +39,7 @@ import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy index c3f36ef545..1efc1c11aa 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy @@ -45,7 +45,7 @@ import org.onap.so.bpmn.common.scripts.OofUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy index c9dadf57cb..fc97c292fb 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy @@ -36,7 +36,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.infrastructure.aai.AAICreateResources -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy index 1fba23d3c8..33a607268d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy @@ -32,7 +32,7 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy index 3eb15558d2..dc9655e7af 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy @@ -24,7 +24,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.logger.LoggingAnchor import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import static org.apache.commons.lang3.StringUtils.*; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy index 00b0b37b18..b121083954 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy @@ -141,7 +141,7 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor { * save e2eslice-service instance id and service name * @param execution */ - private void queryCommunicationSeriveFromAAI(DelegateExecution execution) + void queryCommunicationSeriveFromAAI(DelegateExecution execution) { LOGGER.trace(" ***** begin queryCommunicationSeriveFromAAI *****") String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -186,12 +186,11 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor { String globalSubscriberId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") - AAIResourcesClient resourceClient = new AAIResourcesClient() AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(aaiObjectType, globalSubscriberId, serviceType, instanceId) - if (!resourceClient.exists(resourceUri)) { + if (!getAAIClient().exists(resourceUri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg) } - AAIResultWrapper wrapper = resourceClient.get(resourceUri, NotFoundException.class) + AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class) return wrapper } @@ -215,7 +214,7 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor { requestBody.replaceAll("\\s+", "") String basicAuthValue = UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution) - HttpClient httpClient = new HttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO) + HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO) httpClient.addAdditionalHeader("Authorization", basicAuthValue) httpClient.addAdditionalHeader("Accept", "application/json") Response httpResponse = httpClient.delete(requestBody) @@ -233,6 +232,41 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor { } /** + * prepare update operation status + * @param execution + */ + private void handleNSSMFWFResponse(Response httpResponse, DelegateExecution execution){ + LOGGER.debug(" ======== STARTED prepareUpdateOperationStatus Process ======== ") + + int nsmfResponseCode = httpResponse.getStatus() + LOGGER.debug("nsmfResponseCode${nsmfResponseCode}") + + if (nsmfResponseCode >= 200 && nsmfResponseCode < 204 && httpResponse.hasEntity()) { + String nsmfResponse = httpResponse.readEntity(String.class) + def e2eOperationId = jsonUtil.getJsonValue(nsmfResponse, "operationId") + execution.setVariable("e2eOperationId", e2eOperationId) + execution.setVariable("progress","20") + execution.setVariable("operationContent","waiting nsmf service delete finished") + + execution.setVariable("currentCycle",0) + execution.setVariable("isNSMFTimeOut", "no") + execution.setVariable("isNSMFWFRspSucceed","yes") + } + else + { + String serviceName = execution.getVariable("serviceInstanceName") + execution.setVariable("progress", "100") + execution.setVariable("result", "error") + execution.setVariable("operationContent", "terminate service failure.") + execution.setVariable("reason","NSMF WF asynchronous response failed, status Code:${nsmfResponseCode}") + execution.setVariable("isNSMFWFRspSucceed","no") + LOGGER.error("nsmf async response error,nsmfResponseCode:${nsmfResponseCode},serivceName:${serviceName}") + } + setOperationStatus(execution) + LOGGER.debug("======== COMPLETED prepareUpdateOperationStatus Process ======== ") + } + + /** * prepare to call sub process * @param execution */ @@ -272,22 +306,20 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor { String profileId try { - AAIResourcesClient resourceClient = new AAIResourcesClient() AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_PROFILE_ALL, globalSubscriberId, serviceType, serviceInstanceId) - AAIResultWrapper wrapper = resourceClient.get(resourceUri, NotFoundException.class) + AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class) Optional<CommunicationServiceProfiles> csProfilesOpt = wrapper.asBean(CommunicationServiceProfiles.class) if(csProfilesOpt.isPresent()){ - CommunicationServiceProfiles csProf - iles = csProfilesOpt.get() + CommunicationServiceProfiles csProfiles = csProfilesOpt.get() CommunicationServiceProfile csProfile = csProfiles.getCommunicationServiceProfile().get(0) profileId = csProfile ? csProfile.getProfileId() : "" } resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE, globalSubscriberId, serviceType, serviceInstanceId, profileId) - if (!resourceClient.exists(resourceUri)) { + if (!getAAIClient().exists(resourceUri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "communication service profile was not found in aai") } - - resourceClient.delete(resourceUri) + + getAAIClient().delete(resourceUri) LOGGER.debug("end delete communication service profile from AAI") } catch (any) @@ -308,9 +340,8 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor { try { LOGGER.debug("start delete communication service from AAI") - AAIResourcesClient resourceClient = new AAIResourcesClient() AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), execution.getVariable("serviceInstanceId")) - resourceClient.delete(serviceInstanceUri) + getAAIClient().delete(serviceInstanceUri) execution.setVariable("progress", "100") execution.setVariable("result", "finished") @@ -330,12 +361,10 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor { LOGGER.debug("Starting sendSyncError") try { - String errorMessage + String errorMessage = "Sending Sync Error." if (execution.getVariable("WorkflowException") instanceof WorkflowException) { WorkflowException wfe = execution.getVariable("WorkflowException") errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." } String buildworkflowException = @@ -397,6 +426,7 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor { void prepareFailureStatus(DelegateExecution execution) { + execution.setVariable("result", "finished") execution.setVariable("progress", "100") execution.setVariable("operationContent", "terminate service failure.") setOperationStatus(execution) @@ -426,4 +456,5 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor { execution.setVariable(paraName, paramValue) } } + } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy index 5c7127f36e..41a4ab85ec 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy @@ -31,7 +31,7 @@ import org.onap.so.bpmn.common.scripts.NetworkUtils import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy index f0d43cf8d7..d8160a97bc 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy @@ -45,19 +45,19 @@ import static org.apache.commons.lang3.StringUtils.isBlank class DeleteSliceService extends AbstractServiceTaskProcessor { - String Prefix="DELSS_" + private final String PREFIX ="DeleteSliceService" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() private RequestDBUtil requestDBUtil = new RequestDBUtil() - private static final Logger logger = LoggerFactory.getLogger( DeleteSliceService.class) + private static final Logger LOGGER = LoggerFactory.getLogger( DeleteSliceService.class) @Override void preProcessRequest(DelegateExecution execution) { - execution.setVariable("prefix", Prefix) + execution.setVariable("prefix", PREFIX) String msg = "" - logger.trace("Starting preProcessRequest") + LOGGER.debug("*****${PREFIX} preProcessRequest *****") try { // check for incoming json message/input @@ -71,7 +71,7 @@ class DeleteSliceService extends AbstractServiceTaskProcessor { msg = "e2eslice-service id is null" exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - logger.info("Input Request: ${siRequest}, reqId: ${requestId}, e2eslice-service: ${serviceInstanceId}") + LOGGER.info("Input Request: ${siRequest}, reqId: ${requestId}, e2eslice-service: ${serviceInstanceId}") //subscriberInfo checkAndSetRequestParam(siRequest,"globalSubscriberId",false, execution) @@ -82,17 +82,17 @@ class DeleteSliceService extends AbstractServiceTaskProcessor { execution.setVariable("progress", "0") execution.setVariable("result", "processing") execution.setVariable("operationType", "DELETE") - execution.setVariable("operationContent", "Prepare init service") + execution.setVariable("operationContent", "Delete Slice service operation start") updateServiceOperationStatus(execution) } catch (BpmnError e) { throw e } catch (Exception ex) { msg = "Exception in preProcessRequest " + ex.getMessage() - logger.debug(msg) + LOGGER.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - logger.trace("Exit preProcessRequest") + LOGGER.debug("*****${PREFIX} Exit preProcessRequest *****") } /** @@ -100,40 +100,39 @@ class DeleteSliceService extends AbstractServiceTaskProcessor { * @param execution */ void sendAsyncResponse(DelegateExecution execution) { - logger.trace("Staring sendSyncResponse") + LOGGER.trace("${PREFIX} Start sendSyncResponse ") try { String operationId = execution.getVariable("operationId") String syncResponse = """{"operationId":"${operationId}"}""".trim() - logger.info("sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) + LOGGER.info("sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) sendWorkflowResponse(execution, 202, syncResponse) } catch (Exception ex) { String msg = "Exception in sendSyncResponse: " + ex.getMessage() exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - logger.trace("Exit sendSyncResponse") + LOGGER.trace("${PREFIX} Exit sendSyncResponse") } /** * Deletes the slice service instance in aai */ void deleteSliceServiceInstance(DelegateExecution execution) { - logger.trace("Entered deleteSliceServiceInstance") + LOGGER.trace("${PREFIX} Start deleteSliceServiceInstance") try { - AAIResourcesClient resourceClient = new AAIResourcesClient() AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), execution.getVariable("serviceInstanceId")) - resourceClient.delete(serviceInstanceUri) + getAAIClient().delete(serviceInstanceUri) execution.setVariable("progress", "100") execution.setVariable("result", "finished") execution.setVariable("operationContent", "NSMF completes slicing service termination.") updateServiceOperationStatus(execution) - logger.trace("Exited deleteSliceServiceInstance") + LOGGER.trace("${PREFIX} Exited deleteSliceServiceInstance") }catch(Exception e){ - logger.debug("Error occured within deleteSliceServiceInstance method: " + e) + LOGGER.debug("Error occured within deleteSliceServiceInstance method: " + e) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteSliceServiceInstance from aai") } } @@ -161,7 +160,7 @@ class DeleteSliceService extends AbstractServiceTaskProcessor { * delete service profile from aai * @param execution */ - private void delServiceProfileFromAAI(DelegateExecution execution) + void delServiceProfileFromAAI(DelegateExecution execution) { String globalSubscriberId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") @@ -170,9 +169,8 @@ class DeleteSliceService extends AbstractServiceTaskProcessor { try { - AAIResourcesClient resourceClient = new AAIResourcesClient() AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE_ALL, globalSubscriberId, serviceType, serviceInstanceId) - AAIResultWrapper wrapper = resourceClient.get(resourceUri, NotFoundException.class) + AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class) Optional<ServiceProfiles> serviceProfilesOpt =wrapper.asBean(ServiceProfiles.class) if(serviceProfilesOpt.isPresent()){ ServiceProfiles serviceProfiles = serviceProfilesOpt.get() @@ -180,29 +178,27 @@ class DeleteSliceService extends AbstractServiceTaskProcessor { profileId = serviceProfile ? serviceProfile.getProfileId() : "" } resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE, globalSubscriberId, serviceType, serviceInstanceId, profileId) - if (!resourceClient.exists(resourceUri)) { + if (!getAAIClient().exists(resourceUri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") } - resourceClient.delete(resourceUri) + getAAIClient().delete(resourceUri) } catch (any) { String msg = "delete service profile from aai failed! cause-"+any.getCause() - logger.error(any.printStackTrace()) + LOGGER.error(any.printStackTrace()) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); } } void sendSyncError(DelegateExecution execution) { - logger.info("Starting sendSyncError") + LOGGER.debug("${PREFIX} Start sendSyncError") try { - String errorMessage + String errorMessage = "Sending Sync Error." if (execution.getVariable("WorkflowException") instanceof WorkflowException) { WorkflowException wfe = execution.getVariable("WorkflowException") errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." } String buildworkflowException = @@ -211,17 +207,17 @@ class DeleteSliceService extends AbstractServiceTaskProcessor { <aetgt:ErrorCode>7000</aetgt:ErrorCode> </aetgt:WorkflowException>""" - logger.debug(buildworkflowException) + LOGGER.debug(buildworkflowException) sendWorkflowResponse(execution, 500, buildworkflowException) } catch (Exception ex) { - logger.error("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + LOGGER.error("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) } } void prepareEndOperationStatus(DelegateExecution execution){ - logger.debug(" ======== STARTED prepareEndOperationStatus Process ======== ") + LOGGER.debug(" ======== ${PREFIX} STARTED prepareEndOperationStatus Process ======== ") execution.setVariable("progress", "100") execution.setVariable("result", "error") @@ -233,7 +229,7 @@ class DeleteSliceService extends AbstractServiceTaskProcessor { execution.setVariable("reason",errorMessage) updateServiceOperationStatus(execution) - logger.debug("======== COMPLETED prepareEndOperationStatus Process ======== ") + LOGGER.debug("======== ${PREFIX} COMPLETED prepareEndOperationStatus Process ======== ") } /** @@ -250,7 +246,7 @@ class DeleteSliceService extends AbstractServiceTaskProcessor { String paramValue = jsonUtil.getJsonValue(siRequest, paraName) if (isBlank(paramValue)) { msg = "Input ${paraName} is null" - logger.error(msg) + LOGGER.error(msg) if(isErrorException) { exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy index 79aa745792..fd30722369 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy @@ -31,7 +31,7 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.VidUtils; import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy index 9fa488f8a7..eb2ec2bc9d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy @@ -38,7 +38,7 @@ import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index 15b91e5221..6af7cc069e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.SerializationFeature import org.onap.so.logger.LoggingAnchor -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import static org.apache.commons.lang3.StringUtils.* diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy index 2def9e2d06..4835c9b84b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy @@ -33,7 +33,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index dafc4b5470..c12d3553d5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -25,7 +25,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.logger.LoggingAnchor import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory import org.onap.so.client.HttpClientFactory -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import javax.ws.rs.core.MediaType import javax.ws.rs.core.Response diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy index 4bab2b390d..573282dafd 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy @@ -38,7 +38,7 @@ import org.onap.so.client.aai.AAIObjectPlurals import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy index e9b748b14b..823217c4f7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy @@ -24,7 +24,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.logger.LoggingAnchor import org.onap.so.db.catalog.beans.HomingInstance -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import static org.apache.commons.lang3.StringUtils.* diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy index 180032c8f0..e60fab5766 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy @@ -41,7 +41,7 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.logger.MessageEnum diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy index a6cb5cf4cc..150f55316c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy @@ -23,7 +23,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.logger.LoggingAnchor -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy index a88becad1a..72f71686d9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy @@ -23,7 +23,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.logger.LoggingAnchor -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import static org.apache.commons.lang3.StringUtils.* diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy index 48e4fdf2ff..bc535a348f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy @@ -24,7 +24,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.logger.LoggingAnchor import org.onap.aai.domain.yang.AllottedResource -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import javax.ws.rs.core.UriBuilder diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy index d8897a2468..8d8e97328d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy @@ -76,7 +76,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor * * @param execution */ - private void prepareDecomposeService(DelegateExecution execution) + void prepareDecomposeService(DelegateExecution execution) { LOGGER.trace(" *****${PREFIX} Start prepareDecomposeService *****") try @@ -103,7 +103,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor * get vendor Info * @param execution */ - private void processDecomposition(DelegateExecution execution) { + void processDecomposition(DelegateExecution execution) { LOGGER.debug("*****${PREFIX} start processDecomposition *****") try { @@ -130,7 +130,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor * send deallocate request to nssmf * @param execution */ - private void sendRequestToNSSMF(DelegateExecution execution) + void sendRequestToNSSMF(DelegateExecution execution) { LOGGER.debug("*****${PREFIX} start sendRequestToNSSMF *****") def currentNSSI = execution.getVariable("currentNSSI") @@ -160,7 +160,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor URL url = new URL(nssmfRequest) LOGGER.info("deallocate nssmfRequest:${nssmfRequest}, reqBody: ${json}") - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL) + HttpClient httpClient = getHttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL) Response httpResponse = httpClient.post(json) checkNssmfResponse(httpResponse, execution) @@ -176,7 +176,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor * send to nssmf query progress * @param execution */ - private void getJobStatus(DelegateExecution execution) + void getJobStatus(DelegateExecution execution) { def currentNSSI = execution.getVariable("currentNSSI") String jobId = currentNSSI['jobId'] @@ -198,7 +198,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor URL url = new URL(nssmfRequest) LOGGER.info("get deallocate job status, nssmfRequest:${nssmfRequest}, requestBody: ${json}") - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL) + HttpClient httpClient = getHttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL) Response httpResponse = httpClient.post(json) checkNssmfResponse(httpResponse, execution) @@ -248,7 +248,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor * prepare update requestdb * @param execution */ - private void handleJobStatus(DelegateExecution execution) + void handleJobStatus(DelegateExecution execution) { def currentNSSI = execution.getVariable("currentNSSI") int currentProgress = currentNSSI["jobProgress"] @@ -267,7 +267,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor LOGGER.debug("update operation, currentProgress=${currentProgress}, proportion=${proportion}, progress = ${progress}" ) } - private void timeDelay(DelegateExecution execution) { + void timeDelay(DelegateExecution execution) { try { Thread.sleep(10000); } catch(InterruptedException e) { @@ -279,7 +279,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor * delete slice profile from aai * @param execution */ - private void delSliceProfileFromAAI(DelegateExecution execution) + void delSliceProfileFromAAI(DelegateExecution execution) { LOGGER.debug("*****${PREFIX} start delSliceProfileFromAAI *****") def currentNSSI = execution.getVariable("currentNSSI") @@ -291,12 +291,11 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor try { LOGGER.debug("delete nssiServiceInstanceId:${nssiServiceInstanceId}, profileId:${profileId}") - AAIResourcesClient resourceClient = new AAIResourcesClient() AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, globalSubscriberId, serviceType, nssiServiceInstanceId, profileId) - if (!resourceClient.exists(resourceUri)) { + if (!getAAIClient().exists(resourceUri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") } - resourceClient.delete(resourceUri) + getAAIClient().delete(resourceUri) } catch (any) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy index 09eb7994a8..89c5be8d6e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy @@ -45,7 +45,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy index 7c2a2be6ac..76086dab49 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy @@ -29,7 +29,6 @@ import org.onap.aai.domain.yang.SliceProfiles import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory @@ -309,12 +308,11 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { String globalSubscriberId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") - AAIResourcesClient resourceClient = new AAIResourcesClient() AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(aaiObjectType, globalSubscriberId, serviceType, instanceId) - if (!resourceClient.exists(resourceUri)) { + if (!getAAIClient().exists(resourceUri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg) } - AAIResultWrapper wrapper = resourceClient.get(resourceUri, NotFoundException.class) + AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class) LOGGER.trace(" *****${PREFIX} Exit queryAAI *****") return wrapper } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy index 4c8247a309..511f461844 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy @@ -25,7 +25,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.logger.LoggingAnchor import org.onap.aai.domain.yang.NetworkPolicies import org.onap.aai.domain.yang.NetworkPolicy -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy index eba43632a7..9c8bd156a9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy @@ -27,7 +27,7 @@ import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.NetworkPolicies import org.onap.aai.domain.yang.NetworkPolicy import org.onap.aai.domain.yang.VfModule -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import static org.apache.commons.lang3.StringUtils.* import org.camunda.bpm.engine.delegate.BpmnError diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy index 20d250d89f..ff58fd567d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy @@ -45,7 +45,7 @@ import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.aai.AAIObjectType -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy index 231fe6e252..4eba33dc7d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy @@ -22,7 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.logger.LoggingAnchor -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import static org.apache.commons.lang3.StringUtils.*; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy index 367975e003..16e1241750 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy @@ -34,7 +34,7 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.camunda.bpm.engine.delegate.BpmnError import com.fasterxml.jackson.databind.ObjectMapper import org.onap.so.client.HttpClientFactory -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import javax.ws.rs.core.Response diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy index 63cd3c72f9..5acc016c7b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy @@ -36,7 +36,7 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy index f7852431e5..854584fea9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy @@ -45,7 +45,7 @@ import org.onap.so.client.aai.entities.uri.AAIUri import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.constants.Defaults -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy index cfdba89db7..7caa63ec72 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy @@ -24,7 +24,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.logger.LoggingAnchor import org.onap.so.client.HttpClientFactory -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import javax.ws.rs.core.Response import org.camunda.bpm.engine.delegate.BpmnError diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy index e36f32578d..275cef0b0c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy @@ -35,7 +35,7 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.aai.* import org.onap.so.client.appc.ApplicationControllerOrchestrator import org.onap.so.client.appc.ApplicationControllerSupport -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy index ed65616d89..d5bdb73b61 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy @@ -22,7 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.logger.LoggingAnchor -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.ExceptionUtil diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy index b21efdd563..b27ca4a956 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy @@ -23,7 +23,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.logger.LoggingAnchor -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import static org.apache.commons.lang3.StringUtils.* diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy index 6946eebc56..6e5ee01c9a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy @@ -29,7 +29,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy index 2404169493..76702eab81 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy @@ -30,7 +30,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy index 3e9b934a2e..f1fbafc7de 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy @@ -37,7 +37,7 @@ import org.onap.so.client.aai.entities.Relationships import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy index 7f2bbebc8d..5449ba6708 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy @@ -42,7 +42,7 @@ import org.onap.so.client.aai.entities.Relationships import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy index 26a509022c..053e2b36d1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy @@ -35,7 +35,7 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.aai.AAIRestClientImpl import org.onap.so.client.aai.AAIUpdatorImpl import org.onap.so.client.aai.AAIValidatorImpl -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy index 09e7516f85..e423ecc83c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy @@ -46,7 +46,7 @@ import org.onap.so.client.aai.entities.uri.AAIUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.appc.ApplicationControllerClient import org.onap.so.client.appc.ApplicationControllerSupport -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy index 90523a02be..d11f4c19eb 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy @@ -33,7 +33,7 @@ import org.onap.so.client.aai.* import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.client.aai.entities.uri.AAIUri import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy index 3cb40115ba..34215a11aa 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy @@ -39,7 +39,7 @@ import org.onap.so.client.aai.entities.uri.AAIUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.appc.ApplicationControllerClient import org.onap.so.client.appc.ApplicationControllerSupport -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index d57011f61f..6327ea233c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy @@ -22,7 +22,7 @@ package org.onap.so.bpmn.vcpe.scripts import org.onap.so.logger.LoggingAnchor -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import static org.apache.commons.lang3.StringUtils.* diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy index 553ec2397c..5205fa1874 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy @@ -31,7 +31,7 @@ import org.onap.so.bpmn.common.scripts.NetworkUtils import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy index 0681e54bba..68abcea07c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy @@ -35,7 +35,7 @@ import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy index f24bb46981..b5ddc57781 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy @@ -31,7 +31,7 @@ import org.onap.so.bpmn.common.scripts.AllottedResourceUtils import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy index 51d04dd092..fc50d3a3b3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy @@ -34,7 +34,7 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy index 1427730187..80e5831fbe 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy @@ -29,7 +29,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy index 29ee1a648e..117078992f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy @@ -32,7 +32,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy index 404f19eca9..b029a4686b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy @@ -32,7 +32,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.logger.ErrorCode +import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java index fab3496559..3ea8b190ad 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java @@ -35,8 +35,10 @@ public class ExecutionVariableNames { public final static String TIMEOUT_FOR_NOTIFICATION = "timeoutForPnfEntryNotification"; public final static String PNF_UUID = "pnfUuid"; public final static String SERVICE_INSTANCE_ID = "serviceInstanceId"; + public final static String REQUEST_ID = "requestId"; public final static String MSO_REQUEST_ID = "msoRequestId"; public final static String MODEL_UUID = "modelUuid"; + public final static String REQUEST_PAYLOAD = "requestPayload"; public final static String SERVICE_MODEL_INFO = "serviceModelInfo"; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/NfSoftwareUpgradeDispatcher.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/NfSoftwareUpgradeDispatcher.java index 4482d2a327..6c140061c0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/NfSoftwareUpgradeDispatcher.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/NfSoftwareUpgradeDispatcher.java @@ -69,7 +69,7 @@ public class NfSoftwareUpgradeDispatcher implements JavaDelegate { @Override public void execute(DelegateExecution delegateExecution) throws Exception { - logger.debug("Running execute block for activity id:{}, name:{}", delegateExecution.getCurrentActivityId(), + logger.debug("Running execute block for activity id: {}, name: {}", delegateExecution.getCurrentActivityId(), delegateExecution.getCurrentActivityName()); RequestDetails bpmnRequestDetails = requestVerification(delegateExecution); @@ -82,9 +82,10 @@ public class NfSoftwareUpgradeDispatcher implements JavaDelegate { final List<PnfResourceCustomization> pnfCustomizations = getPnfResourceCustomizations(delegateExecution, serviceModelUuid); final PnfResourceCustomization pnfResourceCustomization = pnfCustomizations.get(0); + final String payload = bpmnRequestDetails.getRequestParameters().getPayload(); populateExecution(delegateExecution, bpmnRequestDetails, pnfResourceCustomization, pnf, serviceInstanceName, - pnfName, serviceModelUuid, userParams); + pnfName, serviceModelUuid, userParams, payload); logger.trace("Completed preProcessRequest PnfSoftwareUpgradeServiceRequest Request "); } @@ -104,7 +105,7 @@ public class NfSoftwareUpgradeDispatcher implements JavaDelegate { private void populateExecution(DelegateExecution delegateExecution, RequestDetails bpmnRequestDetails, PnfResourceCustomization pnfResourceCustomization, Pnf pnf, String serviceInstanceName, String pnfName, - String serviceModelUuid, List<Map<String, Object>> userParams) { + String serviceModelUuid, List<Map<String, Object>> userParams, String payload) { delegateExecution.setVariable(SERVICE_MODEL_INFO, bpmnRequestDetails.getModelInfo()); delegateExecution.setVariable(SERVICE_INSTANCE_NAME, serviceInstanceName); @@ -124,6 +125,8 @@ public class NfSoftwareUpgradeDispatcher implements JavaDelegate { delegateExecution.setVariable(param.get("name").toString(), param.get("value").toString()); } } + + delegateExecution.setVariable(REQUEST_PAYLOAD, payload); } private Pnf getPnfByPnfName(DelegateExecution delegateExecution, String pnfName) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java index 7f2cd5c071..109f45e6eb 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java @@ -71,7 +71,7 @@ import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.Relationships; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java index f933277f3c..de8a35de06 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java @@ -45,7 +45,7 @@ import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; import org.onap.so.db.request.beans.ResourceOperationStatus; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.requestsdb.RequestsDbConstant; import org.slf4j.Logger; diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy new file mode 100644 index 0000000000..8c08e51efe --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy @@ -0,0 +1,308 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # Licensed under the Apache License, Version 2.0 (the "License") + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.onap.logging.filter.base.ONAPComponents +import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory + +import javax.ws.rs.NotFoundException +import javax.ws.rs.core.Response + +import static org.junit.Assert.assertEquals +import static org.junit.Assert.assertNotNull +import static org.mockito.ArgumentMatchers.eq +import static org.mockito.Mockito.* + +class DeleteCommunicationServiceTest extends MsoGroovyTest { + + private HttpClientFactory httpClientFactoryMock + private HttpClient httpClientMock + + @Before + void init() throws IOException { + super.init("DeleteCommunicationServiceTest") + } + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + void testPreProcessRequest(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(""" + { + "globalSubscriberId ":"5GCustomer", + "serviceType ":"5G" + }""".replaceAll("\\\\s+", "")) + when(mockExecution.getVariable("mso-request-id")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82") + + DeleteCommunicationService delCS = new DeleteCommunicationService() + delCS.preProcessRequest(mockExecution) + Mockito.verify(mockExecution,times(3)).setVariable(captor.capture() as String, captor.capture()) + List<ExecutionEntity> values = captor.getAllValues() + assertNotNull(values) + } + + @Test + void testPreInitUpdateOperationStatus(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceInstanceName")).thenReturn("5G-test") + when(mockExecution.getVariable("result")).thenReturn("processing") + when(mockExecution.getVariable("progress")).thenReturn("0") + when(mockExecution.getVariable("operationContent")).thenReturn("delete communication service operation start") + + DeleteCommunicationService delCS = new DeleteCommunicationService() + delCS.preInitUpdateOperationStatus(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String updateOperationStatus= captor.getValue() + assertNotNull(updateOperationStatus) + } + + @Test + void testQueryCommunicationSeriveFromAAI(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") + DeleteCommunicationService obj = spy(DeleteCommunicationService.class) + + AAIResultWrapper wrapper = new AAIResultWrapper(mockQueryCommunicationServiceReturn()) + when(obj.getAAIClient()).thenReturn(client) + when(client.exists(resourceUri)).thenReturn(true) + when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper) + obj.queryCommunicationSeriveFromAAI(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("e2eSliceServiceInstanceId"), captor.capture()) + String e2eSliceServiceInstanceId = captor.getValue() + assertNotNull(e2eSliceServiceInstanceId) + } + + @Test + void testPrepareCallCheckProcessStatus(){ + DeleteCommunicationService dcs = new DeleteCommunicationService() + dcs.prepareCallCheckProcessStatus(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("endProgress"), captor.capture()) + int endProgress = captor.getValue() + assertEquals(90,endProgress) + } + + @Test + void testDelCSProfileFromAAI() + { + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + + AAIResultWrapper wrapper = new AAIResultWrapper(mockQueryCommunicationServiceProfile()) + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_PROFILE_ALL, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") + AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be", "5G-111111") + + DeleteCommunicationService obj = spy(DeleteCommunicationService.class) + when(obj.getAAIClient()).thenReturn(client) + when(client.exists(resourceUri)).thenReturn(true) + when(client.exists(profileUri)).thenReturn(true) + when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper) + doNothing().when(client).delete(profileUri) + obj.delCSProfileFromAAI(mockExecution) + Mockito.verify(client,times(1)).delete(profileUri) + } + + @Test + void testPrepareFailureStatus(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceInstanceName")).thenReturn("5G-test") + when(mockExecution.getVariable("result")).thenReturn("finished") + when(mockExecution.getVariable("progress")).thenReturn("100") + when(mockExecution.getVariable("operationContent")).thenReturn("terminate service failure.") + + DeleteCommunicationService dcs = new DeleteCommunicationService() + dcs.prepareFailureStatus(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String updateOperationStatus= captor.getValue() + assertNotNull(updateOperationStatus) + } + + @Test + void testDelCSFromAAI(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") + DeleteCommunicationService obj = spy(DeleteCommunicationService.class) + when(obj.getAAIClient()).thenReturn(client) + doNothing().when(client).delete(serviceInstanceUri) + + obj.delCSFromAAI(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String updateOperationStatus= captor.getValue() + assertNotNull(updateOperationStatus) + } + + @Test + void testPreFailedOperationStatus(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceInstanceName")).thenReturn("5G-test") + when(mockExecution.getVariable("result")).thenReturn("error") + when(mockExecution.getVariable("progress")).thenReturn("100") + when(mockExecution.getVariable("operationContent")).thenReturn("terminate service failure") + + DeleteCommunicationService deleteCommunicationService = new DeleteCommunicationService() + WorkflowException exception = new WorkflowException("11113",7000,"terminate service failure") + when(mockExecution.getVariable("WorkflowException")).thenReturn(exception) + deleteCommunicationService.preFailedOperationStatus(mockExecution) + + Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String updateOperationStatus= captor.getValue() + assertNotNull(updateOperationStatus) + } + + @Test + void testSendRequest2NSMFWF(){ + httpClientMock = mock(HttpClient.class) + httpClientFactoryMock = mock(HttpClientFactory.class) + String url ="http://so.onap:8080/onap/so/infra/e2eServiceInstances/v3/5G-777" + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0") + when(mockExecution.getVariable("progress")).thenReturn("20") + when(mockExecution.getVariable("operationContent")).thenReturn("waiting nsmf service delete finished") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("mso.infra.endpoint.url")).thenReturn("http://so.onap:8080/onap/so/infra") + when(mockExecution.getVariable("e2eSliceServiceInstanceId")).thenReturn("5G-777") + when(mockExecution.getVariable("e2eOperationId")).thenReturn("e151059a-d924-4629-845f-264db19e50b3") + when(httpClientFactoryMock.newJsonClient(new URL(url), ONAPComponents.SO)).thenReturn(httpClientMock) + DeleteCommunicationService obj = spy(DeleteCommunicationService.class) + + Response responseMock = mock(Response.class) + when(responseMock.getStatus()).thenReturn(200) + when(responseMock.hasEntity()).thenReturn(true) + when(responseMock.getEntity()).thenReturn(getNSSMFResponse()) + when(obj.getHttpClientFactory()).thenReturn(httpClientFactoryMock) + when(httpClientMock.delete(anyString())).thenReturn(responseMock) + + obj.sendRequest2NSMFWF(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String updateOperationStatus= captor.getValue() + assertNotNull(updateOperationStatus) + } + + private String getNSSMFResponse(){ + String response = """{ + "service":{ + "serviceId":"e151059a-d924-4629-845f-264db19e50b4", + "operationId":"e151059a-d924-4629-845f-264db19e50b3" + } + }""" + return response + } + + + + + private String mockQueryCommunicationServiceReturn() + { + String expect = + """{ + "service-instance-id": "5G-666", + "service-instance-name": "eMBB_Slice_Communication_Service_5GCustomer", + "service-type": "eMBB", + "service-role": "communication-service", + "environment-context": "01-010101", + "workload-context": "12", + "created-at": "2019-12-11 19:56:00", + "description": "", + "model-invariant-id": "e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "model-version-id": "8ee5926d-720b-4bb2-86f9-d20e921c143b", + "service-instance-location-id": "300-01|300-02", + "resource-version": "1582623470778", + "orchestration-status": "created", + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/5G-777", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "5G-777" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "eMBB_e2e_Slice_Service_5GCustomer" + } + ] + } + ] + } + }""" + return expect + } + + private String mockQueryCommunicationServiceProfile() + { + String expect = + """{ + "communication-service-profile": [ + { + "profile-id": "5G-111111", + "max-number-of-UEs": 50, + "coverage-area-list": "longgang,futian", + "latency": 20, + "exp-data-rate-UL": 300, + "exp-data-rate-DL": 500, + "ue-mobility-level": "stationary", + "resource-sharing-level": "Non-Shared", + "resource-version": "1577454950460" + } + ] + }""" + return expect + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceServiceTest.groovy new file mode 100644 index 0000000000..fb50fcc43b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceServiceTest.groovy @@ -0,0 +1,171 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # Licensed under the Apache License, Version 2.0 (the "License") + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory + +import javax.ws.rs.NotFoundException + +import static org.junit.Assert.assertNotNull +import static org.mockito.ArgumentMatchers.eq +import static org.mockito.Mockito.doNothing +import static org.mockito.Mockito.spy +import static org.mockito.Mockito.times +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when + +class DeleteSliceServiceTest extends MsoGroovyTest { + @Before + void init() throws IOException { + super.init("DeleteSliceServiceTest") + } + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + void testPreProcessRequest(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("eb0863e9-a69b-4b17-8a56-f05ad110bef7") + when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceInstanceName")).thenReturn("5G-test") + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + when(mockExecution.getVariable("result")).thenReturn("processing") + when(mockExecution.getVariable("progress")).thenReturn("0") + when(mockExecution.getVariable("operationContent")).thenReturn("Delete Slice service operation start") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(""" + { + "globalSubscriberId ":"5GCustomer", + "serviceType ":"5G" + }""".replaceAll("\\\\s+", "")) + when(mockExecution.getVariable("mso-request-id")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82") + + DeleteSliceService delSS = new DeleteSliceService() + delSS.preProcessRequest(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String updateOperationStatus = captor.getValue() + assertNotNull(updateOperationStatus) + } + + @Test + void testDeleteSliceServiceInstance(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + + when(mockExecution.getVariable("result")).thenReturn("finished") + when(mockExecution.getVariable("progress")).thenReturn("100") + when(mockExecution.getVariable("operationContent")).thenReturn("NSMF completes slicing service termination.") + + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") + DeleteSliceService obj = spy(DeleteSliceService.class) + when(obj.getAAIClient()).thenReturn(client) + doNothing().when(client).delete(serviceInstanceUri) + + obj.deleteSliceServiceInstance(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String updateOperationStatus= captor.getValue() + assertNotNull(updateOperationStatus) + } + + @Test + void testDelServiceProfileFromAAI(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + + AAIResultWrapper wrapper = new AAIResultWrapper(mockQuerySliceServiceProfile()) + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE_ALL, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") + AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be", "5G-2222222") + + DeleteSliceService obj = spy(DeleteSliceService.class) + when(obj.getAAIClient()).thenReturn(client) + when(client.exists(resourceUri)).thenReturn(true) + when(client.exists(profileUri)).thenReturn(true) + when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper) + doNothing().when(client).delete(profileUri) + obj.delServiceProfileFromAAI(mockExecution) + Mockito.verify(client,times(1)).delete(profileUri) + } + + @Test + void testPrepareEndOperationStatus(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceInstanceName")).thenReturn("5G-test") + when(mockExecution.getVariable("result")).thenReturn("error") + when(mockExecution.getVariable("progress")).thenReturn("100") + when(mockExecution.getVariable("operationContent")).thenReturn("terminate service failure") + + DeleteSliceService deleteSliceService = new DeleteSliceService() + WorkflowException exception = new WorkflowException("11113",7000,"terminate service failure") + when(mockExecution.getVariable("WorkflowException")).thenReturn(exception) + deleteSliceService.prepareEndOperationStatus(mockExecution) + + Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String updateOperationStatus= captor.getValue() + assertNotNull(updateOperationStatus) + + } + + private String mockQuerySliceServiceProfile(){ + String expect = + """{ + "service-profile": [ + { + "profile-id": "5G-2222222", + "latency": 50, + "max-number-of-UEs": 500, + "coverage-area-TA-list": "longgang,futian", + "ue-mobility-level": "stationary", + "resource-sharing-level": "Non-Shared", + "exp-data-rate-UL": 10, + "exp-data-rate-DL": 30, + "area-traffic-cap-UL": 100, + "area-traffic-cap-DL": 100, + "activity-factor": 80, + "jitter": 10, + "survival-time": 30, + "cs-availability": 95.5, + "reliability": 99.9, + "exp-data-rate": 80, + "traffic-density": 100, + "conn-density": 80, + "resource-version": "1577454958647" + } + ] + }""" + return expect + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSITest.groovy new file mode 100644 index 0000000000..493e2c9e1e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSITest.groovy @@ -0,0 +1,258 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # Licensed under the Apache License, Version 2.0 (the "License") + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.onap.logging.filter.base.ONAPComponents +import org.onap.so.beans.nsmf.JobStatusResponse +import org.onap.so.beans.nsmf.NssiResponse +import org.onap.so.beans.nsmf.ResponseDescriptor +import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.bpmn.core.domain.ServiceArtifact +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceInfo +import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory + +import javax.ws.rs.core.Response + +import static org.junit.Assert.assertNotNull +import static org.junit.Assert.assertTrue +import static org.mockito.ArgumentMatchers.anyString +import static org.mockito.ArgumentMatchers.eq +import static org.mockito.Mockito.doNothing +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.spy +import static org.mockito.Mockito.times +import static org.mockito.Mockito.when + +class DoDeallocateNSSITest extends MsoGroovyTest { + + private HttpClientFactory httpClientFactoryMock + private HttpClient httpClientMock + + @Before + void init() throws IOException { + super.init("DoDeallocateNSSITest") + } + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + + @Test + void testPreProcessRequest(){ + def currentNSSI = [:] + currentNSSI.put("nssiServiceInstanceId","5G-999") + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + DoDeallocateNSSI ddnssi = new DoDeallocateNSSI() + ddnssi.preProcessRequest(mockExecution) + Mockito.verify(mockExecution,times(1)).getVariable("currentNSSI") + } + + @Test + void testPrepareDecomposeService(){ + def currentNSSI = [:] + currentNSSI.put("modelInvariantId", "21d57d4b-52ad-4d3c-a798-248b5bb9124b") + currentNSSI.put("modelVersionId", "bfba363e-e39c-4bd9-a9d5-1371c28f4d22") + currentNSSI.put("nssiServiceInstanceId","5G-999") + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + DoDeallocateNSSI ddnssi = new DoDeallocateNSSI() + ddnssi.prepareDecomposeService(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("serviceModelInfo"), captor.capture()) + String serviceModelInfo = captor.getValue() + assertNotNull(serviceModelInfo) + } + + @Test + void testProcessDecomposition(){ + def currentNSSI = [:] + ServiceArtifact artifact = new ServiceArtifact() + artifact.setContent(getArtifactContent()) + ServiceInfo serviceInfo = new ServiceInfo() + List<ServiceArtifact> artifactList = new ArrayList<>() + artifactList.add(artifact) + serviceInfo.setServiceArtifact(artifactList) + ServiceDecomposition decomposition = new ServiceDecomposition() + decomposition.setServiceInfo(serviceInfo) + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(decomposition) + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + DoDeallocateNSSI ddnssi = new DoDeallocateNSSI() + ddnssi.processDecomposition(mockExecution) + String vendor = currentNSSI.get("vendor") + assertNotNull(vendor) + } + + @Test + void testHandleJobStatus(){ + def currentNSSI = [:] + currentNSSI.put("jobProgress", 10) + currentNSSI.put("proportion", 90) + currentNSSI.put("statusDescription","") + currentNSSI.put("e2eServiceInstanceId","21d57d4b-52ad-4d3c-a798-248b5bb9124b") + currentNSSI.put("operationId","4c614769-f58a-4556-8ad9-dcd903077c82") + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + DoDeallocateNSSI ddnssi = new DoDeallocateNSSI() + ddnssi.handleJobStatus(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String updateOperationStatus= captor.getValue() + assertNotNull(updateOperationStatus) + } + + @Test + void testDelSliceProfileFromAAI(){ + def currentNSSI = [:] + currentNSSI.put("nssiServiceInstanceId", "5G-999") + currentNSSI.put("profileId", "ddf57704-fe8d-417b-882d-2f2a12ddb225") + currentNSSI.put("globalSubscriberId","5GCustomer") + currentNSSI.put("serviceType","5G") + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + + AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, "5GCustomer", "5G", "5G-999", "ddf57704-fe8d-417b-882d-2f2a12ddb225") + DoDeallocateNSSI obj = spy(DoDeallocateNSSI.class) + when(obj.getAAIClient()).thenReturn(client) + when(client.exists(profileUri)).thenReturn(true) + doNothing().when(client).delete(profileUri) + + obj.delSliceProfileFromAAI(mockExecution) + Mockito.verify(client,times(1)).delete(profileUri) + } + + @Test + void testSendRequestToNSSMF(){ + httpClientFactoryMock = mock(HttpClientFactory.class) + httpClientMock = mock(HttpClient.class) + + def currentNSSI = [:] + currentNSSI.put("snssai", "01-010101") + currentNSSI.put("profileId", "ddf57704-fe8d-417b-882d-2f2a12ddb225") + currentNSSI.put("nssiServiceInstanceId","5G-999") + currentNSSI.put("nsiServiceInstanceId","5G-888") + + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + when(mockExecution.getVariable("mso.adapters.nssmf.endpoint")).thenReturn("http://so-nssmf-adapter.onap:8088") + String nssmfRequest = "http://so-nssmf-adapter.onap:8088/api/rest/provMns/v1/NSS/SliceProfiles/ddf57704-fe8d-417b-882d-2f2a12ddb225" + + when(httpClientFactoryMock.newJsonClient(new URL(nssmfRequest), ONAPComponents.EXTERNAL)).thenReturn(httpClientMock) + DoDeallocateNSSI obj = spy(DoDeallocateNSSI.class) + when(obj.getHttpClientFactory()).thenReturn(httpClientFactoryMock) + Response responseMock = mock(Response.class) + NssiResponse response = new NssiResponse() + response.setNssiId("NSSI-C-004-HDBHZ-NSSMF-01-A-HW") + response.setJobId("a5c5913d-448a-bcb1-9b800a944d84") + when(httpClientMock.post(anyString())).thenReturn(responseMock) + when(responseMock.getStatus()).thenReturn(202) + when(responseMock.readEntity(NssiResponse.class)) thenReturn(response) + when(responseMock.hasEntity()).thenReturn(true) + + obj.sendRequestToNSSMF(mockExecution) + String jobId = currentNSSI['jobId'] + assertNotNull(jobId) + } + + @Test + void testGetJobStatus(){ + httpClientFactoryMock = mock(HttpClientFactory.class) + httpClientMock = mock(HttpClient.class) + + def currentNSSI = [:] + currentNSSI.put("jobId", "a5c5913d-448a-bcb1-9b800a944d84") + currentNSSI.put("nssiServiceInstanceId","5G-999") + currentNSSI.put("nsiServiceInstanceId","5G-888") + currentNSSI.put("jobProgress",60) + + when(mockExecution.getVariable("isNSSIDeAllocated")).thenReturn(false) + when(mockExecution.getVariable("isNSSIDeAllocated")).thenReturn(false) + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + when(mockExecution.getVariable("mso.adapters.nssmf.endpoint")).thenReturn("http://so-nssmf-adapter.onap:8088") + String nssmfRequest = "http://so-nssmf-adapter.onap:8088/api/rest/provMns/v1/NSS/jobs/a5c5913d-448a-bcb1-9b800a944d84" + + when(httpClientFactoryMock.newJsonClient(new URL(nssmfRequest), ONAPComponents.EXTERNAL)).thenReturn(httpClientMock) + DoDeallocateNSSI obj = spy(DoDeallocateNSSI.class) + when(obj.getHttpClientFactory()).thenReturn(httpClientFactoryMock) + Response responseMock = mock(Response.class) + ResponseDescriptor descriptor = new ResponseDescriptor() + descriptor.setProgress(100) + descriptor.setStatusDescription("finished deallocate nssi") + JobStatusResponse jobStatusResponse = new JobStatusResponse() + jobStatusResponse.setResponseDescriptor(descriptor) + when(httpClientMock.post(anyString())).thenReturn(responseMock) + when(responseMock.getStatus()).thenReturn(202) + when(responseMock.readEntity(JobStatusResponse.class)) thenReturn(jobStatusResponse) + when(responseMock.hasEntity()).thenReturn(true) + + obj.getJobStatus(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("isNSSIDeAllocated"), captor.capture()) + boolean value = captor.getValue() + assertTrue(value) + } + + + private String getArtifactContent(){ + String content = + """ + { + "metadata":{ + "id":"NSST-C-001-HDBNJ-NSSMF-01-A-HW", + "vendor":"HW", + "version":"1.0", + "name":"eMBB_demo", + "description":"eMBB for demo", + "type":"embb", + "domainType":"cn" + }, + "capabilities":{ + "latency":{ + "type":"integer", + "constrainstsl":"less_or_equal", + "value":"20" + }, + "areaTrafficCapDL":{ + "type":"integer", + "constrainstsl":"less_or_equal", + "value":"300" + }, + "areaTrafficCapUL":{ + "type":"integer", + "constrainstsl":"less_or_equal", + "value":"300" + }, + "maxNumberofUEs":{ + "type":"integer", + "constrainstsl":"less_or_equal", + "value":"300" + } + } + } + """ + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceServiceTest.groovy new file mode 100644 index 0000000000..8a18376819 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceServiceTest.groovy @@ -0,0 +1,460 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # Licensed under the Apache License, Version 2.0 (the "License") + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory + +import javax.ws.rs.NotFoundException + +import static org.junit.Assert.assertEquals +import static org.junit.Assert.assertNotNull +import static org.junit.Assert.assertTrue +import static org.mockito.ArgumentMatchers.eq +import static org.mockito.Mockito.doNothing +import static org.mockito.Mockito.spy +import static org.mockito.Mockito.times +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.when + +class DoDeleteSliceServiceTest extends MsoGroovyTest { + @Before + void init() throws IOException { + super.init("DoDeleteSliceServiceTest") + } + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + void testPreProcessRequest(){ + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("e2a747a0-2ca6-476d-ac28-de999cf3fbfe") + + DoDeleteSliceService doDeleteSliceService = new DoDeleteSliceService() + doDeleteSliceService.preProcessRequest(mockExecution) + + Mockito.verify(mockExecution,times(1)).setVariable(captor.capture() as String, captor.capture()) + List<ExecutionEntity> values = captor.getAllValues() + assertNotNull(values) + } + + @Test + void testQueryE2ESliceSeriveFromAAI(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") + DoDeleteSliceService obj = spy(DoDeleteSliceService.class) + + AAIResultWrapper wrapper = new AAIResultWrapper(mockQuerySliceServiceReturn()) + when(obj.getAAIClient()).thenReturn(client) + when(client.exists(resourceUri)).thenReturn(true) + when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper) + obj.queryE2ESliceSeriveFromAAI(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("snssai"), captor.capture()) + String snssai = captor.getValue() + assertNotNull(snssai) + } + + @Test + void testGetAllottedResFromAAI(){ + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE_ALL, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be") + DoDeleteSliceService obj = spy(DoDeleteSliceService.class) + + AAIResultWrapper wrapper = new AAIResultWrapper(mockQueryAllottedResource()) + when(obj.getAAIClient()).thenReturn(client) + when(client.exists(resourceUri)).thenReturn(true) + when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper) + obj.getAllottedResFromAAI(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("nsiId"), captor.capture()) + String nsiId = captor.getValue() + assertNotNull(nsiId) + } + + @Test + void testGetNSIFromAAI(){ + when(mockExecution.getVariable("nsiId")).thenReturn("5G-888") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5G-888") + DoDeleteSliceService obj = spy(DoDeleteSliceService.class) + + AAIResultWrapper wrapper = new AAIResultWrapper(mockNSIReturn()) + when(obj.getAAIClient()).thenReturn(client) + when(client.exists(resourceUri)).thenReturn(true) + when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper) + obj.getNSIFromAAI(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("nssiIdList"), captor.capture()) + List<String> nssiIdList = captor.getValue() + assertNotNull(nssiIdList) + } + + @Test + void testGetNSSIListFromAAI(){ + List<String> nssiIdList = [] + nssiIdList.add("5G-999") + + when(mockExecution.getVariable("nssiIdList")).thenReturn(nssiIdList) + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5G-999") + DoDeleteSliceService obj = spy(DoDeleteSliceService.class) + + AAIResultWrapper wrapper = new AAIResultWrapper(mockNSSIReturn()) + when(obj.getAAIClient()).thenReturn(client) + when(client.exists(resourceUri)).thenReturn(true) + when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper) + obj.getNSSIListFromAAI(mockExecution) + Mockito.verify(mockExecution,times(1)).setVariable(eq("nssiInstanceList"), captor.capture()) + List<ServiceInstance> nssiInstanceList = captor.getValue() + assertNotNull(nssiInstanceList) + } + + @Test + void testGetCurrentNSSI(){ + ServiceInstance nssi = new ServiceInstance() + nssi.setServiceInstanceId("5G-999") + nssi.setModelInvariantId("21d57d4b-52ad-4d3c-a798-248b5bb9124a") + nssi.setModelVersionId("bfba363e-e39c-4bd9-a9d5-1371c28f4d22") + List<ServiceInstance> nssiInstanceList = [] + nssiInstanceList.add(nssi) + when(mockExecution.getVariable("currentNSSIIndex")).thenReturn(0) + when(mockExecution.getVariable("nssiInstanceList")).thenReturn(nssiInstanceList) + when(mockExecution.getVariable("snssai")).thenReturn("01-010101") + when(mockExecution.getVariable("nsiId")).thenReturn("5G-888") + when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5G-777") + when(mockExecution.getVariable("msoRequestId")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + when(mockExecution.getVariable("proportion")).thenReturn("90") + + DoDeleteSliceService ddss = new DoDeleteSliceService() + ddss.getCurrentNSSI(mockExecution) + verify(mockExecution,times(1)).setVariable(eq("currentNSSI"), captor.capture()) + Map currentNSSI = captor.getValue() + assertTrue(currentNSSI.size()>0) + } + + @Test + void testQuerySliceProfileFromAAI(){ + def currentNSSI = [:] + currentNSSI.put("nssiServiceInstanceId","5G-999") + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + + AAIResultWrapper wrapper = new AAIResultWrapper(mockSliceProfile()) + AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE_ALL, "5GCustomer", "5G", "5G-999") + + DoDeleteSliceService obj = spy(DoDeleteSliceService.class) + when(obj.getAAIClient()).thenReturn(client) + when(client.exists(profileUri)).thenReturn(true) + when(client.get(profileUri, NotFoundException.class)).thenReturn(wrapper) + obj.querySliceProfileFromAAI(mockExecution) + verify(mockExecution,times(1)).setVariable(eq("currentNSSI"), captor.capture()) + Map value = captor.getValue() + assertNotNull(currentNSSI.get('profileId')) + } + + @Test + void parseNextNSSI(){ + ServiceInstance nssi = new ServiceInstance() + nssi.setServiceInstanceId("5G-999") + nssi.setModelInvariantId("21d57d4b-52ad-4d3c-a798-248b5bb9124b") + nssi.setModelVersionId("bfba363e-e39c-4bd9-a9d5-1371c28f4d22") + List<ServiceInstance> nssiInstanceList = [] + nssiInstanceList.add(nssi) + when(mockExecution.getVariable("currentNSSIIndex")).thenReturn(0) + when(mockExecution.getVariable("nssiInstanceList")).thenReturn(nssiInstanceList) + + DoDeleteSliceService ddss = new DoDeleteSliceService() + ddss.parseNextNSSI(mockExecution) + verify(mockExecution,times(1)).setVariable(eq("isAllNSSIFinished"), captor.capture()) + boolean isAllNSSIFinished = captor.getValue() + assertTrue(isAllNSSIFinished) + } + + private String mockSliceProfile(){ + String expect = + """{ + "slice-profile": [ + { + "profile-id": "ddf57704-fe8d-417b-882d-2f2a12ddb225", + "latency": 20, + "max-number-of-UEs": 0, + "coverage-area-TA-list": "[{\\"province\\":\\"??\\",\\"city\\":\\"???\\",\\"county\\":\\"???\\",\\"street\\":\\"?????\\"}]", + "ue-mobility-level": "stationary", + "resource-sharing-level": "0", + "exp-data-rate-UL": 100, + "exp-data-rate-DL": 100, + "activity-factor": 0, + "e2e-latency": 0, + "jitter": 0, + "survival-time": 0, + "exp-data-rate": 0, + "payload-size": 0, + "traffic-density": 0, + "conn-density": 0, + "s-nssai": "01003", + "resource-version": "1580800791373" + } + ] + } + """ + return expect + } + + private String mockNSSIReturn(){ + String expect = + """ + { + "service-instance-id": "5G-999", + "service-instance-name": "eMBB_Slice_NSSI_5GCustomer", + "service-type": "eMBB", + "service-role": "nssi", + "environment-context": "cn", + "model-invariant-id": "21d57d4b-52ad-4d3c-a798-248b5bb9124a", + "model-version-id": "bfba363e-e39c-4bd9-a9d5-1371c28f4d22", + "service-instance-location-id": "300-01|300-02", + "resource-version": "1578449638032", + "orchestration-status": "activated", + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/5G-888", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "5G-888" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "eMBB_e2e_Slice_Service_5GCustomer" + } + ] + } + ] + } + } + """ + return expect + } + + private String mockNSIReturn(){ + String expect = + """ + { + "service-instance-id": "5G-888", + "service-instance-name": "eMBB_e2e_Slice_Service_5GCustomer", + "service-type": "embb", + "service-role": "nsi", + "model-invariant-id": "0e9bcb9a-c832-433b-a0c1-74866768f608", + "model-version-id": "2c5fd79d-0f84-4057-9222-952cb6f27036", + "service-instance-location-id": "300-01|300-02", + "resource-version": "1579691104911", + "orchestration-status": "activated", + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/5G-999", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "5G-999" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "eMBB_Slice_NSSI_5GCustomer" + } + ] + }, + { + "related-to": "allotted-resource", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/5G-777/allotted-resources/allotted-resource/5G-1234", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "5G-777" + }, + { + "relationship-key": "allotted-resource.id", + "relationship-value": "5G-1234" + } + ], + "related-to-property": [ + { + "property-key": "allotted-resource.description" + }, + { + "property-key": "allotted-resource.allotted-resource-name" + } + ] + } + ] + } + } + """ + return expect + } + + private String mockQueryAllottedResource(){ + String expect = + """{ + "allotted-resource": [ + { + "id": "5G-1234", + "resource-version": "1577454983471", + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/5G-888", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "5G-888" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "eMBB_e2e_Slice_Service_5GCustomer" + } + ] + } + ] + } + } + ] + } + """ + return expect + } + + String mockQuerySliceServiceReturn(){ + String expect = + """{ + "service-instance-id": "5G-777", + "service-instance-name": "eMBB_e2e_Slice_Service_5GCustomer", + "service-type": "embb", + "service-role": "e2eslice-service", + "environment-context": "01-010101", + "model-invariant-id": "e65d737a-41e0-4ad1-958f-56defdf2e907", + "model-version-id": "f2f5967e-72d3-4c5c-b880-e214e71dba4e", + "service-instance-location-id": "300-01|300-02", + "resource-version": "1578449638436", + "orchestration-status": "activated", + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/5G-666", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "5G-666" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "eMBB_Slice_Communication_Service_5GCustomer" + } + ] + } + ] + } + } + """ + return expect + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index dab5102efd..bbdcbf7ae3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -66,7 +66,7 @@ import org.onap.so.client.orchestration.AAIVfModuleResources; import org.onap.so.client.orchestration.AAIVnfResources; import org.onap.so.client.orchestration.AAIVolumeGroupResources; import org.onap.so.client.orchestration.AAIVpnBindingResources; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java index 4522f7f2e7..415d4614da 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java @@ -42,7 +42,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; import org.onap.so.client.exception.ExceptionBuilder; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.serviceinstancebeans.RequestDetails; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java index e5f28aa4c3..8b78560521 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java @@ -38,7 +38,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.exceptions.MarshallerException; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java index 00d0fdc01d..332c390c7d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java @@ -50,7 +50,7 @@ import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIVnfResources; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import org.onap.so.db.catalog.client.CatalogDbClient; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/LcmControllerDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/LcmControllerDE.java index 95e270a071..40034aa26c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/LcmControllerDE.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/LcmControllerDE.java @@ -24,7 +24,6 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext; import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable; import org.onap.so.bpmn.infrastructure.decisionpoint.api.controller.ControllerPreparable; -import org.onap.so.client.appc.ApplicationControllerAction; import org.onap.so.client.exception.ExceptionBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,9 +43,6 @@ public abstract class LcmControllerDE implements ControllerRunnable<DelegateExec @Autowired protected List<ControllerPreparable<DelegateExecution>> prepareList; - @Autowired - protected ApplicationControllerAction client; - @Override public void prepare(ControllerContext<DelegateExecution> context) { prepareList.stream().filter(prepare -> prepare.understand(context)) diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/common/SoPropertyConstants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/common/SoPropertyConstants.java new file mode 100644 index 0000000000..badce18a51 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/common/SoPropertyConstants.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.common; + +public interface SoPropertyConstants { + String TARGET_SOFTWARE_VERSION = "targetSoftwareVersion"; + + String SO_ACTION = "action"; + String SO_ACTION_MODE = "mode"; + + String ACTION_ACTIVATE_N_E_SW = "activateNESw"; + String ACTION_DOWNLOAD_N_E_SW = "downloadNESw"; + String ACTION_POST_CHECK = "postCheck"; + String ACTION_PRE_CHECK = "preCheck"; + + String CONTROLLER_STATUS = "ControllerStatus"; +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SDNCLcmPayloadBuilder.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SDNCLcmPayloadBuilder.java new file mode 100644 index 0000000000..b29009ff1d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SDNCLcmPayloadBuilder.java @@ -0,0 +1,153 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.sdnc; + +import java.util.Arrays; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.client.sdnc.lcm.beans.payload.*; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.REQUEST_PAYLOAD; +import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.common.SoPropertyConstants; + +public class SDNCLcmPayloadBuilder { + + private static Logger logger = LoggerFactory.getLogger(SDNCLcmPayloadBuilder.class); + + public static ActivateNESwPayload buildActivateNESwPayload(DelegateExecution execution) { + String requestPayload = String.valueOf(execution.getVariable(REQUEST_PAYLOAD)); + + ActivateNESwPayload activateNESwPayload = new ActivateNESwPayload(); + + String ipaddressV4Oam = JsonUtils.getJsonValue(requestPayload, "ipaddressV4Oam"); + activateNESwPayload.setIpaddressV4Oam(ipaddressV4Oam); + + String targetSwVersion = String.valueOf(execution.getVariable(SoPropertyConstants.TARGET_SOFTWARE_VERSION)); + if (targetSwVersion == null) { + targetSwVersion = JsonUtils.getJsonValue(requestPayload, "targetSwVersion"); + } + activateNESwPayload.setSwVersionToBeActivated(targetSwVersion); + + String playbookName = JsonUtils.getJsonValue(requestPayload, "activateNESwPlaybook"); + if (playbookName != null) { + activateNESwPayload.setPlaybookName(playbookName); + } + + return activateNESwPayload; + } + + public static DownloadNESwPayload buildDownloadNESwPayload(DelegateExecution execution) { + String requestPayload = String.valueOf(execution.getVariable(REQUEST_PAYLOAD)); + + DownloadNESwPayload downloadNESwPayload = new DownloadNESwPayload(); + + String ipaddressV4Oam = JsonUtils.getJsonValue(requestPayload, "ipaddressV4Oam"); + downloadNESwPayload.setIpaddressV4Oam(ipaddressV4Oam); + + String swToBeDownloadedString = JsonUtils.getJsonValue(requestPayload, "swToBeDownloaded"); + SwToBeDownloadedElement[] swToBeDownloadedArray; + + ObjectMapper mapper = new ObjectMapper(); + try { + swToBeDownloadedArray = mapper.readValue(swToBeDownloadedString, SwToBeDownloadedElement[].class); + downloadNESwPayload.setSwToBeDownloaded(Arrays.asList(swToBeDownloadedArray)); + } catch (Exception e) { + logger.error("Parse SwToBeDownloaded error: ", e); + } + + String playbookName = JsonUtils.getJsonValue(requestPayload, "downloadNESwPlaybook"); + if (playbookName != null) { + downloadNESwPayload.setPlaybookName(playbookName); + } + + return downloadNESwPayload; + } + + public static UpgradePostCheckPayload buildUpgradePostCheckPayload(DelegateExecution execution) { + String requestPayload = String.valueOf(execution.getVariable(REQUEST_PAYLOAD)); + + UpgradePostCheckPayload upgradePostCheckPayload = new UpgradePostCheckPayload(); + + String ipaddressV4Oam = JsonUtils.getJsonValue(requestPayload, "ipaddressV4Oam"); + upgradePostCheckPayload.setIpaddressV4Oam(ipaddressV4Oam); + + String oldSwVersion = JsonUtils.getJsonValue(requestPayload, "oldSwVersion"); + upgradePostCheckPayload.setOldSwVersion(oldSwVersion); + + String targetSwVersion = String.valueOf(execution.getVariable(SoPropertyConstants.TARGET_SOFTWARE_VERSION)); + if (targetSwVersion == null) { + targetSwVersion = JsonUtils.getJsonValue(requestPayload, "targetSwVersion"); + } + upgradePostCheckPayload.setTargetSwVersion(targetSwVersion); + + String ruleName = JsonUtils.getJsonValue(requestPayload, "postCheckRuleName"); + upgradePostCheckPayload.setRuleName(ruleName); + + String additionalData = JsonUtils.getJsonValue(requestPayload, "postCheckAdditionalData"); + upgradePostCheckPayload.setAdditionalData(additionalData); + + String playbookName = JsonUtils.getJsonValue(requestPayload, "postCheckPlaybook"); + if (playbookName != null) { + upgradePostCheckPayload.setPlaybookName(playbookName); + } + + return upgradePostCheckPayload; + } + + public static UpgradePreCheckPayload buildUpgradePreCheckPayload(DelegateExecution execution) { + String requestPayload = String.valueOf(execution.getVariable(REQUEST_PAYLOAD)); + + UpgradePreCheckPayload upgradePreCheckPayload = new UpgradePreCheckPayload(); + + String ipaddressV4Oam = JsonUtils.getJsonValue(requestPayload, "ipaddressV4Oam"); + upgradePreCheckPayload.setIpaddressV4Oam(ipaddressV4Oam); + + String oldSwVersion = JsonUtils.getJsonValue(requestPayload, "oldSwVersion"); + upgradePreCheckPayload.setOldSwVersion(oldSwVersion); + + String targetSwVersion = String.valueOf(execution.getVariable(SoPropertyConstants.TARGET_SOFTWARE_VERSION)); + if (targetSwVersion == null) { + targetSwVersion = JsonUtils.getJsonValue(requestPayload, "targetSwVersion"); + } + upgradePreCheckPayload.setTargetSwVersion(targetSwVersion); + + String ruleName = JsonUtils.getJsonValue(requestPayload, "preCheckRuleName"); + upgradePreCheckPayload.setRuleName(ruleName); + + String additionalData = JsonUtils.getJsonValue(requestPayload, "preCheckAdditionalData"); + upgradePreCheckPayload.setAdditionalData(additionalData); + + String playbookName = JsonUtils.getJsonValue(requestPayload, "preCheckPlaybook"); + if (playbookName != null) { + upgradePreCheckPayload.setPlaybookName(playbookName); + } + + return upgradePreCheckPayload; + } + + public static String convertToSting(Object msgObject) throws JsonProcessingException { + ObjectMapper mapper = new ObjectMapper(); + return mapper.writeValueAsString(msgObject); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java index db0d402f6e..ed865e058f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix + * Modifications Copyright (C) 2020 Huawei * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,16 +20,24 @@ package org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.sdnc; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.stereotype.Component; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext; +import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.common.SoPropertyConstants; import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.LcmControllerDE; -import org.springframework.stereotype.Component; +import org.onap.so.client.sdnc.common.SDNCConstants; +import org.onap.so.client.sdnc.lcm.*; +import org.onap.so.client.sdnc.lcm.beans.*; +import org.onap.so.client.sdnc.lcm.beans.payload.*; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.REQUEST_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.REQUEST_PAYLOAD; -/** - * This class is created to demonstrate how to support {@link DelegateExecution} API based SDNC controller. - * - * Function wise, it's similar to the Appc Controller, like in the AppcClient groovy code. - */ @Component public class SdncControllerDE extends LcmControllerDE { @@ -44,14 +53,33 @@ public class SdncControllerDE extends LcmControllerDE { return true; } - /** - * This method is left empty intentionally. If you are planning to use the SDNC Controller, please implement here. - * - * You can use the {@ref ApplicationControllerAction}, {@ref ApplicationControllerOrchestrator}, - * {@ref ApplicationControllerClient} or create your own SDNC Client proxy. - */ @Override protected int callLcmClient(ControllerContext<DelegateExecution> context) { + DelegateExecution execution = context.getExecution(); + + logger.debug("Running activity for id: {}, name: {}", execution.getCurrentActivityId(), + execution.getCurrentActivityName()); + + boolean result; + try { + LcmInput lcmInput = buildLcmInput(execution); + if (lcmInput != null) { + result = sendLcmRequest(execution, lcmInput); + } else { + logger.error("Build LCM Input error"); + result = false; + } + } catch (Exception e) { + logger.error("Call SDNC LCM Client failure: ", e); + result = false; + } + + if (result) { + execution.setVariable(SoPropertyConstants.CONTROLLER_STATUS, "Success"); + } else { + execution.setVariable(SoPropertyConstants.CONTROLLER_STATUS, "Failure"); + } + return 0; } @@ -59,4 +87,177 @@ public class SdncControllerDE extends LcmControllerDE { protected int getErrorCode() { return SDNC_DELEGATE_EXECUTION_ERROR_CODE; } + + private LcmOutput sendSyncRequest(String operation, LcmInput lcmInput) { + SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder(); + SDNCLcmRestClient sdncLcmRestClient; + try { + sdncLcmRestClient = sdncLcmClientBuilder.newSDNCLcmRestClient(operation); + } catch (SDNCLcmClientBuilderException e) { + logger.error("Create SDNCLcmRestClient error: ", e); + return null; + } + + return sdncLcmRestClient.sendRequest(lcmInput); + } + + private LcmOutput selectLcmOutputFromDmaapResponses(List<LcmDmaapResponse> lcmDmaapResponses, LcmInput lcmInput) { + String expectedCorrelationId = + lcmInput.getCommonHeader().getRequestId() + "-" + lcmInput.getCommonHeader().getSubRequestId(); + + for (LcmDmaapResponse lcmDmaapResponse : lcmDmaapResponses) { + String correlationId = lcmDmaapResponse.getCorrelationId(); + if (expectedCorrelationId.equals(correlationId)) { + return lcmDmaapResponse.getBody().getOutput(); + } + } + + return null; + } + + private LcmOutput sendAsyncRequest(String operation, LcmInput lcmInput) { + SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder(); + SDNCLcmDmaapClient sdncLcmDmaapClient; + try { + sdncLcmDmaapClient = sdncLcmClientBuilder.newSDNCLcmDmaapClient(); + } catch (SDNCLcmClientBuilderException e) { + logger.error("Create SDNCLcmDmaapClient error: ", e); + return null; + } + + LcmDmaapRequest lcmDmaapRequest = SDNCLcmMessageBuilder.buildLcmDmaapRequest(operation, lcmInput); + try { + sdncLcmDmaapClient.sendRequest(lcmDmaapRequest); + } catch (Exception e) { + logger.error("SDNCLcmDmaapClient sends request error: ", e); + return null; + } + + long timeout = sdncLcmClientBuilder.getSDNCLcmProperties().getActionTimeout(); + long startTime = System.currentTimeMillis(); + while (true) { + List<LcmDmaapResponse> lcmDmaapResponses = sdncLcmDmaapClient.getResponse(); + if (lcmDmaapResponses.size() > 0) { + LcmOutput lcmOutput = selectLcmOutputFromDmaapResponses(lcmDmaapResponses, lcmInput); + if (lcmOutput != null) { + return lcmOutput; + } + } + + long stopTime = System.currentTimeMillis(); + if ((stopTime - startTime) > timeout) { + logger.error("Timeout for SDNC LCM action {}", lcmInput.getAction()); + return null; + } + } + } + + public static String toLowerHyphen(String lcmAction) { + String regex = "([a-z0-9A-Z])(?=[A-Z])"; + String replacement = "$1-"; + return lcmAction.replaceAll(regex, replacement).toLowerCase(); + } + + private LcmInput buildLcmInput(DelegateExecution execution) throws JsonProcessingException { + String requestId = String.valueOf(execution.getVariable(REQUEST_ID)); + String requestAction = String.valueOf(execution.getVariable(SoPropertyConstants.SO_ACTION)); + String pnfName = String.valueOf(execution.getVariable(PNF_CORRELATION_ID)); + logger.debug(String.format("requestId: %s, action: %s, pnfName: %s", requestId, requestAction, pnfName)); + + String requestPayload = String.valueOf(execution.getVariable(REQUEST_PAYLOAD)); + logger.debug("SO request payload: " + requestPayload); + + String lcmAction; + String lcmPayload; + + switch (requestAction) { + case SoPropertyConstants.ACTION_PRE_CHECK: + lcmAction = SDNCLcmActionConstants.UPGRADE_PRE_CHECK; + + UpgradePreCheckPayload upgradePreCheckPayload; + upgradePreCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePreCheckPayload(execution); + lcmPayload = SDNCLcmPayloadBuilder.convertToSting(upgradePreCheckPayload); + break; + case SoPropertyConstants.ACTION_DOWNLOAD_N_E_SW: + lcmAction = SDNCLcmActionConstants.DOWNLOAD_N_E_SW; + + DownloadNESwPayload downloadNESwPayload; + downloadNESwPayload = SDNCLcmPayloadBuilder.buildDownloadNESwPayload(execution); + lcmPayload = SDNCLcmPayloadBuilder.convertToSting(downloadNESwPayload); + break; + case SoPropertyConstants.ACTION_ACTIVATE_N_E_SW: + lcmAction = SDNCLcmActionConstants.ACTIVATE_N_E_SW; + + ActivateNESwPayload activateNESwPayload; + activateNESwPayload = SDNCLcmPayloadBuilder.buildActivateNESwPayload(execution); + lcmPayload = SDNCLcmPayloadBuilder.convertToSting(activateNESwPayload); + break; + case SoPropertyConstants.ACTION_POST_CHECK: + lcmAction = SDNCLcmActionConstants.UPGRADE_POST_CHECK; + + UpgradePostCheckPayload upgradePostCheckPayload; + upgradePostCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePostCheckPayload(execution); + lcmPayload = SDNCLcmPayloadBuilder.convertToSting(upgradePostCheckPayload); + break; + default: + logger.error("Unsupported SO Action: " + requestAction); + return null; + } + + logger.debug("SDNC LCM payload for {}: {}", lcmAction, lcmPayload); + + String subRequestId = UUID.randomUUID().toString(); + LcmInput lcmInput = + SDNCLcmMessageBuilder.buildLcmInputForPnf(requestId, subRequestId, pnfName, lcmAction, lcmPayload); + + ObjectMapper mapper = new ObjectMapper(); + String lcmInputMsg = mapper.writeValueAsString(lcmInput); + logger.debug("SDNC input message:\n" + lcmInputMsg); + + return lcmInput; + } + + private boolean parseLcmOutput(LcmOutput lcmOutput, String lcmAction) { + if (lcmOutput == null) { + logger.error("Call SDNC LCM API failure"); + return false; + } + + LcmStatus lcmStatus = lcmOutput.getStatus(); + + if (lcmStatus.getCode() == SDNCConstants.LCM_OUTPUT_SUCCESS_CODE) { + logger.debug("Call SDNC LCM API success: " + lcmStatus.getMessage()); + } else { + logger.error("Call SDNC LCM API failure: " + lcmStatus.getMessage()); + } + + String outputPayload = lcmOutput.getPayload(); + logger.debug("SDNC LCM action: {}, result: {}", lcmAction, outputPayload); + if (outputPayload != null) { + String result = JsonUtils.getJsonValue(outputPayload, "result"); + if ("Success".equals(result)) { + logger.debug("Run SDNC LCM action {} success", lcmAction); + return true; + } else { + String reason = JsonUtils.getJsonValue(outputPayload, "reason"); + logger.error("Run SDNC LCM action {} failure, reason: {}", lcmAction, reason); + } + } + + return false; + } + + private boolean sendLcmRequest(DelegateExecution execution, LcmInput lcmInput) { + String actionMode = String.valueOf(execution.getVariable(SoPropertyConstants.SO_ACTION_MODE)); + String lcmOperation = toLowerHyphen(lcmInput.getAction()); + + LcmOutput lcmOutput; + if ("async".equals(actionMode)) { + lcmOutput = sendAsyncRequest(lcmOperation, lcmInput); + } else { + lcmOutput = sendSyncRequest(lcmOperation, lcmInput); + } + + return parseLcmOutput(lcmOutput, lcmInput.getAction()); + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java index ff9d7376de..7930a33a2a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java @@ -39,7 +39,7 @@ import org.onap.so.client.appc.ApplicationControllerAction; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import org.onap.so.db.catalog.client.CatalogDbClient; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java index 1a7d22c0dd..2d39cc185e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java @@ -35,7 +35,7 @@ import org.onap.so.client.appc.ApplicationControllerAction; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.catalog.beans.ControllerSelectionReference; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ExternalTicketTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ExternalTicketTasks.java index 6bfe618460..7bfcd56c42 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ExternalTicketTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ExternalTicketTasks.java @@ -24,7 +24,7 @@ import org.onap.so.logger.LoggingAnchor; import org.camunda.bpm.engine.delegate.BpmnError; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.client.ticket.ExternalTicket; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java index 088ce1ac38..dd9ecbead4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java @@ -31,7 +31,7 @@ import org.onap.namingservice.model.NameGenResponse; import org.onap.namingservice.model.NameGenResponseError; import org.onap.namingservice.model.Respelement; import org.onap.so.client.exception.BadResponseException; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java index e7e4e25af2..01ac675d83 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java @@ -30,7 +30,7 @@ import org.apache.commons.lang.StringUtils; import org.apache.http.HttpStatus; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java index a41c79b171..f6642ab76a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java @@ -48,7 +48,7 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SDNCLcmPayloadBuilderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SDNCLcmPayloadBuilderTest.java new file mode 100644 index 0000000000..61f2ee3432 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SDNCLcmPayloadBuilderTest.java @@ -0,0 +1,135 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.sdnc; + +import com.fasterxml.jackson.core.JsonProcessingException; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.junit.Before; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.junit.runner.RunWith; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.when; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.REQUEST_PAYLOAD; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.common.SoPropertyConstants; +import org.onap.so.client.sdnc.lcm.beans.payload.*; + +@RunWith(SpringJUnit4ClassRunner.class) +public class SDNCLcmPayloadBuilderTest { + private static Logger logger = LoggerFactory.getLogger(SDNCLcmPayloadBuilderTest.class); + + protected static String payload = "{" + "\"ipaddressV4Oam\": \"192.168.1.10\"," + "\"oldSwVersion\": \"v1\"," + + "\"preCheckRuleName\": \"r101\"," + "\"preCheckAdditionalData\": \"{}\"," + + "\"preCheckPlaybook\": \"precheck_playbook\"," + "\"swToBeDownloaded\": \"[{" + + "\\\"swLocation\\\": \\\"http://192.168.1.20/test.zip\\\"," + "\\\"swFileSize\\\": 123456," + + "\\\"swFileCompression\\\": \\\"ZIP\\\"," + "\\\"swFileFormat\\\": \\\"binary\\\"}]\"," + + "\"downloadNESwPlaybook\": \"downloadnesw_playbook\"," + + "\"activateNESwPlaybook\": \"activatenesw_playbook\"," + "\"postCheckRuleName\": \"r102\"," + + "\"postCheckAdditionalData\": \"{}\"," + "\"postCheckPlaybook\": \"postcheck_playbook\"" + "}"; + protected String targetSoftwareVersion = "v2"; + + @MockBean + private DelegateExecution execution; + + public static String getRequestPayload() { + return payload; + } + + @Before + public void setUp() { + when(execution.getVariable(REQUEST_PAYLOAD)).thenReturn(payload); + when(execution.getVariable(SoPropertyConstants.TARGET_SOFTWARE_VERSION)).thenReturn(targetSoftwareVersion); + } + + + @Test + public final void testBuildActivateNESwPayload() { + String expectedPayload = "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\"," + + "\"playbook-name\":\"activatenesw_playbook\"," + "\"swVersionToBeActivated\":\"v2\"" + "}"; + + ActivateNESwPayload activateNESwPayload = SDNCLcmPayloadBuilder.buildActivateNESwPayload(execution); + try { + String payload = SDNCLcmPayloadBuilder.convertToSting(activateNESwPayload); + logger.debug("ActivateNESwPayload:\n" + payload); + + assertEquals(expectedPayload, payload); + } catch (JsonProcessingException e) { + fail("Convert ActivateNESwPayload to String error: " + e.toString()); + } + } + + @Test + public final void testBuildDownloadNESwPayload() { + String expectedSwToBeDownloadedElement = "{" + "\"swLocation\":\"http://192.168.1.20/test.zip\"," + + "\"swFileSize\":123456," + "\"swFileCompression\":\"ZIP\"," + "\"swFileFormat\":\"binary\"" + "}"; + String expectedPayload = + "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\"," + "\"playbook-name\":\"downloadnesw_playbook\"," + + "\"swToBeDownloaded\":[" + expectedSwToBeDownloadedElement + "]" + "}"; + + DownloadNESwPayload downloadNESwPayload = SDNCLcmPayloadBuilder.buildDownloadNESwPayload(execution); + try { + String payload = SDNCLcmPayloadBuilder.convertToSting(downloadNESwPayload); + logger.debug("DownloadNESwPayload:\n" + payload); + + assertEquals(expectedPayload, payload); + } catch (JsonProcessingException e) { + fail("Convert DownloadNESwPayload to String error: " + e.toString()); + } + } + + @Test + public final void testBuildUpgradePostCheckPayload() { + String expectedPayload = "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\"," + + "\"playbook-name\":\"postcheck_playbook\"," + "\"oldSwVersion\":\"v1\"," + + "\"targetSwVersion\":\"v2\"," + "\"ruleName\":\"r102\"," + "\"additionalData\":\"{}\"" + "}"; + + UpgradePostCheckPayload upgradePostCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePostCheckPayload(execution); + try { + String payload = SDNCLcmPayloadBuilder.convertToSting(upgradePostCheckPayload); + logger.debug("UpgradePostCheckPayload:\n" + payload); + + assertEquals(expectedPayload, payload); + } catch (JsonProcessingException e) { + fail("Convert UpgradePostCheckPayload to String error: " + e.toString()); + } + } + + @Test + public final void testBuildUpgradePreCheckPayload() { + String expectedPayload = "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\"," + + "\"playbook-name\":\"precheck_playbook\"," + "\"oldSwVersion\":\"v1\"," + + "\"targetSwVersion\":\"v2\"," + "\"ruleName\":\"r101\"," + "\"additionalData\":\"{}\"" + "}"; + + UpgradePreCheckPayload upgradePreCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePreCheckPayload(execution); + try { + String payload = SDNCLcmPayloadBuilder.convertToSting(upgradePreCheckPayload); + logger.debug("UpgradePreCheckPayload:\n" + payload); + + assertEquals(expectedPayload, payload); + } catch (JsonProcessingException e) { + fail("Convert UpgradePreCheckPayload to String error: " + e.toString()); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDETest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDETest.java index 674167624e..02c7dca9ae 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDETest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDETest.java @@ -28,7 +28,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext; import org.onap.so.bpmn.infrastructure.decisionpoint.api.controller.ControllerPreparable; -import org.onap.so.client.appc.ApplicationControllerAction; import org.onap.so.client.exception.ExceptionBuilder; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; @@ -48,9 +47,6 @@ public class SdncControllerDETest { @MockBean private ControllerPreparable<DelegateExecution> preparable; - @MockBean - protected ApplicationControllerAction client; - @Before public void setUp() { when(controllerContext.getControllerActor()).thenReturn("sdnc"); diff --git a/common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java b/common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java index 40acac57aa..725da97d5b 100644 --- a/common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java +++ b/common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java @@ -8,11 +8,9 @@ import javax.management.JMX; import javax.management.MBeanServer; import javax.management.ObjectInstance; import javax.management.ObjectName; -import org.jboss.logging.MDC; -import org.onap.logging.filter.base.ONAPComponents; -import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.onap.so.logger.ErrorCode; -import org.onap.so.logger.ScheduledTasksMDCSetup; +import org.onap.logging.filter.base.ErrorCode; +import org.onap.logging.filter.base.ScheduledLogging; +import org.onap.logging.filter.base.ScheduledTaskException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -32,23 +30,16 @@ public class ScheduledDnsLookup { @Autowired private DbDnsIpAddress dnsIpAddress; - @Autowired - private ScheduledTasksMDCSetup scheduledMDCSetup; - private static Logger logger = LoggerFactory.getLogger(ScheduledDnsLookup.class); + @ScheduledLogging @Scheduled(fixedRate = 15000) - public void performDnsLookup() { - scheduledMDCSetup.mdcSetup(ONAPComponents.SO, "performDnsLookup"); + public void performDnsLookup() throws ScheduledTaskException { String dnsUrl = System.getenv(DB_HOST); - try { if (dnsUrl == null) { - scheduledMDCSetup.errorMDCSetup(ErrorCode.DataError, "Database DNS is not provided."); - logger.error("Database DNS is not provided. Please verify the configuration"); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.ERROR.toString()); - scheduledMDCSetup.exitAndClearMDC(); - return; + throw new ScheduledTaskException(ErrorCode.DataError, + "Database DNS is not provided. Please verify the configuration"); } InetAddress inetAddress = java.net.InetAddress.getByName(dnsUrl); @@ -57,7 +48,6 @@ public class ScheduledDnsLookup { /* This is in initial state */ if (currentIpAddress == null) { dnsIpAddress.setIpAddress(ipAddress); - scheduledMDCSetup.exitAndClearMDC(); return; } @@ -69,7 +59,6 @@ public class ScheduledDnsLookup { } catch (UnknownHostException e) { logger.warn("Database DNS %s is not resolvable to an IP Address", dnsUrl); } - scheduledMDCSetup.exitAndClearMDC(); } private void softEvictConnectionPool() { diff --git a/common/src/main/java/org/onap/so/logger/ScheduledTasksMDCSetup.java b/common/src/main/java/org/onap/so/logger/ScheduledTasksMDCSetup.java deleted file mode 100644 index 41c4b4bfae..0000000000 --- a/common/src/main/java/org/onap/so/logger/ScheduledTasksMDCSetup.java +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.logger; - -import java.util.UUID; -import org.onap.logging.filter.base.Constants; -import org.onap.logging.filter.base.MDCSetup; -import org.onap.logging.filter.base.ONAPComponentsList; -import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.slf4j.MDC; -import org.springframework.stereotype.Component; - -@Component -public class ScheduledTasksMDCSetup extends MDCSetup { - - public void mdcSetup(ONAPComponentsList targetEntity, String serviceName) { - try { - setEntryTimeStamp(); - setServerFQDN(); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString()); - MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, UUID.randomUUID().toString()); - MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, targetEntity.toString()); - MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, Constants.DefaultValues.UNKNOWN); - MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, serviceName); - setLogTimestamp(); - setElapsedTime(); - MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, getProperty(Constants.Property.PARTNER_NAME)); - logger.info(ONAPLogConstants.Markers.ENTRY, "Entering"); - } catch (Exception e) { - logger.warn("Error in ScheduledTasksMDCSetup mdcSetup: {}", e.getMessage()); - } - } - - public void errorMDCSetup(ErrorCode errorCode, String errorDescription) { - MDC.put(ONAPLogConstants.MDCs.ERROR_CODE, String.valueOf(errorCode.getValue())); - MDC.put(ONAPLogConstants.MDCs.ERROR_DESC, errorDescription); - } - - public void exitAndClearMDC() { - try { - setStatusCode(); - setLogTimestamp(); - setElapsedTime(); - logger.info(ONAPLogConstants.Markers.EXIT, "Exiting."); - } catch (Exception e) { - logger.warn("Error in ScheduledTasksMDCSetup clear MDC: {}", e.getMessage()); - } - MDC.clear(); - } - - public void setStatusCode() { - String currentStatusCode = MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE); - if (currentStatusCode == null || !currentStatusCode.equals(ONAPLogConstants.ResponseStatus.ERROR.toString())) { - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.COMPLETE.toString()); - } - } -} diff --git a/common/src/main/java/org/onap/so/utils/CryptoUtils.java b/common/src/main/java/org/onap/so/utils/CryptoUtils.java index 1c38dfb774..eecee4c83f 100644 --- a/common/src/main/java/org/onap/so/utils/CryptoUtils.java +++ b/common/src/main/java/org/onap/so/utils/CryptoUtils.java @@ -24,7 +24,7 @@ package org.onap.so.utils; import org.onap.so.logger.LoggingAnchor; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java index 4f13cec8f4..035ad1dc81 100644 --- a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java +++ b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java @@ -6,6 +6,7 @@ import java.util.concurrent.ConcurrentHashMap; import org.camunda.bpm.client.ExternalTaskClient; import org.camunda.bpm.client.interceptor.ClientRequestInterceptor; import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider; +import org.onap.logging.filter.base.ScheduledLogging; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -53,6 +54,7 @@ public class ExternalTaskServiceUtils { return Integer.parseInt(env.getProperty("workflow.topics.maxClients", "3")); } + @ScheduledLogging @Scheduled(fixedDelay = 30000) public void checkAllClientsActive() { getClients().stream().filter(client -> !client.isActive()).forEach(ExternalTaskClient::start); diff --git a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java index 0ff3ccfa9c..3ae644be6b 100644 --- a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java +++ b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java @@ -34,7 +34,7 @@ import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.sax.SAXSource; import org.onap.so.logger.LoggingAnchor; import org.onap.so.exceptions.MarshallerException; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/common/src/test/java/org/onap/so/logger/ScheduledTasksMDCSetupTest.java b/common/src/test/java/org/onap/so/logger/ScheduledTasksMDCSetupTest.java deleted file mode 100644 index f232781871..0000000000 --- a/common/src/test/java/org/onap/so/logger/ScheduledTasksMDCSetupTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.logger; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import org.junit.After; -import org.junit.Test; -import org.onap.logging.filter.base.Constants; -import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.onap.so.utils.Components; -import org.onap.so.utils.UUIDChecker; -import org.slf4j.MDC; - -public class ScheduledTasksMDCSetupTest { - private ScheduledTasksMDCSetup tasksMDCSetup = new ScheduledTasksMDCSetup(); - - @After - public void tearDown() { - MDC.clear(); - System.clearProperty("partnerName"); - } - - @Test - public void mdcSetupTest() { - System.setProperty("partnerName", Components.APIH.toString()); - tasksMDCSetup.mdcSetup(Components.APIH, "mdcSetupTest"); - - assertTrue(UUIDChecker.isValidUUID(MDC.get(ONAPLogConstants.MDCs.REQUEST_ID))); - assertEquals(Components.APIH.toString(), MDC.get(ONAPLogConstants.MDCs.TARGET_ENTITY)); - assertEquals(Components.APIH.toString(), MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)); - assertEquals("mdcSetupTest", MDC.get(ONAPLogConstants.MDCs.SERVICE_NAME)); - assertEquals(Constants.DefaultValues.UNKNOWN, MDC.get(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME)); - assertNotNull(MDC.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); - assertNotNull(MDC.get(ONAPLogConstants.MDCs.ELAPSED_TIME)); - assertNotNull(MDC.get(ONAPLogConstants.MDCs.LOG_TIMESTAMP)); - assertNotNull(MDC.get(ONAPLogConstants.MDCs.SERVER_FQDN)); - } - - @Test - public void errorMDCSetupTest() { - tasksMDCSetup.errorMDCSetup(ErrorCode.UnknownError, "Error"); - - assertEquals("900", MDC.get(ONAPLogConstants.MDCs.ERROR_CODE)); - assertEquals("Error", MDC.get(ONAPLogConstants.MDCs.ERROR_DESC)); - } - - @Test - public void setStatusCodeTest() { - tasksMDCSetup.setStatusCode(); - - assertEquals(ONAPLogConstants.ResponseStatus.COMPLETE.toString(), - MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); - } - - @Test - public void setStatusCodeErrorTest() { - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.ERROR.toString()); - tasksMDCSetup.setStatusCode(); - - assertEquals(ONAPLogConstants.ResponseStatus.ERROR.toString(), - MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); - } -} diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java index bedce185c5..806646022c 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java @@ -34,7 +34,7 @@ import org.onap.so.apihandlerinfra.exceptions.ApiException; import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException; import org.onap.so.apihandlerinfra.exceptions.ValidateException; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import com.fasterxml.jackson.databind.ObjectMapper; import org.slf4j.Logger; diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java index a896078d44..dd51032300 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java @@ -22,7 +22,7 @@ package org.onap.so.apihandlerinfra.logging; import java.io.Serializable; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java index 2cdf4f1a3f..7bd371c974 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java @@ -27,7 +27,7 @@ import org.junit.rules.ExpectedException; import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandlerinfra.exceptions.*; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import java.io.IOException; import java.util.LinkedList; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java index 94e03f1452..d4bc4fd165 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java @@ -64,7 +64,7 @@ import org.onap.so.db.catalog.beans.ServiceRecipe; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.OperationStatus; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java index 88028d32a1..3007ddd7c9 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java @@ -39,7 +39,7 @@ import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.serviceinstancebeans.ModelType; import org.onap.so.serviceinstancebeans.RequestReferences; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java index 34eca2f266..0ec61785fd 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java @@ -50,7 +50,7 @@ import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest; import org.onap.so.apihandlerinfra.tasksbeans.Value; import org.onap.so.apihandlerinfra.tasksbeans.Variables; import org.onap.so.exceptions.ValidationException; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java index b7d3d633d6..4e019ca602 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java @@ -57,7 +57,7 @@ import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.beans.RequestProcessingData; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.serviceinstancebeans.CloudRequestData; import org.onap.so.serviceinstancebeans.GetOrchestrationListResponse; @@ -328,8 +328,6 @@ public class OrchestrationRequests { ir.setVolumeGroupInstanceId(iar.getVolumeGroupId()); if (iar.getVolumeGroupName() != null) ir.setVolumeGroupInstanceName(iar.getVolumeGroupName()); - if (iar.getRequestorId() != null) - ir.setRequestorId(iar.getRequestorId()); if (iar.getInstanceGroupId() != null) ir.setInstanceGroupId(iar.getInstanceGroupId()); if (iar.getInstanceGroupName() != null) diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java index 90cf50262b..836f08adb5 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java @@ -35,7 +35,7 @@ import org.onap.so.apihandler.common.ResponseBuilder; import org.onap.so.apihandlerinfra.exceptions.ApiException; import org.onap.so.db.request.beans.OrchestrationTask; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java index 38fb1596d0..9b37043b2d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java @@ -76,7 +76,7 @@ import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LogConstants; import org.onap.so.logger.MessageEnum; import org.onap.so.serviceinstancebeans.CloudConfiguration; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java index a15d9cfd48..6132815cf6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java @@ -43,7 +43,7 @@ import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; import org.onap.so.constants.Status; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.HttpHeadersConstants; import org.onap.so.logger.LogConstants; import org.onap.so.logger.MdcConstants; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java index 33eae43e44..f1e8e711c4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java @@ -56,7 +56,7 @@ import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java index edc287ce0a..418c702768 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java @@ -50,7 +50,7 @@ import org.onap.so.apihandlerinfra.tasksbeans.TaskList; import org.onap.so.apihandlerinfra.tasksbeans.TaskVariableValue; import org.onap.so.apihandlerinfra.tasksbeans.TaskVariables; import org.onap.so.apihandlerinfra.tasksbeans.TasksGetResponse; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java index d9955352c6..357497591d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java @@ -41,7 +41,7 @@ import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; import org.onap.so.apihandlerinfra.workflowspecificationbeans.*; import org.onap.so.db.catalog.beans.*; import org.onap.so.db.catalog.client.CatalogDbClient; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java index 20e27a5265..3fd672bf42 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java @@ -45,7 +45,7 @@ import org.onap.so.constants.Status; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LogConstants; import org.onap.so.logger.MessageEnum; import org.onap.so.serviceinstancebeans.ModelType; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java index 877376cc79..bb2b89ca82 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java @@ -54,7 +54,7 @@ import org.onap.so.constants.Status; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java index 43f957174c..59c0694ea2 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java @@ -55,7 +55,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestStatus; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java index 2f922220c9..e11635370c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java @@ -44,7 +44,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.Action; import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution; import org.onap.so.apihandlerinfra.tenantisolationbeans.Status; import org.onap.so.exceptions.ValidationException; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.serviceinstancebeans.RequestError; import org.onap.so.serviceinstancebeans.ServiceException; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java index b2596f9013..398e168800 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java @@ -34,7 +34,7 @@ import org.onap.so.apihandlerinfra.tenantisolation.process.CreateVnfOperationalE import org.onap.so.apihandlerinfra.tenantisolation.process.DeactivateVnfOperationalEnvironment; import org.onap.so.apihandlerinfra.tenantisolationbeans.Action; import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.requestsdb.RequestsDBHelper; import org.slf4j.Logger; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java index e9ce0bf99a..2df0a1ff21 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java @@ -27,7 +27,7 @@ import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandlerinfra.exceptions.ApiException; import org.onap.so.apihandlerinfra.exceptions.ValidateException; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java index 65d3109445..f0943393ed 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java @@ -35,7 +35,7 @@ import org.onap.so.apihandlerinfra.exceptions.ValidateException; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.utils.CryptoUtils; import org.onap.logging.filter.base.ONAPComponents; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java index 0005d26016..9b24a14f68 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java @@ -42,7 +42,7 @@ import org.onap.so.client.aai.entities.Relationships; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.db.request.beans.OperationalEnvDistributionStatus; import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.requestsdb.RequestsDBHelper; import org.slf4j.Logger; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java index 624a7f6945..77579817ff 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java @@ -43,7 +43,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.DistributionStatus; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.db.request.beans.OperationalEnvDistributionStatus; import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.requestsdb.RequestsDBHelper; import org.slf4j.Logger; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java index 3812aa9edf..e78823593e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java @@ -31,7 +31,7 @@ import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; import org.onap.so.apihandlerinfra.tenantisolation.dmaap.DmaapOperationalEnvClient; import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper; import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientObjectBuilder; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.requestsdb.RequestsDBHelper; import org.slf4j.Logger; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java index 5eb4a67fa6..d6969a9851 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java @@ -45,7 +45,7 @@ import org.onap.so.client.grm.beans.ServiceEndPoint; import org.onap.so.client.grm.beans.ServiceEndPointList; import org.onap.so.client.grm.beans.ServiceEndPointRequest; import org.onap.so.client.grm.beans.Version; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.requestsdb.RequestsDBHelper; import org.slf4j.Logger; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java index e8ea153a6a..59f7621b90 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java @@ -33,7 +33,7 @@ import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper; import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.requestsdb.RequestsDBHelper; import org.slf4j.Logger; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java index bc867503f2..3d80ec230e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java @@ -27,7 +27,7 @@ import org.junit.rules.ExpectedException; import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandlerinfra.exceptions.*; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import java.io.IOException; import java.util.LinkedList; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java index 46fd2f9025..9b892af869 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java @@ -32,6 +32,7 @@ import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -155,6 +156,7 @@ public class OrchestrationRequestsTest extends BaseTest { assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); assertThat(response.getBody(), sameBeanAs(testResponse).ignoring("request.startTime") .ignoring("request.finishTime").ignoring("request.requestStatus.timeStamp")); + assertNull(response.getBody().getRequest().getInstanceReferences().getRequestorId()); assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0)); assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0)); assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0)); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java index 8d8f4969d7..0f096ee374 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java @@ -46,7 +46,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestInfo; import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters; import org.onap.so.client.aai.AAIVersion; import org.onap.so.db.request.beans.InfraActiveRequests; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.springframework.beans.factory.annotation.Autowired; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json index 8953dfdfe0..e50aed7a33 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json @@ -37,7 +37,7 @@ "networkId": null, "networkName": null, "networkType": null, - "requestorId": null, + "requestorId": "xxxxxx", "configurationId": null, "configurationName": null, "operationalEnvId": null, diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.so-app b/packages/docker/src/main/docker/docker-files/Dockerfile.so-app index e8f02f12c6..84bd2987e3 100644 --- a/packages/docker/src/main/docker/docker-files/Dockerfile.so-app +++ b/packages/docker/src/main/docker/docker-files/Dockerfile.so-app @@ -1,4 +1,4 @@ -FROM onap/so/base-image:1.0 +FROM registry.gitlab.com/onap-integration/docker/onap-java ARG http_proxy ENV HTTP_PROXY=$http_proxy @@ -7,22 +7,18 @@ ARG https_proxy ENV HTTPS_PROXY=$https_proxy ENV https_proxy=$HTTPS_PROXY -RUN mkdir /app && mkdir /app/config && mkdir /app/certificates && mkdir /app/logs && mkdir /app/ca-certificates +USER root +RUN mkdir -p /app/{config,certificates,logs,ca-certificates} +RUN chown -R onap:onap /app && chmod 700 /app/*.sh +USER onap COPY maven/app.jar /app COPY configs/logging/logback-spring.xml /app COPY scripts/start-app.sh /app COPY scripts/wait-for.sh /app COPY ca-certificates/onap-ca.crt /app/ca-certificates/onap-ca.crt -RUN chown -R so:so /app && chmod 700 /app/*.sh - -## TODO for Casablanca: install this in the openstack-adapter container -## Install heatbridge -#RUN apt-get install -y python && apt-get install -y python-pip && echo 'PIP Installed, doing upgrade' && pip install --upgrade pip -#RUN mkdir /opt/mso/heatbridge -#COPY heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl /opt/mso/heatbridge -#RUN pip install /opt/mso/heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl +RUN chmod 700 /app/*.sh # Springboot configuration (required) VOLUME /app/config diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image b/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image deleted file mode 100644 index c0b298e778..0000000000 --- a/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image +++ /dev/null @@ -1,17 +0,0 @@ -FROM docker.io/openjdk:8-jdk-alpine - -ARG http_proxy -ARG https_proxy -ENV HTTP_PROXY=$http_proxy -ENV HTTPS_PROXY=$https_proxy -ENV http_proxy=$HTTP_PROXY -ENV https_proxy=$HTTPS_PROXY - -# Update the package list and upgrade installed packages -RUN apk update && apk upgrade - -# Install commonly needed tools -RUN apk --no-cache add curl netcat-openbsd sudo nss - -# Create 'so' user -RUN addgroup -g 1000 so && adduser -S -u 1000 -G so -s /bin/sh so diff --git a/packages/docker/src/main/docker/docker-files/scripts/start-app.sh b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh index 75d64fefa0..ebab3c6ea3 100644 --- a/packages/docker/src/main/docker/docker-files/scripts/start-app.sh +++ b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh @@ -16,9 +16,9 @@ then update-ca-certificates --fresh fi - # Re-exec this script as the 'so' user. + # Re-exec this script as the 'onap' user. this=`readlink -f $0` - exec su so -c "$this" + exec su onap -c "$this" fi touch /app/app.jar @@ -670,17 +670,17 @@ <dependency> <groupId>org.onap.logging-analytics</groupId> <artifactId>logging-slf4j</artifactId> - <version>1.6.4</version> + <version>1.6.6-SNAPSHOT</version> </dependency> <dependency> <groupId>org.onap.logging-analytics</groupId> <artifactId>logging-filter-base</artifactId> - <version>1.6.4</version> + <version>1.6.6-SNAPSHOT</version> </dependency> <dependency> <groupId>org.onap.logging-analytics</groupId> <artifactId>logging-filter-spring</artifactId> - <version>1.6.4</version> + <version>1.6.6-SNAPSHOT</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> |