diff options
135 files changed, 1540 insertions, 2008 deletions
diff --git a/adapters/mso-adapter-utils/pom.xml b/adapters/mso-adapter-utils/pom.xml index 3057b47ebd..f7d16b20da 100644 --- a/adapters/mso-adapter-utils/pom.xml +++ b/adapters/mso-adapter-utils/pom.xml @@ -10,7 +10,6 @@ <artifactId>mso-adapter-utils</artifactId> <name>mso-adapter-utils</name> <description>Common MSO utilities, including Openstack client wrappers.</description> - <dependencyManagement> <dependencies> <dependency> @@ -27,7 +26,6 @@ <finalName>${project.artifactId}</finalName> <sourceDirectory>src/main/java</sourceDirectory> <plugins> - <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> @@ -75,7 +73,6 @@ </plugin> </plugins> </build> - <dependencies> <dependency> <groupId>org.glassfish.jersey.core</groupId> @@ -84,7 +81,6 @@ <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> <scope>test</scope> </dependency> <dependency> 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 be42ff10bb..743abc0177 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 @@ -30,6 +30,8 @@ import java.util.Scanner; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriBuilderException; +import org.onap.logging.filter.base.ErrorCode; +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.adapters.vdu.CloudInfo; import org.onap.so.adapters.vdu.PluginAction; import org.onap.so.adapters.vdu.VduArtifact; @@ -43,7 +45,6 @@ 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.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; @@ -51,7 +52,6 @@ import org.onap.so.openstack.exceptions.MsoAdapterException; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.exceptions.MsoOpenstackException; import org.onap.so.openstack.mappers.StackInfoMapper; -import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -151,16 +151,16 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin { for (String key : MULTICLOUD_INPUTS) { if (!stackInputs.isEmpty() && stackInputs.containsKey(key)) { - if (key == OOF_DIRECTIVES) { + if (OOF_DIRECTIVES.equals(key)) { oofDirectives = (String) stackInputs.get(key); } - if (key == SDNC_DIRECTIVES) { + if (SDNC_DIRECTIVES.equals(key)) { sdncDirectives = (String) stackInputs.get(key); } - if (key == USER_DIRECTIVES) { + if (USER_DIRECTIVES.equals(key)) { userDirectives = (String) stackInputs.get(key); } - if (key == TEMPLATE_TYPE) { + if (TEMPLATE_TYPE.equals(key)) { templateType = (String) stackInputs.get(key); } if (logger.isDebugEnabled()) { diff --git a/adapters/mso-adapters-rest-interface/pom.xml b/adapters/mso-adapters-rest-interface/pom.xml index 015efd2c4b..5e589b885f 100644 --- a/adapters/mso-adapters-rest-interface/pom.xml +++ b/adapters/mso-adapters-rest-interface/pom.xml @@ -18,8 +18,6 @@ <plugins> <plugin> <artifactId>maven-jar-plugin</artifactId> - <!--<version>2.6</version>--> - <version>3.0.2</version> <configuration> <classesDirectory>target/classes</classesDirectory> </configuration> diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml index 7ba222a86a..89ef373348 100644 --- a/adapters/mso-catalog-db-adapter/pom.xml +++ b/adapters/mso-catalog-db-adapter/pom.xml @@ -6,21 +6,18 @@ <artifactId>adapters</artifactId> <version>1.8.0-SNAPSHOT</version> </parent> - <groupId>org.onap.so.adapters</groupId> <artifactId>mso-catalog-db-adapter</artifactId> <packaging>jar</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <swagger.version>2.0.8</swagger.version> </properties> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> - <version>${springboot.version}</version> <configuration> <mainClass>org.onap.so.adapters.catalogdb.CatalogDBApplication</mainClass> </configuration> @@ -120,33 +117,8 @@ </dependencyManagement> <dependencies> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - - <dependency> - <groupId>com.fasterxml.jackson.dataformat</groupId> - <artifactId>jackson-dataformat-yaml</artifactId> - <version>2.9.9</version> - </dependency> - - <dependency> - <groupId>io.swagger.core.v3</groupId> - <artifactId>swagger-annotations</artifactId> - <version>${swagger.version}</version> - </dependency> - <dependency> <groupId>io.swagger.core.v3</groupId> <artifactId>swagger-jaxrs2</artifactId> - <version>2.0.6</version> - </dependency> - <dependency> - <groupId>org.mariadb.jdbc</groupId> - <artifactId>mariadb-java-client</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> @@ -173,11 +145,6 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>uk.co.blackpepper.bowman</groupId> - <artifactId>bowman-client</artifactId> - <version>${bowman.client.version}</version> - </dependency> - <dependency> <groupId>org.javassist</groupId> <artifactId>javassist</artifactId> <version>3.25.0-GA</version> @@ -185,7 +152,6 @@ <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> <scope>test</scope> </dependency> <dependency> @@ -194,10 +160,6 @@ </dependency> <dependency> <groupId>io.micrometer</groupId> - <artifactId>micrometer-core</artifactId> - </dependency> - <dependency> - <groupId>io.micrometer</groupId> <artifactId>micrometer-registry-prometheus</artifactId> </dependency> </dependencies> diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml index e975425852..32448d31dc 100644 --- a/adapters/mso-openstack-adapters/pom.xml +++ b/adapters/mso-openstack-adapters/pom.xml @@ -160,7 +160,6 @@ <dependency> <groupId>janino</groupId> <artifactId>janino</artifactId> - <version>2.5.15</version> </dependency> <dependency> <groupId>org.pacesys.openstack4j.connectors</groupId> @@ -224,13 +223,11 @@ <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-contract-wiremock</artifactId> - <version>1.2.4.RELEASE</version> <scope>test</scope> </dependency> <dependency> @@ -246,7 +243,6 @@ <dependency> <groupId>org.camunda.bpm</groupId> <artifactId>camunda-external-task-client</artifactId> - <version>1.4.0</version> </dependency> <dependency> <groupId>com.github.seancfoley</groupId> diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java index 010d91fec9..52340d684a 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java @@ -36,6 +36,7 @@ import org.onap.so.openstack.beans.NetworkStatus; import org.onap.so.openstack.beans.RouteTarget; import org.onap.so.openstack.beans.Subnet; +@Deprecated @WebService(name = "NetworkAdapter", targetNamespace = "http://org.onap.so/network") public interface MsoNetworkAdapter { // TODO: Rename all of these to include Vlan in the service name? At least for the diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java index abfacebf05..1446047ebd 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java @@ -34,7 +34,6 @@ import org.apache.cxf.jaxws.EndpointImpl; import org.apache.cxf.transport.servlet.CXFServlet; import org.onap.so.adapters.cloudregion.CloudRegionRestV1; import org.onap.so.adapters.network.MsoNetworkAdapterImpl; -import org.onap.so.adapters.vnf.MsoVnfAdapterAsyncImpl; import org.onap.so.adapters.vnf.MsoVnfAdapterImpl; import org.onap.so.client.policy.JettisonStyleMapperProvider; import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor; @@ -55,8 +54,6 @@ public class CXFConfiguration { @Autowired private MsoVnfAdapterImpl vnfAdapterImpl; @Autowired - private MsoVnfAdapterAsyncImpl vnfAdapterAsyncImpl; - @Autowired private CloudRegionRestV1 cloudRegionRestV1; @Autowired private JettisonStyleMapperProvider jettisonStyleObjectMapper; @@ -92,31 +89,6 @@ public class CXFConfiguration { return endpoint; } - /* - * vnfAdapterEndpoint VnfAsyncAdapterEndpoint VnfCloudAdapterEndpoint - */ - @Bean - public Endpoint vnfAdapterEndpoint() { - EndpointImpl endpoint = new EndpointImpl(springBus(), vnfAdapterImpl); - endpoint.publish("/VnfAdapter"); - endpoint.setWsdlLocation("VnfAdapter.wsdl"); - endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor()); - endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor()); - endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor()); - return endpoint; - } - - @Bean - public Endpoint vnfAsyncAdapterEndpoint() { - EndpointImpl endpoint = new EndpointImpl(springBus(), vnfAdapterAsyncImpl); - endpoint.publish("/VnfAsyncAdapter"); - endpoint.setWsdlLocation("VnfAsyncAdapter.wsdl"); - endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor()); - endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor()); - endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor()); - return endpoint; - } - // Uses normal Jackson marshalling semantics @Bean public Server rsServerApi() { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java index 0dd7635506..15cf4af62a 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java @@ -121,6 +121,8 @@ public class CreateAAIInventory { cloudInformation.getOwner()); logger.debug("Successfully queried neutron resources and built AAI actions to add l-interfaces to vservers."); + heatBridgeClient.buildAddVolumes(stackResources); + // Update AAI logger.debug("Current Dry Run Value: {}", env.getProperty("heatBridgeDryrun", Boolean.class, false)); heatBridgeClient.submitToAai(env.getProperty("heatBridgeDryrun", Boolean.class, false)); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java index 14df4e6941..f13b5bda7c 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java @@ -239,6 +239,7 @@ public class PollService extends ExternalTaskUtils { StackInfo stack = pollCreateResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), stackId, success); outputs = vnfAdapterImpl.copyStringOutputs(stack.getOutputs()); + } VfModuleRollback modRollback = new VfModuleRollback(buildVnfRollback(req, stackId, isMulticloud), req.getVfModuleId(), stackId, req.getMessageId()); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java index d6d2264217..52dfa6a534 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java @@ -61,8 +61,8 @@ public class RollbackService extends ExternalTaskUtils { JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class); boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId()); if (!isMulticloud) { - vnfAdapterImpl.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), - req.getVolumeGroupName(), req.getMsoRequest(), false); + vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), + req.getVolumeGroupName(), null, req.getMsoRequest(), new Holder<>()); pollRollbackStatus = true; success = true; } else { @@ -78,16 +78,11 @@ public class RollbackService extends ExternalTaskUtils { boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId()); if (!isMulticloud) { vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), - req.getVfModuleName(), req.getVnfId(), req.getVfModuleId(), - req.getModelCustomizationUuid(), req.getMsoRequest(), new Holder<>()); + req.getVfModuleName(), req.getModelCustomizationUuid(), req.getMsoRequest(), + new Holder<>()); pollRollbackStatus = true; success = true; } else { - /* - * vnfPluginImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), - * req.getVfModuleName(),req.getMsoRequest(), new Holder<>()); TODO: Figure out how to properly - * rollback - */ pollRollbackStatus = false; success = true; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java index 6b76c3af9a..9d217380d6 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java @@ -55,7 +55,6 @@ import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; import org.onap.so.logging.tasks.AuditMDCSetup; import org.onap.so.openstack.beans.NetworkRollback; import org.onap.so.openstack.beans.RouteTarget; -import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.utils.ExternalTaskUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -97,33 +96,26 @@ public class StackService extends ExternalTaskUtils { String errorMessage = ""; try { if (xmlRequest != null) { - Holder<Map<String, String>> outputs = new Holder<>(); - Holder<VnfRollback> vnfRollback = new Holder<>(); Optional<String> requestType = findRequestType(xmlRequest); - Holder<String> networkId = new Holder<>(); - Holder<String> neutronNetworkId = new Holder<>(); - Holder<String> networkFqdn = new Holder<>(); Holder<Map<String, String>> subnetIdMap = new Holder<>(); Holder<NetworkRollback> networkRollback = new Holder<>(); if ("createVolumeGroupRequest".equals(requestType.get())) { logger.debug("Executing External Task Stack Service For Create Volume Group"); - createVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success); + createVolumeGroup(xmlRequest, canonicalStackId, backout, success); } else if ("createVfModuleRequest".equals(requestType.get())) { logger.debug("Executing External Task Stack Service For Create Vf Module"); - createVfModule(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success); + createVfModule(xmlRequest, canonicalStackId, backout, success); } else if ("deleteVfModuleRequest".equals(requestType.get())) { logger.debug("Executing External Task Stack Service For Delete Vf Module"); - deleteVfModule(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success); + deleteVfModule(xmlRequest, canonicalStackId, backout, success); } else if ("deleteVolumeGroupRequest".equals(requestType.get())) { logger.debug("Executing External Task Stack Service For Delete Volume Group"); - deleteVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success); + deleteVolumeGroup(xmlRequest, canonicalStackId, backout, success); } else if ("createNetworkRequest".equals(requestType.get())) { - createNetwork(xmlRequest, networkId, neutronNetworkId, networkFqdn, subnetIdMap, networkRollback, - canonicalStackId, backout, success, os3Nw); + createNetwork(xmlRequest, subnetIdMap, networkRollback, canonicalStackId, backout, success, os3Nw); } else if ("deleteNetworkRequest".equals(requestType.get())) { deleteNetwork(xmlRequest, canonicalStackId, backout, success); } else if ("updateNetworkRequest".equals(requestType.get())) { - updateNetwork(xmlRequest, subnetIdMap, networkRollback, canonicalStackId, backout, success); } else if ("rollbackNetworkRequest".equals(requestType.get())) { rollbackNetwork(xmlRequest, canonicalStackId, backout, success); @@ -152,8 +144,7 @@ public class StackService extends ExternalTaskUtils { } } - private void createVolumeGroup(String xmlRequest, Holder<Map<String, String>> outputs, - Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout, + private void createVolumeGroup(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout, MutableBoolean success) throws VnfException { CreateVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class); String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType(); @@ -162,19 +153,19 @@ public class StackService extends ExternalTaskUtils { vnfPluginImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), completeVnfVfModuleType, req.getVnfVersion(), "", req.getVolumeGroupName(), "", "VOLUME", null, null, req.getModelCustomizationUuid(), req.getVolumeGroupParams(), false, true, - req.getEnableBridge(), req.getMsoRequest(), canonicalStackId, outputs, vnfRollback); + req.getEnableBridge(), req.getMsoRequest(), canonicalStackId); } else { vnfAdapterImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), completeVnfVfModuleType, req.getVnfVersion(), "", req.getVolumeGroupName(), "", "VOLUME", null, null, req.getModelCustomizationUuid(), req.getVolumeGroupParams(), false, true, - req.getEnableBridge(), req.getMsoRequest(), canonicalStackId, outputs, vnfRollback); + req.getEnableBridge(), req.getMsoRequest(), canonicalStackId); } success.setTrue(); backout.setValue(!req.getSuppressBackout()); } - private void createVfModule(String xmlRequest, Holder<Map<String, String>> outputs, Holder<VnfRollback> vnfRollback, - Holder<String> canonicalStackId, MutableBoolean backout, MutableBoolean success) throws VnfException { + private void createVfModule(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout, + MutableBoolean success) throws VnfException { CreateVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVfModuleRequest.class); String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType(); boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId()); @@ -183,21 +174,22 @@ public class StackService extends ExternalTaskUtils { completeVnfVfModuleType, req.getVnfVersion(), req.getVnfId(), req.getVfModuleName(), req.getVfModuleId(), req.getRequestType(), req.getVolumeGroupStackId(), req.getBaseVfModuleStackId(), req.getModelCustomizationUuid(), req.getVfModuleParams(), false, - false, req.getEnableBridge(), req.getMsoRequest(), canonicalStackId, outputs, vnfRollback); + false, req.getEnableBridge(), req.getMsoRequest(), canonicalStackId); } else { vnfAdapterImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), completeVnfVfModuleType, req.getVnfVersion(), req.getVnfId(), req.getVfModuleName(), req.getVfModuleId(), req.getRequestType(), req.getVolumeGroupStackId(), req.getBaseVfModuleStackId(), req.getModelCustomizationUuid(), req.getVfModuleParams(), false, - false, req.getEnableBridge(), req.getMsoRequest(), canonicalStackId, outputs, vnfRollback); + false, req.getEnableBridge(), req.getMsoRequest(), canonicalStackId); } success.setTrue(); backout.setValue(req.getBackout()); } - private void deleteVfModule(String xmlRequest, Holder<Map<String, String>> outputs, Holder<VnfRollback> vnfRollback, - Holder<String> canonicalStackId, MutableBoolean backout, MutableBoolean success) throws VnfException { + private void deleteVfModule(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout, + MutableBoolean success) throws VnfException { backout.setFalse(); + Holder<Map<String, String>> outputs = new Holder<>(); DeleteVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteVfModuleRequest.class); boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId()); if (isMulticloud) { @@ -205,8 +197,7 @@ public class StackService extends ExternalTaskUtils { req.getVfModuleStackId(), req.getMsoRequest(), outputs); } else { vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), - req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(), req.getModelCustomizationUuid(), - req.getMsoRequest(), outputs); + req.getVfModuleStackId(), req.getModelCustomizationUuid(), req.getMsoRequest(), outputs); } success.setTrue(); if (outputs != null && outputs.value != null) { @@ -216,21 +207,24 @@ public class StackService extends ExternalTaskUtils { } } - private void deleteVolumeGroup(String xmlRequest, Holder<Map<String, String>> outputs, - Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout, + private void deleteVolumeGroup(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout, MutableBoolean success) throws VnfException { backout.setFalse(); DeleteVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteVolumeGroupRequest.class); - vnfAdapterImpl.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), - req.getVolumeGroupStackId(), req.getMsoRequest(), false); + vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), + req.getVolumeGroupStackId(), null, req.getMsoRequest(), new Holder<>()); success.setTrue(); canonicalStackId.value = req.getVolumeGroupStackId(); } - private void createNetwork(String xmlRequest, Holder<String> networkId, Holder<String> neutronNetworkId, - Holder<String> networkFqdn, Holder<Map<String, String>> subnetIdMap, + private void createNetwork(String xmlRequest, Holder<Map<String, String>> subnetIdMap, Holder<NetworkRollback> networkRollback, Holder<String> canonicalStackId, MutableBoolean backout, MutableBoolean success, MutableBoolean os3) throws NetworkException { + + Holder<String> networkId = new Holder<>(); + Holder<String> neutronNetworkId = new Holder<>(); + Holder<String> networkFqdn = new Holder<>(); + CreateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateNetworkRequest.class); HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams(); if (params == null) { 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 deleted file mode 100644 index 5b0370b25e..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java +++ /dev/null @@ -1,296 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vnf; - - -import java.security.GeneralSecurityException; -import java.util.Set; -import java.util.TreeSet; -import javax.annotation.PostConstruct; -import javax.xml.bind.DatatypeConverter; -import org.apache.http.HttpEntity; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -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.logging.filter.base.ErrorCode; -import org.onap.so.logger.MessageEnum; -import org.onap.so.utils.CryptoUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Component; - -/** - * This is the class that is used to POST replies from the MSO adapters to the BPEL engine. It can be configured via - * property file, or modified using the member methods. The properties to use are: org.onap.so.adapters.vnf.bpelauth - * encrypted authorization string to send to BEPL engine org.onap.so.adapters.vnf.sockettimeout socket timeout value - * org.onap.so.adapters.vnf.connecttimeout connect timeout value org.onap.so.adapters.vnf.retrycount number of times to - * retry failed connections org.onap.so.adapters.vnf.retryinterval interval (in seconds) between retries - * org.onap.so.adapters.vnf.retrylist list of response codes that will trigger a retry (the special code 900 means - * "connection was not established") - */ -@Component -@Scope("prototype") -public class BpelRestClient { - public static final String MSO_PROP_VNF_ADAPTER = "MSO_PROP_VNF_ADAPTER"; - private static final String PROPERTY_DOMAIN = "org.onap.so.adapters.vnf"; - private static final String BPEL_AUTH_PROPERTY = PROPERTY_DOMAIN + ".bpelauth"; - private static final String SOCKET_TIMEOUT_PROPERTY = PROPERTY_DOMAIN + ".sockettimeout"; - private static final String CONN_TIMEOUT_PROPERTY = PROPERTY_DOMAIN + ".connecttimeout"; - private static final String RETRY_COUNT_PROPERTY = PROPERTY_DOMAIN + ".retrycount"; - private static final String RETRY_INTERVAL_PROPERTY = PROPERTY_DOMAIN + ".retryinterval"; - private static final String RETRY_LIST_PROPERTY = PROPERTY_DOMAIN + ".retrylist"; - private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; - private static final Logger logger = LoggerFactory.getLogger(BpelRestClient.class); - - /** Default socket timeout (in seconds) */ - public static final int DEFAULT_SOCKET_TIMEOUT = 5; - /** Default connect timeout (in seconds) */ - public static final int DEFAULT_CONNECT_TIMEOUT = 5; - /** By default, retry up to five times */ - public static final int DEFAULT_RETRY_COUNT = 5; - /** Default interval to wait between retries (in seconds), negative means use backoff algorithm */ - public static final int DEFAULT_RETRY_INTERVAL = -15; - /** Default list of response codes to trigger a retry */ - public static final String DEFAULT_RETRY_LIST = "408,429,500,502,503,504,900"; // 900 is "connection failed" - /** Default credentials */ - public static final String DEFAULT_CREDENTIALS = ""; - - @Autowired - private Environment env; - // Properties of the BPEL client -- all are configurable - private int socketTimeout; - private int connectTimeout; - private int retryCount; - private int retryInterval; - private Set<Integer> retryList; - private String credentials; - - // last response from BPEL engine - private int lastResponseCode; - private String lastResponse; - - /** - * Create a client to send results to the BPEL engine, using configuration from the MSO_PROP_VNF_ADAPTER properties. - */ - public BpelRestClient() { - socketTimeout = DEFAULT_SOCKET_TIMEOUT; - connectTimeout = DEFAULT_CONNECT_TIMEOUT; - retryCount = DEFAULT_RETRY_COUNT; - retryInterval = DEFAULT_RETRY_INTERVAL; - setRetryList(DEFAULT_RETRY_LIST); - credentials = DEFAULT_CREDENTIALS; - lastResponseCode = 0; - lastResponse = ""; - - } - - @PostConstruct - protected void init() { - - socketTimeout = env.getProperty(SOCKET_TIMEOUT_PROPERTY, Integer.class, DEFAULT_SOCKET_TIMEOUT); - connectTimeout = env.getProperty(CONN_TIMEOUT_PROPERTY, Integer.class, DEFAULT_CONNECT_TIMEOUT); - retryCount = env.getProperty(RETRY_COUNT_PROPERTY, Integer.class, DEFAULT_RETRY_COUNT); - retryInterval = env.getProperty(RETRY_INTERVAL_PROPERTY, Integer.class, DEFAULT_RETRY_INTERVAL); - setRetryList(env.getProperty(RETRY_LIST_PROPERTY, DEFAULT_RETRY_LIST)); - credentials = getEncryptedProperty(BPEL_AUTH_PROPERTY, DEFAULT_CREDENTIALS, ENCRYPTION_KEY_PROP); - } - - public int getSocketTimeout() { - return socketTimeout; - } - - public void setSocketTimeout(int socketTimeout) { - this.socketTimeout = socketTimeout; - } - - public int getConnectTimeout() { - return connectTimeout; - } - - public void setConnectTimeout(int connectTimeout) { - this.connectTimeout = connectTimeout; - } - - public int getRetryCount() { - return retryCount; - } - - public void setRetryCount(int retryCount) { - int newRetryCount = retryCount; - if (newRetryCount < 0) - newRetryCount = DEFAULT_RETRY_COUNT; - this.retryCount = newRetryCount; - } - - public int getRetryInterval() { - return retryInterval; - } - - public void setRetryInterval(int retryInterval) { - this.retryInterval = retryInterval; - } - - public String getCredentials() { - return credentials; - } - - public void setCredentials(String credentials) { - this.credentials = credentials; - } - - public String getRetryList() { - if (retryList.isEmpty()) - return ""; - String t = retryList.toString(); - return t.substring(1, t.length() - 1); - } - - public void setRetryList(String retryList) { - Set<Integer> s = new TreeSet<>(); - for (String t : retryList.split("[, ]")) { - try { - s.add(Integer.parseInt(t)); - } catch (NumberFormatException x) { - // ignore - } - } - this.retryList = s; - } - - public int getLastResponseCode() { - return lastResponseCode; - } - - public String getLastResponse() { - return lastResponse; - } - - /** - * Post a response to the URL of the BPEL engine. As long as the response code is one of those in the retryList, the - * post will be retried up to "retrycount" times with an interval (in seconds) of "retryInterval". If retryInterval - * is negative, then each successive retry interval will be double the previous one. - * - * @param toBpelStr the content (XML or JSON) to post - * @param bpelUrl the URL to post to - * @param isxml true if the content is XML, otherwise assumed to be JSON - * @return true if the post succeeded, false if all retries failed - */ - public boolean bpelPost(final String toBpelStr, final String bpelUrl, final boolean isxml) { - int totalretries = 0; - int retryint = retryInterval; - while (true) { - sendOne(toBpelStr, bpelUrl, isxml); - // Note: really should handle response code 415 by switching between content types if needed - if (!retryList.contains(lastResponseCode)) { - debug("Got response code: " + lastResponseCode + ": returning."); - return true; - } - if (totalretries >= retryCount) { - debug("Retried " + totalretries + " times, giving up."); - logger.error("{} {} Could not deliver response to BPEL after {} tries: {}", - MessageEnum.RA_SEND_VNF_NOTIF_ERR, ErrorCode.BusinessProcessError.getValue(), totalretries, - toBpelStr); - return false; - } - totalretries++; - int sleepinterval = retryint; - if (retryint < 0) { - // if retry interval is negative double the retry on each pass - sleepinterval = -retryint; - retryint *= 2; - } - debug("Sleeping for " + sleepinterval + " seconds."); - try { - Thread.sleep(sleepinterval * 1000L); - } catch (InterruptedException e) { - logger.debug("Exception while Thread sleep", e); - Thread.currentThread().interrupt(); - } - } - } - - private void debug(String m) { - logger.debug(m); - } - - private void sendOne(final String toBpelStr, final String bpelUrl, final boolean isxml) { - logger.debug("Sending to BPEL server: {}", bpelUrl); - logger.debug("Content is: {}", toBpelStr); - - // POST - HttpPost post = new HttpPost(bpelUrl); - if (credentials != null && !credentials.isEmpty()) - post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(credentials.getBytes())); - - logger.debug("HTTPPost Headers: {}", post.getAllHeaders()); - - // ContentType - ContentType ctype = isxml ? ContentType.APPLICATION_XML : ContentType.APPLICATION_JSON; - post.setEntity(new StringEntity(toBpelStr, ctype)); - - // Timeouts - RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(socketTimeout * 1000) - .setConnectTimeout(connectTimeout * 1000).build(); - post.setConfig(requestConfig); - - try (CloseableHttpClient client = HttpClients.createDefault()) { - CloseableHttpResponse response = client.execute(post); - if (response != null) { - lastResponseCode = response.getStatusLine().getStatusCode(); - HttpEntity entity = response.getEntity(); - lastResponse = (entity != null) ? EntityUtils.toString(entity) : ""; - } else { - lastResponseCode = 900; - lastResponse = ""; - } - } catch (Exception e) { - logger.error("{} {} Exception - Error sending Bpel notification: {} ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - ErrorCode.BusinessProcessError.getValue(), toBpelStr, e); - lastResponseCode = 900; - lastResponse = ""; - } - - logger.debug("Response code from BPEL server: {}", lastResponseCode); - logger.debug("Response body is: {}", lastResponse); - } - - private String getEncryptedProperty(String key, String defaultValue, String encryptionKey) { - if (env.getProperty(key) != null) { - try { - return CryptoUtils.decrypt(env.getProperty(key), env.getProperty(encryptionKey)); - } catch (GeneralSecurityException e) { - logger.debug("Exception while decrypting property: {} ", env.getProperty(key), e); - } - } - return defaultValue; - } - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java deleted file mode 100644 index 4b9c36b7b7..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vnf; - - -import java.util.Map; -import javax.jws.Oneway; -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebService; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import org.onap.so.entity.MsoRequest; -import org.onap.so.openstack.mappers.MapAdapter; - -/** - * This webservice defines the Asynchronous versions of VNF adapter calls. The notification messages for final responses - * are documented elsewhere (by the client service WSDL). - * - */ -@Deprecated -@WebService(name = "VnfAdapterAsync", targetNamespace = "http://org.onap.so/vnfA") -public interface MsoVnfAdapterAsync { - /** - * This is the "Create VNF" Web Service Endpoint definition. - */ - @WebMethod - @Oneway - public void createVnfA(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId, - @WebParam(name = "cloudOwner") @XmlElement(required = false) String cloudOwner, - @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId, - @WebParam(name = "vnfType") @XmlElement(required = true) String vnfType, - @WebParam(name = "vnfVersion") @XmlElement(required = false) String vnfVersion, - @WebParam(name = "vnfName") @XmlElement(required = true) String vnfName, - @WebParam(name = "requestType") @XmlElement(required = false) String requestType, - @WebParam(name = "volumeGroupHeatStackId") @XmlElement(required = false) String volumeGroupHeatStackId, - @WebParam(name = "inputs") @XmlJavaTypeAdapter(MapAdapter.class) Map<String, Object> inputs, - @WebParam(name = "failIfExists") Boolean failIfExists, @WebParam(name = "backout") Boolean backout, - @WebParam(name = "enableBridge") Boolean enableBridge, - @WebParam(name = "messageId") @XmlElement(required = true) String messageId, - @WebParam(name = "request") MsoRequest msoRequest, - @WebParam(name = "notificationUrl") @XmlElement(required = true) String notificationUrl); - - @WebMethod - @Oneway - public void deleteVnfA(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId, - @WebParam(name = "cloudOwner") @XmlElement(required = false) String cloudOwner, - @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId, - @WebParam(name = "vnfName") @XmlElement(required = true) String vnfName, - @WebParam(name = "messageId") @XmlElement(required = true) String messageId, - @WebParam(name = "request") MsoRequest msoRequest, - @WebParam(name = "notificationUrl") @XmlElement(required = true) String notificationUrl); - - - @WebMethod - public void healthCheckA(); -} 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 deleted file mode 100644 index 3bea44b884..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java +++ /dev/null @@ -1,342 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vnf; - - -import java.net.MalformedURLException; -import java.net.URL; -import java.security.GeneralSecurityException; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.jws.WebService; -import javax.xml.bind.DatatypeConverter; -import javax.xml.namespace.QName; -import javax.xml.ws.BindingProvider; -import javax.xml.ws.Holder; -import javax.xml.ws.handler.MessageContext; -import org.onap.so.adapters.vnf.async.client.CreateVnfNotification; -import org.onap.so.adapters.vnf.async.client.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.logging.filter.base.ErrorCode; -import org.onap.so.logger.LoggingAnchor; -import org.onap.so.logger.MessageEnum; -import org.onap.so.openstack.beans.VnfRollback; -import org.onap.so.utils.CryptoUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Component; - -@WebService(serviceName = "VnfAdapterAsync", endpointInterface = "org.onap.so.adapters.vnf.MsoVnfAdapterAsync", - targetNamespace = "http://org.onap.so/vnfA") -@Component -public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { - - private static final Logger logger = LoggerFactory.getLogger(MsoVnfAdapterAsyncImpl.class); - - private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.vnf.bpelauth"; - private static final String ENCRYPTION_KEY_PROP = "mso.msoKey"; - - @Autowired - private Environment environment; - - @Autowired - private MsoVnfAdapterImpl vnfImpl; - - /** - * Health Check web method. Does nothing but return to show the adapter is deployed. - */ - @Override - public void healthCheckA() { - logger.debug("Health check call in VNF Adapter"); - } - - /** - * This is the asynchronous "Create VNF" web service implementation. It will create a new VNF of the requested type - * in the specified cloud and tenant. The tenant must exist before this service is called. - * - * If a VNF with the same name already exists, this can be considered a success or failure, depending on the value - * of the 'failIfExists' parameter. - * - * All VNF types will be defined in the MSO catalog. The caller must request one of these pre-defined types or an - * error will be returned. Within the catalog, each VNF type references (among other things) a Heat template which - * is used to deploy the required VNF artifacts (VMs, networks, etc.) to the cloud. - * - * Depending on the Heat template, a variable set of input parameters will be defined, some of which are required. - * The caller is responsible to pass the necessary input data for the VNF or an error will be thrown. - * - * The method sends an asynchronous response to the notification URL when processing completes. The - * createAsyncResponse contains the vnfId (the canonical name of the stack), a Map of VNF output attributes, and a - * VnfRollback object. This last object can be passed as-is to the rollbackVnf operation to undo everything that was - * created for the VNF. This is useful if a VNF is successfully created but the orchestrator fails on a subsequent - * operation. - * - * Note: this method is implemented by calling the synchronous web method and translating the response to an - * asynchronous notification. - * - * @param cloudSiteId CLLI code of the cloud site in which to create the VNF - * @param cloudOwner cloud owner of the cloud site in which to create the VNF - * @param tenantId Openstack tenant identifier - * @param vnfType VNF type key, should match a VNF definition in catalog DB - * @param vnfName Name to be assigned to the new VNF - * @param inputs Map of key=value inputs for VNF stack creation - * @param failIfExists Flag whether already existing VNF should be considered a success or failure - * @param msoRequest Request tracking information for logs - * @param notificationURL the target URL for asynchronous response - */ - @Override - public void createVnfA(String cloudSiteId, String cloudOwner, String tenantId, String vnfType, String vnfVersion, - String vnfName, String requestType, String volumeGroupHeatStackId, Map<String, Object> inputs, - Boolean failIfExists, Boolean backout, Boolean enableBridge, String messageId, MsoRequest msoRequest, - String notificationUrl) { - - logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF); - // Synchronous Web Service Outputs - Holder<String> vnfId = new Holder<>(); - Holder<Map<String, String>> outputs = new Holder<>(); - Holder<VnfRollback> vnfRollback = new Holder<>(); - - try { - vnfImpl.createVnf(cloudSiteId, cloudOwner, tenantId, vnfType, vnfVersion, vnfName, requestType, - volumeGroupHeatStackId, inputs, failIfExists, backout, enableBridge, msoRequest, vnfId, outputs, - vnfRollback); - } catch (VnfException e) { - logger.error("{} {} VnfException in createVnfA ", MessageEnum.RA_CREATE_VNF_ERR, - ErrorCode.BusinessProcessError.getValue(), e); - org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; - String eMsg = null; - try { - eMsg = e.getFaultInfo().getMessage(); - exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory - .fromValue(e.getFaultInfo().getCategory().name()); - } catch (Exception e1) { - logger.error("{} {} Exception - Fault info ", MessageEnum.RA_FAULT_INFO_EXC, - ErrorCode.BusinessProcessError.getValue(), e1); - } - // Build and send Asynchronous error response - try { - VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl); - notifyPort.createVnfNotification(messageId, false, exCat, eMsg, null, null, null); - } catch (Exception e1) { - logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - ErrorCode.BusinessProcessError.getValue(), e1); - } - logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE); - return; - } - logger.debug("Async Create VNF: {} VnfId:{}", vnfName, vnfId.value); - // Build and send Asynchronous response - try { - VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl); - notifyPort.createVnfNotification(messageId, true, null, null, vnfId.value, copyCreateOutputs(outputs), - copyVrb(vnfRollback)); - } catch (Exception e) { - logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - ErrorCode.BusinessProcessError.getValue(), e); - } - logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE); - return; - } - - /** - * This is the Asynchronous "Delete VNF" web service implementation. It will delete a VNF by name or ID in the - * specified cloud and tenant. - * - * The method has no outputs. - * - * @param cloudSiteId CLLI code of the cloud site in which to delete - * @param cloudOwner cloud owner of cloud site in which to delete - * @param tenantId Openstack tenant identifier - * @param vnfName VNF Name or Openstack ID - * @param msoRequest Request tracking information for logs - * @param notificationURL the target URL for asynchronous response - */ - @Override - public void deleteVnfA(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String messageId, - MsoRequest msoRequest, String notificationUrl) { - - logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_DELETE_VNF); - - try { - vnfImpl.deleteVnf(cloudSiteId, cloudOwner, tenantId, vnfName, msoRequest); - } catch (VnfException e) { - logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_DELETE_VNF_ERR, - ErrorCode.BusinessProcessError.getValue(), e); - org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; - String eMsg = null; - try { - eMsg = e.getFaultInfo().getMessage(); - exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory - .fromValue(e.getFaultInfo().getCategory().name()); - } catch (Exception e1) { - logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC, - ErrorCode.BusinessProcessError.getValue(), e1); - } - // Build and send Asynchronous error response - try { - VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl); - notifyPort.deleteVnfNotification(messageId, false, exCat, eMsg); - } catch (Exception e1) { - logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - ErrorCode.BusinessProcessError.getValue(), e1); - } - logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE); - return; - } - - logger.debug("Async Delete VNF: {}", vnfName); - // Build and send Asynchronous response - try { - VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl); - notifyPort.deleteVnfNotification(messageId, true, null, null); - - } catch (Exception e) { - logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - ErrorCode.BusinessProcessError.getValue(), e); - } - - logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE); - return; - } - - private org.onap.so.adapters.vnf.async.client.VnfRollback copyVrb(Holder<VnfRollback> hVrb) { - org.onap.so.adapters.vnf.async.client.VnfRollback cvrb = - new org.onap.so.adapters.vnf.async.client.VnfRollback(); - - if (hVrb != null && hVrb.value != null) { - org.onap.so.adapters.vnf.async.client.MsoRequest cmr = - new org.onap.so.adapters.vnf.async.client.MsoRequest(); - - cvrb.setCloudSiteId(hVrb.value.getCloudSiteId()); - if (hVrb.value.getMsoRequest() != null) { - cmr.setRequestId(hVrb.value.getMsoRequest().getRequestId()); - cmr.setServiceInstanceId(hVrb.value.getMsoRequest().getServiceInstanceId()); - } else { - cmr.setRequestId(null); - cmr.setServiceInstanceId(null); - } - cvrb.setMsoRequest(cmr); - cvrb.setVnfId(hVrb.value.getVnfId()); - cvrb.setTenantId(hVrb.value.getTenantId()); - cvrb.setTenantCreated(hVrb.value.getTenantCreated()); - cvrb.setVnfCreated(hVrb.value.getVnfCreated()); - } - return cvrb; - } - - private CreateVnfNotification.Outputs copyCreateOutputs(Holder<Map<String, String>> hMap) { - - CreateVnfNotification.Outputs outputs = new CreateVnfNotification.Outputs(); - - if (hMap != null && hMap.value != null) { - Map<String, String> sMap; - sMap = hMap.value; - CreateVnfNotification.Outputs.Entry entry = new CreateVnfNotification.Outputs.Entry(); - - for (String key : sMap.keySet()) { - entry.setKey(key); - entry.setValue(sMap.get(key)); - outputs.getEntry().add(entry); - } - } - return outputs; - } - - private VnfAdapterNotify getNotifyEP(String notificationUrl) { - - URL warWsdlLoc = null; - try { - warWsdlLoc = Thread.currentThread().getContextClassLoader().getResource("VnfAdapterNotify.wsdl"); - } catch (Exception e) { - logger.error("{} {} Exception - WSDL not found ", MessageEnum.RA_WSDL_NOT_FOUND, - ErrorCode.BusinessProcessError.getValue(), e); - } - if (warWsdlLoc == null) { - logger.error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND, - ErrorCode.BusinessProcessError.getValue()); - } else { - try { - logger.debug("VnfAdpaterNotify.wsdl location:{}", warWsdlLoc.toURI().toString()); - } catch (Exception e) { - logger.error("{} {} Exception - WSDL URL convention ", MessageEnum.RA_WSDL_URL_CONVENTION_EXC, - ErrorCode.BusinessProcessError.getValue(), e); - } - } - - VnfAdapterNotify_Service notifySvc = - new VnfAdapterNotify_Service(warWsdlLoc, new QName("http://org.onap.so/vnfNotify", "vnfAdapterNotify")); - - VnfAdapterNotify notifyPort = notifySvc.getMsoVnfAdapterAsyncImplPort(); - - BindingProvider bp = (BindingProvider) notifyPort; - - URL epUrl = null; - try { - epUrl = new URL(notificationUrl); - } catch (MalformedURLException e1) { - logger.error("{} {} MalformedURLException ", MessageEnum.RA_INIT_NOTIF_EXC, - ErrorCode.BusinessProcessError.getValue(), e1); - } - - if (null != epUrl) { - logger.debug("Notification Endpoint URL: {}", epUrl.toExternalForm()); - bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm()); - } else { - logger.debug("epUrl is NULL:"); - } - - // authentication - try { - Map<String, Object> reqCtx = bp.getRequestContext(); - Map<String, List<String>> headers = new HashMap<>(); - - String userCredentials = this.getEncryptedProperty(BPEL_AUTH_PROP, "", ENCRYPTION_KEY_PROP); - - String basicAuth = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()); - reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers); - headers.put("Authorization", Collections.singletonList(basicAuth)); - } catch (Exception e) { - logger.error("{} {} Exception - Unable to set authorization in callback request ", - MessageEnum.RA_SET_CALLBACK_AUTH_EXC, ErrorCode.BusinessProcessError.getValue(), e); - } - - return notifyPort; - } - - public String getEncryptedProperty(String key, String defaultValue, String encryptionKey) { - try { - return CryptoUtils.decrypt(this.environment.getProperty(key), this.environment.getProperty(encryptionKey)); - } catch (GeneralSecurityException e) { - logger.debug("Exception while decrypting property: {} ", this.environment.getProperty(key), e); - } - return defaultValue; - - } - -} 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 4ee6cf259e..92d1c5f684 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 @@ -184,7 +184,7 @@ public class MsoVnfAdapterImpl { } this.createVfModule(cloudSiteId, cloudOwner, tenantId, vnfType, vnfVersion, genericVnfId, vnfName, vfModuleId, newRequestType, vfVolGroupHeatStackId, vfBaseHeatStackId, null, inputs, failIfExists, - backout, enableBridge, msoRequest, vnfId, outputs, rollback); + backout, enableBridge, msoRequest, vnfId); return; } // createVf will know if the requestType starts with "X" that it's the "old" way @@ -196,89 +196,12 @@ public class MsoVnfAdapterImpl { } this.createVfModule(cloudSiteId, cloudOwner, tenantId, vnfType, vnfVersion, genericVnfId, vnfName, vfModuleId, newRequestTypeSb.toString(), vfVolGroupHeatStackId, vfBaseHeatStackId, null, inputs, failIfExists, - backout, enableBridge, msoRequest, vnfId, outputs, rollback); + backout, enableBridge, msoRequest, vnfId); return; // End createVf shortcut } /** - * This is the "Delete VNF" web service implementation. It will delete a VNF by name or ID in the specified cloud - * and tenant. - * - * The method has no outputs. - * - * @param cloudSiteId CLLI code of the cloud site in which to delete - * @param cloudOwner cloud owner of the cloud region in which to delete - * @param tenantId Openstack tenant identifier - * @param vnfName VNF Name or Openstack ID - * @param msoRequest Request tracking information for logs - */ - @Deprecated - public void deleteVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest) - throws VnfException { - - logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); - - try { - StackInfo stackInfo = msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true, 118); - - msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(), - stackInfo.isOperationPerformed() ? String.format(RESOURCE_DELETED_STATUS_MESSAGE, VOLUME_GROUP) - : String.format(RESOURCE_NOT_EXIST_STATUS_MESSAGE, VOLUME_GROUP, VOLUME_GROUP)); - } catch (MsoException me) { - me.addContext(DELETE_VNF); - // Failed to query the Stack due to an openstack exception. - // Convert to a generic VnfException - String error = - "Delete VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, - tenantId, OPENSTACK, DELETE_VNF, ErrorCode.DataError.getValue(), "Exception - " + DELETE_VNF, me); - logger.debug(error); - throw new VnfException(me); - } - - // On success, nothing is returned. - return; - } - - /** - * This is the "Delete VNF" web service implementation. It will delete a VNF by name or ID in the specified cloud - * and tenant. - * - * The method has no outputs. - * - * @param cloudSiteId CLLI code of the cloud site in which to delete - * @param cloudOwner cloud owner of the cloud region in which to delete - * @param tenantId Openstack tenant identifier - * @param vnfName VNF Name or Openstack ID - * @param msoRequest Request tracking information for logs - */ - @Deprecated - public void deleteVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest, - boolean pollStackStatus) throws VnfException { - - logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); - - try { - msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, pollStackStatus, 118); - } catch (MsoException me) { - me.addContext(DELETE_VNF); - // Failed to query the Stack due to an openstack exception. - // Convert to a generic VnfException - String error = - "Delete VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, - tenantId, OPENSTACK, DELETE_VNF, ErrorCode.DataError.getValue(), "Exception - " + DELETE_VNF, me); - logger.debug(error); - throw new VnfException(me); - } - - // On success, nothing is returned. - return; - } - - - /** * This web service endpoint will rollback a previous Create VNF operation. A rollback object is returned to the * client in a successful creation response. The client can pass that object as-is back to the rollbackVnf operation * to undo the creation. @@ -408,14 +331,12 @@ public class MsoVnfAdapterImpl { return stringMap; } - // TODO remove rollback and outputs and polling + // TODO remove polling public void createVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfType, String vnfVersion, String genericVnfName, String vnfName, String vfModuleId, String requestType, String volumeGroupHeatStackId, String baseVfHeatStackId, String modelCustomizationUuid, Map<String, Object> inputs, Boolean failIfExists, Boolean backout, Boolean enableBridge, - MsoRequest msoRequest, Holder<String> vnfId, Holder<Map<String, String>> outputs, - Holder<VnfRollback> rollback) throws VnfException { - boolean pollForCompletion = false; + MsoRequest msoRequest, Holder<String> stackId) throws VnfException { String vfModuleName = vnfName; String vfModuleType = vnfType; String vfVersion = vnfVersion; @@ -465,19 +386,6 @@ public class MsoVnfAdapterImpl { logger.debug("requestTypeString = " + requestTypeString + ", nestedStackId = " + nestedStackId + ", nestedBaseStackId = " + nestedBaseStackId); - // TODO remove - // Build a default rollback object (no actions performed) - VnfRollback vfRollback = new VnfRollback(); - vfRollback.setCloudSiteId(cloudSiteId); - vfRollback.setCloudOwner(cloudOwner); - vfRollback.setTenantId(tenantId); - vfRollback.setMsoRequest(msoRequest); - vfRollback.setRequestType(requestTypeString); - vfRollback.setVolumeGroupHeatStackId(volumeGroupHeatStackId); - vfRollback.setBaseGroupHeatStackId(baseVfHeatStackId); - vfRollback.setIsBase(isBaseRequest); - vfRollback.setModelCustomizationUuid(mcu); - // handle a nestedStackId if sent- this one would be for the volume - so applies to both Vf and Vnf StackInfo nestedHeatStack = null; Map<String, Object> nestedVolumeOutputs = null; @@ -931,9 +839,8 @@ public class MsoVnfAdapterImpl { } if (msoHeatUtils != null) { heatStack = msoHeatUtils.createStack(cloudSiteId, cloudOwner, tenantId, vfModuleName, null, - template, goldenInputs, pollForCompletion, heatTemplate.getTimeoutMinutes(), - newEnvironmentString, nestedTemplatesChecked, heatFilesObjects, backout.booleanValue(), - failIfExists); + template, goldenInputs, false, heatTemplate.getTimeoutMinutes(), newEnvironmentString, + nestedTemplatesChecked, heatFilesObjects, backout.booleanValue(), failIfExists); String resource = VF_MODULE; if (isVolumeRequest) { resource = VOLUME_GROUP; @@ -958,14 +865,8 @@ public class MsoVnfAdapterImpl { logger.error("Error creating Stack", e); throw new VnfException("Exception during heat.createStack! " + e.getMessage()); } - // Reach this point if createStack is successful. - // Populate remaining rollback info and response parameters. - vfRollback.setVnfId(heatStack.getCanonicalName()); - vfRollback.setVnfCreated(true); - vnfId.value = heatStack.getCanonicalName(); - outputs.value = copyStringOutputs(heatStack.getOutputs()); - rollback.value = vfRollback; // TODO remove + stackId.value = heatStack.getCanonicalName(); logger.debug("VF Module {} successfully created", vfModuleName); } catch (Exception e) { logger.debug("unhandled exception in create VF", e); @@ -973,19 +874,19 @@ public class MsoVnfAdapterImpl { } } - public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String vnfId, - String vfModuleId, String modelCustomizationUuid, MsoRequest msoRequest, - Holder<Map<String, String>> outputs) throws VnfException { + public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String stackId, + String modelCustomizationUuid, MsoRequest msoRequest, Holder<Map<String, String>> outputs) + throws VnfException { Map<String, Object> stackOutputs; try { - stackOutputs = msoHeatUtils.queryStackForOutputs(cloudSiteId, cloudOwner, tenantId, vnfName); + stackOutputs = msoHeatUtils.queryStackForOutputs(cloudSiteId, cloudOwner, tenantId, stackId); } catch (MsoException me) { // Failed to query the Stack due to an openstack exception. // Convert to a generic VnfException me.addContext("DeleteVFModule"); - String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + String error = "Delete VFModule: Query to get outputs: " + stackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, + logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), stackId, cloudOwner, cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(), "Exception - " + QUERY_STACK, me); logger.debug(error); throw new VnfException(me); @@ -993,11 +894,14 @@ public class MsoVnfAdapterImpl { // call method which handles the conversion from Map<String,Object> to Map<String,String> for our expected // Object types outputs.value = this.convertMapStringObjectToStringString(stackOutputs); - int timeoutMinutes = msoHeatUtils.getVfHeatTimeoutValue(modelCustomizationUuid, false); + int timeoutMinutes = 118; + if (modelCustomizationUuid != null) { + timeoutMinutes = msoHeatUtils.getVfHeatTimeoutValue(modelCustomizationUuid, false); + } try { StackInfo currentStack = - msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, false, timeoutMinutes); + msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, stackId, false, timeoutMinutes); if (currentStack != null && outputs != null && outputs.value != null) { logger.debug("Adding canonical stack id to outputs " + currentStack.getCanonicalName()); outputs.value.put("canonicalStackId", currentStack.getCanonicalName()); @@ -1010,8 +914,8 @@ public class MsoVnfAdapterImpl { // Failed to query the Stack due to an openstack exception. // Convert to a generic VnfException String error = - "Delete VF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, + "Delete VF: " + stackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; + logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), stackId, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(), "Exception - deleteStack", me); logger.error(error); throw new VnfException(me); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java index 58c43be36a..bde6d6b9c4 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -42,6 +42,7 @@ import java.util.Optional; import java.util.Set; import javax.jws.WebService; import javax.xml.ws.Holder; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.adapters.vdu.CloudInfo; import org.onap.so.adapters.vdu.VduException; import org.onap.so.adapters.vdu.VduInstance; @@ -63,11 +64,9 @@ 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.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; -import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.exceptions.MsoExceptionCategory; import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry; @@ -532,8 +531,8 @@ public class MsoVnfPluginAdapterImpl { public void createVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vfModuleType, String vnfVersion, String genericVnfId, String vfModuleName, String vfModuleId, String requestType, String volumeGroupId, String baseVfModuleId, String modelCustomizationUuid, Map<String, Object> inputs, - Boolean failIfExists, Boolean backout, Boolean enableBridge, MsoRequest msoRequest, Holder<String> vnfId, - Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback) throws VnfException { + Boolean failIfExists, Boolean backout, Boolean enableBridge, MsoRequest msoRequest, Holder<String> vnfId) + throws VnfException { // Will capture execution time for metrics long startTime = System.currentTimeMillis(); @@ -575,21 +574,6 @@ public class MsoVnfPluginAdapterImpl { logger.debug("requestType = " + requestType + ", volumeGroupStackId = " + volumeGroupId + ", baseStackId = " + baseVfModuleId); - // Build a default rollback object (no actions performed) - VnfRollback vfRollback = new VnfRollback(); - vfRollback.setCloudSiteId(cloudSiteId); - vfRollback.setCloudOwner(cloudOwner); - vfRollback.setTenantId(tenantId); - vfRollback.setMsoRequest(msoRequest); - vfRollback.setRequestType(requestType); - vfRollback.setIsBase(false); // Until we know better - vfRollback.setVolumeGroupHeatStackId(volumeGroupId); - vfRollback.setBaseGroupHeatStackId(baseVfModuleId); - vfRollback.setModelCustomizationUuid(modelCustomizationUuid); - vfRollback.setMode("CFY"); - - rollback.value = vfRollback; // Default rollback - no updates performed - // Get the VNF/VF Module definition from the Catalog DB first. // There are three relevant records: VfModule, VfModuleCustomization, VnfResource @@ -696,7 +680,6 @@ public class MsoVnfPluginAdapterImpl { // Populate the outputs from the existing deployment. vnfId.value = vduInstance.getVduInstanceId(); - outputs.value = copyStringOutputs(vduInstance.getOutputs()); return; } } @@ -794,7 +777,6 @@ public class MsoVnfPluginAdapterImpl { if (vfModule.getIsBase()) { logger.debug("This is a BASE Module request"); - vfRollback.setIsBase(true); } else { logger.debug("This is an Add-On Module request"); @@ -1063,15 +1045,7 @@ public class MsoVnfPluginAdapterImpl { throw new VnfException("Exception during instantiateVdu: " + e.getMessage()); } - - // Reach this point if create is successful. - // Populate remaining rollback info and response parameters. - vfRollback.setVnfCreated(true); - vfRollback.setVnfId(vduInstance.getVduInstanceId()); vnfId.value = vduInstance.getVduInstanceId(); - outputs.value = copyStringOutputs(vduInstance.getOutputs()); - - rollback.value = vfRollback; logger.debug("VF Module " + vfModuleName + " successfully created"); return; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java index 1b2fdfedfa..1de7273909 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java @@ -160,6 +160,13 @@ public interface HeatBridgeApi { String cloudOwner) throws HeatBridgeException; /** + * Query and build AAI actions for Openstack volumes + * + * @throws HeatBridgeException when failing to remove heatbridge data from AAI for a given vf-module + */ + void buildAddVolumes(List<Resource> stackResources) throws HeatBridgeException; + + /** * Query and build AAI actions for Openstack Compute resources to AAI's pserver and pinterface objects * * @param stackResources Openstack StackResources list @@ -180,4 +187,6 @@ public interface HeatBridgeApi { * @throws HeatBridgeException when failing to remove heatbridge data from AAI for a given vf-module */ void deleteVfModuleData(String vnfId, String vfModuleId) throws HeatBridgeException; + + } 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 0512912b9f..1bf4aff8f6 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 @@ -64,6 +64,7 @@ import org.onap.aai.domain.yang.SriovPf; import org.onap.aai.domain.yang.SriovVf; import org.onap.aai.domain.yang.Subnets; import org.onap.aai.domain.yang.Vlan; +import org.onap.aai.domain.yang.Volume; import org.onap.aai.domain.yang.Vserver; import org.onap.aaiclient.client.aai.AAIDSLQueryClient; import org.onap.aaiclient.client.aai.AAIResourcesClient; @@ -103,6 +104,7 @@ import org.openstack4j.model.network.Network; import org.openstack4j.model.network.NetworkType; import org.openstack4j.model.network.Port; import org.openstack4j.model.network.Subnet; +import org.openstack4j.model.storage.block.VolumeAttachment; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.core.env.Environment; @@ -421,6 +423,46 @@ public class HeatBridgeImpl implements HeatBridgeApi { } } + @Override + public void buildAddVolumes(List<Resource> stackResources) throws HeatBridgeException { + try { + if (stackResources.stream().anyMatch(r -> r.getType().equals("OS::Cinder::Volume"))) { + stackResources.stream().filter(r -> r.getType().equalsIgnoreCase("OS::Cinder::Volume")) + .forEach(r -> createVolume(r)); + } else { + logger.debug("Heat stack contains no volumes"); + } + } catch (Exception e) { + logger.error("Failed to add volumes to AAI", e); + throw new HeatBridgeException("Failed to add volumes to AAI", e); + } + + } + + protected void createVolume(Resource r) { + org.openstack4j.model.storage.block.Volume osVolume = osClient.getVolumeById(r.getPhysicalResourceId()); + List<? extends VolumeAttachment> attachments = osVolume.getAttachments(); + if (attachments != null) { + Optional<? extends VolumeAttachment> vserver = attachments.stream().findFirst(); + if (vserver.isPresent()) { + Volume volume = new Volume(); + volume.setVolumeId(r.getPhysicalResourceId()); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(vserver.get().getServerId()) + .volume(r.getPhysicalResourceId())); + transaction.createIfNotExists(uri, Optional.of(volume)); + } else { + logger.warn( + "Volume {} contains no attachments in openstack. Unable to determine which vserver volume belongs too.", + r.getPhysicalResourceId()); + } + } else { + logger.warn( + "Volume {} contains no attachments in openstack. Unable to determine which vserver volume belongs too.", + r.getPhysicalResourceId()); + } + } + protected String getInterfaceType(NodeType nodeType, String nicType) { logger.debug("nicType: " + nicType + "nodeType: " + nodeType); if (DIRECT.equalsIgnoreCase(nicType)) { @@ -488,7 +530,13 @@ public class HeatBridgeImpl implements HeatBridgeApi { for (Pserver pserver : serverHostnames.values()) { AAIResourceUri uri = AAIUriFactory .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().pserver(pserver.getHostname())); - resourcesClient.createIfNotExists(uri, Optional.of(pserver)); + if (resourcesClient.exists(uri)) { + Pserver updatePserver = new Pserver(); + updatePserver.setPserverId(pserver.getPserverId()); + resourcesClient.update(uri, updatePserver); + } else { + resourcesClient.create(uri, pserver); + } } } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java index 1f6c0df90f..bbdd05bddc 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java @@ -247,8 +247,8 @@ public class AaiHelper { Pserver pserver = new Pserver(); pserver.setInMaint(false); pserver.setHostname(server.getHypervisorHostname()); - if (server.getId() != null) { - pserver.setPserverId(server.getId()); + if (server.getHostId() != null) { + pserver.setPserverId(server.getHostId()); } if (server.getHost() != null) { pserver.setPserverName2(server.getHost()); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java index 8d47ff4ceb..a4aacfe0e2 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java @@ -43,6 +43,7 @@ import org.openstack4j.model.heat.Resource; import org.openstack4j.model.network.Network; import org.openstack4j.model.network.Port; import org.openstack4j.model.network.Subnet; +import org.openstack4j.model.storage.block.Volume; public interface OpenstackClient { @@ -101,4 +102,11 @@ public interface OpenstackClient { * @return Subnet object. */ Subnet getSubnetById(String subnetId); + + /** + * Get a volume object by volume ID + * + * @return Volume object. + */ + Volume getVolumeById(String volumeId); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java index 1505203d7c..81f09b8a3e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java @@ -46,6 +46,8 @@ import org.openstack4j.model.heat.Resource; import org.openstack4j.model.network.Network; import org.openstack4j.model.network.Port; import org.openstack4j.model.network.Subnet; +import org.openstack4j.model.storage.block.Volume; +import org.openstack4j.model.storage.block.VolumeBackup; abstract class OpenstackClientImpl implements OpenstackClient { @Override @@ -84,6 +86,11 @@ abstract class OpenstackClientImpl implements OpenstackClient { return getClient().networking().subnet().get(subnetId); } + @Override + public Volume getVolumeById(String id) { + return getClient().blockStorage().volumes().get(id); + } + /** * Retrieves the specific client to utilize. * diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java index 3a82dd5b72..94d9a28b76 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java @@ -4,10 +4,7 @@ import static org.junit.Assert.assertEquals; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.HashMap; -import java.util.Map; import java.util.Optional; -import javax.xml.ws.Holder; import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; import org.junit.Test; @@ -16,13 +13,10 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.adapters.tasks.orchestration.RollbackService; import org.onap.so.adapters.vnf.MsoVnfAdapterImpl; import org.onap.so.adapters.vnf.VnfAdapterUtils; import org.onap.so.adapters.vnf.exceptions.VnfException; -import org.onap.so.entity.MsoRequest; import org.onap.so.logging.tasks.AuditMDCSetup; -import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.utils.MsoHeatUtils; import com.woorea.openstack.heat.model.Stack; @@ -73,14 +67,14 @@ public class RollbackServiceTest { Mockito.when(vnfAdapterUtils.isMulticloudMode(Mockito.any(), Mockito.any())).thenReturn(false); Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(payload); Mockito.doNothing().when(vnfAdapterImpl).deleteVfModule(Mockito.any(), Mockito.any(), Mockito.any(), - Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any()); + Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any()); Mockito.doNothing().when(mockExternalTaskService).complete(Mockito.any(), Mockito.any()); rollbackService.executeExternalTask(mockExternalTask, mockExternalTaskService); Mockito.verify(vnfAdapterImpl, Mockito.times(1)).deleteVfModule(Mockito.eq("regionOne"), Mockito.eq("CloudOwner"), Mockito.eq("0422ffb57ba042c0800a29dc85ca70f8"), Mockito.eq("dummy_id"), - Mockito.any(String.class), Mockito.any(String.class), Mockito.any(), Mockito.any(), Mockito.any()); + Mockito.any(String.class), Mockito.any(), Mockito.any()); Mockito.verify(mockExternalTaskService).complete(Mockito.eq(mockExternalTask), Mockito.any()); } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java index 7a00cfe145..77d1be5b2f 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java @@ -69,7 +69,7 @@ public class StackServiceTest { Mockito.doNothing().when(vnfAdapterImpl).createVfModule(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), - Mockito.any(), Mockito.any(), Mockito.any()); + Mockito.any()); Mockito.doNothing().when(mockExternalTaskService).complete(Mockito.any(), Mockito.any()); stackService.executeExternalTask(mockExternalTask, mockExternalTaskService); @@ -106,8 +106,7 @@ public class StackServiceTest { Mockito.eq("1.0"), Mockito.eq("6640feba-55f6-4946-9694-4d9558c8870a"), Mockito.eq("dummy_id"), Mockito.eq("985a468b-328b-4c2b-ad0e-b8f1e19501c4"), Mockito.eq(null), Mockito.eq(null), Mockito.eq(null), Mockito.eq("074c64d0-7e13-4bcc-8bdb-ea922331102d"), Mockito.eq(paramsMap), - Mockito.eq(false), Mockito.eq(false), Mockito.eq(null), Mockito.any(), Mockito.any(), Mockito.any(), - Mockito.any()); + Mockito.eq(false), Mockito.eq(false), Mockito.eq(null), Mockito.any(), Mockito.any()); Mockito.verify(mockExternalTaskService).complete(Mockito.eq(mockExternalTask), Mockito.eq(variables)); } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java deleted file mode 100644 index 883009216f..0000000000 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vnf; - -import static org.junit.Assert.assertEquals; -import javax.inject.Provider; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.boot.web.server.LocalServerPort; - -public class BpelRestClientTest extends BaseRestTestUtils { - - - @LocalServerPort - private int port; - @Autowired - private Provider<BpelRestClient> clientProvider; - - @Test - public void verifyPropertiesRead() { - BpelRestClient client = clientProvider.get(); - - assertEquals(5, client.getRetryCount()); - assertEquals(30, client.getConnectTimeout()); - assertEquals("test:test", client.getCredentials()); - assertEquals(30, client.getSocketTimeout()); - assertEquals("408, 429, 500, 502, 503, 504, 900", client.getRetryList()); - assertEquals(-15, client.getRetryInterval()); - - } - -} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java deleted file mode 100644 index 92761c8453..0000000000 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vnf; - - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess; -import java.util.HashMap; -import org.apache.http.HttpStatus; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.onap.so.entity.MsoRequest; -import org.springframework.beans.factory.annotation.Autowired; -import static org.junit.Assert.assertNotNull; - -public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { - - @Autowired - MsoVnfAdapterAsyncImpl instance; - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - @Test - public void healthCheckVNFTest() { - instance.healthCheckA(); - } - - @Test - public void createVNFTest() throws Exception { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStackVfModule_200(wireMockServer); - wireMockServer.stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")) - .withRequestBody(containing("messageId")).willReturn(aResponse().withStatus(HttpStatus.SC_OK))); - - String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"; - String notificationUrl = - "http://localhost:" + wireMockPort + "/notify/adapterNotify/updateVnfNotificationRequest"; - instance.createVnfA("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", - "volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, - "messageId", msoRequest, notificationUrl); - - wireMockServer.verify(1, postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); - } - - @Test - public void createVNFTest_Exception() throws Exception { - String notificationUrl = - "http://localhost:" + wireMockPort + "/notify/adapterNotify/updateVnfNotificationRequest"; - instance.createVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", - "volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, - "messageId", null, notificationUrl); - - wireMockServer.verify(1, postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); - - } - - @Test - public void deleteVnfTest() { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - instance.deleteVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", - msoRequest, "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest"); - assertNotNull(msoRequest); - } - -} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java index 909a558cff..2b842d3f52 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java @@ -25,6 +25,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.get; import static com.github.tomakehurst.wiremock.client.WireMock.patch; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.when; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404; @@ -57,7 +58,6 @@ import org.onap.so.openstack.utils.MsoHeatUtils; import org.springframework.beans.factory.annotation.Autowired; import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.stubbing.Scenario; -import static org.junit.Assert.assertNotNull; public class MsoVnfAdapterImplTest extends BaseRestTestUtils { @@ -85,8 +85,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, Boolean.TRUE, Boolean.TRUE, - Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); + Boolean.FALSE, msoRequest, new Holder<>()); assertNotNull(map); } @@ -102,7 +101,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, null, Boolean.TRUE, Boolean.FALSE, - msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + msoRequest, new Holder<>()); assertNotNull(map); } @@ -133,8 +132,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, Boolean.FALSE, Boolean.TRUE, - Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); + Boolean.FALSE, msoRequest, new Holder<>()); assertNotNull(map); } @@ -151,8 +149,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, Boolean.TRUE, Boolean.TRUE, - Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); + Boolean.FALSE, msoRequest, new Holder<>()); assertNotNull(map); } @@ -169,8 +166,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), - new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>()); } @Test @@ -188,8 +184,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), - new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>()); } @Test @@ -207,8 +202,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), - new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>()); } @Test @@ -228,8 +222,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), - new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>()); } @Test @@ -263,8 +256,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), - new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>()); } @Test @@ -303,8 +295,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "XVFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", null, map, Boolean.FALSE, Boolean.TRUE, - Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); + Boolean.FALSE, msoRequest, new Holder<>()); } @Test @@ -324,8 +315,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), - new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>()); } private MsoRequest getMsoRequest() { @@ -499,9 +489,8 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl(); MsoRequest msoRequest = getMsoRequest(); try { - instance.deleteVfModule("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", - "5aae1e49-805c-4f9f-bd78-055bf7451157", "11420693-3f69-4c61-b3ee-9787c744e760", null, msoRequest, - new Holder<Map<String, String>>()); + instance.deleteVfModule("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", null, + msoRequest, new Holder<Map<String, String>>()); } catch (Exception e) { } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java index fab7df5345..cf3e1c5ee1 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java @@ -106,6 +106,8 @@ import org.openstack4j.model.network.Network; import org.openstack4j.model.network.NetworkType; import org.openstack4j.model.network.Port; import org.openstack4j.model.network.Subnet; +import org.openstack4j.model.storage.block.Volume; +import org.openstack4j.model.storage.block.VolumeAttachment; import org.openstack4j.openstack.heat.domain.HeatResource; import org.openstack4j.openstack.heat.domain.HeatResource.Resources; import org.slf4j.Logger; @@ -118,7 +120,6 @@ import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.ImmutableMap; - @RunWith(MockitoJUnitRunner.Silent.class) public class HeatBridgeImplTest { @@ -808,6 +809,28 @@ public class HeatBridgeImplTest { assertEquals(1, images.size()); } + @Test + public void testBuildAddVolumes() throws HeatBridgeException { + List<Resource> stackResources = (List<Resource>) extractTestStackResources(); + Volume volume = mock(Volume.class); + List<VolumeAttachment> attachments = new ArrayList<>(); + VolumeAttachment server = mock(VolumeAttachment.class); + attachments.add(server); + when(volume.getAttachments()).thenAnswer(x -> attachments); + when(server.getServerId()).thenReturn("vserverIdTest"); + + when(osClient.getVolumeById("5ad95036-8daf-4379-a59c-865f35976ca3")).thenReturn(volume); + + heatbridge.buildAddVolumes(stackResources); + + verify(transaction, times(1)).createIfNotExists( + eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion("CloudOwner", "RegionOne").tenant("7320ec4a5b9d4589ba7c4412ccfd290f") + .vserver("vserverIdTest").volume("5ad95036-8daf-4379-a59c-865f35976ca3"))), + any(Optional.class)); + verify(osClient, times(1)).getVolumeById(eq("5ad95036-8daf-4379-a59c-865f35976ca3")); + } + private List<? extends Resource> extractTestStackResources() { List<HeatResource> stackResources = null; try { @@ -838,4 +861,5 @@ public class HeatBridgeImplTest { } + } diff --git a/adapters/mso-openstack-adapters/src/test/resources/stack-resources.json b/adapters/mso-openstack-adapters/src/test/resources/stack-resources.json index 6b63895a33..159c6665f2 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/stack-resources.json +++ b/adapters/mso-openstack-adapters/src/test/resources/stack-resources.json @@ -436,6 +436,28 @@ "resource_status_reason": "state changed", "physical_resource_id": "5ad95036-8daf-4379-a59c-865f35976cd4", "resource_type": "OS::Neutron::Net" + }, + { + "resource_name": "volume", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_pfe_network-2wmjvgzrhtvs/290fc2fd-cd1d-47d0-90eb-2ece7c009b29/resources/bridge_network", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_pfe_network-2wmjvgzrhtvs/290fc2fd-cd1d-47d0-90eb-2ece7c009b29", + "rel": "stack" + } + ], + "logical_resource_id": "some_id", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2018-04-09T21:09:55Z", + "required_by": [ + "bridge_network_subnet" + ], + "resource_status_reason": "state changed", + "physical_resource_id": "5ad95036-8daf-4379-a59c-865f35976ca3", + "resource_type": "OS::Cinder::Volume" } ] } diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml index a488558610..09e2cc26d7 100644 --- a/adapters/mso-requests-db-adapter/pom.xml +++ b/adapters/mso-requests-db-adapter/pom.xml @@ -6,19 +6,10 @@ <artifactId>adapters</artifactId> <version>1.8.0-SNAPSHOT</version> </parent> - <groupId>org.onap.so.adapters</groupId> <artifactId>mso-requests-db-adapter</artifactId> <dependencies> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-validation</artifactId> - </dependency> - <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxws</artifactId> </dependency> @@ -41,11 +32,6 @@ </dependency> <dependency> <groupId>org.onap.so</groupId> - <artifactId>mso-requests-db</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.so</groupId> <artifactId>mso-requests-db-repositories</artifactId> <version>${project.version}</version> </dependency> @@ -63,7 +49,6 @@ <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> <scope>test</scope> </dependency> <dependency> @@ -93,8 +78,6 @@ <artifactId>cxf-logging</artifactId> <version>${project.version}</version> </dependency> - - </dependencies> <pluginRepositories> <pluginRepository> @@ -245,15 +228,9 @@ <pluginExecutions> <pluginExecution> <pluginExecutionFilter> - <groupId> - org.apache.cxf - </groupId> - <artifactId> - cxf-java2ws-plugin - </artifactId> - <versionRange> - [3.2.5,) - </versionRange> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-java2ws-plugin</artifactId> + <versionRange>[3.2.5,)</versionRange> <goals> <goal>java2ws</goal> </goals> diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml index cad9c9fbc0..358b14e37a 100644 --- a/adapters/mso-sdnc-adapter/pom.xml +++ b/adapters/mso-sdnc-adapter/pom.xml @@ -13,7 +13,6 @@ </properties> <name>mso-sdnc-adapter</name> <description>mso sdnc adapter</description> - <build> <finalName>${project.artifactId}-${project.version}</finalName> <pluginManagement> @@ -135,7 +134,6 @@ <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-jersey2-jaxrs</artifactId> - <version>1.5.16</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java index da0fcd3d04..047686ccc3 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java @@ -31,6 +31,7 @@ public interface Constants { public static final String SDNC_AUTH_PROP = "org.onap.so.adapters.sdnc.sdncauth"; public static final String BPEL_AUTH_PROP = "org.onap.so.adapters.sdnc.bpelauth"; + public static final String SDNC_HOST = "org.onap.so.adapters.sdnc.sdncHost"; public static final String SDNC_SVCCFGRESP_ROOT = "input"; public static final String SDNC_REQ_ID = "/svc-request-id"; diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/tasks/SDNCService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/tasks/SDNCService.java new file mode 100644 index 0000000000..e5b7049934 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/tasks/SDNCService.java @@ -0,0 +1,136 @@ +package org.onap.so.adapters.sdnc.tasks; + +import java.security.GeneralSecurityException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.UriBuilder; +import javax.xml.bind.DatatypeConverter; +import org.camunda.bpm.client.task.ExternalTask; +import org.camunda.bpm.client.task.ExternalTaskService; +import org.onap.logging.filter.spring.SpringClientPayloadFilter; +import org.onap.so.adapters.sdnc.impl.Constants; +import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter; +import org.onap.so.logging.tasks.AuditMDCSetup; +import org.onap.so.utils.CryptoUtils; +import org.onap.so.utils.ExternalTaskUtils; +import org.onap.so.utils.RetrySequenceLevel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.http.client.BufferingClientHttpRequestFactory; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Component +public class SDNCService extends ExternalTaskUtils { + + private static final Logger logger = LoggerFactory.getLogger(SDNCService.class); + + @Autowired + private AuditMDCSetup mdcSetup; + + @Autowired + private RestTemplate restTemplate; + + @Autowired + private Environment env; + + private ObjectMapper objMapper = new ObjectMapper(); + + public SDNCService() { + super(RetrySequenceLevel.SHORT); + objMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + } + + // TODO maybe make a new sdnc client + public void executePostTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { + mdcSetup.setupMDC(externalTask); + logger.debug("Executing External Task SDNC Post Service"); + Map<String, Object> variables = new HashMap<>(); + boolean success = false; + String errorMessage = ""; + try { + Object request = externalTask.getVariable("sdncRequest"); + String jsonRequest = buildJsonRequest(request); + + UriBuilder url = UriBuilder.fromUri(env.getProperty(Constants.SDNC_HOST)); + url.path((String) externalTask.getVariable("sdncUri")); + + HttpEntity<String> requestEntity = new HttpEntity<String>(jsonRequest, getHttpHeader()); + ResponseEntity<Object> responseEntity = + restTemplate.exchange(url.build(), HttpMethod.POST, requestEntity, Object.class); + + if (responseEntity.getStatusCode().equals(HttpStatus.ACCEPTED)) { + success = true; + } else { + errorMessage = "SDNC returned a " + responseEntity.getStatusCode().value(); + } + } catch (Exception e) { + logger.error("Error during External Task SDNC Post Service", e); + errorMessage = "Error during External Task SDNC Post Service: " + e.getMessage(); + } + + if (success) { + externalTaskService.complete(externalTask, variables); + logger.debug("The External Task {} was Successful", externalTask.getId()); + } else { + if (externalTask.getRetries() == null) { + logger.debug("The External Task {} Failed, Setting Retries to Default Start Value {}", + externalTask.getId(), getRetrySequence().length); + externalTaskService.handleFailure(externalTask, errorMessage, "errorDetails", getRetrySequence().length, + 10000); + } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) { + logger.debug("The External Task {} Failed, All Retries Exhausted", externalTask.getId()); + variables.put("errorMessage", errorMessage); + externalTaskService.handleBpmnError(externalTask, "SDNCWorkflowException", null, variables); + } else { + logger.debug("The External Task {} Failed, Decrementing Retries to {} with Retry Delay {}", + externalTask.getId(), externalTask.getRetries() - 1, + calculateRetryDelay(externalTask.getRetries())); + externalTaskService.handleFailure(externalTask, errorMessage, "errorDetails", + externalTask.getRetries() - 1, calculateRetryDelay(externalTask.getRetries())); + } + } + } + + public void executeGetTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { + logger.debug("Executing External Task SDNC Get Service"); + + } + + private String buildJsonRequest(Object request) throws JsonProcessingException { + String jsonRequest = objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(request); + return jsonRequest; + } + + private HttpHeaders getHttpHeader() throws GeneralSecurityException { + HttpHeaders httpHeader = new HttpHeaders(); + httpHeader.set("Authorization", getAuth()); + httpHeader.setContentType(MediaType.APPLICATION_JSON); + List<MediaType> acceptMediaTypes = new ArrayList<>(); + acceptMediaTypes.add(MediaType.APPLICATION_JSON); + acceptMediaTypes.add(MediaType.TEXT_PLAIN); + httpHeader.setAccept(acceptMediaTypes); + return httpHeader; + } + + protected String getAuth() throws GeneralSecurityException { + String auth = CryptoUtils.decrypt(env.getProperty(Constants.SDNC_AUTH_PROP), + env.getProperty(Constants.ENCRYPTION_KEY_PROP)); + return "Basic " + DatatypeConverter.printBase64Binary(auth.getBytes()); + } + +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/tasks/TaskServices.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/tasks/TaskServices.java new file mode 100644 index 0000000000..fd95b44aee --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/tasks/TaskServices.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.tasks; + +import javax.annotation.PostConstruct; +import org.camunda.bpm.client.ExternalTaskClient; +import org.onap.so.utils.ExternalTaskServiceUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Component; + +@Component +@Profile("!test") +public class TaskServices { + + @Autowired + private ExternalTaskServiceUtils externalTaskServiceUtils; + + @Autowired + private SDNCService service; + + @PostConstruct + public void post() throws Exception { + for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) { + ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient(); + client.subscribe("sdncPost").lockDuration(externalTaskServiceUtils.getLockDurationLong()) + .handler(service::executePostTask).open(); + } + } + + @PostConstruct + public void get() throws Exception { + for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) { + ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient(); + client.subscribe("sdncGet").lockDuration(externalTaskServiceUtils.getLockDurationLong()) + .handler(service::executeGetTask).open(); + } + } +} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/tasks/SDNCServiceTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/tasks/SDNCServiceTest.java new file mode 100644 index 0000000000..386d83f87d --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/tasks/SDNCServiceTest.java @@ -0,0 +1,72 @@ +package org.onap.so.adapters.sdnc.tasks; + +import java.io.IOException; +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.util.HashMap; +import org.camunda.bpm.client.task.ExternalTask; +import org.camunda.bpm.client.task.ExternalTaskService; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.so.logging.tasks.AuditMDCSetup; +import org.springframework.core.env.Environment; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.client.RestTemplate; + +@RunWith(MockitoJUnitRunner.class) +public class SDNCServiceTest { + + private String RESOURCE_PATH = "src/test/resources"; + + @Mock + private ExternalTask mockExternalTask; + + @Mock + private ExternalTaskService mockExternalTaskService; + + @Mock + private AuditMDCSetup mdcSetup; + + @Mock + private RestTemplate restTemplate; + + @Mock + private ResponseEntity<Object> response; + + @Mock + private Environment env; + + @Spy + @InjectMocks + private SDNCService sdncService; + + @Test + public void testExecutePostTask() throws IOException, GeneralSecurityException { + String payload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/sdncRequest.json"))); + + Mockito.when(env.getProperty("org.onap.so.adapters.sdnc.sdncHost")).thenReturn("sdncHost"); + Mockito.when(mockExternalTask.getVariable("sdncRequest")).thenReturn(payload); + Mockito.when(mockExternalTask.getVariable("sdncUri")).thenReturn("/sdnc/action"); + Mockito.doReturn("Basic 123").when(sdncService).getAuth(); + Mockito.when(restTemplate.exchange(Mockito.any(URI.class), Mockito.eq(HttpMethod.POST), + Mockito.any(HttpEntity.class), Mockito.eq(Object.class))).thenReturn(response); + Mockito.when(response.getStatusCode()).thenReturn(HttpStatus.ACCEPTED); + Mockito.doNothing().when(mockExternalTaskService).complete(Mockito.any(), Mockito.any()); + + sdncService.executePostTask(mockExternalTask, mockExternalTaskService); + + Mockito.verify(mockExternalTaskService).complete(Mockito.eq(mockExternalTask), Mockito.eq(new HashMap<>())); + + } + +} diff --git a/adapters/mso-sdnc-adapter/src/test/resources/sdncRequest.json b/adapters/mso-sdnc-adapter/src/test/resources/sdncRequest.json new file mode 100644 index 0000000000..879b9b3765 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/resources/sdncRequest.json @@ -0,0 +1,12 @@ +{ + "request_control": { + "transaction_id": "migId", + "request_id": "reqId", + "invocation_id": "subReqId", + "async": true, + "callback_url": "host/callback" + }, + "input": { + "id": "id" + } +}
\ No newline at end of file diff --git a/adapters/so-appc-orchestrator/pom.xml b/adapters/so-appc-orchestrator/pom.xml index f01288f1b4..2e4a4427b3 100644 --- a/adapters/so-appc-orchestrator/pom.xml +++ b/adapters/so-appc-orchestrator/pom.xml @@ -6,7 +6,6 @@ <artifactId>adapters</artifactId> <version>1.8.0-SNAPSHOT</version> </parent> - <groupId>org.onap.so.adapters</groupId> <artifactId>so-appc-orchestrator</artifactId> <packaging>jar</packaging> @@ -21,7 +20,6 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> - <version>${springboot.version}</version> <configuration> <mainClass>org.onap.so.adapters.appc.orchestrator.AppcOrchestratorApplication</mainClass> </configuration> @@ -153,7 +151,6 @@ <dependency> <groupId>org.camunda.bpm</groupId> <artifactId>camunda-external-task-client</artifactId> - <version>1.4.0</version> </dependency> <dependency> <groupId>org.onap.so</groupId> @@ -199,7 +196,6 @@ <dependency> <groupId>pl.pragmatists</groupId> <artifactId>JUnitParams</artifactId> - <version>1.0.5</version> <scope>test</scope> </dependency> <dependency> diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml index 447dbfdf30..4d17f5510a 100644 --- a/asdc-controller/pom.xml +++ b/asdc-controller/pom.xml @@ -6,8 +6,6 @@ <artifactId>so</artifactId> <version>1.8.0-SNAPSHOT</version> </parent> - - <groupId>org.onap.so</groupId> <artifactId>asdc-controller</artifactId> <name>asdc-controller</name> <description>ASDC CLient and Controller</description> @@ -18,7 +16,6 @@ <sdc.tosca.version>1.6.5</sdc.tosca.version> <jtosca.version>1.5.1</jtosca.version> </properties> - <build> <finalName>${project.artifactId}-${project.version}</finalName> <pluginManagement> @@ -193,17 +190,8 @@ </build> <dependencies> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-jersey2-jaxrs</artifactId> - <version>1.5.16</version> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> @@ -271,11 +259,6 @@ </dependency> <dependency> <groupId>org.onap.so</groupId> - <artifactId>mso-requests-db</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.so</groupId> <artifactId>mso-requests-db-repositories</artifactId> <version>${project.version}</version> </dependency> @@ -297,17 +280,11 @@ <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.2.3</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-contract-wiremock</artifactId> - <version>1.2.4.RELEASE</version> - </dependency> - <dependency> - <groupId>io.micrometer</groupId> - <artifactId>micrometer-core</artifactId> </dependency> <dependency> <groupId>io.micrometer</groupId> diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 60a689c04a..c051aac9b8 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -10,7 +10,6 @@ <artifactId>MSOCommonBPMN</artifactId> <name>MSOCommonBPMN</name> <packaging>jar</packaging> - <build> <plugins> <plugin> @@ -19,7 +18,6 @@ <configuration> <compilerId>groovy-eclipse-compiler</compilerId> </configuration> - <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> @@ -33,11 +31,9 @@ </dependency> </dependencies> </plugin> - <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>3.0.2</version> <executions> <execution> <goals> @@ -139,29 +135,15 @@ </plugins> </pluginManagement> </build> - <dependencyManagement> - <dependencies> - <dependency> - <!-- Import dependency management from camunda --> - <groupId>org.camunda.bpm</groupId> - <artifactId>camunda-bom</artifactId> - <version>${camunda.version}</version> - <scope>import</scope> - <type>pom</type> - </dependency> - </dependencies> - </dependencyManagement> <dependencies> <dependency> <groupId>org.camunda.bpm.springboot</groupId> <artifactId>camunda-bpm-spring-boot-starter</artifactId> - <version>${camunda.springboot.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-contract-wiremock</artifactId> - <version>1.2.4.RELEASE</version> <scope>test</scope> </dependency> <dependency> @@ -172,7 +154,6 @@ <dependency> <groupId>org.camunda.bpm.extension.mockito</groupId> <artifactId>camunda-bpm-mockito</artifactId> - <version>3.2.1</version> <scope>test</scope> </dependency> <dependency> @@ -182,15 +163,7 @@ <dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> + </dependency> <dependency> <!-- Needed for InMemoryH2Test --> <groupId>com.h2database</groupId> @@ -199,10 +172,6 @@ </dependency> <dependency> <groupId>org.codehaus.groovy</groupId> - <artifactId>groovy</artifactId> - </dependency> - <dependency> - <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-xml</artifactId> </dependency> <dependency> @@ -234,39 +203,16 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.onap.so</groupId> - <artifactId>common</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> <groupId>org.onap.so.adapters</groupId> <artifactId>mso-adapters-rest-interface</artifactId> <version>${project.version}</version> </dependency> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - </dependency> - <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> <dependency> - <groupId>com.jayway.jsonpath</groupId> - <artifactId>json-path</artifactId> - </dependency> - <dependency> - <groupId>javax.ws.rs</groupId> - <artifactId>javax.ws.rs-api</artifactId> - <version>${jax.ws.rs}</version> - </dependency> - - <dependency> <groupId>org.onap.appc.client</groupId> <artifactId>client-lib</artifactId> <version>${appc.client.version}</version> @@ -297,18 +243,6 @@ </exclusions> </dependency> <dependency> - <groupId>org.aspectj</groupId> - <artifactId>aspectjrt</artifactId> - </dependency> - <dependency> - <groupId>org.json</groupId> - <artifactId>json</artifactId> - </dependency> - <dependency> - <groupId>org.glassfish.jersey.core</groupId> - <artifactId>jersey-common</artifactId> - </dependency> - <dependency> <groupId>org.glassfish.jersey.core</groupId> <artifactId>jersey-client</artifactId> </dependency> @@ -334,18 +268,11 @@ <dependency> <groupId>pl.pragmatists</groupId> <artifactId>JUnitParams</artifactId> - <version>1.1.0</version> + <scope>test</scope> </dependency> <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-contract-wiremock</artifactId> - <version>1.2.4.RELEASE</version> <scope>test</scope> </dependency> <dependency> diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java index c02afc3327..054cc378ef 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java @@ -41,13 +41,18 @@ public class FlowManipulatorListenerRunner extends ListenerRunner { private static Logger logger = LoggerFactory.getLogger(FlowManipulatorListenerRunner.class); - protected List<FlowManipulator> flowManipulators; + protected List<PreFlowManipulator> flowManipulators; + + protected List<PostFlowManipulator> postflowManipulators; @PostConstruct protected void init() { flowManipulators = new ArrayList<>( - Optional.ofNullable(context.getBeansOfType(FlowManipulator.class)).orElse(new HashMap<>()).values()); + Optional.ofNullable(context.getBeansOfType(PreFlowManipulator.class)).orElse(new HashMap<>()).values()); + + postflowManipulators = new ArrayList<>(Optional.ofNullable(context.getBeansOfType(PostFlowManipulator.class)) + .orElse(new HashMap<>()).values()); } @@ -56,11 +61,26 @@ public class FlowManipulatorListenerRunner extends ListenerRunner { do { sequenceBeforeFlowManipulator = execution.getVariable(BBConstants.G_CURRENT_SEQUENCE); ExecuteBuildingBlock currentBB = flowsToExecute.get(execution.getCurrentSequence()); - List<FlowManipulator> filtered = filterListeners(flowManipulators, + List<PreFlowManipulator> filtered = filterListeners(flowManipulators, + (item -> item.shouldRunFor(currentBB.getBuildingBlock().getBpmnFlowName(), + execution.getCurrentSequence() == 0, execution))); + + logger.info("Running pre flow manipulators:\n{}", + filtered.stream().map(item -> item.getClass().getName()).collect(Collectors.joining("\n"))); + filtered.forEach(item -> item.run(flowsToExecute, currentBB, execution)); + } while (isBuildingBlockSkipped(sequenceBeforeFlowManipulator, execution)); + } + + public void postModifyFlows(List<ExecuteBuildingBlock> flowsToExecute, BuildingBlockExecution execution) { + int sequenceBeforeFlowManipulator; + do { + sequenceBeforeFlowManipulator = execution.getVariable(BBConstants.G_CURRENT_SEQUENCE); + ExecuteBuildingBlock currentBB = flowsToExecute.get(execution.getCurrentSequence() - 1); + List<PostFlowManipulator> filtered = filterListeners(postflowManipulators, (item -> item.shouldRunFor(currentBB.getBuildingBlock().getBpmnFlowName(), execution.getCurrentSequence() == 0, execution))); - logger.info("Running flow manipulators:\n{}", + logger.info("Running post flow manipulators:\n{}", filtered.stream().map(item -> item.getClass().getName()).collect(Collectors.joining("\n"))); filtered.forEach(item -> item.run(flowsToExecute, currentBB, execution)); } while (isBuildingBlockSkipped(sequenceBeforeFlowManipulator, execution)); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PostFlowManipulator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PostFlowManipulator.java new file mode 100644 index 0000000000..b0e259b801 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PostFlowManipulator.java @@ -0,0 +1,5 @@ +package org.onap.so.bpmn.common.listener.flowmanipulator; + +public interface PostFlowManipulator extends FlowManipulator { + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PreFlowManipulator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PreFlowManipulator.java new file mode 100644 index 0000000000..1020f65695 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PreFlowManipulator.java @@ -0,0 +1,5 @@ +package org.onap.so.bpmn.common.listener.flowmanipulator; + +public interface PreFlowManipulator extends FlowManipulator { + +} 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 f40948fc49..7113386052 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 @@ -207,7 +207,8 @@ public class ExceptionBuilder { } } - public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) { + public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) + throws BpmnError { buildWorkflowException(execution, errorCode, errorMessage); logger.info("Throwing MSOWorkflowException"); @@ -372,8 +373,18 @@ public class ExceptionBuilder { } buildWorkflowException(execution, 500, workflowExceptionMessage.toString(), Components.OPENSTACK); throw new BpmnError("MSOWorkflowException"); + } - + public void processSDNCException(DelegateExecution execution) { + logger.debug("Processing SDNC Exception"); + String errorMessage = ""; + try { + errorMessage = (String) execution.getVariable("errorMessage"); + } catch (Exception e) { + logger.debug("Error while Processing SDNC Exception", e); + } + buildWorkflowException(execution, 500, errorMessage, ONAPComponents.SDNC); + throw new BpmnError("MSOWorkflowException"); } public void processInventoryException(DelegateExecution execution) { diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfAdapterCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfAdapterCallback.xml index d63a5ecbaf..b579e54659 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfAdapterCallback.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfAdapterCallback.xml @@ -1,6 +1,3 @@ - - -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <createVfModuleResponse> <messageId>255ca199-7f53-4800-8ab0-c55954b3ff0f</messageId> <rollback> diff --git a/bpmn/MSOCoreBPMN/pom.xml b/bpmn/MSOCoreBPMN/pom.xml index 34790bb496..b6aead393f 100644 --- a/bpmn/MSOCoreBPMN/pom.xml +++ b/bpmn/MSOCoreBPMN/pom.xml @@ -9,7 +9,6 @@ <modelVersion>4.0.0</modelVersion> <artifactId>MSOCoreBPMN</artifactId> <packaging>jar</packaging> - <build> <plugins> <plugin> @@ -28,11 +27,9 @@ </execution> </executions> </plugin> - <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>3.0.2</version> <executions> <execution> <id>tests-jar</id> @@ -48,32 +45,19 @@ </plugin> </plugins> </build> - <dependencies> - <!-- latest commons-fileupload --> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.4</version> </dependency> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - </dependency> - <dependency> - <groupId>org.camunda.connect</groupId> - <artifactId>camunda-connect-connectors-all</artifactId> - <version>1.0.5</version> - </dependency> - <dependency> <groupId>org.camunda.bpm</groupId> <artifactId>camunda-engine-plugin-connect</artifactId> - <version>${camunda.version}</version> </dependency> <dependency> <groupId>org.camunda.bpm</groupId> <artifactId>camunda-engine</artifactId> - <version>${camunda.version}</version> </dependency> <dependency> <groupId>com.h2database</groupId> @@ -104,18 +88,5 @@ <artifactId>json-schema-validator</artifactId> <version>2.2.6</version> </dependency> - <dependency> - <groupId>com.github.fge</groupId> - <artifactId>json-schema-core</artifactId> - <version>1.2.4</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-beans</artifactId> - </dependency> - <dependency> - <groupId>org.yaml</groupId> - <artifactId>snakeyaml</artifactId> - </dependency> </dependencies> </project> diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml index 1df4a26246..aa76782aef 100644 --- a/bpmn/mso-infrastructure-bpmn/pom.xml +++ b/bpmn/mso-infrastructure-bpmn/pom.xml @@ -138,7 +138,6 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> - <version>${springboot.version}</version> <configuration> <mainClass>org.onap.so.bpmn.infrastructure.MSOInfrastructureApplication</mainClass> </configuration> @@ -201,13 +200,6 @@ <type>pom</type> <scope>import</scope> </dependency> - <dependency> - <groupId>org.camunda.bpm</groupId> - <artifactId>camunda-bom</artifactId> - <version>${camunda.version}</version> - <scope>import</scope> - <type>pom</type> - </dependency> </dependencies> </dependencyManagement> <dependencies> @@ -275,13 +267,11 @@ <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-contract-wiremock</artifactId> - <version>1.2.4.RELEASE</version> <scope>test</scope> </dependency> <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> <scope>test</scope> </dependency> <dependency> @@ -299,15 +289,13 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.camunda.bpm.extension</groupId> + <groupId>org.camunda.bpm.assert</groupId> <artifactId>camunda-bpm-assert</artifactId> - <version>2.0-alpha2</version> <scope>test</scope> </dependency> <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> - <version>1.7.0</version> <scope>test</scope> </dependency> <dependency> diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java index 2d41eb4e26..15064e501d 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java @@ -46,8 +46,9 @@ import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.core.env.Environment; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; /** @@ -61,7 +62,7 @@ import io.swagger.annotations.ApiOperation; * further on executing the process */ @Path("/async") -@Api(value = "/async", description = "Provides asynchronous starting of a bpmn process") +@OpenAPIDefinition(info = @Info(title = "/async", description = "Provides asynchronous starting of a bpmn process")) @Provider @Component public class WorkflowAsyncResource extends ProcessEngineAwareService { @@ -97,8 +98,7 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService { @POST @Path("/services/{processKey}") - @ApiOperation(value = "Starts a new process with the appropriate process Key", - notes = "Aysnc fall outs are only logged") + @Operation(description = "Starts a new process with the appropriate process Key. Aysnc fall outs are only logged") @Produces("application/json") @Consumes("application/json") public Response startProcessInstanceByKey(@PathParam("processKey") String processKey, VariableMapImpl variableMap) { 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 2eb9d175f2..9547017e64 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 @@ -41,8 +41,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; /** * Generalized REST interface that injects a message event into a waiting BPMN process. Examples: @@ -53,7 +54,8 @@ import io.swagger.annotations.ApiOperation; * </pre> */ @Path("/") -@Api(description = "Provides a generic service to inject messages into a waiting BPMN Proccess") +@OpenAPIDefinition(info = @Info(title = "/", + description = "Provides a generic service to inject messages into a waiting BPMN Proccess")) @Component public class WorkflowMessageResource { private static final Logger logger = LoggerFactory.getLogger(WorkflowMessageResource.class); @@ -64,7 +66,7 @@ public class WorkflowMessageResource { @POST @Path("/WorkflowMessage/{messageType}/{correlator}") - @ApiOperation(value = "Workflow message correlator", notes = "") + @Operation(description = "Workflow message correlator") @Consumes("*/*") @Produces(MediaType.TEXT_PLAIN) public Response deliver(@HeaderParam("Content-Type") String contentType, 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 731e9d8703..0f2aee7837 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 @@ -55,11 +55,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; import org.springframework.stereotype.Component; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; @Path("/workflow") -@Api(value = "/workflow", description = "Root of workflow services") +@OpenAPIDefinition(info = @Info(title = "/workflow", description = "Root of workflow services")) @Component public class WorkflowResource extends ProcessEngineAwareService { @@ -83,7 +84,7 @@ public class WorkflowResource extends ProcessEngineAwareService { */ @POST @Path("/services/{processKey}") - @ApiOperation(value = "Starts a new process with the appropriate process synchronously", notes = "d") + @Operation(description = "Starts a new process with the appropriate process synchronously") @Produces("application/json") @Consumes("application/json") public Response startProcessInstanceByKey(@PathParam("processKey") String processKey, VariableMapImpl variableMap) { @@ -549,7 +550,7 @@ public class WorkflowResource extends ProcessEngineAwareService { @Path("/services/{processKey}/{processInstanceId}") @Produces("application/json") @Consumes("application/json") - @ApiOperation(value = "Allows for retrieval of the variables for a given process", notes = "") + @Operation(description = "Allows for retrieval of the variables for a given process") public WorkflowResponse getProcessVariables(@PathParam("processKey") String processKey, @PathParam("processInstanceId") String processInstanceId) { // TODO filter only set of variables diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java index 03feda6d0f..3923c6ffb6 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java @@ -23,12 +23,13 @@ package org.onap.so.bpmn.infrastructure; import java.util.Arrays; +import java.util.HashSet; import javax.xml.ws.Endpoint; import org.apache.cxf.Bus; import org.apache.cxf.endpoint.Server; import org.apache.cxf.feature.LoggingFeature; import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; -import org.apache.cxf.jaxrs.swagger.Swagger2Feature; +import org.apache.cxf.jaxrs.openapi.OpenApiFeature; import org.apache.cxf.jaxws.EndpointImpl; import org.apache.cxf.transport.servlet.CXFServlet; import org.onap.so.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType; @@ -112,14 +113,15 @@ public class CXFConfiguration { } @Bean - public Swagger2Feature createSwaggerFeature() { - Swagger2Feature swagger2Feature = new Swagger2Feature(); + public OpenApiFeature createSwaggerFeature() { + OpenApiFeature swagger2Feature = new OpenApiFeature(); swagger2Feature.setPrettyPrint(true); swagger2Feature.setTitle("SO Orchestration Application"); - swagger2Feature.setContact("The ONAP SO team"); + swagger2Feature.setContactName("The ONAP SO team"); swagger2Feature.setDescription("This project is the SO Orchestration Engine"); swagger2Feature.setVersion("1.0.0"); - swagger2Feature.setResourcePackage("org.onap.so.bpmn.common.workflow.service"); + swagger2Feature + .setResourcePackages(new HashSet<String>(Arrays.asList("org.onap.so.bpmn.common.workflow.service"))); swagger2Feature.setScan(true); return swagger2Feature; } diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java index 0161422b64..179d3e84aa 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java @@ -729,78 +729,6 @@ public abstract class WorkflowTest { } } - /** - * Runs a program to inject VNF callback data into the test environment. A program is essentially just a list of - * keys that identify callback data to be injected, in sequence. An example program: - * - * <pre> - * createVnf, deleteVnf - * </pre> - * - * Errors are handled with junit assertions and will cause the test to fail. - * - * @param callbacks an object containing callback data for the program - * @param program the program to execute - */ - protected void injectVNFCallbacks(CallbackSet callbacks, String program) { - - String[] cmds = program.replaceAll("\\s+", "").split(","); - - for (String cmd : cmds) { - String action = cmd; - String modifier = "STD"; - - if (cmd.contains(":")) { - String[] parts = cmd.split(":"); - action = parts[0]; - modifier = parts[1]; - } - - String content = null; - - if ("STD".equals(modifier)) { - CallbackData callbackData = callbacks.get(action); - - if (callbackData == null) { - String msg = "No callback defined for '" + action + "' VNF request"; - logger.debug(msg); - fail(msg); - } - - content = callbackData.getContent(); - } else if ("ERR".equals(modifier)) { - String msg = "Currently unsupported VNF program modifier: '" + modifier + "'"; - logger.debug(msg); - fail(msg); - } else { - String msg = "Invalid VNF program modifier: '" + modifier + "'"; - logger.debug(msg); - fail(msg); - } - - boolean injected = false; - - if (content.contains("createVnfNotification")) { - injected = injectCreateVNFCallback(content, 10000); - } else if (content.contains("deleteVnfNotification")) { - injected = injectDeleteVNFCallback(content, 10000); - } else if (content.contains("updateVnfNotification")) { - injected = injectUpdateVNFCallback(content, 10000); - } - - if (!injected) { - String msg = "Failed to inject VNF '" + action + "' callback"; - logger.debug(msg); - fail(msg); - } - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - fail("Interrupted after injection of VNF '" + action + "' callback"); - } - } - } /** * Waits for the number of running processes with the specified process definition key to equal a particular count. @@ -1179,112 +1107,6 @@ public abstract class WorkflowTest { return true; } - /** - * Injects a Update VNF adapter callback request. The specified callback data may contain the placeholder string - * ((MESSAGE-ID)) which is replaced with the actual message ID. It may also contain the placeholder string - * ((REQUEST-ID)) which is replaced request ID of the original MSO request. - * - * @param content the content of the callback - * @param timeout the timeout in milliseconds - * @return true if the callback could be injected, false otherwise - * @throws JAXBException if the content does not adhere to the schema - */ - protected boolean injectUpdateVNFCallback(String content, long timeout) { - - String messageId = (String) getProcessVariable("vnfAdapterUpdate", "VNFU_messageId", timeout); - - if (messageId == null) { - return false; - } - - content = content.replace("((MESSAGE-ID))", messageId); - // Deprecated usage. All test code should switch to the (( ... )) syntax. - content = content.replace("{{MESSAGE-ID}}", messageId); - - content = content.replace("((REQUEST-ID))", msoRequestId); - // Deprecated usage. All test code should switch to the (( ... )) syntax. - content = content.replace("{{REQUEST-ID}}", msoRequestId); - - logger.debug("Injecting VNF adapter callback"); - - // Is it possible to unmarshal this with JAXB? I couldn't. - - UpdateVnfNotification updateVnfNotification = new UpdateVnfNotification(); - XPathTool xpathTool = new VnfNotifyXPathTool(); - xpathTool.setXML(content); - - try { - String completed = xpathTool.evaluate("/tns:updateVnfNotification/tns:completed/text()"); - updateVnfNotification.setCompleted("true".equals(completed)); - - NodeList entries = (NodeList) xpathTool.evaluate("/tns:updateVnfNotification/tns:outputs/tns:entry", - XPathConstants.NODESET); - - UpdateVnfNotificationOutputs outputs = new UpdateVnfNotificationOutputs(); - - for (int i = 0; i < entries.getLength(); i++) { - Node node = entries.item(i); - - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element entry = (Element) node; - String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent(); - String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent(); - outputs.add(key, value); - } - } - - updateVnfNotification.setOutputs(outputs); - - VnfRollback rollback = new VnfRollback(); - - String cloudSiteId = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:cloudSiteId/text()"); - rollback.setCloudSiteId(cloudSiteId); - - String cloudOwner = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:cloudOwner/text()"); - rollback.setCloudOwner(cloudOwner); - - String requestId = - xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()"); - String serviceInstanceId = xpathTool - .evaluate("/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()"); - - if (requestId != null || serviceInstanceId != null) { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId(requestId); - msoRequest.setServiceInstanceId(serviceInstanceId); - rollback.setMsoRequest(msoRequest); - } - - String tenantCreated = - xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:tenantCreated/text()"); - rollback.setTenantCreated("true".equals(tenantCreated)); - - String tenantId = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:tenantId/text()"); - rollback.setTenantId(tenantId); - - String vnfCreated = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:vnfCreated/text()"); - rollback.setVnfCreated("true".equals(vnfCreated)); - - String rollbackVnfId = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:vnfId/text()"); - rollback.setVnfId(rollbackVnfId); - - updateVnfNotification.setRollback(rollback); - - } catch (Exception e) { - logger.debug("Failed to unmarshal VNF callback content:"); - logger.debug(content); - return false; - } - - VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl(); - - - notifyService.updateVnfNotification(messageId, updateVnfNotification.isCompleted(), - updateVnfNotification.getException(), updateVnfNotification.getErrorMessage(), - updateVnfNotification.getOutputs(), updateVnfNotification.getRollback()); - - return true; - } /** * Runs a program to inject workflow messages into the test environment. A program is essentially just a list of diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java index 91cfa93a34..0c001b1192 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java @@ -22,7 +22,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import java.util.HashMap; diff --git a/bpmn/pom.xml b/bpmn/pom.xml index 9d2231f936..7b7135fafc 100644 --- a/bpmn/pom.xml +++ b/bpmn/pom.xml @@ -2,22 +2,17 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <parent> <groupId>org.onap.so</groupId> <artifactId>so</artifactId> <version>1.8.0-SNAPSHOT</version> </parent> - <artifactId>bpmn</artifactId> <name>BPMN Subsystem</name> <description>BPMN Subsystem for MSO</description> <packaging>pom</packaging> - <properties> - <camunda.version>7.14.0</camunda.version> <camunda.bpm.assert.version>1.2</camunda.bpm.assert.version> - <camunda.bpm.webapp.artifact>camunda-webapp-jboss-standalone</camunda.bpm.webapp.artifact> <h2.version>1.4.196</h2.version> <groovy.version>2.5.3</groovy.version> <saxon.version>9.5.1-8</saxon.version> @@ -26,10 +21,8 @@ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <sdnc.northbound.version>1.5.2</sdnc.northbound.version> </properties> - <modules> <module>MSOCoreBPMN</module> - <module>MSOCommonBPMN</module> <module>so-bpmn-infrastructure-common</module> <module>so-bpmn-tasks</module> @@ -37,7 +30,6 @@ <module>so-bpmn-infrastructure-flows</module> <module>mso-infrastructure-bpmn</module> </modules> - <!-- Define artifact versions for child modules --> <dependencyManagement> <dependencies> diff --git a/bpmn/so-bpmn-building-blocks/pom.xml b/bpmn/so-bpmn-building-blocks/pom.xml index dbd954ca64..a08fc61cfd 100644 --- a/bpmn/so-bpmn-building-blocks/pom.xml +++ b/bpmn/so-bpmn-building-blocks/pom.xml @@ -79,17 +79,6 @@ </plugins> </pluginManagement> </build> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.camunda.bpm</groupId> - <artifactId>camunda-bom</artifactId> - <version>${camunda.version}</version> - <scope>import</scope> - <type>pom</type> - </dependency> - </dependencies> - </dependencyManagement> <dependencies> <dependency> <groupId>org.camunda.bpm</groupId> @@ -111,15 +100,13 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.camunda.bpm.extension</groupId> + <groupId>org.camunda.bpm.assert</groupId> <artifactId>camunda-bpm-assert</artifactId> - <version>2.0-alpha2</version> <scope>test</scope> </dependency> <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> - <version>1.7.0</version> <scope>test</scope> </dependency> <dependency> @@ -155,8 +142,11 @@ <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-contract-wiremock</artifactId> + </dependency> </dependencies> </project> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java index 874e3415b2..9103c567ae 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java @@ -19,7 +19,7 @@ */ package org.onap.so.bpmn; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.java index 11e6d7798d..49e05bfc69 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.common; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.io.IOException; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAISetVnfInMaintBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAISetVnfInMaintBBTest.java index 64aa06cd20..af3455f301 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAISetVnfInMaintBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAISetVnfInMaintBBTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.common; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.io.IOException; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAIUnsetVnfInMaintBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAIUnsetVnfInMaintBBTest.java index c67db438d9..8036dc9111 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAIUnsetVnfInMaintBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAIUnsetVnfInMaintBBTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.common; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.io.IOException; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/SDNOHealthCheckBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/SDNOHealthCheckBBTest.java index ed1fb3fd91..74412fd672 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/SDNOHealthCheckBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/SDNOHealthCheckBBTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.common; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.io.IOException; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java index bd29e5570a..f492326b0c 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java @@ -22,7 +22,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.process; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.io.IOException; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java index affe1857bd..b4eab2cc13 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java index 558e785e94..05665a0da8 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.io.IOException; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java index a036f6713e..d0114f3858 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java @@ -20,9 +20,10 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.job; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.execute; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.job; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.execute; +import org.camunda.bpm.engine.runtime.Job; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java index ba9beabce7..1dd1a55b5c 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java index dae430e400..15455dce1a 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java index 7c18a20604..90e9e9dd62 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/HomingBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/HomingBBTest.java index bca4d3a979..77eb6aac33 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/HomingBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/HomingBBTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java index 48104017a5..4b35afa78a 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java @@ -30,7 +30,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.Job; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.camunda.bpm.engine.task.Task; -import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.onap.so.bpmn.BaseBPMNTest; @@ -51,7 +50,7 @@ public class PauseForManualTaskActivityTest extends BaseBPMNTest { variables.put("taskTimeout", TIMEOUT_10_S); ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables); assertThat(pi).isNotNull(); - BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask"); + assertThat(pi).isWaitingAt("ManualUserTask"); Task task = taskService.createTaskQuery().active().list().get(0); assertThat(pi).task().isNotNull(); assertNotNull(task); @@ -70,7 +69,7 @@ public class PauseForManualTaskActivityTest extends BaseBPMNTest { variables.put("taskTimeout", TIMEOUT_10_S); ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables); assertThat(pi).isNotNull(); - BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask"); + assertThat(pi).isWaitingAt("ManualUserTask"); assertThat(pi).task().isNotNull(); Task task = taskService.createTaskQuery().active().list().get(0); assertNotNull(task); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java index 29d7a80f63..6a87656134 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.junit.Assert.assertNotNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; @@ -30,7 +30,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.Job; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.camunda.bpm.engine.task.Task; -import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions; import org.junit.Ignore; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; @@ -52,7 +51,7 @@ public class PauseForManualTaskRainyDayTest extends BaseBPMNTest { variables.put("taskTimeout", TIMEOUT_10_S); ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskRainyDay", variables); assertThat(pi).isNotNull(); - BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask"); + assertThat(pi).isWaitingAt("ManualUserTask"); Task task = taskService.createTaskQuery().active().list().get(0); assertThat(pi).task().isNotNull(); assertNotNull(task); @@ -71,7 +70,7 @@ public class PauseForManualTaskRainyDayTest extends BaseBPMNTest { variables.put("taskTimeout", TIMEOUT_10_S); ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskRainyDay", variables); assertThat(pi).isNotNull(); - BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask"); + assertThat(pi).isWaitingAt("ManualUserTask"); assertThat(pi).task().isNotNull(); Task task = taskService.createTaskQuery().active().list().get(0); assertNotNull(task); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/SDNCHandlerTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/SDNCHandlerTest.java index 199ada5909..8f48e02afa 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/SDNCHandlerTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/SDNCHandlerTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.Mockito.doReturn; import java.io.IOException; import java.nio.file.Files; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java index 55d21471fc..ac03cac4f9 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java index 6f66df6c0d..7b94865771 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java index 8bfe6c020f..c4fc017c36 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java index 99ee8d9fcb..ac5d0b516d 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java index 10040b813c..1d4d383ae1 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java index a174bbb90c..20721b4950 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java index b1229cdfdf..36ab790b15 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java index ae61f3c46e..870feb2ab9 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java index 0a700c5fa1..31f4c3a78c 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java index 89cc13f0f0..340e2a60a4 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java index 0dbde4b62c..935cccbac7 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java index a7be9e69c1..6657cd8ce5 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java index 2d4a11c17e..5af5d07921 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java index dfb6bc1d9c..61845c9de1 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java index 9854bd8860..9d6d10c118 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java index de999e1074..784c62d003 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml index 90f9a57191..c6a4ffc01d 100644 --- a/bpmn/so-bpmn-infrastructure-common/pom.xml +++ b/bpmn/so-bpmn-infrastructure-common/pom.xml @@ -38,7 +38,6 @@ <configuration> <compilerId>groovy-eclipse-compiler</compilerId> </configuration> - <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> @@ -114,19 +113,6 @@ </pluginManagement> <finalName>${project.artifactId}-${project.version}</finalName> </build> - - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.camunda.bpm</groupId> - <artifactId>camunda-bom</artifactId> - <version>${camunda.version}</version> - <scope>import</scope> - <type>pom</type> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> <dependency> <groupId>org.camunda.bpm.springboot</groupId> @@ -146,10 +132,11 @@ <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxrs</artifactId> </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-rs-service-description-swagger</artifactId> - </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId> + <version>3.4.2</version> +</dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> @@ -254,7 +241,6 @@ <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> <scope>test</scope> </dependency> <dependency> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AAISliceUtil.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AAISliceUtil.groovy new file mode 100644 index 0000000000..b2415e296f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AAISliceUtil.groovy @@ -0,0 +1,146 @@ +/*- + * ============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.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.aaiclient.client.aai.AAIObjectName +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +import javax.ws.rs.NotFoundException + +class AAISliceUtil { + private static final Logger LOGGER = LoggerFactory.getLogger(AAISliceUtil.class); + ExceptionUtil exceptionUtil = new ExceptionUtil() + /** + * Get NSSI Id from AAI + * @param execution + * @param nsiId + * @return + */ + List<String> getNSSIIdList(DelegateExecution execution, String nsiId){ + List<String> nssiIdList = [] + + try + { + String errorMsg = "query nssi from aai failed." + AAIResultWrapper wrapper = queryAAI(execution, AAIFluentTypeBuilder.Types.SERVICE_INSTANCE, nsiId, errorMsg) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + if(si.isPresent()) + { + List<Relationship> relationshipList = si.get().getRelationshipList()?.getRelationship() + for (Relationship relationship : relationshipList) + { + String relatedTo = relationship.getRelatedTo() + if (relatedTo == "service-instance") + { + String relatedLink = relationship.getRelatedLink()?:"" + String instanceId = relatedLink ? relatedLink.substring(relatedLink.lastIndexOf("/") + 1,relatedLink.length()) : "" + AAIResultWrapper wrapper1 = queryAAI(execution, AAIFluentTypeBuilder.Types.SERVICE_INSTANCE, instanceId, errorMsg) + Optional<ServiceInstance> serviceInstance = wrapper1.asBean(ServiceInstance.class) + def nssiId + if (serviceInstance.isPresent()) { + ServiceInstance instance = serviceInstance.get() + if ("nssi".equalsIgnoreCase(instance.getServiceRole())) { + nssiId = instance.getServiceInstanceId() + nssiIdList.add(nssiId) + } + } + } + } + } + } + catch(BpmnError e){ + throw e + } + catch (Exception ex){ + String msg = "Exception in getNSIFromAAI " + ex.getMessage() + LOGGER.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + return nssiIdList + } + + + /** + * get nssi service from AAI + * prepare list + * @param execution + */ + List<ServiceInstance> getNSSIListFromAAI(DelegateExecution execution, List<String> nssiIdList) + { + LOGGER.trace("***** Start getNSSIListFromAAI *****") + List<ServiceInstance> nssiInstanceList = [] + String errorMsg = "query nssi list from aai failed" + for(String nssiId : nssiIdList){ + AAIResultWrapper wrapper = queryAAI(execution, AAIFluentTypeBuilder.Types.SERVICE_INSTANCE, nssiId, errorMsg) + Optional<ServiceInstance> si =wrapper.asBean(ServiceInstance.class) + if(si.isPresent()){ + nssiInstanceList.add(si.get()) + } + } + LOGGER.trace(" ***** Exit getNSSIListFromAAI *****") + return nssiInstanceList + } + + + /** + * query AAI + * @param execution + * @param aaiObjectName + * @param instanceId + * @return AAIResultWrapper + */ + private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectName aaiObjectName, String instanceId, String errorMsg) + { + LOGGER.trace(" ***** Start queryAAI *****") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + + org.onap.aaiclient.client.generated.fluentbuilders.ServiceInstance serviceInstanceType = AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(instanceId) + def type + if (aaiObjectName == AAIFluentTypeBuilder.Types.ALLOTTED_RESOURCE) { + type = serviceInstanceType.allottedResources() + } else if (aaiObjectName == AAIFluentTypeBuilder.Types.SLICE_PROFILES) { + type = serviceInstanceType.sliceProfiles() + } else { + type = serviceInstanceType + } + def uri = AAIUriFactory.createResourceUri(type) + if (!getAAIClient().exists(uri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg) + } + AAIResultWrapper wrapper = getAAIClient().get(uri, NotFoundException.class) + LOGGER.trace(" *****${PREFIX} Exit queryAAI *****") + return wrapper + } + + AAIResourcesClient getAAIClient(){ + return new AAIResourcesClient() + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy index e2d9c16328..78cafa7be5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy @@ -94,6 +94,9 @@ class AllocateSliceSubnet extends AbstractServiceTaskProcessor { String servicename = jsonUtil.getJsonValue(subnetInstanceReq, "name") execution.setVariable("servicename", servicename) + String sST = jsonUtil.getJsonValue(subnetInstanceReq, "sst") + execution.setVariable("sst", sST) + String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiInfo.nsiId") if (isBlank(nsiId)) { msg = "Input nsiId is null" diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy index 059a209336..276b6f0500 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy @@ -263,9 +263,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.anSliceTaskInfo sliceTaskInfo.setSliceInstanceId(serviceInstanceId) + String sliceProfileName = "an_" + sliceParams.serviceName // create slice profile - ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, oStatus) + ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, sliceProfileName, oStatus) //timestamp format YYYY-MM-DD hh:mm:ss rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) @@ -338,10 +339,11 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ String routeId = UUID.randomUUID().toString() route.setRouteId(routeId) route.setType("endpoint") - route.setRole("an") + route.setRole("AN") route.setFunction("3gppTransportEP") route.setIpAddress( sliceTaskInfo.sliceProfile.ipAddress) route.setNextHop(sliceTaskInfo.sliceProfile.nextHopInfo) + route.setLogicalInterfaceId(sliceTaskInfo.sliceProfile.logicInterfaceId) route.setAddressFamily("ipv4") route.setPrefixLength(24) sliceTaskInfo.setEndPointId(routeId) @@ -363,10 +365,11 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ String routeId = UUID.randomUUID().toString() route.setRouteId(routeId) route.setType("endpoint") - route.setRole("cn") + route.setRole("CN") route.setFunction("3gppTransportEP") route.setIpAddress( sliceTaskInfo.sliceProfile.ipAddress) route.setNextHop(sliceTaskInfo.sliceProfile.nextHopInfo) + route.setLogicalInterfaceId(sliceTaskInfo.sliceProfile.logicInterfaceId) route.setAddressFamily("ipv4") route.setPrefixLength(24) @@ -454,9 +457,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.cnSliceTaskInfo sliceTaskInfo.setSliceInstanceId(serviceInstanceId) + String sliceProfileName = "cn_"+sliceParams.serviceName // create slice profile - ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, oStatus) + ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, sliceProfileName, oStatus) //timestamp format YYYY-MM-DD hh:mm:ss rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) @@ -597,10 +601,11 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ String serviceInstanceId = UUID.randomUUID().toString() sliceTaskInfo.setSliceInstanceId(serviceInstanceId) + String sliceProfileName = "tn_" + sliceParams.serviceName //execution.setVariable("cnSliceProfileInstanceId", serviceInstanceId) //todo: // create slice profile - ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, oStatus) + ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, sliceProfileName, oStatus) //timestamp format YYYY-MM-DD hh:mm:ss rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) @@ -701,6 +706,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID serviceInfo.nssiId = sliceTaskInfo.suggestNssiId serviceInfo.sST = sliceTaskInfo.sliceProfile.sST ?: sliceParams.serviceProfile.get("sST") + serviceInfo.nssiName = "nssi_tn" + execution.getVariable("sliceServiceInstanceName") nbiRequest.setServiceInfo(serviceInfo) nbiRequest.setEsrInfo(esrInfo) @@ -923,10 +929,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ client.create(sourceInstanceUri, relationship) } - static def createSliceProfileInstance(SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo, String oStatus) { + static def createSliceProfileInstance(SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo, String sliceProfileName, String oStatus) { // create slice profile ServiceInstance rspi = new ServiceInstance() - rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name) + rspi.setServiceInstanceName(sliceProfileName) rspi.setServiceType(sliceTaskInfo.sliceProfile.getSST()) rspi.setServiceRole("slice-profile") rspi.setOrchestrationStatus(oStatus) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy index ccb04d9440..5476cb5afa 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy @@ -183,6 +183,7 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ serviceProfile.setUlThptPerSlice(Integer.parseInt(serviceProfileMap.get("uLThptPerSlice").toString())) serviceProfile.setUlThptPerUE(Integer.parseInt(serviceProfileMap.get("uLThptPerUE").toString())) serviceProfile.setActivityFactor(Integer.parseInt(serviceProfileMap.get("activityFactor").toString())) + serviceProfile.setMaxNumberOfConns(Integer.parseInt(serviceProfileMap.get("maxNumberofConns").toString())) serviceProfile.setJitter(Integer.parseInt(serviceProfileMap.get("jitter").toString())) serviceProfile.setSurvivalTime("0") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy index 25a7159264..91a69b3123 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts import com.fasterxml.jackson.databind.ObjectMapper import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.ServiceInstance import org.onap.so.beans.nsmf.EsrInfo import org.onap.so.beans.nsmf.NetworkType import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest @@ -55,6 +56,8 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ OofUtils oofUtils = new OofUtils() + AAISliceUtil aaiSliceUtil = new AAISliceUtil() + private static final ObjectMapper objectMapper = new ObjectMapper() private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil) @@ -70,7 +73,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ * prepare the params for decompose nst * @param execution */ - public void prepareDecomposeNST(DelegateExecution execution) { + void prepareDecomposeNST(DelegateExecution execution) { SliceTaskParamsAdapter sliceTaskParams = execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter @@ -131,7 +134,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ "modelVersion":"" }""" execution.setVariable("nsstServiceModelInfo", serviceModelInfo) - } /** @@ -162,7 +164,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ } else { execution.setVariable("nsstHandleContinue", true) } - } /** @@ -190,7 +191,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ } private void handleByType(DelegateExecution execution, ServiceDecomposition serviceDecomposition, - SliceTaskParamsAdapter sliceParams, List<SubnetCapability> subnetCapabilities) { + SliceTaskParamsAdapter sliceParams, List<SubnetCapability> subnetCapabilities) { ModelInfo modelInfo = serviceDecomposition.getModelInfo() String vendor = serviceDecomposition.getServiceRole() SubnetType subnetType = convertServiceCategory(serviceDecomposition.getServiceCategory()) @@ -257,7 +258,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ if(serviceCategory ==~ /CN.*/){ return SubnetType.CN } - if (serviceCategory ==~ /AN.*NF.*/){ + if (serviceCategory ==~ /AN.*/){ return SubnetType.AN } if (serviceCategory ==~ /TN.*BH.*/){ @@ -346,7 +347,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ } /** - * todo: need rewrite * process select nsi response * @param execution */ @@ -369,10 +369,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions") - Map<String, Object> solution = nsiSolutions.get(0) - - //String resourceSharingLevel = execution.getVariable("resourceSharingLevel") - //Boolean isSharable = resourceSharingLevel == "shared" + Map<String, Object> solution = nsiSolutions?.get(0) if (solution != null) { if (execution.getVariable("queryNsiFirst")) { @@ -384,7 +381,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ } execution.setVariable("queryNsiFirst", false) } else { - processSharedNSI(solution, sliceTaskParams) + processSharedNSI(solution, sliceTaskParams, execution) execution.setVariable("needQuerySliceProfile", false) } } @@ -393,18 +390,28 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ logger.debug("*** Completed options Call to OOF ***") } - private static void processSharedNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) { + private void processSharedNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams, DelegateExecution execution) { Map<String, Object> sharedNSISolution = solution.get("sharedNSISolution") as Map String nsiId = sharedNSISolution.get("NSIId") String nsiName = sharedNSISolution.get("NSIName") sliceParams.setSuggestNsiId(nsiId) sliceParams.setSuggestNsiName(nsiName) + List<String> nssiId = aaiSliceUtil.getNSSIIdList(execution,nsiId) + List<ServiceInstance> nssiInstances = aaiSliceUtil.getNSSIListFromAAI(execution, nssiId) + List<Map> sliceProfiles = sharedNSISolution.get("sliceProfiles") as List<Map> handleSliceProfiles(sliceProfiles, sliceParams) + Map<String, Object> nssiSolution = new HashMap<>() + for(ServiceInstance instance: nssiInstances){ + nssiSolution.put("NSSIId", instance.getServiceInstanceId()) + nssiSolution.put("NSSIName", instance.getServiceInstanceName()) + processNssiResult(sliceParams, instance.getEnvironmentContext(), nssiSolution) + } + } - private static void processNewNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) { + private void processNewNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) { Map<String, Object> newNSISolution = solution.get("newNSISolution") as Map List<Map> sliceProfiles = newNSISolution.get("sliceProfiles") as List<Map> handleSliceProfiles(sliceProfiles, sliceParams) @@ -436,7 +443,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ * get NSSI Selection Capability for AN * @param execution */ - public void getNSSISelectionCap4AN(DelegateExecution execution) { + void getNSSISelectionCap4AN(DelegateExecution execution) { def vendor = execution.getVariable("vendor") as String @@ -458,7 +465,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ * get NSSI Selection Capability for TN * @param execution */ - public void getNSSISelectionCap4TN(DelegateExecution execution) { + void getNSSISelectionCap4TN(DelegateExecution execution) { def vendor = execution.getVariable("vendor") as String @@ -479,7 +486,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ * get NSSI Selection Capability for CN * @param execution */ - public void getNSSISelectionCap4CN(DelegateExecution execution) { + void getNSSISelectionCap4CN(DelegateExecution execution) { def vendor = execution.getVariable("vendor") as String @@ -513,7 +520,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ } /** - * if exist nssi need to select? + * if exist nssi need to select * @param execution */ public void handleNssiSelect(DelegateExecution execution) { @@ -526,20 +533,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ boolean needAnNssiSelection = execution.getVariable("NEED_AN_NSSI_SELECTION") as Boolean boolean needTnNssiSelection = execution.getVariable("NEED_TN_NSSI_SELECTION") as Boolean - /** - * [ - * ​ { - * ​ "subType": subtype, - * ​ "nsstInfo": object, - * ​ "sliceProfile": object - * ​ }, - * { - * "subType": subtype, - * "nsstInfo": object, - * "sliceProfile": object - * } - * ] - */ List<Map> nssiNeedHandlerInfos = new ArrayList<>() Map<String, Object> nssiNeedHandlerMap = new HashMap() @@ -676,7 +669,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ } private void processNssiResult(SliceTaskParamsAdapter sliceTaskParams, SubnetType subnetType, - Map<String, Object> solution) { + Map<String, Object> solution) { switch (subnetType) { case SubnetType.CN: sliceTaskParams.cnSliceTaskInfo.suggestNssiId = solution.get("NSSIId") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy index 78c6a084ef..9221067cce 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy @@ -111,6 +111,7 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { String serviceType = execution.getVariable("subscriptionServiceType") String ssInstanceId = execution.getVariable("sliceServiceInstanceId") String sliceProfileStr = execution.getVariable("sliceProfile") + String sst = execution.getVariable("sst") try { if (sliceProfileStr == null || sliceProfileStr.isEmpty()) { String msg = "ERROR: createServiceInstance: sliceProfile is null" @@ -126,7 +127,7 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { sliceInstanceName = ssInstanceId } ss.setServiceInstanceName(sliceInstanceName) - ss.setServiceType(serviceType) + ss.setServiceType(sst) String serviceStatus = "deactivated" ss.setOrchestrationStatus(serviceStatus) String modelInvariantUuid = execution.getVariable("modelInvariantUuid") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy index 019e836514..09bbb81b6b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy @@ -87,6 +87,9 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { String sliceServiceInstanceName = execution.getVariable("servicename") execution.setVariable("sliceServiceInstanceName", sliceServiceInstanceName) + String sst = execution.getVariable("sst") + execution.setVariable("sst", sst) + //additional properties String sliceProfile = jsonUtil.getJsonValue(additionalPropJsonStr, "sliceProfile") if (isBlank(sliceProfile)) { diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml index fa45a415ee..9f78182811 100644 --- a/bpmn/so-bpmn-infrastructure-flows/pom.xml +++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml @@ -9,13 +9,10 @@ <modelVersion>4.0.0</modelVersion> <artifactId>so-bpmn-infrastructure-flows</artifactId> <packaging>jar</packaging> - <properties> - <camunda.bpm.assert.version>2.0-alpha2</camunda.bpm.assert.version> <assertj.core.version>1.7.0</assertj.core.version> <grpc.version>1.17.1</grpc.version> </properties> - <build> <plugins> <plugin> @@ -138,17 +135,6 @@ </pluginManagement> <finalName>${project.artifactId}-${project.version}</finalName> </build> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.camunda.bpm</groupId> - <artifactId>camunda-bom</artifactId> - <version>${camunda.version}</version> - <scope>import</scope> - <type>pom</type> - </dependency> - </dependencies> - </dependencyManagement> <dependencies> <dependency> <groupId>org.camunda.bpm.springboot</groupId> @@ -190,7 +176,8 @@ </dependency> <dependency> <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-rs-service-description-swagger</artifactId> + <artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId> + <version>3.4.2</version> </dependency> <dependency> <groupId>com.h2database</groupId> @@ -200,8 +187,6 @@ <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> - <version>1.10.19</version> - <!-- remove --> <scope>test</scope> </dependency> <dependency> @@ -258,15 +243,13 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.camunda.bpm.extension</groupId> + <groupId>org.camunda.bpm.assert</groupId> <artifactId>camunda-bpm-assert</artifactId> - <version>${camunda.bpm.assert.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> - <version>${assertj.core.version}</version> <scope>test</scope> </dependency> <dependency> @@ -277,7 +260,6 @@ <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> <scope>test</scope> </dependency> <dependency> @@ -286,5 +268,9 @@ <version>${grpc.version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-contract-wiremock</artifactId> + </dependency> </dependencies> </project> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn index 29f024991d..07077a1cab 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn @@ -125,6 +125,7 @@ nss.prepareInitOperationStatus(execution)</bpmn:script> <camunda:in source="sliceParams" target="sliceParams" /> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:in source="servicename" target="servicename" /> + <camunda:in source="sst" target="sst" /> </bpmn:extensionElements> <bpmn:incoming>Flow_0g7721r</bpmn:incoming> <bpmn:outgoing>Flow_189zwjw</bpmn:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn index 82efc97e92..b70569b8ad 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn @@ -136,6 +136,7 @@ css.prepareOofSelection(execution)</bpmn:script> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:out source="rollbackData" target="rollbackData" /> <camunda:out source="rolledBack" target="rolledBack" /> + <camunda:in source="sst" target="sst" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1bevt3a</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mlrlbv</bpmn:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java index 9521e68e16..7aaf558901 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java @@ -100,4 +100,8 @@ public class GrpcNettyServer extends BluePrintProcessingServiceImplBase { return this.detailedMessages; } + public void resetList() { + detailedMessages.clear(); + } + } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java index a03da25248..786ee1e239 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java @@ -49,7 +49,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.ok; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; /** diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSWUPDownloadTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSWUPDownloadTest.java index b9c5fdf145..cd54c49671 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSWUPDownloadTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSWUPDownloadTest.java @@ -20,11 +20,24 @@ package org.onap.so.bpmn.infrastructure.process; -import com.google.protobuf.Struct; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.okJson; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static org.assertj.core.api.Assertions.fail; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.assertj.core.api.Assertions; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Before; import org.junit.Test; +import org.onap.aaiclient.client.aai.AAIVersion; import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers; import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput; @@ -32,21 +45,10 @@ import org.onap.so.BaseBPMNTest; import org.onap.so.GrpcNettyServer; import org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.aaiclient.client.aai.AAIVersion; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import static com.github.tomakehurst.wiremock.client.WireMock.okJson; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static org.assertj.core.api.Assertions.fail; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import com.google.protobuf.Struct; /** * Basic Integration test for GenericPnfSWUPDownloadTest.bpmn workflow. @@ -100,6 +102,7 @@ public class GenericPnfSWUPDownloadTest extends BaseBPMNTest { mockCatalogDb(); mockAai(); + grpcNettyServer.resetList(); final String msoRequestId = UUID.randomUUID().toString(); executionVariables.put(ExecutionVariableNames.MSO_REQUEST_ID, msoRequestId); @@ -117,12 +120,12 @@ public class GenericPnfSWUPDownloadTest extends BaseBPMNTest { } // Layout is to reflect the bpmn visual layout - assertThat(pi).isEnded().hasPassedInOrder("download_StartEvent", "ServiceTask_1mpt2eq", "ServiceTask_1nl90ao", + assertThat(pi).isStarted().hasPassedInOrder("download_StartEvent", "ServiceTask_1mpt2eq", "ServiceTask_1nl90ao", "ExclusiveGateway_1rj84ne", "ServiceTask_0yavde3", "ExclusiveGateway_1ja7grm", "ServiceTask_1wxo7xz", "ExclusiveGateway_08lusga", "download_EndEvent"); List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages(); - assertThat(detailedMessages.size() == 3); + assertEquals(3, detailedMessages.size()); int count = 0; try { for (ExecutionServiceInput eSI : detailedMessages) { @@ -138,7 +141,7 @@ public class GenericPnfSWUPDownloadTest extends BaseBPMNTest { e.printStackTrace(); fail("GenericPnfSWUPDownload request exception", e); } - assertThat(count == actionNames.length); + assertTrue(count == actionNames.length); } private boolean isProcessInstanceEnded() { diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java index de81f91e66..1c00f3628d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java @@ -46,7 +46,10 @@ import static com.github.tomakehurst.wiremock.client.WireMock.put; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.assertj.core.api.Assertions.fail; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; /** * Basic Integration test for GenericPnfSoftwareUpgrade.bpmn workflow. @@ -120,13 +123,13 @@ public class GenericPnfSoftwareUpgradeTest extends BaseBPMNTest { } // Layout is to reflect the bpmn visual layout - assertThat(pi).isEnded().hasPassedInOrder("softwareUpgrade_startEvent", "ServiceTask_042uz7n", + assertThat(pi).isStarted().hasPassedInOrder("softwareUpgrade_startEvent", "ServiceTask_042uz7n", "ScriptTask_10klpg8", "ServiceTask_0slpahe", "ExclusiveGateway_0x6h0ni", "ServiceTask_0x5cje8", "ExclusiveGateway_0v3l3wv", "ServiceTask_02lxf48", "ExclusiveGateway_0ch3fef", "ServiceTask_0y2uysu", "ExclusiveGateway_1ny9b1z", "ScriptTask_1igtc83", "CallActivity_0o1mi8u", "softwareUpgrade_endEvent"); List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages(); - assertThat(detailedMessages.size() == 4); + assertEquals(4, detailedMessages.size()); int count = 0; try { for (ExecutionServiceInput eSI : detailedMessages) { @@ -142,7 +145,8 @@ public class GenericPnfSoftwareUpgradeTest extends BaseBPMNTest { e.printStackTrace(); fail("GenericPnfSoftwareUpgrade request exception", e); } - assertThat(count == actionNames.length); + assertTrue(count == actionNames.length); + grpcNettyServer.resetList(); } private boolean isProcessInstanceEnded() { @@ -159,27 +163,26 @@ public class GenericPnfSoftwareUpgradeTest extends BaseBPMNTest { * the fields of actionIdentifiers should match the one in the * response/GenericPnfSoftwareUpgrade_catalogdb.json. */ - assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_pnf_software_upgrade_restconf"); - assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0"); - assertThat(actionIdentifiers.getActionName()).isEqualTo(action); - assertThat(actionIdentifiers.getMode()).isEqualTo("async"); + assertEquals("test_pnf_software_upgrade_restconf", actionIdentifiers.getBlueprintName()); + assertEquals("1.0.0", actionIdentifiers.getBlueprintVersion()); + assertEquals(action, actionIdentifiers.getActionName()); + assertEquals("async", actionIdentifiers.getMode()); CommonHeader commonHeader = executionServiceInput.getCommonHeader(); - assertThat(commonHeader.getOriginatorId()).isEqualTo("SO"); + assertEquals("SO", commonHeader.getOriginatorId()); Struct payload = executionServiceInput.getPayload(); Struct requeststruct = payload.getFieldsOrThrow(action + "-request").getStructValue(); - assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo"); + assertEquals("PNFDemo", requeststruct.getFieldsOrThrow("resolution-key").getStringValue()); Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue(); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo"); - assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()) - .isEqualTo("32daaac6-5017-4e1e-96c8-6a27dfbe1421"); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()) - .isEqualTo("38dc9a92-214c-11e7-93ae-92361f002680"); - assertThat(propertiesStruct.getFieldsOrThrow("target-software-version").getStringValue()) - .isEqualTo("demo-sw-ver2.0.0"); + assertEquals("PNFDemo", propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()); + assertEquals("32daaac6-5017-4e1e-96c8-6a27dfbe1421", + propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()); + assertEquals("38dc9a92-214c-11e7-93ae-92361f002680", + propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()); + assertEquals("demo-sw-ver2.0.0", propertiesStruct.getFieldsOrThrow("target-software-version").getStringValue()); } private void mockAai() { diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PnfHealthCheckTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PnfHealthCheckTest.java index 2423ad8465..bc364ae736 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PnfHealthCheckTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PnfHealthCheckTest.java @@ -41,7 +41,9 @@ import java.util.Map; import java.util.UUID; import static com.github.tomakehurst.wiremock.client.WireMock.*; import static org.assertj.core.api.Assertions.fail; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * Basic Integration test for GenericPnfHealthCheck.bpmn workflow. @@ -118,7 +120,7 @@ public class PnfHealthCheckTest extends BaseBPMNTest { List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages(); logger.debug("Size of detailedMessage is {}", detailedMessages.size()); - assertThat(detailedMessages.size() == 1).isTrue(); + assertTrue(detailedMessages.size() == 1); int count = 0; try { for (ExecutionServiceInput eSI : detailedMessages) { @@ -132,7 +134,7 @@ public class PnfHealthCheckTest extends BaseBPMNTest { e.printStackTrace(); fail("PNFHealthCheck request exception", e); } - assertThat(count == 1).isTrue(); + assertTrue(count == 1); } private boolean isProcessInstanceEnded() { @@ -148,25 +150,25 @@ public class PnfHealthCheckTest extends BaseBPMNTest { /** * the fields of actionIdentifiers should match the one in the response/PnfHealthCheck_catalogdb.json. */ - assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_pnf_health_check_restconf"); - assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0"); - assertThat(actionIdentifiers.getActionName()).isEqualTo(action); - assertThat(actionIdentifiers.getMode()).isEqualTo("async"); + assertEquals("test_pnf_health_check_restconf", actionIdentifiers.getBlueprintName()); + assertEquals("1.0.0", actionIdentifiers.getBlueprintVersion()); + assertEquals(action, actionIdentifiers.getActionName()); + assertEquals("async", actionIdentifiers.getMode()); CommonHeader commonHeader = executionServiceInput.getCommonHeader(); - assertThat(commonHeader.getOriginatorId()).isEqualTo("SO"); + assertEquals("SO", commonHeader.getOriginatorId()); Struct payload = executionServiceInput.getPayload(); Struct requeststruct = payload.getFieldsOrThrow(action + "-request").getStructValue(); - assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo"); + assertEquals("PNFDemo", requeststruct.getFieldsOrThrow("resolution-key").getStringValue()); Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue(); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo"); - assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()) - .isEqualTo("32daaac6-5017-4e1e-96c8-6a27dfbe1421"); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()) - .isEqualTo("38dc9a92-214c-11e7-93ae-92361f002680"); + assertEquals("PNFDemo", propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()); + assertEquals("32daaac6-5017-4e1e-96c8-6a27dfbe1421", + propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()); + assertEquals("38dc9a92-214c-11e7-93ae-92361f002680", + propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()); } private void mockAai() { diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java index 7da3a2c81b..60c7e4e769 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java @@ -26,8 +26,9 @@ import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.put; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.assertj.core.api.Assertions.fail; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; -import com.google.protobuf.Struct; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.io.IOException; import java.util.HashMap; import java.util.List; @@ -47,6 +48,7 @@ import org.onap.so.bpmn.mock.FileUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import com.google.protobuf.Struct; /** * Basic Integration test for ServiceLevelUpgrade.bpmn workflow. @@ -125,6 +127,7 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { mockCatalogDb(); mockRequestDb(); mockAai(); + grpcNettyServer.resetList(); final String msoRequestId = UUID.randomUUID().toString(); executionVariables.put(ExecutionVariableNames.MSO_REQUEST_ID, msoRequestId); @@ -148,7 +151,7 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { "Gateway_1vq11i7", "Activity_0o2rrag", "Activity_1n4rk7m", "Activity_1lz38px", "Event_12983th"); List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages(); - assertThat(detailedMessages.size() == 5); + assertEquals(10, detailedMessages.size()); int count = 0; String action = ""; try { @@ -164,7 +167,7 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { e.printStackTrace(); fail("GenericPnfSoftwareUpgrade request exception", e); } - assertThat(count == actionNames.length); + assertTrue(count == actionNames.length); } private boolean isProcessInstanceEnded() { @@ -181,25 +184,25 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { /** * the fields of actionIdentifiers should match the one in the response/PnfHealthCheck_catalogdb.json. */ - assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_pnf_software_upgrade_restconf"); - assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0"); - assertThat(actionIdentifiers.getActionName()).isEqualTo(action); - assertThat(actionIdentifiers.getMode()).isEqualTo("async"); + assertEquals("test_pnf_software_upgrade_restconf", actionIdentifiers.getBlueprintName()); + assertEquals("1.0.0", actionIdentifiers.getBlueprintVersion()); + assertEquals(action, actionIdentifiers.getActionName()); + assertEquals("async", actionIdentifiers.getMode()); CommonHeader commonHeader = executionServiceInput.getCommonHeader(); - assertThat(commonHeader.getOriginatorId()).isEqualTo("SO"); + assertEquals("SO", commonHeader.getOriginatorId()); Struct payload = executionServiceInput.getPayload(); Struct requeststruct = payload.getFieldsOrThrow(action + "-request").getStructValue(); - assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo(pnfName); + assertEquals(pnfName, requeststruct.getFieldsOrThrow("resolution-key").getStringValue()); Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue(); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo(pnfName); - assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()) - .isEqualTo("d88da85c-d9e8-4f73-b837-3a72a431622b"); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()) - .isEqualTo("38dc9a92-214c-11e7-93ae-92361f002680"); + assertEquals(pnfName, propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()); + assertEquals("d88da85c-d9e8-4f73-b837-3a72a431622b", + propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()); + assertEquals("38dc9a92-214c-11e7-93ae-92361f002680", + propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()); } private void mockAai() { diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml index 564a117674..881cb30548 100644 --- a/bpmn/so-bpmn-tasks/pom.xml +++ b/bpmn/so-bpmn-tasks/pom.xml @@ -11,7 +11,6 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <grpc.version>1.17.1</grpc.version> </properties> <build> <plugins> @@ -47,9 +46,9 @@ </configuration> </plugin> <plugin> - <groupId>io.swagger</groupId> + <groupId>io.swagger.codegen.v3</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> - <version>2.3.1</version> + <version>3.0.24</version> <executions> <execution> <goals> @@ -163,11 +162,10 @@ <scope>import</scope> </dependency> <dependency> - <groupId>org.camunda.bpm</groupId> - <artifactId>camunda-bom</artifactId> - <version>${camunda.version}</version> - <scope>import</scope> - <type>pom</type> + <groupId>io.grpc</groupId> + <artifactId>grpc-testing</artifactId> + <version>1.17.1</version> + <scope>test</scope> </dependency> </dependencies> </dependencyManagement> @@ -180,7 +178,6 @@ <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-contract-wiremock</artifactId> - <version>1.2.4.RELEASE</version> <scope>test</scope> </dependency> <dependency> @@ -210,7 +207,6 @@ <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> <scope>test</scope> </dependency> <dependency> @@ -229,11 +225,6 @@ </exclusions> </dependency> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-configuration-processor</artifactId> - <optional>true</optional> - </dependency> - <dependency> <groupId>nl.jqno.equalsverifier</groupId> <artifactId>equalsverifier</artifactId> <version>2.5.1</version> @@ -242,7 +233,6 @@ <dependency> <groupId>io.grpc</groupId> <artifactId>grpc-testing</artifactId> - <version>${grpc.version}</version> <scope>test</scope> </dependency> <dependency> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java index 3556cc024c..6c6bd61041 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java @@ -104,7 +104,8 @@ public class UserParamsServiceTraversal { if ((vfModuleCustomization.getVfModule() != null) && ((vfModuleCustomization.getVfModule().getModuleHeatTemplate() != null && vfModuleCustomization.getHeatEnvironment() != null)) - || (vfModuleCustomization.getVfModule().getModelName() != null + || (vfModuleCustomization.getVfModule() != null + && vfModuleCustomization.getVfModule().getModelName() != null && vfModuleCustomization.getVfModule().getModelName() .contains("helm"))) { foundVfModuleOrVG = true; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index b756772188..ec2ca74fa7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -420,15 +420,24 @@ public class WorkflowActionBBTasks { } public void postProcessingExecuteBB(DelegateExecution execution) { - List<ExecuteBuildingBlock> flowsToExecute = - (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); - String handlingCode = (String) execution.getVariable(HANDLINGCODE); - final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); - int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); - ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1); - String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName(); - if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte && "Success".equalsIgnoreCase(handlingCode)) { - postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute); + try { + List<ExecuteBuildingBlock> flowsToExecute = + (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + String handlingCode = (String) execution.getVariable(HANDLINGCODE); + final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); + int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); + logger.debug("Current Sequence: {}", currentSequence); + ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1); + String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName(); + if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte + && "Success".equalsIgnoreCase(handlingCode)) { + postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute); + } + + flowManipulatorListenerRunner.postModifyFlows(flowsToExecute, new DelegateExecutionImpl(execution)); + } catch (Exception ex) { + logger.error("Exception in postProcessingExecuteBB", ex); + workflowAction.buildAndThrowException(execution, "Failed to post process Execute BB"); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java index bc32489944..b90844a733 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java @@ -22,12 +22,12 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks.listeners; import java.util.List; import org.onap.so.bpmn.common.BuildingBlockExecution; -import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator; +import org.onap.so.bpmn.common.listener.flowmanipulator.PreFlowManipulator; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.springframework.stereotype.Component; @Component -public class HomingListener implements FlowManipulator { +public class HomingListener implements PreFlowManipulator { @Override diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java index 4cde9c1fc8..08e877956d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java @@ -26,7 +26,7 @@ import java.util.Optional; import org.onap.so.bpmn.common.BBConstants; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.listener.db.PostCompletionRequestsDbListener; -import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator; +import org.onap.so.bpmn.common.listener.flowmanipulator.PreFlowManipulator; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.db.catalog.beans.VnfResourceCustomization; @@ -36,7 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component -public class MultiStageSkipListener implements FlowManipulator, PostCompletionRequestsDbListener { +public class MultiStageSkipListener implements PreFlowManipulator, PostCompletionRequestsDbListener { @Autowired protected BBInputSetupUtils bbInputSetupUtils; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java index 564ee91fb2..3af839fbec 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java @@ -27,7 +27,7 @@ import java.util.Set; import org.apache.logging.log4j.util.Strings; import org.onap.so.bpmn.common.BBConstants; import org.onap.so.bpmn.common.BuildingBlockExecution; -import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator; +import org.onap.so.bpmn.common.listener.flowmanipulator.PreFlowManipulator; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.db.catalog.beans.PnfResourceCustomization; import org.onap.so.db.catalog.beans.VfModuleCustomization; @@ -38,7 +38,7 @@ import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; @Component -public class SkipCDSBuildingBlockListener implements FlowManipulator { +public class SkipCDSBuildingBlockListener implements PreFlowManipulator { @Autowired private CatalogDbClient catalogDbClient; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java index 83f61e3a4f..5ffba455b3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java @@ -3,7 +3,7 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks.listeners; import java.util.List; import org.onap.so.bpmn.common.BBConstants; import org.onap.so.bpmn.common.BuildingBlockExecution; -import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator; +import org.onap.so.bpmn.common.listener.flowmanipulator.PreFlowManipulator; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; @@ -11,7 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component -public class SkipConfigVnfListener implements FlowManipulator { +public class SkipConfigVnfListener implements PreFlowManipulator { private final CatalogDbClient catalogDbClient; diff --git a/bpmn/so-bpmn-tasks/src/main/resources/naming-service/swagger.json b/bpmn/so-bpmn-tasks/src/main/resources/naming-service/swagger.json index b86ffbc6b0..c3dc52cc5c 100644 --- a/bpmn/so-bpmn-tasks/src/main/resources/naming-service/swagger.json +++ b/bpmn/so-bpmn-tasks/src/main/resources/naming-service/swagger.json @@ -235,7 +235,7 @@ "type": "string", "description": "Naming type of the resource" }, - "${naming-ingredients(zero or more)}": { + "{naming-ingredients(zero or more)}": { "type": "string", "description": "values to subsitute in the naming recipe" } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncUpgradePreCheckPnfBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncUpgradePreCheckPnfBBTest.java index 0ba1e27f5e..5a070aff4a 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncUpgradePreCheckPnfBBTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncUpgradePreCheckPnfBBTest.java @@ -55,16 +55,40 @@ public class PrepareSdncUpgradePreCheckPnfBBTest { } @Test - public void prepare_jsonWithoutActionPayload() { + public void prepareJson_payloadWithoutAction() { String payloadWithoutActionArray = "{\"json name\": \"test1\"}"; ControllerContext<BuildingBlockExecution> controllerContext = - createControllerContext(payloadWithoutActionArray); + createControllerContext(payloadWithoutActionArray, "action1"); testedObject.prepare(controllerContext); assertThat((String) controllerContext.getExecution().getVariable("payload")) .isEqualTo(payloadWithoutActionArray); } + @Test + public void prepareJson_payloadWithActionJsonObject() { + String jsonActionObjectKey = "action1"; + String jsonActionObject = String.format("{\"%s\":\"act1\"}", jsonActionObjectKey); + String payloadWithActionArray = String.format("{\"json name\":\"test1\",\"action\": [%s]}", jsonActionObject); + ControllerContext<BuildingBlockExecution> controllerContext = + createControllerContext(payloadWithActionArray, jsonActionObjectKey); + + testedObject.prepare(controllerContext); + + assertThat((String) controllerContext.getExecution().getVariable("payload")).isEqualTo(jsonActionObject); + } + + @Test + public void prepareJson_payloadWithActionJsonObjectButDifferentKey() { + String payloadWithActionArray = ("{\"json name\":\"test1\",\"action\": [{\"action1\":\"act1\"}]}"); + ControllerContext<BuildingBlockExecution> controllerContext = + createControllerContext(payloadWithActionArray, "otherAction"); + + testedObject.prepare(controllerContext); + + assertThat((String) controllerContext.getExecution().getVariable("payload")).isEqualTo(payloadWithActionArray); + } + private ControllerContext<BuildingBlockExecution> createControllerContext(String actor, String action, String scope) { ControllerContext<BuildingBlockExecution> controllerContext = new ControllerContext<>(); @@ -74,9 +98,10 @@ public class PrepareSdncUpgradePreCheckPnfBBTest { return controllerContext; } - private ControllerContext<BuildingBlockExecution> createControllerContext(String payload) { + private ControllerContext<BuildingBlockExecution> createControllerContext(String payload, String action) { ControllerContext<BuildingBlockExecution> controllerContext = new ControllerContext<>(); controllerContext.setExecution(prepareBuildingBlockExecution(payload)); + controllerContext.setControllerAction(action); return controllerContext; } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelTest.java new file mode 100644 index 0000000000..cfaa4040c7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelTest.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.service.level; + +import static org.assertj.core.api.Assertions.assertThat; +import java.util.ArrayList; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Test; +import java.util.List; +import org.onap.so.bpmn.infrastructure.service.level.impl.ServiceLevelConstants; + +public class ServiceLevelTest { + + private static final String EXECUTION_KEY_PNF_NAME_LIST = "pnfNameList"; + private static final String EXECUTION_KEY_PNF_COUNTER = "pnfCounter"; + + @Test + public void pnfCounterExecution_success() { + // given + String pnfName = "pnfName1"; + DelegateExecution execution = new DelegateExecutionFake(); + execution.setVariable(EXECUTION_KEY_PNF_NAME_LIST, createPnfNameList(pnfName)); + execution.setVariable(EXECUTION_KEY_PNF_COUNTER, 0); + // when + new ServiceLevel().pnfCounterExecution(execution); + // then + assertThat(execution.getVariable(ServiceLevelConstants.PNF_NAME)).isEqualTo(pnfName); + assertThat(execution.getVariable(EXECUTION_KEY_PNF_COUNTER)).isEqualTo(1); + } + + private List<String> createPnfNameList(String pnfName) { + List<String> pnfNameList = new ArrayList<>(); + pnfNameList.add(pnfName); + return pnfNameList; + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversalTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversalTest.java new file mode 100644 index 0000000000..99f17a3628 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversalTest.java @@ -0,0 +1,219 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.tasks; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.common.BBConstants; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.catalog.beans.ConfigurationResource; +import org.onap.so.db.catalog.beans.CvnfcCustomization; +import org.onap.so.db.catalog.beans.HeatTemplate; +import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VfModule; +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; +import org.onap.so.db.catalog.beans.HeatEnvironment; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.mock; + +public class UserParamsServiceTraversalTest extends BaseTaskTest { + + private static final String MACRO_ASSIGN_JSON = "Macro/ServiceMacroAssign.json"; + private static final String MACRO_ASSIGN_PNF_JSON = "Macro/ServiceMacroAssignPnf.json"; + private static final String NETWORK_COLLECTION_JSON = "Macro/CreateNetworkCollection.json"; + private static final String serviceInstanceId = "123"; + private DelegateExecution execution; + private CatalogDbClient mockCatalogDbClient; + private UserParamsServiceTraversal userParamsServiceTraversal; + private String requestAction; + + @Before + public void before() throws Exception { + execution = new DelegateExecutionFake(); + mockCatalogDbClient = mock(CatalogDbClient.class); + userParamsServiceTraversal = new UserParamsServiceTraversal(mockCatalogDbClient, mock(ExceptionBuilder.class)); + requestAction = "assignInstance"; + } + + @Test + public void getResourceListFromUserParamsForVnfs() throws Exception { + initExecution(requestAction, readBpmnRequestFromFile(MACRO_ASSIGN_JSON), false); + Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient) + .getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(), + anyString(), anyString()); + + List<Resource> resourceListFromUserParams = userParamsServiceTraversal.getResourceListFromUserParams(execution, + getUserParams(), serviceInstanceId, requestAction); + List<WorkflowType> expected = List.of(WorkflowType.SERVICE, WorkflowType.VNF, WorkflowType.VOLUMEGROUP, + WorkflowType.VFMODULE, WorkflowType.CONFIGURATION); + List<WorkflowType> result = + resourceListFromUserParams.stream().map(Resource::getResourceType).collect(Collectors.toList()); + + assertEquals(5, resourceListFromUserParams.size()); + assertThat(expected, is(result)); + } + + @Test + public void getResourceListFromUserParamsForPnfs() throws Exception { + initExecution(requestAction, readBpmnRequestFromFile(MACRO_ASSIGN_PNF_JSON), false); + Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient) + .getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(), + anyString(), anyString()); + + List<Resource> resourceListFromUserParams = userParamsServiceTraversal.getResourceListFromUserParams(execution, + getUserParams(), serviceInstanceId, requestAction); + List<WorkflowType> expected = List.of(WorkflowType.SERVICE, WorkflowType.PNF); + List<WorkflowType> result = + resourceListFromUserParams.stream().map(Resource::getResourceType).collect(Collectors.toList()); + + assertEquals(2, resourceListFromUserParams.size()); + assertThat(expected, is(result)); + } + + @Test + public void getResourceListFromUserParamsForNetworks() throws Exception { + requestAction = "createInstance"; + initExecution(requestAction, readBpmnRequestFromFile(NETWORK_COLLECTION_JSON), false); + Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient) + .getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(), + anyString(), anyString()); + Mockito.doReturn(getService()).when(mockCatalogDbClient).getServiceByID(anyString()); + Mockito.doReturn(new NetworkCollectionResourceCustomization()).when(mockCatalogDbClient) + .getNetworkCollectionResourceCustomizationByID(anyString()); + + List<Resource> resourceListFromUserParams = userParamsServiceTraversal.getResourceListFromUserParams(execution, + getUserParams(), serviceInstanceId, requestAction); + List<WorkflowType> expected = List.of(WorkflowType.SERVICE, WorkflowType.NETWORK, WorkflowType.NETWORK, + WorkflowType.NETWORKCOLLECTION); + List<WorkflowType> result = + resourceListFromUserParams.stream().map(Resource::getResourceType).collect(Collectors.toList()); + + assertEquals(4, resourceListFromUserParams.size()); + assertThat(expected, is(result)); + } + + @Test + public void getResourceListFromUserParamsBuildAndThrowExceptionWhenVfModuleAreEmpty() throws Exception { + initExecution(requestAction, readBpmnRequestFromFile(MACRO_ASSIGN_JSON), false); + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + vfModuleCustomization.setVfModule(null); + Mockito.doReturn(vfModuleCustomization).when(mockCatalogDbClient) + .getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + + List<Resource> resourceListFromUserParams = userParamsServiceTraversal.getResourceListFromUserParams(execution, + getUserParams(), serviceInstanceId, requestAction); + List<WorkflowType> expected = List.of(WorkflowType.SERVICE, WorkflowType.VNF); + List<WorkflowType> result = + resourceListFromUserParams.stream().map(Resource::getResourceType).collect(Collectors.toList()); + + assertEquals(2, resourceListFromUserParams.size()); + assertThat(expected, is(result)); + } + + private List<Map<String, Object>> getUserParams() throws IOException { + String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST); + ServiceInstancesRequest sIRequest = new ObjectMapper().readValue(bpmnRequest, ServiceInstancesRequest.class); + return sIRequest.getRequestDetails().getRequestParameters().getUserParams(); + } + + @Test + public void getResourceListFromUserParamsWhenUserParamsAreNull() throws Exception { + List<Resource> expectedResourceList = new ArrayList<>(); + List<Resource> resultResourceList = userParamsServiceTraversal.getResourceListFromUserParams(execution, null, + serviceInstanceId, requestAction); + + assertEquals(expectedResourceList, resultResourceList); + } + + private String readBpmnRequestFromFile(String fileName) throws IOException { + return new String(Files.readAllBytes(Paths.get("src/test/resources/__files/" + fileName))); + } + + private void initExecution(String gAction, String bpmnRequest, boolean isAlaCarte) { + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", isAlaCarte); + execution.setVariable("apiVersion", "7"); + } + + private Service getService() { + Service service = new Service(); + List<CollectionResourceCustomization> collectionResourceCustomizations = new ArrayList<>(); + CollectionResourceCustomization collectionResourceCustomization = new CollectionResourceCustomization(); + collectionResourceCustomization.setModelCustomizationUUID("123"); + collectionResourceCustomizations.add(collectionResourceCustomization); + service.setCollectionResourceCustomizations(collectionResourceCustomizations); + return service; + } + + private VfModuleCustomization getVfModuleCustomization() { + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + vfModuleCustomization.setVolumeHeatEnv(new HeatEnvironment()); + vfModuleCustomization.setModelCustomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + VfModule vfModule = new VfModule(); + vfModule.setVolumeHeatTemplate(new HeatTemplate()); + vfModule.setModelName("helm"); + vfModule.setModuleHeatTemplate(new HeatTemplate()); + vfModuleCustomization.setVfModule(vfModule); + return vfModuleCustomization; + } + + private List<CvnfcCustomization> getCvnfcCustomizations() { + ConfigurationResource configurationResource = new ConfigurationResource(); + configurationResource.setToscaNodeType("FabricConfiguration"); + + CvnfcConfigurationCustomization cvnfcConfigurationCustomization = new CvnfcConfigurationCustomization(); + cvnfcConfigurationCustomization.setConfigurationResource(configurationResource); + CvnfcCustomization cvnfcCustomization = new CvnfcCustomization(); + + List<CvnfcConfigurationCustomization> cvnfcConfigurationCustomizations = new ArrayList<>(); + cvnfcConfigurationCustomizations.add(cvnfcConfigurationCustomization); + cvnfcCustomization.setCvnfcConfigurationCustomization(cvnfcConfigurationCustomizations); + + List<CvnfcCustomization> cvnfcCustomizations = new ArrayList<>(); + cvnfcCustomizations.add(cvnfcCustomization); + return cvnfcCustomizations; + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssignPnf.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssignPnf.json new file mode 100644 index 0000000000..4be44e0c1f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssignPnf.json @@ -0,0 +1,72 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "Sample Service Model", + "modelVersion": "10.0" + }, + "cloudConfiguration": { + "cloudOwner" : "my-custom-cloud-owner" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "PACKET CORE" + }, + "project": { + "projectName": "{some project name}" + }, + "subscriberInfo": { + "globalSubscriberId": "{some subscriber id}" + }, + "requestInfo": { + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": true, + "requestorId": "xxxxxx", + "instanceName": "test" + }, + "requestParameters": { + "subscriptionServiceType": "VMX", + "aLaCarte": false, + "userParams": [ + { + "service": { + "modelInfo": { + "modelType": "service", + "modelName": "Sample Service Model", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceParams": [], + "resources": { + "pnfs": [ + { + "modelInfo": { + "modelType": "pnf", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "someValue" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceParams": [] + } + ] + } + } + } + ] + } + } +} diff --git a/common/pom.xml b/common/pom.xml index f1541314ec..45359231d0 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -10,24 +10,18 @@ <artifactId>common</artifactId> <name>common</name> <description>MSO Common classes:- Logger</description> - <properties> <grpc.version>1.17.1</grpc.version> <protobuf.version>3.6.1</protobuf.version> <grpc.netty.version>4.1.30.Final</grpc.netty.version> <ccsdk.version>0.4.2</ccsdk.version> </properties> - <dependencies> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> </dependency> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - </dependency> - <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> </dependency> @@ -61,14 +55,6 @@ <version>2.3.2</version> </dependency> <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - </dependency> - <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-client</artifactId> <scope>test</scope> @@ -181,7 +167,6 @@ <artifactId>proto-definition</artifactId> <version>${ccsdk.version}</version> </dependency> - <!-- protobuf dependencies --> <dependency> <groupId>com.google.protobuf</groupId> @@ -203,11 +188,6 @@ </dependency> <dependency> <groupId>io.grpc</groupId> - <artifactId>grpc-stub</artifactId> - <version>${grpc.version}</version> - </dependency> - <dependency> - <groupId>io.grpc</groupId> <artifactId>grpc-netty</artifactId> <version>${grpc.version}</version> </dependency> @@ -225,7 +205,6 @@ <dependency> <groupId>org.camunda.bpm</groupId> <artifactId>camunda-external-task-client</artifactId> - <version>1.4.0</version> </dependency> <dependency> <groupId>org.onap.appc.client</groupId> @@ -297,11 +276,6 @@ <artifactId>validation-api</artifactId> </dependency> <dependency> - <groupId>javax.xml.bind</groupId> - <artifactId>jaxb-api</artifactId> - <version>2.3.0</version> - </dependency> - <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-core</artifactId> <version>2.3.0</version> @@ -319,7 +293,6 @@ <dependency> <groupId>org.ehcache</groupId> <artifactId>ehcache</artifactId> - <version>3.8.1</version> </dependency> </dependencies> <dependencyManagement> @@ -378,7 +351,6 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>3.0.2</version> <executions> <execution> <id>tests-jar</id> diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssmfRequest.java b/common/src/main/java/org/onap/so/beans/nsmf/NssmfRequest.java index 356c1cb4de..32ba36275e 100644 --- a/common/src/main/java/org/onap/so/beans/nsmf/NssmfRequest.java +++ b/common/src/main/java/org/onap/so/beans/nsmf/NssmfRequest.java @@ -43,6 +43,8 @@ public class NssmfRequest implements Serializable { private NetworkType networkType; + private String sST; + private Object additionalProperties; public NssmfRequest() {} @@ -56,8 +58,10 @@ public class NssmfRequest implements Serializable { this.additionalProperties = additionalProperties; this.serviceInstanceID = serviceInfo.getNssiId(); this.name = serviceInfo.getNssiName(); + this.sST = serviceInfo.getSST(); } + } diff --git a/common/src/main/java/org/onap/so/constants/Status.java b/common/src/main/java/org/onap/so/constants/Status.java index b460418f0f..67c5ff0d40 100644 --- a/common/src/main/java/org/onap/so/constants/Status.java +++ b/common/src/main/java/org/onap/so/constants/Status.java @@ -27,6 +27,7 @@ package org.onap.so.constants; public enum Status { PENDING, IN_PROGRESS, + WAIT_COMPLETION_NOTIF, COMPLETE, COMPLETED, FAILED, diff --git a/common/src/main/java/org/onap/so/security/BaseWebSecurityConfigurerAdapter.java b/common/src/main/java/org/onap/so/security/BaseWebSecurityConfigurerAdapter.java new file mode 100644 index 0000000000..f494a6b812 --- /dev/null +++ b/common/src/main/java/org/onap/so/security/BaseWebSecurityConfigurerAdapter.java @@ -0,0 +1,44 @@ +package org.onap.so.security; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.builders.WebSecurity; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.web.firewall.StrictHttpFirewall; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +public abstract class BaseWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter { + private static final Logger LOGGER = LoggerFactory.getLogger(BaseWebSecurityConfigurerAdapter.class); + + @Autowired + protected UserDetailsService userDetailsService; + + @Autowired + protected BCryptPasswordEncoder passwordEncoder; + + abstract HttpSecurityConfigurer getHttpSecurityConfigurer(); + + @Override + protected void configure(final HttpSecurity http) throws Exception { + HttpSecurityConfigurer httpSecurityConfigurer = getHttpSecurityConfigurer(); + LOGGER.debug("Injecting {} configuration ...", httpSecurityConfigurer.getClass()); + + httpSecurityConfigurer.configure(http); + } + + @Override + public void configure(final WebSecurity web) throws Exception { + super.configure(web); + final StrictHttpFirewall firewall = new MSOSpringFirewall(); + web.httpFirewall(firewall); + } + + @Override + protected void configure(final AuthenticationManagerBuilder auth) throws Exception { + auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder); + } +} diff --git a/common/src/main/java/org/onap/so/security/CorsBasicHttpSecurityConfigurer.java b/common/src/main/java/org/onap/so/security/CorsBasicHttpSecurityConfigurer.java new file mode 100644 index 0000000000..27c998f87d --- /dev/null +++ b/common/src/main/java/org/onap/so/security/CorsBasicHttpSecurityConfigurer.java @@ -0,0 +1,33 @@ +package org.onap.so.security; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Profile; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.stereotype.Component; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.CorsConfigurationSource; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import java.util.Arrays; + +@Component("cors") +@Profile({"cors"}) +public class CorsBasicHttpSecurityConfigurer implements HttpSecurityConfigurer { + + @Override + public void configure(final HttpSecurity http) throws Exception { + http.cors().and().csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll() + .antMatchers("/**").fullyAuthenticated().and().httpBasic(); + } + + @Bean + CorsConfigurationSource corsConfigurationSource() { + CorsConfiguration configuration = new CorsConfiguration(); + configuration.setAllowedOrigins(Arrays.asList("*")); + configuration.setAllowedMethods(Arrays.asList("OPTIONS", "GET", "POST", "PATCH")); + configuration.setAllowCredentials(true); + configuration.setAllowedHeaders(Arrays.asList("*")); + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + source.registerCorsConfiguration("/**", configuration); + return source; + } +} diff --git a/common/src/main/java/org/onap/so/security/CorsWebSecurityConfigurerAdapter.java b/common/src/main/java/org/onap/so/security/CorsWebSecurityConfigurerAdapter.java new file mode 100644 index 0000000000..08ecd0c578 --- /dev/null +++ b/common/src/main/java/org/onap/so/security/CorsWebSecurityConfigurerAdapter.java @@ -0,0 +1,24 @@ +package org.onap.so.security; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.springframework.core.annotation.Order; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; + +@EnableWebSecurity +@Configuration +@Order(1) +@Profile({"cors"}) +public class CorsWebSecurityConfigurerAdapter extends BaseWebSecurityConfigurerAdapter { + @Autowired + @Qualifier("cors") + protected HttpSecurityConfigurer httpSecurityConfigurer; + + @Override + HttpSecurityConfigurer getHttpSecurityConfigurer() { + return httpSecurityConfigurer; + } +} diff --git a/common/src/main/java/org/onap/so/security/SoBasicHttpSecurityConfigurer.java b/common/src/main/java/org/onap/so/security/SoBasicHttpSecurityConfigurer.java index 9aceb03519..da989ee42a 100644 --- a/common/src/main/java/org/onap/so/security/SoBasicHttpSecurityConfigurer.java +++ b/common/src/main/java/org/onap/so/security/SoBasicHttpSecurityConfigurer.java @@ -28,7 +28,7 @@ import org.springframework.util.StringUtils; * @author Waqas Ikram (waqas.ikram@est.tech) * */ -@Component +@Component("basic") public class SoBasicHttpSecurityConfigurer implements HttpSecurityConfigurer { @Autowired diff --git a/common/src/main/java/org/onap/so/security/SoWebSecurityConfigurerAdapter.java b/common/src/main/java/org/onap/so/security/SoWebSecurityConfigurerAdapter.java index 903d586ab1..c14ae47d89 100644 --- a/common/src/main/java/org/onap/so/security/SoWebSecurityConfigurerAdapter.java +++ b/common/src/main/java/org/onap/so/security/SoWebSecurityConfigurerAdapter.java @@ -19,20 +19,12 @@ */ package org.onap.so.security; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; import org.springframework.core.annotation.Order; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.security.web.firewall.StrictHttpFirewall; /** * @author Waqas Ikram (waqas.ikram@est.tech) @@ -42,34 +34,13 @@ import org.springframework.security.web.firewall.StrictHttpFirewall; @Configuration @Order(1) @Profile({"basic", "test"}) -public class SoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter { - private static final Logger LOGGER = LoggerFactory.getLogger(SoWebSecurityConfigurerAdapter.class); - - @Autowired - private HttpSecurityConfigurer httpSecurityConfigurer; - +public class SoWebSecurityConfigurerAdapter extends BaseWebSecurityConfigurerAdapter { @Autowired - private UserDetailsService userDetailsService; - - @Autowired - private BCryptPasswordEncoder passwordEncoder; - - @Override - protected void configure(final HttpSecurity http) throws Exception { - LOGGER.debug("Injecting {} configuration ...", httpSecurityConfigurer.getClass()); - - httpSecurityConfigurer.configure(http); - } - - @Override - public void configure(final WebSecurity web) throws Exception { - super.configure(web); - final StrictHttpFirewall firewall = new MSOSpringFirewall(); - web.httpFirewall(firewall); - } + @Qualifier("basic") + protected HttpSecurityConfigurer httpSecurityConfigurer; @Override - protected void configure(final AuthenticationManagerBuilder auth) throws Exception { - auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder); + HttpSecurityConfigurer getHttpSecurityConfigurer() { + return httpSecurityConfigurer; } } diff --git a/graph-inventory/aai-client/pom.xml b/graph-inventory/aai-client/pom.xml index 5bce9c66f4..0ab486bbea 100644 --- a/graph-inventory/aai-client/pom.xml +++ b/graph-inventory/aai-client/pom.xml @@ -134,10 +134,6 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <scope>compile</scope> @@ -150,42 +146,6 @@ <optional>true</optional> </dependency> <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-annotations</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.module</groupId> - <artifactId>jackson-module-jaxb-annotations</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.jaxrs</groupId> - <artifactId>jackson-jaxrs-json-provider</artifactId> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - </dependency> - <dependency> - <groupId>org.onap.logging-analytics</groupId> - <artifactId>logging-slf4j</artifactId> - </dependency> - <dependency> - <groupId>org.onap.logging-analytics</groupId> - <artifactId>logging-filter-base</artifactId> - </dependency> - <dependency> - <groupId>org.onap.logging-analytics</groupId> - <artifactId>logging-filter-spring</artifactId> - </dependency> - <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> @@ -197,11 +157,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>javax.ws.rs</groupId> - <artifactId>javax.ws.rs-api</artifactId> - <version>2.1</version> - </dependency> - <dependency> <groupId>com.github.tomakehurst</groupId> <artifactId>wiremock-standalone</artifactId> <version>2.13.0</version> @@ -279,31 +234,9 @@ <artifactId>aai-schema</artifactId> </dependency> <dependency> - <groupId>com.jayway.jsonpath</groupId> - <artifactId>json-path</artifactId> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - </dependency> - <dependency> <groupId>org.antlr</groupId> <artifactId>antlr4-runtime</artifactId> <version>4.7</version> </dependency> - <dependency> - <groupId>net.jodah</groupId> - <artifactId>failsafe</artifactId> - <version>2.0.1</version> - </dependency> - <dependency> - <groupId>org.reflections</groupId> - <artifactId>reflections</artifactId> - <version>0.9.11</version> - </dependency> </dependencies> </project> diff --git a/mso-api-handlers/mso-api-handler-common/pom.xml b/mso-api-handlers/mso-api-handler-common/pom.xml index c31cc485ec..a2415322b4 100644 --- a/mso-api-handlers/mso-api-handler-common/pom.xml +++ b/mso-api-handlers/mso-api-handler-common/pom.xml @@ -12,13 +12,8 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <swagger-version>1.3.0</swagger-version> - <jax-rs-version>1.1.1</jax-rs-version> <json4s-jackson-version>3.6.0</json4s-jackson-version> <json4s-core-version>3.6.0</json4s-core-version> - <reflections-version>0.9.9-RC1</reflections-version> - <paranamer-version>2.5.2</paranamer-version> - <scannotation-version>1.0.3</scannotation-version> </properties> <dependencyManagement> <dependencies> @@ -49,10 +44,6 @@ <version>2.6</version> </dependency> <dependency> - <groupId>antlr</groupId> - <artifactId>antlr</artifactId> - </dependency> - <dependency> <groupId>javax.activation</groupId> <artifactId>activation</artifactId> <version>1.1.1</version> @@ -77,10 +68,6 @@ <artifactId>javax.servlet-api</artifactId> </dependency> <dependency> - <groupId>org.json</groupId> - <artifactId>json</artifactId> - </dependency> - <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> @@ -90,18 +77,7 @@ <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency> - <dependency> - <groupId>com.googlecode.junit-toolbox</groupId> - <artifactId>junit-toolbox</artifactId> - <version>2.4</version> - </dependency> - <dependency> - <groupId>org.onap.so</groupId> - <artifactId>common</artifactId> - <version>${project.version}</version> - </dependency> </dependencies> - <build> <finalName>${project.artifactId}-${project.version}</finalName> <plugins> diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java index 2101252ad0..b75411b9a8 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java @@ -46,6 +46,8 @@ public class RequestClientParameter { private String instanceGroupId; private boolean generateIdsOnly; private String operationType; + private String migrationId; + private String circuitId; private RequestClientParameter(Builder builder) { requestId = builder.requestId; @@ -71,6 +73,8 @@ public class RequestClientParameter { instanceGroupId = builder.instanceGroupId; generateIdsOnly = builder.generateIdsOnly; operationType = builder.operationType; + migrationId = builder.migrationId; + circuitId = builder.circuitId; } public String getOperationType() { @@ -169,6 +173,22 @@ public class RequestClientParameter { this.generateIdsOnly = generateIdsOnly; } + public String getMigrationId() { + return migrationId; + } + + public void setMigrationId(String migrationId) { + this.migrationId = migrationId; + } + + public String getCircuitId() { + return circuitId; + } + + public void setCircuitId(String circuitId) { + this.circuitId = circuitId; + } + public static class Builder { private String requestId; private boolean isBaseVfModule = false; @@ -193,6 +213,18 @@ public class RequestClientParameter { private String instanceGroupId; private boolean generateIdsOnly; private String operationType; + private String migrationId; + private String circuitId; + + public Builder setCircuitId(String circuitId) { + this.circuitId = circuitId; + return this; + } + + public Builder setMigrationId(String migrationId) { + this.migrationId = migrationId; + return this; + } public Builder setOperationType(String operationType) { this.operationType = operationType; diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml index cd7c102c10..cf1df1bfb0 100644 --- a/mso-api-handlers/mso-api-handler-infra/pom.xml +++ b/mso-api-handlers/mso-api-handler-infra/pom.xml @@ -10,17 +10,8 @@ <name>mso-api-handler-infra</name> <description>ONAP SO API Handler Infra</description> <properties> - <camunda.version>7.14.0</camunda.version> - <camunda.bpm.assert.version>1.2</camunda.bpm.assert.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <swagger.version>2.0.8</swagger.version> - <jax-rs-version>1.1.1</jax-rs-version> - <json4s-jackson-version>3.6.0</json4s-jackson-version> - <json4s-core-version>3.6.0</json4s-core-version> - <reflections-version>0.9.9-RC1</reflections-version> - <paranamer-version>2.5.2</paranamer-version> - <scannotation-version>1.0.3</scannotation-version> </properties> <dependencyManagement> <dependencies> @@ -32,14 +23,6 @@ <type>pom</type> <scope>import</scope> </dependency> - <dependency> - <!-- Import dependency management from camunda --> - <groupId>org.camunda.bpm</groupId> - <artifactId>camunda-bom</artifactId> - <version>${camunda.version}</version> - <scope>import</scope> - <type>pom</type> - </dependency> </dependencies> </dependencyManagement> <dependencies> @@ -55,7 +38,6 @@ <dependency> <groupId>io.swagger.core.v3</groupId> <artifactId>swagger-jaxrs2</artifactId> - <version>2.0.8</version> </dependency> <dependency> <groupId>com.h2database</groupId> @@ -100,7 +82,6 @@ <dependency> <groupId>pl.pragmatists</groupId> <artifactId>JUnitParams</artifactId> - <version>1.0.5</version> <scope>test</scope> </dependency> <dependency> @@ -137,7 +118,6 @@ <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> <scope>test</scope> </dependency> <dependency> @@ -148,7 +128,6 @@ <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-contract-wiremock</artifactId> - <version>1.2.4.RELEASE</version> <scope>test</scope> </dependency> <dependency> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/Allocate3gppService.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/Allocate3gppService.java index 0444e66842..42be95436d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/Allocate3gppService.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/Allocate3gppService.java @@ -47,6 +47,9 @@ public class Allocate3gppService { @JsonProperty("networkType") private String networkType; + @JsonProperty("sst") + private String sST; + @JsonProperty("additionalProperties") private Map<String, Object> additionalProperties = new HashMap<>(); @@ -106,6 +109,14 @@ public class Allocate3gppService { this.additionalProperties = additionalProperties; } + public String getsST() { + return sST; + } + + public void setsST(String sST) { + this.sST = sST; + } + @Override public String toString() { return "Allocate3gppService [name=" + name + ", modelInvariantUuid=" + modelInvariantUuid + ", modelUuid=" diff --git a/mso-api-handlers/mso-requests-db/pom.xml b/mso-api-handlers/mso-requests-db/pom.xml index ce1b960be3..ba3eac4725 100644 --- a/mso-api-handlers/mso-requests-db/pom.xml +++ b/mso-api-handlers/mso-requests-db/pom.xml @@ -1,13 +1,11 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <parent> <groupId>org.onap.so</groupId> <artifactId>mso-api-handlers</artifactId> <version>1.8.0-SNAPSHOT</version> </parent> - <artifactId>mso-requests-db</artifactId> <name>mso-requests-db</name> <description>MSO Requests Database definition and Hibernate objects</description> diff --git a/mso-catalog-db/pom.xml b/mso-catalog-db/pom.xml index 80ad6cc86e..cca606a13a 100644 --- a/mso-catalog-db/pom.xml +++ b/mso-catalog-db/pom.xml @@ -64,7 +64,6 @@ <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> <scope>test</scope> </dependency> <dependency> @@ -69,7 +69,6 @@ <jax.ws.rs>2.1</jax.ws.rs> <springboot.version>2.3.7.RELEASE</springboot.version> <aaf.version>2.1.21</aaf.version> - <camunda.springboot.version>7.14.0</camunda.springboot.version> <format.skipValidate>false</format.skipValidate> <format.skipExecute>true</format.skipExecute> <io.fabric8.version>0.33.0</io.fabric8.version> @@ -203,7 +202,6 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> - <version>2.8</version> <!-- This version supports the "deployAtEnd" parameter --> <configuration> <skip /> @@ -283,7 +281,6 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> - <version>3.6</version> <dependencies> <dependency> <groupId>org.apache.maven.wagon</groupId> @@ -731,7 +728,6 @@ <dependency> <groupId>javax.annotation</groupId> <artifactId>javax.annotation-api</artifactId> - <version>1.3.1</version> </dependency> <dependency> <groupId>javax.inject</groupId> @@ -1069,6 +1065,57 @@ <version>${aaf.version}</version> <scope>runtime</scope> </dependency> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-jersey2-jaxrs</artifactId> + <version>1.6.2</version> + </dependency> + <dependency> + <groupId>ch.vorburger.mariaDB4j</groupId> + <artifactId>mariaDB4j</artifactId> + <version>2.3.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-contract-wiremock</artifactId> + <version>1.2.4.RELEASE</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.camunda.bpm.assert</groupId> + <artifactId>camunda-bpm-assert</artifactId> + <version>3.0.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>janino</groupId> + <artifactId>janino</artifactId> + <version>2.5.15</version> + </dependency> + <dependency> + <groupId>org.camunda.bpm</groupId> + <artifactId>camunda-external-task-client</artifactId> + <version>1.4.0</version> + </dependency> + <dependency> + <groupId>pl.pragmatists</groupId> + <artifactId>JUnitParams</artifactId> + <version>1.0.5</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.swagger.core.v3</groupId> + <artifactId>swagger-jaxrs2</artifactId> + <version>2.1.7</version> + </dependency> + <dependency> + <groupId>org.camunda.bpm</groupId> + <artifactId>camunda-bom</artifactId> + <version>7.14.0</version> + <scope>import</scope> + <type>pom</type> + </dependency> </dependencies> </dependencyManagement> <profiles> diff --git a/releases/1.8.0.yaml b/releases/1.8.0.yaml new file mode 100644 index 0000000000..99bf277e47 --- /dev/null +++ b/releases/1.8.0.yaml @@ -0,0 +1,36 @@ + +--- +distribution_type: 'container' +container_release_tag: '1.8.0' +project: 'so' +log_dir: 'so-maven-docker-stage-master/635/' +ref: '31aba9aba28d7be2417a99ba7e862a7a8c68005b' +containers: + - name: 'so/vnfm-adapter' + version: '1.8.0-20210215T1458' + - name: 'so/catalog-db-adapter' + version: '1.8.0-20210215T1458' + - name: 'so/request-db-adapter' + version: '1.8.0-20210215T1458' + - name: 'so/openstack-adapter' + version: '1.8.0-20210215T1458' + - name: 'so/sdnc-adapter' + version: '1.8.0-20210215T1458' + - name: 'so/vfc-adapter' + version: '1.8.0-20210215T1458' + - name: 'so/sdc-controller' + version: '1.8.0-20210215T1458' + - name: 'so/bpmn-infra' + version: '1.8.0-20210215T1458' + - name: 'so/so-monitoring' + version: '1.8.0-20210215T1458' + - name: 'so/api-handler-infra' + version: '1.8.0-20210215T1458' + - name: 'so/nssmf-adapter' + version: '1.8.0-20210215T1458' + - name: 'so/mso-cnf-adapter' + version: '1.8.0-20210210T0420' + - name: 'so/so-oof-adapter' + version: '1.8.0-20210215T1458' + - name: 'so/so-etsi-nfvo-ns-lcm' + version: '1.8.0-20210215T1458' diff --git a/so-optimization-clients/pom.xml b/so-optimization-clients/pom.xml index 90fca31e6c..77ce71e843 100644 --- a/so-optimization-clients/pom.xml +++ b/so-optimization-clients/pom.xml @@ -59,7 +59,6 @@ <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-contract-wiremock</artifactId> - <version>1.2.4.RELEASE</version> <scope>test</scope> </dependency> <dependency> @@ -84,7 +83,6 @@ <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.2.3</version> <scope>test</scope> </dependency> <dependency> diff --git a/so-sdn-clients/pom.xml b/so-sdn-clients/pom.xml index 025bb1f06a..96d47445de 100644 --- a/so-sdn-clients/pom.xml +++ b/so-sdn-clients/pom.xml @@ -87,15 +87,8 @@ </dependencyManagement> <dependencies> <dependency> - <groupId>org.camunda.bpm.springboot</groupId> - <artifactId>camunda-bpm-spring-boot-starter</artifactId> - <version>${camunda.springboot.version}</version> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-contract-wiremock</artifactId> - <version>1.2.4.RELEASE</version> <scope>test</scope> </dependency> <dependency> @@ -125,20 +118,9 @@ <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.2.3</version> <scope>test</scope> </dependency> <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.6</version> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-configuration-processor</artifactId> - <optional>true</optional> - </dependency> - <dependency> <groupId>org.onap.so</groupId> <artifactId>common</artifactId> <version>${project.version}</version> @@ -156,18 +138,5 @@ <groupId>org.glassfish.jersey.core</groupId> <artifactId>jersey-common</artifactId> </dependency> - <dependency> - <groupId>org.glassfish.jersey.core</groupId> - <artifactId>jersey-client</artifactId> - </dependency> - <dependency> - <groupId>org.glassfish.jersey.inject</groupId> - <artifactId>jersey-hk2</artifactId> - <version>2.26</version> - </dependency> - <dependency> - <groupId>org.glassfish.jersey.media</groupId> - <artifactId>jersey-media-json-jackson</artifactId> - </dependency> </dependencies> </project> diff --git a/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java index 01ac675d83..1a123679c7 100644 --- a/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java +++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java @@ -26,7 +26,7 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import org.onap.so.logger.LoggingAnchor; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpStatus; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; diff --git a/version.properties b/version.properties index 11f0383267..b3f28cde3f 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=1 minor=8 -patch=0 +patch=1 base_version=${major}.${minor}.${patch} |