aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-catalog-db-adapter/pom.xml34
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java10
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java9
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java1
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java10
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java88
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java27
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java18
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java4
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java12
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java22
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java16
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java21
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java13
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java4
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java553
-rw-r--r--asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java10
-rw-r--r--asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionCompletion.java (renamed from adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/WMAdapterRestTest.java)30
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListener.java (renamed from adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/BPRestCallbackTest.java)38
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListenerRunner.java64
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java28
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java10
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java21
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutorListener.java42
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java51
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImplTest.java118
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn258
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java26
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy20
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java46
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/UnassignNetworkException.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java149
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java27
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java63
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java16
-rw-r--r--common/pom.xml2
-rw-r--r--common/src/main/java/org/onap/so/client/BaseClient.java2
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java1
-rw-r--r--common/src/main/java/org/onap/so/client/RestTemplateConfig.java3
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java4
-rw-r--r--common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java4
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java15
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java33
-rw-r--r--common/src/test/java/org/onap/so/client/dmaap/rest/DMaaPRestClientTest.java96
-rw-r--r--common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java9
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java9
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java1
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java17
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java6
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json103
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java592
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java600
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java6
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java2
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java8
-rw-r--r--pom.xml10
73 files changed, 2234 insertions, 1316 deletions
diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml
index a51aa66afa..9745935925 100644
--- a/adapters/mso-catalog-db-adapter/pom.xml
+++ b/adapters/mso-catalog-db-adapter/pom.xml
@@ -85,40 +85,6 @@
</plugins>
<pluginManagement>
<plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings
- only. It has no influence on the Maven build itself. -->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>
- org.jvnet.jax-ws-commons
- </groupId>
- <artifactId>
- jaxws-maven-plugin
- </artifactId>
- <versionRange>
- [2.3,)
- </versionRange>
- <goals>
- <goal>wsgen</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore>
- </ignore>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
-
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
index ff0f8dc432..cd3b2a377b 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
@@ -22,6 +22,7 @@ package org.onap.so.adapters.catalogdb;
import org.onap.logging.filter.spring.LoggingInterceptor;
+import org.onap.logging.filter.spring.StatusLoggingInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -34,11 +35,18 @@ import org.springframework.web.servlet.handler.MappedInterceptor;
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Autowired
- LoggingInterceptor loggingInterceptor;
+ private LoggingInterceptor loggingInterceptor;
+
+ @Autowired
+ private StatusLoggingInterceptor statusLoggingInterceptor;
@Bean
public MappedInterceptor mappedLoggingInterceptor() {
return new MappedInterceptor(new String[] {"/**"}, loggingInterceptor);
}
+ @Bean
+ public MappedInterceptor mappedStatusLoggingInterceptor() {
+ return new MappedInterceptor(new String[] {"/**"}, statusLoggingInterceptor);
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index f82c7acd38..707a2a45af 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -22,6 +22,7 @@ package org.onap.so.db.catalog.client;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -733,4 +734,12 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
assertNull(workflow);
}
+ @Test
+ public void getCloudSites() {
+ List<CloudSite> cloudSites = client.getCloudSites();
+ assertNotNull(cloudSites);
+ assertNotEquals(0, cloudSites.size());
+ }
+
+
}
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java
index e1dc4cab66..3a14b2ff84 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java
@@ -41,7 +41,6 @@ import net.javacrumbs.shedlock.spring.ScheduledLockConfigurationBuilder;
* @since Version 1.0
*
*/
-
@SpringBootApplication(scanBasePackages = {"org.onap.so", "org.onap.logging.filter"})
@EnableScheduling
@EnableMBeanExport(registration = RegistrationPolicy.IGNORE_EXISTING)
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java
index c0dfbe08ef..9135d31ac3 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java
@@ -22,6 +22,7 @@ package org.onap.so.adapters.requestsdb.application;
import org.onap.logging.filter.spring.LoggingInterceptor;
+import org.onap.logging.filter.spring.StatusLoggingInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -34,11 +35,18 @@ import org.springframework.web.servlet.handler.MappedInterceptor;
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Autowired
- LoggingInterceptor loggingInterceptor;
+ private LoggingInterceptor loggingInterceptor;
+
+ @Autowired
+ private StatusLoggingInterceptor statusLoggingInterceptor;
@Bean
public MappedInterceptor mappedLoggingInterceptor() {
return new MappedInterceptor(new String[] {"/**"}, loggingInterceptor);
}
+ @Bean
+ public MappedInterceptor mappedStatusLoggingInterceptor() {
+ return new MappedInterceptor(new String[] {"/**"}, statusLoggingInterceptor);
+ }
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java
index 110bbabdb2..fc9efef947 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java
@@ -31,14 +31,10 @@ import org.onap.aai.domain.yang.EsrVnfmList;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipData;
-import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.TenantNotFoundException;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmNotFoundException;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.AAIVersion;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.vnfmadapter.v1.model.Tenant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -61,38 +57,6 @@ public class AaiHelper {
}
/**
- * Add a relationship to the given generic VNF to the given VNFM.
- *
- * @param vnf the generic VNF
- * @param vnfmId the ID of the VNFM
- */
- public void addRelationshipFromGenericVnfToVnfm(final GenericVnf vnf, final String vnfmId) {
- if (vnf.getRelationshipList() == null) {
- vnf.setRelationshipList(new RelationshipList());
- }
- final RelationshipList vnfmRelationshiplist = vnf.getRelationshipList();
- vnfmRelationshiplist.getRelationship().add(createRelationshipToVnfm(vnfmId));
-
- }
-
- private Relationship createRelationshipToVnfm(final String vnfmId) {
- final Relationship relationship = new Relationship();
- relationship.setRelatedTo("esr-vnfm");
- relationship.setRelationshipLabel("tosca.relationships.DependsOn");
- relationship.setRelatedLink("/aai/" + AAIVersion.LATEST
- + AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId).build().toString());
- relationship.getRelationshipData().add(createRelationshipData("esr-vnfm.vnfm-id", vnfmId));
- return relationship;
- }
-
- private RelationshipData createRelationshipData(final String key, final String value) {
- final RelationshipData data = new RelationshipData();
- data.setRelationshipKey(key);
- data.setRelationshipValue(value);
- return data;
- }
-
- /**
* Get the VNFM assigned for use for the given generic VNF.
*
* @param vnf the generic VNF
@@ -242,30 +206,6 @@ public class AaiHelper {
return vserver;
}
- /**
- * Add a relationship to the given vserver to the given VNF.
- *
- * @param vnf the vserver
- * @param vnfmId the ID of the VNF
- */
- public void addRelationshipFromVserverVnfToGenericVnf(final Vserver vserver, final String vnfId) {
- if (vserver.getRelationshipList() == null) {
- vserver.setRelationshipList(new RelationshipList());
- }
- final RelationshipList vserverRelationshiplist = vserver.getRelationshipList();
- vserverRelationshiplist.getRelationship().add(createRelationshipToGenericVnf(vnfId));
- }
-
- private Relationship createRelationshipToGenericVnf(final String vnfId) {
- final Relationship relationship = new Relationship();
- relationship.setRelatedTo("generic-vnf");
- relationship.setRelationshipLabel("tosca.relationships.HostedOn");
- relationship.setRelatedLink("/aai/" + AAIVersion.LATEST
- + AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).build().toString());
- relationship.getRelationshipData().add(createRelationshipData("generic-vnf.vnf-id", vnfId));
- return relationship;
- }
-
public void setOamIpAddressSource(final String vnfId, final OamIpAddressSource oamIpAddressSource) {
mapOfVnfIdToOamIpAddressHolder.put(vnfId, oamIpAddressSource);
}
@@ -274,32 +214,4 @@ public class AaiHelper {
return mapOfVnfIdToOamIpAddressHolder.get(vnfId);
}
- /**
- * Add a relationship to the given tenant to the given VNF.
- *
- * @param vnf the generic vnf
- * @param tenant the Tenant
- */
-
- public void addRelationshipFromGenericVnfToTenant(final GenericVnf vnf, final Tenant tenant) {
- if (vnf.getRelationshipList() == null) {
- vnf.setRelationshipList(new RelationshipList());
- }
- final RelationshipList vnfmRelationshiplist = vnf.getRelationshipList();
- vnfmRelationshiplist.getRelationship().add(createRelationshipToTenant(tenant));
- }
-
- private Relationship createRelationshipToTenant(final Tenant tenant) {
- final Relationship relationship = new Relationship();
- relationship.setRelatedTo("tenant");
- relationship.setRelatedLink("/aai/" + AAIVersion.LATEST + AAIUriFactory.createResourceUri(AAIObjectType.TENANT,
- tenant.getCloudOwner(), tenant.getRegionName(), tenant.getTenantId()).build().toString());
- relationship.getRelationshipData()
- .add(createRelationshipData("cloud-region.cloud-owner", tenant.getCloudOwner()));
- relationship.getRelationshipData()
- .add(createRelationshipData("cloud-region.cloud-region-id", tenant.getRegionName()));
- relationship.getRelationshipData().add(createRelationshipData("tenant.tenant-id", tenant.getTenantId()));
- return relationship;
- }
-
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java
index 7021c02511..d19190d88e 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java
@@ -72,12 +72,22 @@ public interface AaiServiceProvider {
EsrVnfm invokeGetVnfm(final String vnfmId);
/**
- * Invoke a PUT request for a generic vnf.
+ * Invoke a PATCH request for a generic vnf.
*
* @param vnf the generic vnf
* @return
*/
- void invokePutGenericVnf(GenericVnf vnf);
+ void invokePatchGenericVnf(GenericVnf vnf);
+
+ /**
+ * Invoke a PUT request for a relationship from a generic vnf to a VNFM.
+ *
+ * @param vnf the generic vnf
+ * @param vnfmId the ID of the VNFM
+ * @return
+ */
+ void invokePutGenericVnfToVnfmRelationship(GenericVnf vnf, final String vnfmId);
+
/**
* Invoke a PUT request for a vserver.
@@ -92,6 +102,19 @@ public interface AaiServiceProvider {
final Vserver vserver);
/**
+ * Invoke a PUT request for a relationship from a vserver to a generic vnf.
+ *
+ * @param cloudOwner the cloud owner
+ * @param cloudRegion the cloud region the vserver is deployed on
+ * @param tenantId the ID of the tenant the vserver is deployed on
+ * @param vserver the vserver
+ * @param vnfId the ID of the generic vnf
+ * @return
+ */
+ void invokePutVserverToVnfRelationship(final String cloudOwner, final String cloudRegion, final String tenantId,
+ final Vserver vserver, final String vnfId);
+
+ /**
* Invoke a DELETE request for a vserver.
*
* @param cloudOwner the cloud owner
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
index 019a08af78..6dc6020834 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
@@ -98,12 +98,18 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
}
@Override
- public void invokePutGenericVnf(final GenericVnf vnf) {
+ public void invokePatchGenericVnf(final GenericVnf vnf) {
aaiClientProvider.getAaiClient()
.update(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()), vnf);
}
@Override
+ public void invokePutGenericVnfToVnfmRelationship(final GenericVnf vnf, final String vnfmId) {
+ aaiClientProvider.getAaiClient().connect(AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId),
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()));
+ }
+
+ @Override
public void invokePutVserver(final String cloudOwner, final String cloudRegion, final String tenant,
final Vserver vserver) {
aaiClientProvider.getAaiClient().create(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
@@ -111,6 +117,16 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
}
@Override
+ public void invokePutVserverToVnfRelationship(final String cloudOwner, final String cloudRegion,
+ final String tenant, final Vserver vserver, final String vnfId) {
+ aaiClientProvider.getAaiClient()
+ .connect(
+ AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenant,
+ vserver.getVserverId()),
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+ }
+
+ @Override
public void invokeDeleteVserver(final String cloudOwner, final String cloudRegion, final String tenant,
final String vserverId) {
aaiClientProvider.getAaiClient().delete(
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
index b621759b59..ae9316cfdf 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
@@ -42,6 +42,7 @@ import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.aai.domain.yang.EsrVnfm;
+import org.onap.logging.filter.spring.SpringClientPayloadFilter;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.JSON;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
@@ -173,7 +174,8 @@ public class VnfmServiceProviderConfiguration {
private void removeSpringClientFilter(final RestTemplate restTemplate) {
ListIterator<ClientHttpRequestInterceptor> interceptorIterator = restTemplate.getInterceptors().listIterator();
while (interceptorIterator.hasNext()) {
- if (interceptorIterator.next() instanceof SOSpringClientFilter) {
+ ClientHttpRequestInterceptor interceptor = interceptorIterator.next();
+ if (interceptor instanceof SOSpringClientFilter || interceptor instanceof SpringClientPayloadFilter) {
interceptorIterator.remove();
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
index 0aad91e5be..461c15a512 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
@@ -81,21 +81,25 @@ public class LifecycleManager {
* @return the response to the request
*/
public CreateVnfResponse createVnf(final String vnfIdInAai, final CreateVnfRequest request) {
- final GenericVnf genericVnf = getGenericVnfFromAai(vnfIdInAai);
+ GenericVnf genericVnf = getGenericVnfFromAai(vnfIdInAai);
EsrVnfm vnfm = aaiHelper.getAssignedVnfm(genericVnf);
checkIfVnfAlreadyExistsInVnfm(vnfm, genericVnf);
if (vnfm == null) {
vnfm = aaiHelper.selectVnfm(genericVnf);
- aaiHelper.addRelationshipFromGenericVnfToVnfm(genericVnf, vnfm.getVnfmId());
+ aaiServiceProvider.invokePutGenericVnfToVnfmRelationship(genericVnf, vnfm.getVnfmId());
}
- aaiHelper.addRelationshipFromGenericVnfToTenant(genericVnf, request.getTenant());
final InlineResponse201 vnfmResponse = sendCreateRequestToVnfm(request, genericVnf, vnfIdInAai, vnfm);
logger.info("Create response: {}", vnfmResponse);
genericVnf.setSelflink(getSelfLink(vnfmResponse, vnfm));
- aaiServiceProvider.invokePutGenericVnf(genericVnf);
+
+ GenericVnf genericVnfPatch = new GenericVnf();
+ genericVnfPatch.setVnfId(genericVnf.getVnfId());
+ genericVnfPatch.setSelflink(genericVnf.getSelflink());
+ aaiServiceProvider.invokePatchGenericVnf(genericVnfPatch);
+
final String vnfIdInVnfm = vnfmResponse.getId();
final OamIpAddressSource oamIpAddressSource = extractOamIpAddressSource(request);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
index eb912c8775..7a6bbfe0d9 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
@@ -97,10 +97,12 @@ public class NotificationHandler implements Runnable {
private void handleVnfInstantiateCompleted() {
final GenericVnf genericVnf = aaiServiceProvider
.invokeQueryGenericVnf(vnfInstance.getLinks().getSelf().getHref()).getGenericVnf().get(0);
- setOamIpAddress(genericVnf, vnfInstance);
- genericVnf.setOrchestrationStatus("Created");
- aaiServiceProvider.invokePutGenericVnf(genericVnf);
+ final GenericVnf genericVnfPatch = new GenericVnf();
+ genericVnfPatch.setVnfId(genericVnf.getVnfId());
+ setOamIpAddress(genericVnfPatch, vnfInstance);
+ genericVnfPatch.setOrchestrationStatus("Created");
+ aaiServiceProvider.invokePatchGenericVnf(genericVnfPatch);
addVservers(vnfLcmOperationOccurrenceNotification, genericVnf.getVnfId(), vnfInstance.getVimConnectionInfo());
@@ -162,9 +164,12 @@ public class NotificationHandler implements Runnable {
jobManager.notificationProcessedForOperation(vnfLcmOperationOccurrenceNotification.getVnfLcmOpOccId(),
deleteSuccessful);
jobManager.vnfDeleted(vnfLcmOperationOccurrenceNotification.getVnfLcmOpOccId());
- genericVnf.setOrchestrationStatus("Assigned");
- genericVnf.setSelflink("");
- aaiServiceProvider.invokePutGenericVnf(genericVnf);
+
+ final GenericVnf genericVnfPatch = new GenericVnf();
+ genericVnfPatch.setVnfId(genericVnf.getVnfId());
+ genericVnfPatch.setOrchestrationStatus("Assigned");
+ genericVnfPatch.setSelflink("");
+ aaiServiceProvider.invokePatchGenericVnf(genericVnfPatch);
}
}
@@ -180,10 +185,11 @@ public class NotificationHandler implements Runnable {
getVimConnectionInfo(vimConnectionIdToVimConnectionInfo, vnfc);
if (ChangeTypeEnum.ADDED.equals(vnfc.getChangeType())) {
final Vserver vserver = aaiHelper.createVserver(vnfc);
- aaiHelper.addRelationshipFromVserverVnfToGenericVnf(vserver, vnfId);
-
aaiServiceProvider.invokePutVserver(getCloudOwner(vimConnectionInfo), getCloudRegion(vimConnectionInfo),
getTenant(vimConnectionInfo), vserver);
+
+ aaiServiceProvider.invokePutVserverToVnfRelationship(getCloudOwner(vimConnectionInfo),
+ getCloudRegion(vimConnectionInfo), getTenant(vimConnectionInfo), vserver, vnfId);
}
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
index 89a2c102f4..f83e9c94d2 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
@@ -212,12 +212,16 @@ public class Sol003LcnControllerTest {
final Vserver vserver = (Vserver) bodyArgument2.getAllValues().get(0);
assertEquals("myVnfc1", vserver.getVserverId());
- final Relationship relationship = vserver.getRelationshipList().getRelationship().get(0);
- assertEquals("generic-vnf", relationship.getRelatedTo());
- assertEquals("tosca.relationships.HostedOn", relationship.getRelationshipLabel());
- assertEquals("/aai/v15/network/generic-vnfs/generic-vnf/myTestVnfId", relationship.getRelatedLink());
- assertEquals("generic-vnf.vnf-id", relationship.getRelationshipData().get(0).getRelationshipKey());
- assertEquals("myTestVnfId", relationship.getRelationshipData().get(0).getRelationshipValue());
+
+ final ArgumentCaptor<AAIResourceUri> uriArgument1Connect = ArgumentCaptor.forClass(AAIResourceUri.class);
+ final ArgumentCaptor<AAIResourceUri> uriArgument2Connect = ArgumentCaptor.forClass(AAIResourceUri.class);
+ verify(aaiResourcesClient, timeout(1000)).connect(uriArgument1Connect.capture(), uriArgument2Connect.capture());
+ assertEquals(
+ "/cloud-infrastructure/cloud-regions/cloud-region/" + CLOUD_OWNER + "/" + REGION + "/tenants/tenant/"
+ + TENANT_ID + "/vservers/vserver/myVnfc1",
+ uriArgument1Connect.getAllValues().get(0).build().toString());
+ assertEquals("/network/generic-vnfs/generic-vnf/myTestVnfId",
+ uriArgument2Connect.getAllValues().get(0).build().toString());
}
@Test
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
index fe55907420..297f74433e 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.content;
@@ -175,20 +176,14 @@ public class VnfmAdapterControllerTest {
assertEquals("/network/generic-vnfs/generic-vnf/myTestVnfId", uriArgument.getValue().build().toString());
assertEquals("myTestVnfId", genericVnfArgument.getValue().getVnfId());
- assertEquals(2, genericVnfArgument.getValue().getRelationshipList().getRelationship().size());
- final Relationship vnfmRelationship =
- genericVnfArgument.getValue().getRelationshipList().getRelationship().get(0);
- assertEquals("esr-vnfm", vnfmRelationship.getRelatedTo());
- assertEquals("tosca.relationships.DependsOn", vnfmRelationship.getRelationshipLabel());
- assertEquals("/aai/v15/external-system/esr-vnfm-list/esr-vnfm/vnfm2", vnfmRelationship.getRelatedLink());
-
- final Relationship tenantRelationship =
- genericVnfArgument.getValue().getRelationshipList().getRelationship().get(1);
- assertEquals("tenant", tenantRelationship.getRelatedTo());
- assertEquals(
- "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/myTestCloudOwner/myTestRegion/tenants/tenant/myTestTenantId",
- tenantRelationship.getRelatedLink());
+ final ArgumentCaptor<AAIResourceUri> uriArgument1Connect = ArgumentCaptor.forClass(AAIResourceUri.class);
+ final ArgumentCaptor<AAIResourceUri> uriArgument2Connect = ArgumentCaptor.forClass(AAIResourceUri.class);
+ verify(aaiResourcesClient, timeout(1000)).connect(uriArgument1Connect.capture(), uriArgument2Connect.capture());
+ assertEquals("/external-system/esr-vnfm-list/esr-vnfm/vnfm2",
+ uriArgument1Connect.getAllValues().get(0).build().toString());
+ assertEquals("/network/generic-vnfs/generic-vnf/myTestVnfId",
+ uriArgument2Connect.getAllValues().get(0).build().toString());
// check the job status
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
index 7f1c1968c1..d60c377730 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
@@ -65,7 +65,7 @@ public class DeployActivitySpecs {
logger.warn("The hostname for SDC activities deployment is not configured in SO");
return;
}
- if (!checkHttpOk(hostname)) {
+ if (!checkHttpServerUp(hostname)) {
logger.warn("The sdc end point is not alive");
return;
}
@@ -144,21 +144,22 @@ public class DeployActivitySpecs {
return;
}
- public boolean checkHttpOk(String host) {
+ public boolean checkHttpServerUp(String host) {
URL url = null;
- boolean isOk = false;
+ boolean isUp = false;
int responseCode = 0;
try {
url = new URL(host);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setConnectTimeout(5000);
responseCode = connection.getResponseCode();
} catch (Exception e) {
logger.warn("Exception on connecting to SDC WFD endpoint: " + e.getMessage());
}
- if (responseCode == HttpStatus.SC_OK) {
- isOk = true;
+ if (responseCode == HttpStatus.SC_OK || responseCode == HttpStatus.SC_NOT_FOUND) {
+ isUp = true;
}
- return isOk;
+ return isUp;
}
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index ac78dfaefc..b2dbcb4639 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -2792,7 +2792,7 @@ public class ToscaResourceInstaller {
+ vfModuleStructure.getVfModuleMetadata().getVfModuleModelName();
}
- protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct,
+ public List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct,
EntityQueryBuilder entityType, TopologyTemplateQueryBuilder topologyTemplateBuilder, boolean nestedSearch) {
EntityQuery entityQuery = entityType.build();
@@ -2804,7 +2804,7 @@ public class ToscaResourceInstaller {
}
- protected String getLeafPropertyValue(IEntityDetails entityDetails, String propName) {
+ public String getLeafPropertyValue(IEntityDetails entityDetails, String propName) {
Property leafProperty = entityDetails.getProperties().get(propName);
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
index 4b069e6ac7..07eca567d5 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
@@ -26,15 +26,16 @@ import java.util.Map;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.INotificationData;
import org.onap.sdc.api.notification.IResourceInstance;
+import org.onap.sdc.tosca.parser.api.IEntityDetails;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
+import org.onap.sdc.tosca.parser.elements.queries.EntityQuery;
+import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery;
import org.onap.sdc.tosca.parser.enums.SdcTypes;
import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
-import org.onap.sdc.toscaparser.api.Group;
-import org.onap.sdc.toscaparser.api.NodeTemplate;
import org.onap.sdc.toscaparser.api.elements.Metadata;
import org.onap.so.asdc.installer.IVfModuleData;
import org.onap.so.asdc.installer.ToscaResourceStructure;
-import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.asdc.installer.heat.ToscaResourceInstaller;
public class ASDCNotificationLogging {
@@ -63,7 +64,7 @@ public class ASDCNotificationLogging {
return "NULL";
}
-
+ ToscaResourceInstaller toscaResourceInstaller = new ToscaResourceInstaller();
StringBuilder buffer = new StringBuilder("CSAR Notification:");
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -103,33 +104,33 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
- List<NodeTemplate> serviceProxyResourceList =
- toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.SERVICE_PROXY);
+ List<IEntityDetails> serviceProxyResourceList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.SERVICE_PROXY), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE),
+ true);
+
if (serviceProxyResourceList != null) {
- for (NodeTemplate serviceProxyNodeTemplate : serviceProxyResourceList) {
+ for (IEntityDetails serviceProxyEntity : serviceProxyResourceList) {
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
buffer.append("Service Proxy Properties:");
buffer.append(System.lineSeparator());
buffer.append("Model Name:");
- buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
buffer.append(System.lineSeparator());
buffer.append("Model UUID:");
- buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
buffer.append(System.lineSeparator());
buffer.append("Description:");
- buffer.append(
- serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
buffer.append(System.lineSeparator());
buffer.append("Version:");
- buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
buffer.append(System.lineSeparator());
buffer.append("InvariantUuid:");
- buffer.append(
- serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -138,31 +139,31 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
buffer.append("Model Customization UUID:");
- buffer.append(serviceProxyNodeTemplate.getMetaData()
- .getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ buffer.append(
+ serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
buffer.append(System.lineSeparator());
buffer.append("Model Instance Name:");
- buffer.append(serviceProxyNodeTemplate.getName());
+ buffer.append(serviceProxyEntity.getName());
buffer.append(System.lineSeparator());
buffer.append("Tosca Node Type:");
- buffer.append(serviceProxyNodeTemplate.getType());
+ buffer.append(serviceProxyEntity.getToscaType());
buffer.append(System.lineSeparator());
buffer.append("Version:");
- buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
buffer.append(System.lineSeparator());
buffer.append("InvariantUuid:");
- buffer.append(
- serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
buffer.append(System.lineSeparator());
}
}
- List<NodeTemplate> configurationNodeTemplatesList =
- toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CONFIGURATION);
+ List<IEntityDetails> configurationList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.CONFIGURATION), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE),
+ true);
- if (configurationNodeTemplatesList != null) {
- for (NodeTemplate configNodeTemplate : configurationNodeTemplatesList) {
+ if (configurationList != null) {
+ for (IEntityDetails configEntity : configurationList) {
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -170,22 +171,22 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
buffer.append("Model Name:");
- buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
buffer.append(System.lineSeparator());
buffer.append("Model UUID:");
- buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
buffer.append(System.lineSeparator());
buffer.append("Description:");
- buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
buffer.append(System.lineSeparator());
buffer.append("Version:");
- buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
buffer.append(System.lineSeparator());
buffer.append("InvariantUuid:");
- buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
buffer.append(System.lineSeparator());
buffer.append("Tosca Node Type:");
- buffer.append(configNodeTemplate.getType());
+ buffer.append(configEntity.getToscaType());
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -193,62 +194,63 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
buffer.append("Model Customization UUID:");
- buffer.append(
- configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
buffer.append(System.lineSeparator());
buffer.append("Model Instance Name:");
- buffer.append(configNodeTemplate.getName());
+ buffer.append(configEntity.getName());
buffer.append(System.lineSeparator());
buffer.append("NFFunction:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(
- configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
buffer.append(System.lineSeparator());
buffer.append("NFRole:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFROLE));
buffer.append(System.lineSeparator());
buffer.append("NFType:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFTYPE));
buffer.append(System.lineSeparator());
}
}
- List<NodeTemplate> vfNodeTemplatesList = toscaResourceStructure.getSdcCsarHelper().getServiceVfList();
- for (NodeTemplate vfNodeTemplate : vfNodeTemplatesList) {
+ List<IEntityDetails> vfEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
+
+
+ for (IEntityDetails vfEntity : vfEntityList) {
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
buffer.append("VNF Properties:");
buffer.append(System.lineSeparator());
buffer.append("Model Name:");
- buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
buffer.append(System.lineSeparator());
buffer.append("Model UUID:");
- buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
buffer.append(System.lineSeparator());
buffer.append("Description:");
- buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
buffer.append(System.lineSeparator());
buffer.append("Version:");
- buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
buffer.append(System.lineSeparator());
buffer.append("Type:");
- buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)));
+ buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)));
buffer.append(System.lineSeparator());
buffer.append("Category:");
- buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY)));
+ buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY)));
buffer.append(System.lineSeparator());
buffer.append("InvariantUuid:");
- buffer.append(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
buffer.append(System.lineSeparator());
buffer.append("Max Instances:");
- buffer.append(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES));
+ buffer.append(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES));
buffer.append(System.lineSeparator());
buffer.append("Min Instances:");
- buffer.append(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES));
+ buffer.append(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES));
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -256,37 +258,35 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
buffer.append("Customization UUID:");
- buffer.append(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
buffer.append(System.lineSeparator());
buffer.append("NFFunction:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate,
- SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ buffer.append(
+ toscaResourceInstaller.getLeafPropertyValue(vfEntity, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
buffer.append(System.lineSeparator());
buffer.append("NFCode:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate,
- "nf_naming_code"));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(vfEntity, "nf_naming_code"));
buffer.append(System.lineSeparator());
buffer.append("NFRole:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate,
- SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(vfEntity, SdcPropertyNames.PROPERTY_NAME_NFROLE));
buffer.append(System.lineSeparator());
buffer.append("NFType:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate,
- SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(vfEntity, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
buffer.append(System.lineSeparator());
buffer.append("MultiStageDesign:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate,
- "multi_stage_design"));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(vfEntity, "multi_stage_design"));
buffer.append(System.lineSeparator());
- List<Group> groupList =
- toscaResourceStructure.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType(
- vfNodeTemplate, "org.openecomp.groups.VfcInstanceGroup");
- if (groupList != null) {
- for (Group group : groupList) {
- Metadata instanceMetadata = group.getMetadata();
+ List<IEntityDetails> vfcInstanceEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder("org.openecomp.groups.VfcInstanceGroup"),
+ TopologyTemplateQuery.newBuilder(SdcTypes.VF)
+ .customizationUUID(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID),
+ false);
+
+ if (vfcInstanceEntityList != null) {
+ for (IEntityDetails vfcEntity : vfcInstanceEntityList) {
+ Metadata instanceMetadata = vfcEntity.getMetadata();
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -300,7 +300,7 @@ public class ASDCNotificationLogging {
buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
buffer.append(System.lineSeparator());
buffer.append("Type:");
- buffer.append(vfNodeTemplate.getType());
+ buffer.append(vfcEntity.getToscaType());
buffer.append(System.lineSeparator());
buffer.append("InvariantUuid:");
buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
@@ -309,43 +309,43 @@ public class ASDCNotificationLogging {
}
+ List<IEntityDetails> vfModuleEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder("org.openecomp.groups.VfModule"),
+ TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE)
+ .customizationUUID(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID),
+ false);
- List<Group> vfGroups = toscaResourceStructure.getSdcCsarHelper().getVfModulesByVf(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
- for (Group group : vfGroups) {
+ for (IEntityDetails vfModuleEntity : vfModuleEntityList) {
- Metadata vfMetadata = group.getMetadata();
+ Metadata vfMetadata = vfModuleEntity.getMetadata();
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
buffer.append("VF Module Properties:");
buffer.append(System.lineSeparator());
buffer.append("ModelInvariantUuid:");
- buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)));
+ buffer.append(testNull(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)));
buffer.append(System.lineSeparator());
buffer.append("ModelName:");
- buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME)));
+ buffer.append(testNull(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME)));
buffer.append(System.lineSeparator());
buffer.append("ModelUuid:");
- buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)));
+ buffer.append(testNull(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)));
buffer.append(System.lineSeparator());
buffer.append("ModelVersion:");
- buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION)));
+ buffer.append(testNull(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION)));
buffer.append(System.lineSeparator());
buffer.append("Description:");
- buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ buffer.append(testNull(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
buffer.append(System.lineSeparator());
- List<NodeTemplate> groupMembers =
- toscaResourceStructure.getSdcCsarHelper().getMembersOfVfModule(vfNodeTemplate, group);
+ List<IEntityDetails> groupMembers = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder("org.openecomp.groups.VfModule")
+ .uUID(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID),
+ TopologyTemplateQuery.newBuilder(SdcTypes.VF), false);
- for (NodeTemplate node : groupMembers) {
+ for (IEntityDetails node : groupMembers) {
buffer.append("Member Name:");
buffer.append(testNull(node.getName()));
buffer.append(System.lineSeparator());
@@ -355,17 +355,18 @@ public class ASDCNotificationLogging {
buffer.append("VF Module Customization Properties:");
buffer.append(System.lineSeparator());
buffer.append("Model Customization UUID:");
- buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
+ buffer.append(testNull(toscaResourceInstaller.getLeafPropertyValue(vfModuleEntity,
SdcPropertyNames.PROPERTY_NAME_VFMODULECUSTOMIZATIONUUID)));
buffer.append(System.lineSeparator());
}
- List<NodeTemplate> vfConfigList = toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplateBySdcType(vfNodeTemplate, SdcTypes.CONFIGURATION);
+ List<IEntityDetails> fabricEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.CONFIGURATION), TopologyTemplateQuery.newBuilder(SdcTypes.VF),
+ false);
- if (vfConfigList != null) {
- for (NodeTemplate configNodeTemplate : vfConfigList) {
+ if (fabricEntityList != null) {
+ for (IEntityDetails configEntity : fabricEntityList) {
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -373,24 +374,22 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
buffer.append("Model Name:");
- buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
buffer.append(System.lineSeparator());
buffer.append("Model UUID:");
- buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
buffer.append(System.lineSeparator());
buffer.append("Description:");
- buffer.append(
- configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
buffer.append(System.lineSeparator());
buffer.append("Version:");
- buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
buffer.append(System.lineSeparator());
buffer.append("InvariantUuid:");
- buffer.append(
- configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
buffer.append(System.lineSeparator());
buffer.append("Tosca Node Type:");
- buffer.append(configNodeTemplate.getType());
+ buffer.append(configEntity.getToscaType());
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -398,95 +397,96 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
buffer.append("Model Customization UUID:");
- buffer.append(configNodeTemplate.getMetaData()
- .getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ buffer.append(
+ configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
buffer.append(System.lineSeparator());
buffer.append("Model Instance Name:");
- buffer.append(configNodeTemplate.getName());
+ buffer.append(configEntity.getName());
buffer.append(System.lineSeparator());
buffer.append("NFFunction:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(
- configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
buffer.append(System.lineSeparator());
buffer.append("NFRole:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(
- configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFROLE));
buffer.append(System.lineSeparator());
buffer.append("NFType:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(
- configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFTYPE));
buffer.append(System.lineSeparator());
}
}
- List<NodeTemplate> cvfcList =
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfNodeTemplate, SdcTypes.CVFC);
+ List<IEntityDetails> cvnfcEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.CVFC), TopologyTemplateQuery.newBuilder(SdcTypes.VF), false);
- for (NodeTemplate cvfcTemplate : cvfcList) {
+ for (IEntityDetails cvnfcEntity : cvnfcEntityList) {
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
buffer.append("CVNFC Properties:");
buffer.append(System.lineSeparator());
buffer.append("ModelCustomizationUuid:");
- buffer.append(testNull(
- cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ buffer.append(
+ testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
buffer.append(System.lineSeparator());
buffer.append("ModelInvariantUuid:");
buffer.append(
- testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
buffer.append(System.lineSeparator());
buffer.append("ModelName:");
- buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ buffer.append(testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
buffer.append(System.lineSeparator());
buffer.append("ModelUuid:");
- buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ buffer.append(testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
buffer.append(System.lineSeparator());
buffer.append("ModelVersion:");
- buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ buffer.append(testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
buffer.append(System.lineSeparator());
buffer.append("Description:");
- buffer.append(
- testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ buffer.append(testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
buffer.append(System.lineSeparator());
buffer.append("Template Name:");
- buffer.append(testNull(cvfcTemplate.getName()));
+ buffer.append(testNull(cvnfcEntity.getName()));
buffer.append(System.lineSeparator());
+ List<IEntityDetails> vfcEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.VFC),
+ TopologyTemplateQuery.newBuilder(SdcTypes.CVFC).customizationUUID(
+ cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)),
+ false);
- List<NodeTemplate> vfcList =
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC);
-
- for (NodeTemplate vfcTemplate : vfcList) {
+ for (IEntityDetails vfcEntity : vfcEntityList) {
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
buffer.append("VNFC Properties:");
buffer.append(System.lineSeparator());
buffer.append("ModelCustomizationUuid:");
buffer.append(testNull(
- vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
buffer.append(System.lineSeparator());
buffer.append("ModelInvariantUuid:");
buffer.append(
- testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
buffer.append(System.lineSeparator());
buffer.append("ModelName:");
- buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ buffer.append(testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
buffer.append(System.lineSeparator());
buffer.append("ModelUuid:");
- buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ buffer.append(testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
buffer.append(System.lineSeparator());
buffer.append("ModelVersion:");
- buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ buffer.append(testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
buffer.append(System.lineSeparator());
buffer.append("Description:");
buffer.append(
- testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
buffer.append(System.lineSeparator());
buffer.append("Sub Category:");
buffer.append(
- testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)));
+ testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)));
buffer.append(System.lineSeparator());
}
@@ -495,41 +495,40 @@ public class ASDCNotificationLogging {
}
+ List<IEntityDetails> vlEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.VL), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
+ if (vlEntityList != null) {
- List<NodeTemplate> nodeTemplatesVLList = toscaResourceStructure.getSdcCsarHelper().getServiceVlList();
-
- if (nodeTemplatesVLList != null) {
-
- for (NodeTemplate vlNode : nodeTemplatesVLList) {
+ for (IEntityDetails vlEntity : vlEntityList) {
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
buffer.append("NETWORK Level Properties:");
buffer.append(System.lineSeparator());
buffer.append("Model Name:");
- buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
buffer.append(System.lineSeparator());
buffer.append("Model InvariantUuid:");
- buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
buffer.append(System.lineSeparator());
buffer.append("Model UUID:");
- buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
buffer.append(System.lineSeparator());
buffer.append("Model Version:");
- buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
buffer.append(System.lineSeparator());
buffer.append("AIC Max Version:");
- buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
+ buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
buffer.append(System.lineSeparator());
buffer.append("AIC Min Version:");
- buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
+ buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
buffer.append(System.lineSeparator());
buffer.append("Tosca Node Type:");
- buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)));
+ buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)));
buffer.append(System.lineSeparator());
buffer.append("Description:");
- buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
buffer.append(System.lineSeparator());
@@ -537,22 +536,22 @@ public class ASDCNotificationLogging {
buffer.append("NETWORK Customization Properties:");
buffer.append(System.lineSeparator());
buffer.append("CustomizationUUID:");
- buffer.append(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ buffer.append(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
buffer.append(System.lineSeparator());
buffer.append("Network Technology:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNode,
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(vlEntity,
SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY));
buffer.append(System.lineSeparator());
buffer.append("Network Type:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNode,
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(vlEntity,
SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE));
buffer.append(System.lineSeparator());
buffer.append("Network Role:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNode,
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(vlEntity,
SdcPropertyNames.PROPERTY_NAME_NETWORKROLE));
buffer.append(System.lineSeparator());
buffer.append("Network Scope:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNode,
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(vlEntity,
SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE));
buffer.append(System.lineSeparator());
@@ -560,52 +559,55 @@ public class ASDCNotificationLogging {
}
+ List<IEntityDetails> crEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.CR), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
- List<NodeTemplate> networkCollectionList =
- toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CR);
-
- if (networkCollectionList != null) {
- for (NodeTemplate crNode : networkCollectionList) {
+ if (crEntityList != null) {
+ for (IEntityDetails crEntity : crEntityList) {
buffer.append(System.lineSeparator());
buffer.append("Network Collection Properties:");
buffer.append(System.lineSeparator());
buffer.append("Model Name:");
- buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
buffer.append(System.lineSeparator());
buffer.append("Model UUID:");
- buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ buffer.append(System.lineSeparator());
+ buffer.append("Customization UUID:");
+ buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
buffer.append(System.lineSeparator());
buffer.append("InvariantUuid:");
- buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
buffer.append(System.lineSeparator());
buffer.append("Description:");
- buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
buffer.append(System.lineSeparator());
buffer.append("Version:");
- buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
buffer.append(System.lineSeparator());
buffer.append("Tosca Node Type:");
- buffer.append(crNode.getType());
+ buffer.append(crEntity.getToscaType());
buffer.append(System.lineSeparator());
buffer.append("CR Function:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode,
- "cr_function"));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity, "cr_function"));
buffer.append(System.lineSeparator());
buffer.append("CR Role:");
- buffer.append(
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, "cr_role"));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity, "cr_role"));
buffer.append(System.lineSeparator());
buffer.append("CR Type:");
- buffer.append(
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, "cr_type"));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity, "cr_type"));
buffer.append(System.lineSeparator());
- List<NodeTemplate> vlNodeList =
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(crNode, SdcTypes.VL);
+ List<IEntityDetails> networkEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.VL),
+ TopologyTemplateQuery.newBuilder(SdcTypes.CR).customizationUUID(
+ crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)),
+ false);
+
- for (NodeTemplate vlNodeTemplate : vlNodeList) {
+ for (IEntityDetails vlEntity : networkEntityList) {
- Metadata vlMetadata = vlNodeTemplate.getMetaData();
+ Metadata vlMetadata = vlEntity.getMetadata();
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -631,19 +633,20 @@ public class ASDCNotificationLogging {
buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
buffer.append(System.lineSeparator());
buffer.append("Tosca Node Type:");
- buffer.append(vlNodeTemplate.getType());
+ buffer.append(vlEntity.getToscaType());
buffer.append(System.lineSeparator());
}
+ List<IEntityDetails> ncEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder("org.openecomp.groups.NetworkCollection"),
+ TopologyTemplateQuery.newBuilder(SdcTypes.CR).customizationUUID(
+ crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)),
+ false);
- List<Group> groupList =
- toscaResourceStructure.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType(
- crNode, "org.openecomp.groups.NetworkCollection");
-
- if (groupList != null) {
- for (Group group : groupList) {
- Metadata instanceMetadata = group.getMetadata();
+ if (ncEntityList != null) {
+ for (IEntityDetails ncEntity : ncEntityList) {
+ Metadata instanceMetadata = ncEntity.getMetadata();
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
buffer.append("Network Instance Group Properties:");
@@ -670,96 +673,172 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
buffer.append("Model Customization UUID:");
- buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
buffer.append(System.lineSeparator());
buffer.append("Model Instance Name:");
- buffer.append(crNode.getName());
+ buffer.append(crEntity.getName());
buffer.append(System.lineSeparator());
buffer.append("Network Scope:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode,
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity,
SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE));
buffer.append(System.lineSeparator());
buffer.append("Network Role:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode,
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity,
SdcPropertyNames.PROPERTY_NAME_NETWORKROLE));
buffer.append(System.lineSeparator());
buffer.append("Network Type:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode,
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity,
SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE));
buffer.append(System.lineSeparator());
buffer.append("Network Technology:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode,
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity,
SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY));
buffer.append(System.lineSeparator());
}
}
- List<NodeTemplate> allottedResourceList = toscaResourceStructure.getSdcCsarHelper().getAllottedResources();
+ List<IEntityDetails> arEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
- if (allottedResourceList != null) {
+ if (arEntityList != null) {
buffer.append(System.lineSeparator());
- buffer.append("Allotted Resource Properties:");
+ buffer.append("VF Allotted Resource Properties:");
buffer.append(System.lineSeparator());
- for (NodeTemplate allottedNode : allottedResourceList) {
+ for (IEntityDetails arEntity : arEntityList) {
- buffer.append("Model Name:");
- buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
- buffer.append(System.lineSeparator());
- buffer.append("Model Name:");
- buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
- buffer.append(System.lineSeparator());
- buffer.append("Model InvariantUuid:");
- buffer.append(
- testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
- buffer.append(System.lineSeparator());
- buffer.append("Model Version:");
- buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
- buffer.append(System.lineSeparator());
- buffer.append("Model UUID:");
- buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
- buffer.append(System.lineSeparator());
- buffer.append("Model Subcategory:");
- buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY));
- buffer.append(System.lineSeparator());
- buffer.append("Model Category:");
- buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
- buffer.append(System.lineSeparator());
- buffer.append("Model Description:");
- buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
- buffer.append(System.lineSeparator());
+ Metadata metadata = arEntity.getMetadata();
+ String category = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
+ if ("Allotted Resource".equalsIgnoreCase(category)) {
- buffer.append("Allotted Resource Customization Properties:");
- buffer.append(System.lineSeparator());
+ buffer.append("Model Name:");
+ buffer.append(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Name:");
+ buffer.append(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model InvariantUuid:");
+ buffer.append(
+ testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Version:");
+ buffer.append(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model UUID:");
+ buffer.append(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Subcategory:");
+ buffer.append(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Category:");
+ buffer.append(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Description:");
+ buffer.append(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ buffer.append(System.lineSeparator());
- buffer.append("Model Cutomization UUID:");
- buffer.append(testNull(
- allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
- buffer.append(System.lineSeparator());
- buffer.append("NFFunction:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode,
- SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
- buffer.append(System.lineSeparator());
- buffer.append("NFCode:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode,
- "nf_naming_code"));
- buffer.append(System.lineSeparator());
- buffer.append("NFRole:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode,
- SdcPropertyNames.PROPERTY_NAME_NFROLE));
- buffer.append(System.lineSeparator());
- buffer.append("NFType:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode,
- SdcPropertyNames.PROPERTY_NAME_NFTYPE));
- buffer.append(System.lineSeparator());
+ buffer.append("Allotted Resource Customization Properties:");
+ buffer.append(System.lineSeparator());
+
+ buffer.append("Model Cutomization UUID:");
+ buffer.append(testNull(
+ arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFFunction:");
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(arEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFCode:");
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(arEntity, "nf_naming_code"));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFRole:");
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(arEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFType:");
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(arEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+ buffer.append(System.lineSeparator());
+ }
}
}
+ List<IEntityDetails> pnfAREntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.PNF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
+
+ if (pnfAREntityList != null) {
+
+ buffer.append(System.lineSeparator());
+ buffer.append("PNF Allotted Resource Properties:");
+ buffer.append(System.lineSeparator());
+
+ for (IEntityDetails pnfAREntity : pnfAREntityList) {
+
+ Metadata metadata = pnfAREntity.getMetadata();
+ String category = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
+
+ if ("Allotted Resource".equalsIgnoreCase(category)) {
+
+ buffer.append("Model Name:");
+ buffer.append(testNull(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Name:");
+ buffer.append(testNull(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model InvariantUuid:");
+ buffer.append(
+ testNull(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Version:");
+ buffer.append(testNull(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model UUID:");
+ buffer.append(testNull(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Subcategory:");
+ buffer.append(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Category:");
+ buffer.append(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Description:");
+ buffer.append(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ buffer.append(System.lineSeparator());
+
+
+ buffer.append("Allotted Resource Customization Properties:");
+ buffer.append(System.lineSeparator());
+
+ buffer.append("Model Cutomization UUID:");
+ buffer.append(testNull(
+ pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFFunction:");
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(pnfAREntity,
+ SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFCode:");
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(pnfAREntity, "nf_naming_code"));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFRole:");
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(pnfAREntity,
+ SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFType:");
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(pnfAREntity,
+ SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+ buffer.append(System.lineSeparator());
+ }
+
+ }
+ }
+
+
return buffer.toString();
}
diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java
index b41fbaf658..75ab089719 100644
--- a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java
+++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java
@@ -29,7 +29,9 @@ import static com.github.tomakehurst.wiremock.client.WireMock.verify;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
import org.junit.Test;
+import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Spy;
import org.onap.so.asdc.BaseTest;
import org.onap.so.asdc.activity.DeployActivitySpecs;
import org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse;
@@ -50,6 +52,10 @@ public class DeployActivitySpecsITTest extends BaseTest {
@Autowired
private DeployActivitySpecs deployActivitySpecs;
+ @InjectMocks
+ @Spy
+ DeployActivitySpecs deployActivitySpecsM;
+
@Test
public void deployActivitySpecsIT_Test() throws Exception {
ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse();
@@ -100,7 +106,9 @@ public class DeployActivitySpecsITTest extends BaseTest {
put(urlPathMatching(urlPath)).willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(org.springframework.http.HttpStatus.OK.value())));
- deployActivitySpecs.deployActivities();
+ String host = "http://localhost:8090";
+ when(deployActivitySpecsM.checkHttpServerUp(host)).thenReturn(false);
+ deployActivitySpecsM.deployActivities();
verify(0, putRequestedFor(urlEqualTo(urlPath)));
}
diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java
index 7a876a67a2..6d88ab6630 100644
--- a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java
+++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java
@@ -71,7 +71,7 @@ public class DeployActivitySpecsTest {
new ArrayList<org.onap.so.db.catalog.beans.ActivitySpec>();
catalogActivitySpecList.add(catalogActivitySpec);
when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("http://testEndpoint");
- doReturn(true).when(deployActivitySpecs).checkHttpOk("http://testEndpoint");
+ doReturn(true).when(deployActivitySpecs).checkHttpServerUp("http://testEndpoint");
when(activitySpecRepository.findAll()).thenReturn(catalogActivitySpecList);
doReturn("testActivityId").when(activitySpecsActions).createActivitySpec(Mockito.any(), Mockito.any());
doReturn(true).when(activitySpecsActions).certifyActivitySpec(Mockito.any(), Mockito.any());
diff --git a/adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/WMAdapterRestTest.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionCompletion.java
index 08728fa339..1018d7f025 100644
--- a/adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/WMAdapterRestTest.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionCompletion.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *l
+ *
* 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.
@@ -18,28 +18,8 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.workflowmessage;
+package org.onap.so.bpmn.common.listener.validation;
-import org.junit.Assert;
-import org.junit.Test;
+public interface WorkflowActionCompletion extends WorkflowActionListener {
-public class WMAdapterRestTest {
-
- @Test(expected = ClassFormatError.class)
- public void testHealthCheckException() throws Exception {
-
- WMAdapterRest test = new WMAdapterRest();
- test.healthcheck("34388737-cdad-4d96-ae6f-39d08024b495");
- Assert.assertFalse(true);
-
- }
-
- @Test(expected = ClassFormatError.class)
- public void testReceiveWorkflowMsgException() throws Exception {
- WMAdapterRest test = new WMAdapterRest();
- test.receiveWorkflowMessage("contentTypeHeader", "messageType", "correlator", "content");
- Assert.assertFalse(true);
-
- }
}
-
diff --git a/adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/BPRestCallbackTest.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListener.java
index 21917c3d2c..4788c55053 100644
--- a/adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/BPRestCallbackTest.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListener.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,25 +18,27 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.workflowmessage;
+package org.onap.so.bpmn.common.listener.validation;
-import org.apache.http.entity.ContentType;
-import org.junit.Test;
-import org.mockito.Mock;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
-import static junit.framework.Assert.assertFalse;
+public interface WorkflowActionListener {
-public class BPRestCallbackTest {
+ /**
+ * Should this listener run for given bb
+ *
+ * @return
+ *
+ */
+ public boolean shouldRunFor(String bbName, String eventName);
- @Mock
- ContentType contentType;
+ /**
+ * Determines whether or not the listener should be executed
+ *
+ *
+ * @param execution
+ * @return
+ */
+ public void executeListener(DelegateExecution execution);
- @Test
- public void testSendExceptionCase() {
-
- BPRestCallback test = new BPRestCallback();
- test.send("workflowMessageUrl/", "messageType", "correlator", contentType,"message");
- assertFalse(test.send("workflowMessageUrl/", "messageType", "correlator", contentType,"message"));
-
- }
- }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListenerRunner.java
new file mode 100644
index 0000000000..806c1b835d
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListenerRunner.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.listener.validation;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Optional;
+import javax.annotation.PostConstruct;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.listener.ListenerRunner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+
+
+@Component
+public class WorkflowActionListenerRunner extends ListenerRunner {
+
+ private static Logger logger = LoggerFactory.getLogger(WorkflowActionListenerRunner.class);
+
+ protected List<WorkflowActionListener> workflowActionListeners;
+
+ @PostConstruct
+ protected void init() {
+ workflowActionListeners = new ArrayList<>(Optional
+ .ofNullable(context.getBeansOfType(WorkflowActionListener.class)).orElse(new HashMap<>()).values());
+ }
+
+ public void executeAsyncListeners(String bbName, DelegateExecution execution, String eventName) {
+ try {
+ logger.info("NotifyingWorkflowActionListeners");
+ runNotifications(workflowActionListeners, bbName, execution, eventName);
+ } catch (Exception e) {
+ logger.error("Error in Notifying Workflow Action Listeners", e);
+ }
+ }
+
+ protected void runNotifications(List<? extends WorkflowActionListener> listeners, String bbName,
+ DelegateExecution execution, String eventName) {
+ List<? extends WorkflowActionListener> filtered =
+ filterListeners(listeners, (item -> item.shouldRunFor(bbName, eventName)));
+ filtered.forEach(item -> item.executeListener(execution));
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
index dcb9e08d0b..fcac86b251 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
@@ -23,9 +23,7 @@
package org.onap.so.bpmn.servicedecomposition.tasks;
import java.io.IOException;
-import java.io.ObjectOutputStream;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -76,12 +74,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.type.TypeFactory;
@Component("BBInputSetupUtils")
public class BBInputSetupUtils {
@@ -177,39 +174,32 @@ public class BBInputSetupUtils {
}
public InfraActiveRequests loadOriginalInfraActiveRequestById(String requestId) {
-
return this.requestsDbClient.getInfraActiveRequestbyRequestId(
this.requestsDbClient.getInfraActiveRequestbyRequestId(requestId).getOriginalRequestId());
}
public List<ExecuteBuildingBlock> loadOriginalFlowExecutionPath(String requestId) {
-
- List<ExecuteBuildingBlock> asList = null;
if (requestId != null) {
-
InfraActiveRequests request = loadInfraActiveRequestById(requestId);
-
if (request.getOriginalRequestId() != null) {
-
RequestProcessingData requestProcessingData =
this.requestsDbClient.getRequestProcessingDataBySoRequestIdAndName(
request.getOriginalRequestId(), PROCESSING_DATA_NAME_EXECUTION_FLOWS);
-
- ObjectMapper om = new ObjectMapper();
try {
- ExecuteBuildingBlock[] asArray =
- om.readValue(requestProcessingData.getValue(), ExecuteBuildingBlock[].class);
- asList = Arrays.asList(asArray);
+ ObjectMapper om = new ObjectMapper();
+ TypeFactory typeFactory = objectMapper.getTypeFactory();
+ return om.readValue(requestProcessingData.getValue(),
+ typeFactory.constructCollectionType(List.class, ExecuteBuildingBlock.class));
} catch (Exception e) {
logger.error(DATA_LOAD_ERROR, e);
+ throw new RuntimeException("Error Loading Original Request Data", e);
}
+ } else {
+ throw new RuntimeException("Original Request Id is null for record: " + requestId);
}
-
} else {
- logger.debug(REQUEST_ERROR);
+ throw new RuntimeException("Null Request Id Passed in");
}
-
- return asList;
}
public Service getCatalogServiceByModelUUID(String modelUUID) {
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
index 5f70ab5924..3a1e126fef 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
@@ -82,7 +82,7 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
String correlationValue = messageId;
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
@WebMethod(operationName = "queryVnfNotification")
@@ -117,7 +117,7 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
message.setOutputs(outputs);
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
@WebMethod(operationName = "createVnfNotification")
@@ -150,7 +150,7 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
message.setRollback(rollback);
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
@WebMethod(operationName = "updateVnfNotification")
@@ -181,7 +181,7 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
message.setRollback(rollback);
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
@WebMethod(operationName = "deleteVnfNotification")
@@ -208,6 +208,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
message.setErrorMessage(errorMessage);
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java
new file mode 100644
index 0000000000..56526c7f89
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java
@@ -0,0 +1,21 @@
+package org.onap.so.bpmn.core.plugins;
+
+import org.camunda.bpm.engine.delegate.ExecutionListener;
+import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener;
+import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl;
+import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl;
+import org.camunda.bpm.engine.impl.util.xml.Element;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AsyncTaskExecutor extends AbstractBpmnParseListener {
+
+ private void injectTaskExecutorExecutionListener(ActivityImpl activity) {
+ activity.addListener(ExecutionListener.EVENTNAME_END, new AsyncTaskExecutorListener());
+ }
+
+ @Override
+ public void parseEndEvent(Element endEventElement, ScopeImpl scope, ActivityImpl activity) {
+ injectTaskExecutorExecutionListener(activity);
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutorListener.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutorListener.java
new file mode 100644
index 0000000000..94f4b313d4
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutorListener.java
@@ -0,0 +1,42 @@
+package org.onap.so.bpmn.core.plugins;
+
+import org.camunda.bpm.engine.RepositoryService;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.ExecutionListener;
+import org.onap.so.bpmn.common.listener.validation.WorkflowActionListenerRunner;
+import org.onap.so.spring.SpringContextHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AsyncTaskExecutorListener implements ExecutionListener {
+ private final Logger logger = LoggerFactory.getLogger(AsyncTaskExecutorListener.class);
+
+
+ private WorkflowActionListenerRunner listenerRunner;
+
+ @Override
+ public void notify(DelegateExecution execution) throws Exception {
+ if (!isBlank(execution.getCurrentActivityName())) {
+ try {
+ String id = execution.getId();
+ if (id != null) {
+ RepositoryService repositoryService = execution.getProcessEngineServices().getRepositoryService();
+ String processName = repositoryService.createProcessDefinitionQuery()
+ .processDefinitionId(execution.getProcessDefinitionId()).singleResult().getName();
+ logger.info("ProcessName : {}", processName);
+ if (processName != null) {
+ listenerRunner =
+ SpringContextHelper.getAppContext().getBean(WorkflowActionListenerRunner.class);
+ listenerRunner.executeAsyncListeners(processName, execution, ExecutionListener.EVENTNAME_END);
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error occured in executing Complete Task Listeners", e);
+ }
+ }
+ }
+
+ private boolean isBlank(Object object) {
+ return object == null || "".equals(object.toString().trim());
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java
new file mode 100644
index 0000000000..96c6af42ed
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java
@@ -0,0 +1,51 @@
+/*-
+ * ============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.bpmn.core.plugins;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener;
+import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin;
+import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+
+
+@Component
+public class BPMNProcessCompletePlugin extends AbstractProcessEnginePlugin {
+
+ @Autowired
+ private AsyncTaskExecutor asyncTaskExecutor;
+
+ @Override
+ public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
+ List<BpmnParseListener> preParseListeners = processEngineConfiguration.getCustomPreBPMNParseListeners();
+ if (preParseListeners == null) {
+ preParseListeners = new ArrayList<>();
+ processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners);
+ }
+ preParseListeners.add(asyncTaskExecutor);
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImplTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImplTest.java
new file mode 100644
index 0000000000..d15d71a9e9
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImplTest.java
@@ -0,0 +1,118 @@
+package org.onap.so.bpmn.common.workflow.service;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.DeleteVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.MsoExceptionCategory;
+import org.onap.so.bpmn.common.adapter.vnf.QueryVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.RollbackVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.VnfRollback;
+import org.onap.so.bpmn.common.adapter.vnf.VnfStatus;
+import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult;
+
+@RunWith(MockitoJUnitRunner.class)
+public class VnfAdapterNotifyServiceImplTest {
+
+
+ @InjectMocks
+ @Spy
+ private VnfAdapterNotifyServiceImpl vnfAdapterNotifyServiceImpl;
+
+ @Mock
+ private CallbackHandlerService callbackHandlerService;
+
+ @Mock
+ private CallbackResult callbackResult;
+
+ protected CreateVnfNotification.Outputs outputs = new CreateVnfNotification.Outputs();
+ protected QueryVnfNotification.Outputs queryOutputs = new QueryVnfNotification.Outputs();
+ protected UpdateVnfNotification.Outputs updateOutputs = new UpdateVnfNotification.Outputs();
+
+ protected VnfRollback vnfRollback = new VnfRollback();
+
+ @Test
+ public void rollbackVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("rollbackVnfNotification"),
+ any(RollbackVnfNotification.class), eq("rollbackVnfNotificationCallback"),
+ eq("rollbackVnfNotificationCallback"), eq("VNFRB_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+
+ vnfAdapterNotifyServiceImpl.rollbackVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK,
+ "Error creating stack");
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("rollbackVnfNotification"),
+ any(RollbackVnfNotification.class), eq("rollbackVnfNotificationCallback"),
+ eq("rollbackVnfNotificationCallback"), eq("VNFRB_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+ }
+
+ @Test
+ public void queryVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("queryVnfNotification"),
+ any(QueryVnfNotification.class), eq("queryVnfNotificationCallback"), eq("queryVnfNotificationCallback"),
+ eq("VNFQ_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"), eq(null));
+
+ vnfAdapterNotifyServiceImpl.queryVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK, "",
+ Boolean.TRUE, "vnfid", VnfStatus.ACTIVE, queryOutputs);
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("queryVnfNotification"),
+ any(QueryVnfNotification.class), eq("queryVnfNotificationCallback"), eq("queryVnfNotificationCallback"),
+ eq("VNFQ_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"), eq(null));
+ }
+
+ @Test
+ public void createVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("createVnfNotification"),
+ any(CreateVnfNotification.class), eq("createVnfNotificationCallback"),
+ eq("createVnfNotificationCallback"), eq("VNFC_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+
+ vnfAdapterNotifyServiceImpl.createVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK, "",
+ "vnfId", outputs, vnfRollback);
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("createVnfNotification"),
+ any(CreateVnfNotification.class), eq("createVnfNotificationCallback"),
+ eq("createVnfNotificationCallback"), eq("VNFC_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+ }
+
+ @Test
+ public void updateVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("updateVnfNotification"),
+ any(UpdateVnfNotification.class), eq("updateVnfNotificationCallback"),
+ eq("updateVnfNotificationCallback"), eq("VNFU_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+
+ vnfAdapterNotifyServiceImpl.updateVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK, "",
+ updateOutputs, vnfRollback);
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("updateVnfNotification"),
+ any(UpdateVnfNotification.class), eq("updateVnfNotificationCallback"),
+ eq("updateVnfNotificationCallback"), eq("VNFU_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+ }
+
+ @Test
+ public void deleteVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("deleteVnfNotification"),
+ any(DeleteVnfNotification.class), eq("deleteVnfACallback"), eq("deleteVnfACallback"), eq("VNFDEL_uuid"),
+ eq("messageId"), eq("[VNF-NOTIFY]"), eq(null));
+
+ vnfAdapterNotifyServiceImpl.deleteVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK, "");
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("deleteVnfNotification"),
+ any(DeleteVnfNotification.class), eq("deleteVnfACallback"), eq("deleteVnfACallback"), eq("VNFDEL_uuid"),
+ eq("messageId"), eq("[VNF-NOTIFY]"), eq(null));
+ }
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
index efdee8601e..bb900420e3 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
<bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true">
<bpmn:startEvent id="Start_WorkflowActionBB" name="start">
<bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing>
@@ -46,7 +46,7 @@
<bpmn:outgoing>SequenceFlow_0l7kaba</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_1m2eezj" name="Completed = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowC">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("completed")==true&amp;&amp;execution.getVariable("isRollback")==false&amp;&amp;execution.getVariable("handlingCode")=="Success"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==false&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_RetrieveBBExectuionList" name="Retrieve BB Execution List" camunda:expression="${WorkflowAction.selectExecutionList(execution)}">
<bpmn:incoming>SequenceFlow_15s0okp</bpmn:incoming>
@@ -54,7 +54,7 @@
</bpmn:serviceTask>
<bpmn:serviceTask id="Task_SendSync" name="Send Sync Ack API Handler" camunda:asyncAfter="true" camunda:expression="${WorkflowActionBBTasks.sendSyncAck(execution)}">
<bpmn:incoming>SequenceFlow_0sckerv</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1wb59ic</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1lrz41x</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="Task_UpdateRequestComplete" name="Update Request To Complete" camunda:expression="${WorkflowActionBBTasks.updateRequestStatusToComplete(execution)}">
<bpmn:incoming>SequenceFlow_0kf5sen</bpmn:incoming>
@@ -83,7 +83,7 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_024g0d1" name="no" sourceRef="ExclusiveGateway_10q79b6" targetRef="Task_UpdateDb" />
<bpmn:sequenceFlow id="SequenceFlow_0vi883o" name="yes" sourceRef="ExclusiveGateway_10q79b6" targetRef="Task_SendSyncAckError">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==true&amp;&amp;execution.getVariable("sentSyncResponse")==false}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==true&&execution.getVariable("sentSyncResponse")==false}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_0eana0l" sourceRef="Task_SendSyncAckError" targetRef="Task_UpdateDb" />
<bpmn:serviceTask id="Task_SendSyncAckError" name="Send Sync Ack API Handler" camunda:asyncAfter="true" camunda:expression="${WorkflowActionBBTasks.sendSyncAck(execution)}">
@@ -92,10 +92,10 @@
</bpmn:serviceTask>
</bpmn:subProcess>
<bpmn:sequenceFlow id="SequenceFlow_0v588sm" name="Rollback = true" sourceRef="ExclusiveGateway_Finished" targetRef="Task_RollbackExecutionPath">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1atzsgn" sourceRef="Task_RollbackExecutionPath" targetRef="Task_SelectBB">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isRollbackNeeded")==true}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==true}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_RollbackExecutionPath" name="Rollback Execution Path" camunda:expression="${WorkflowActionBBTasks.rollbackExecutionPath(execution)}">
<bpmn:incoming>SequenceFlow_0v588sm</bpmn:incoming>
@@ -104,7 +104,7 @@
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0vc9go9" sourceRef="Task_RetrieveBBExectuionList" targetRef="ExclusiveGateway_isTopLevelFlow" />
<bpmn:sequenceFlow id="SequenceFlow_11530ei" name="Abort = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowAbort">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Abort"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Abort"}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_AbortAndCallErrorHandling" name="Update Request To Failed" camunda:expression="${WorkflowActionBBFailure.updateRequestStatusToFailed(execution)}">
<bpmn:incoming>SequenceFlow_02ksbt0</bpmn:incoming>
@@ -115,7 +115,6 @@
<bpmn:incoming>SequenceFlow_1r570x3</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_1p8yxu6" sourceRef="Task_AbortAndCallErrorHandling" targetRef="EndEvent_0lzz1ya" />
- <bpmn:sequenceFlow id="SequenceFlow_1wb59ic" sourceRef="Task_SendSync" targetRef="Task_PreValidateWorkflow" />
<bpmn:sequenceFlow id="SequenceFlow_01j184u" sourceRef="ExclusiveGateway_Finished" targetRef="Task_0a31dkf" />
<bpmn:serviceTask id="Task_0a31dkf" name="Check Retry Status" camunda:expression="${WorkflowActionBBTasks.checkRetryStatus(execution)}">
<bpmn:incoming>SequenceFlow_01j184u</bpmn:incoming>
@@ -128,7 +127,7 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_0sckerv" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlow" targetRef="Task_SendSync" />
<bpmn:sequenceFlow id="SequenceFlow_0unbew4" name="no" sourceRef="ExclusiveGateway_isTopLevelFlow" targetRef="Task_PreValidateWorkflow">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:exclusiveGateway id="ExclusiveGateway_isTopLevelFlowAbort" name="Is Top-Level Flow?" default="SequenceFlow_02ksbt0">
<bpmn:incoming>SequenceFlow_11530ei</bpmn:incoming>
@@ -137,7 +136,7 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_02ksbt0" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlowAbort" targetRef="Task_AbortAndCallErrorHandling" />
<bpmn:sequenceFlow id="SequenceFlow_1r570x3" name="no" sourceRef="ExclusiveGateway_isTopLevelFlowAbort" targetRef="EndEvent_0lzz1ya">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:exclusiveGateway id="ExclusiveGateway_isTopLevelFlowC" name="Is Top-Level Flow?" default="SequenceFlow_0kf5sen">
<bpmn:incoming>SequenceFlow_1m2eezj</bpmn:incoming>
@@ -145,13 +144,13 @@
<bpmn:outgoing>SequenceFlow_0kf5sen</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_0x4urgp" name="no" sourceRef="ExclusiveGateway_isTopLevelFlowC" targetRef="End_WorkflowActionBB">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:endEvent id="End_RollbackFailed" name="end">
<bpmn:incoming>SequenceFlow_1ui67mc</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_11dlyzt" name="Rollback Not Needed" sourceRef="Task_RollbackExecutionPath" targetRef="Task_UpdateRequestToFailed">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isRollbackNeeded")==false}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==false}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_UpdateRequestToFailed" name="Update Request To Failed" camunda:expression="${WorkflowActionBBFailure.updateRequestStatusToFailedWithRollback(execution)}">
<bpmn:incoming>SequenceFlow_11dlyzt</bpmn:incoming>
@@ -159,7 +158,7 @@
<bpmn:outgoing>SequenceFlow_1ui67mc</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0l7kaba" name="Rollback Completed" sourceRef="ExclusiveGateway_Finished" targetRef="Task_UpdateRequestToFailed">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("completed")==true&amp;&amp;execution.getVariable("isRollback")==true&amp;&amp;execution.getVariable("handlingCode")=="Success"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==true&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1ui67mc" sourceRef="Task_UpdateRequestToFailed" targetRef="End_RollbackFailed" />
<bpmn:subProcess id="SubProcess_0fuugr9" name="Java Exception Handling Sub Process" triggeredByEvent="true">
@@ -186,7 +185,7 @@
<bpmn:sequenceFlow id="SequenceFlow_1tfizxf" sourceRef="Task_PreValidateWorkflow" targetRef="Task_SelectBB" />
<bpmn:serviceTask id="Task_PreValidateWorkflow" name="PreValidate Workflow" camunda:expression="${WorkflowValidatorRunner.preValidate(execution.getVariable(&#34;requestAction&#34;), execution)}">
<bpmn:incoming>SequenceFlow_0unbew4</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_1wb59ic</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0etawv5</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1tfizxf</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="ServiceTask_0lbkcyp" name="Post Processing Execute BB" camunda:expression="${WorkflowActionBBTasks.postProcessingExecuteBB(execution)}">
@@ -196,6 +195,19 @@
<bpmn:sequenceFlow id="SequenceFlow_1hsqed1" sourceRef="Call_ExecuteBB" targetRef="ServiceTask_0lbkcyp" />
<bpmn:sequenceFlow id="SequenceFlow_1fftixk" sourceRef="ServiceTask_0lbkcyp" targetRef="ExclusiveGateway_Finished" />
<bpmn:sequenceFlow id="SequenceFlow_1pnkpim" sourceRef="Task_0a31dkf" targetRef="Task_SelectBB" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1dez26n" name="Generated Id&#39;s?">
+ <bpmn:incoming>SequenceFlow_1lrz41x</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0etawv5</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0ilo6lo</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1lrz41x" sourceRef="Task_SendSync" targetRef="ExclusiveGateway_1dez26n" />
+ <bpmn:sequenceFlow id="SequenceFlow_0etawv5" name="no" sourceRef="ExclusiveGateway_1dez26n" targetRef="Task_PreValidateWorkflow">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("generateIdsOnly") == null || execution.getVariable("generateIdsOnly")==false}]]></bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:endEvent id="EndEvent_12f15tu" name="End">
+ <bpmn:incoming>SequenceFlow_0ilo6lo</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0ilo6lo" name="yes" sourceRef="ExclusiveGateway_1dez26n" targetRef="EndEvent_12f15tu" />
</bpmn:process>
<bpmn:error id="Error_0kd2o2a" name="java.lang.Exception" errorCode="java.lang.Exception" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
@@ -213,8 +225,8 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_15s0okp_di" bpmnElement="SequenceFlow_15s0okp">
- <di:waypoint x="-398" y="120" />
- <di:waypoint x="-365" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-398" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-365" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-381" y="99" width="0" height="0" />
</bpmndi:BPMNLabel>
@@ -223,8 +235,8 @@
<dc:Bounds x="560" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0mqrkxv_di" bpmnElement="SequenceFlow_0mqrkxv">
- <di:waypoint x="339" y="120" />
- <di:waypoint x="400" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="339" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="400" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="324.5" y="105" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -239,9 +251,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1m2eezj_di" bpmnElement="SequenceFlow_1m2eezj">
- <di:waypoint x="949" y="132" />
- <di:waypoint x="980" y="165" />
- <di:waypoint x="1060" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="949" y="132" />
+ <di:waypoint xsi:type="dc:Point" x="980" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="165" />
<bpmndi:BPMNLabel>
<dc:Bounds x="968" y="168" width="83" height="12" />
</bpmndi:BPMNLabel>
@@ -250,15 +262,15 @@
<dc:Bounds x="-365" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0654g3m_di" bpmnElement="Task_SendSync">
- <dc:Bounds x="-132" y="-6" width="100" height="80" />
+ <dc:Bounds x="-100" y="-76" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0wzh11j_di" bpmnElement="Task_UpdateRequestComplete">
<dc:Bounds x="1161" y="206" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1pz6edz_di" bpmnElement="SequenceFlow_1pz6edz">
- <di:waypoint x="1261" y="246" />
- <di:waypoint x="1322" y="246" />
- <di:waypoint x="1322" y="183" />
+ <di:waypoint xsi:type="dc:Point" x="1261" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1322" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1322" y="183" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1247" y="231" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -279,16 +291,16 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0v588sm_di" bpmnElement="SequenceFlow_0v588sm">
- <di:waypoint x="936" y="145" />
- <di:waypoint x="936" y="262" />
- <di:waypoint x="339" y="262" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="145" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="262" />
+ <di:waypoint xsi:type="dc:Point" x="339" y="262" />
<bpmndi:BPMNLabel>
<dc:Bounds x="769.202380952381" y="272" width="73" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1atzsgn_di" bpmnElement="SequenceFlow_1atzsgn">
- <di:waypoint x="289" y="222" />
- <di:waypoint x="289" y="160" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="222" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="160" />
<bpmndi:BPMNLabel>
<dc:Bounds x="259" y="191" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -297,16 +309,16 @@
<dc:Bounds x="239" y="222" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0vc9go9_di" bpmnElement="SequenceFlow_0vc9go9">
- <di:waypoint x="-265" y="120" />
- <di:waypoint x="-228" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-265" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-228" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-246" y="105" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_11530ei_di" bpmnElement="SequenceFlow_11530ei">
- <di:waypoint x="946" y="105" />
- <di:waypoint x="983" y="44" />
- <di:waypoint x="1060" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="946" y="105" />
+ <di:waypoint xsi:type="dc:Point" x="983" y="44" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="45" />
<bpmndi:BPMNLabel>
<dc:Bounds x="975" y="17" width="58" height="12" />
</bpmndi:BPMNLabel>
@@ -321,28 +333,19 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1p8yxu6_di" bpmnElement="SequenceFlow_1p8yxu6">
- <di:waypoint x="1276" y="-36" />
- <di:waypoint x="1359" y="-36" />
- <di:waypoint x="1359" y="45" />
- <di:waypoint x="1386" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1276" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="1359" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="1359" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1386" y="45" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1329" y="5" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1wb59ic_di" bpmnElement="SequenceFlow_1wb59ic">
- <di:waypoint x="-32" y="34" />
- <di:waypoint x="32" y="34" />
- <di:waypoint x="32" y="120" />
- <di:waypoint x="80" y="120" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="47" y="77" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_01j184u_di" bpmnElement="SequenceFlow_01j184u">
- <di:waypoint x="936" y="95" />
- <di:waypoint x="936" y="55" />
- <di:waypoint x="936" y="55" />
- <di:waypoint x="936" y="4" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="95" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="55" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="55" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="4" />
<bpmndi:BPMNLabel>
<dc:Bounds x="906" y="49" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -357,16 +360,16 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0sckerv_di" bpmnElement="SequenceFlow_0sckerv">
- <di:waypoint x="-202" y="96" />
- <di:waypoint x="-202" y="34" />
- <di:waypoint x="-132" y="34" />
+ <di:waypoint xsi:type="dc:Point" x="-202" y="96" />
+ <di:waypoint xsi:type="dc:Point" x="-202" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="-100" y="-36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="-195" y="55.55555555555556" width="18" height="12" />
+ <dc:Bounds x="-195" y="17.612903225806477" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0unbew4_di" bpmnElement="SequenceFlow_0unbew4">
- <di:waypoint x="-178" y="120" />
- <di:waypoint x="80" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-178" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="80" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-87" y="99.95468180757382" width="12" height="12" />
</bpmndi:BPMNLabel>
@@ -378,16 +381,16 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_02ksbt0_di" bpmnElement="SequenceFlow_02ksbt0">
- <di:waypoint x="1085" y="20" />
- <di:waypoint x="1085" y="-37" />
- <di:waypoint x="1176" y="-37" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="20" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="-37" />
+ <di:waypoint xsi:type="dc:Point" x="1176" y="-37" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1091" y="-8" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1r570x3_di" bpmnElement="SequenceFlow_1r570x3">
- <di:waypoint x="1110" y="45" />
- <di:waypoint x="1386" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1110" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1386" y="45" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1242" y="20" width="12" height="12" />
</bpmndi:BPMNLabel>
@@ -399,10 +402,10 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0x4urgp_di" bpmnElement="SequenceFlow_0x4urgp">
- <di:waypoint x="1110" y="165" />
- <di:waypoint x="1220" y="165" />
- <di:waypoint x="1220" y="165" />
- <di:waypoint x="1304" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1110" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1220" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1220" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1304" y="165" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1256" y="140" width="12" height="12" />
</bpmndi:BPMNLabel>
@@ -414,9 +417,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_11dlyzt_di" bpmnElement="SequenceFlow_11dlyzt">
- <di:waypoint x="289" y="302" />
- <di:waypoint x="289" y="368" />
- <di:waypoint x="960" y="368" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="302" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="368" />
+ <di:waypoint xsi:type="dc:Point" x="960" y="368" />
<bpmndi:BPMNLabel>
<dc:Bounds x="381.45685840707966" y="325" width="63" height="24" />
</bpmndi:BPMNLabel>
@@ -428,33 +431,33 @@
<dc:Bounds x="960" y="325" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0l7kaba_di" bpmnElement="SequenceFlow_0l7kaba">
- <di:waypoint x="942" y="139" />
- <di:waypoint x="976" y="252" />
- <di:waypoint x="1016" y="252" />
- <di:waypoint x="1016" y="325" />
+ <di:waypoint xsi:type="dc:Point" x="942" y="139" />
+ <di:waypoint xsi:type="dc:Point" x="976" y="252" />
+ <di:waypoint xsi:type="dc:Point" x="1016" y="252" />
+ <di:waypoint xsi:type="dc:Point" x="1016" y="325" />
<bpmndi:BPMNLabel>
<dc:Bounds x="959" y="255" width="52" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1edjl5x_di" bpmnElement="SequenceFlow_1edjl5x">
- <di:waypoint x="556" y="657" />
- <di:waypoint x="602" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="556" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="602" y="657" />
<bpmndi:BPMNLabel>
<dc:Bounds x="534" y="636" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0wvzfgf_di" bpmnElement="SequenceFlow_0wvzfgf">
- <di:waypoint x="813" y="657" />
- <di:waypoint x="880" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="813" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="880" y="657" />
<bpmndi:BPMNLabel>
<dc:Bounds x="801.5" y="636" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1ui67mc_di" bpmnElement="SequenceFlow_1ui67mc">
- <di:waypoint x="1060" y="365" />
- <di:waypoint x="1134" y="365" />
- <di:waypoint x="1134" y="365" />
- <di:waypoint x="1159" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1134" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1134" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1159" y="365" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1104" y="359" width="90" height="13" />
</bpmndi:BPMNLabel>
@@ -466,25 +469,25 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_024g0d1_di" bpmnElement="SequenceFlow_024g0d1">
- <di:waypoint x="652" y="657" />
- <di:waypoint x="683" y="657" />
- <di:waypoint x="683" y="657" />
- <di:waypoint x="713" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="652" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="683" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="683" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="713" y="657" />
<bpmndi:BPMNLabel>
<dc:Bounds x="677" y="634" width="12" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0vi883o_di" bpmnElement="SequenceFlow_0vi883o">
- <di:waypoint x="627" y="632" />
- <di:waypoint x="627" y="548" />
- <di:waypoint x="713" y="548" />
+ <di:waypoint xsi:type="dc:Point" x="627" y="632" />
+ <di:waypoint xsi:type="dc:Point" x="627" y="548" />
+ <di:waypoint xsi:type="dc:Point" x="713" y="548" />
<bpmndi:BPMNLabel>
<dc:Bounds x="633" y="584" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0eana0l_di" bpmnElement="SequenceFlow_0eana0l">
- <di:waypoint x="763" y="588" />
- <di:waypoint x="763" y="617" />
+ <di:waypoint xsi:type="dc:Point" x="763" y="588" />
+ <di:waypoint xsi:type="dc:Point" x="763" y="617" />
<bpmndi:BPMNLabel>
<dc:Bounds x="778" y="596.5" width="0" height="12" />
</bpmndi:BPMNLabel>
@@ -511,15 +514,15 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_11d126w_di" bpmnElement="SequenceFlow_11d126w">
- <di:waypoint x="606" y="875" />
- <di:waypoint x="690" y="875" />
+ <di:waypoint xsi:type="dc:Point" x="606" y="875" />
+ <di:waypoint xsi:type="dc:Point" x="690" y="875" />
<bpmndi:BPMNLabel>
<dc:Bounds x="603" y="854" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0w4sx88_di" bpmnElement="SequenceFlow_0w4sx88">
- <di:waypoint x="790" y="875" />
- <di:waypoint x="856" y="875" />
+ <di:waypoint xsi:type="dc:Point" x="790" y="875" />
+ <di:waypoint xsi:type="dc:Point" x="856" y="875" />
<bpmndi:BPMNLabel>
<dc:Bounds x="778" y="854" width="0" height="12" />
</bpmndi:BPMNLabel>
@@ -528,25 +531,25 @@
<dc:Bounds x="400" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0mew9im_di" bpmnElement="SequenceFlow_0mew9im">
- <di:waypoint x="500" y="120" />
- <di:waypoint x="560" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="500" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="560" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="530" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0kf5sen_di" bpmnElement="SequenceFlow_0kf5sen">
- <di:waypoint x="1085" y="190" />
- <di:waypoint x="1085" y="246" />
- <di:waypoint x="1161" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="190" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1161" y="246" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1091" y="218" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1tfizxf_di" bpmnElement="SequenceFlow_1tfizxf">
- <di:waypoint x="180" y="120" />
- <di:waypoint x="211" y="120" />
- <di:waypoint x="211" y="120" />
- <di:waypoint x="239" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="180" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="211" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="211" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="239" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="226" y="120" width="0" height="0" />
</bpmndi:BPMNLabel>
@@ -558,27 +561,60 @@
<dc:Bounds x="735" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1hsqed1_di" bpmnElement="SequenceFlow_1hsqed1">
- <di:waypoint x="660" y="120" />
- <di:waypoint x="735" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="660" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="735" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="697.5" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1fftixk_di" bpmnElement="SequenceFlow_1fftixk">
- <di:waypoint x="835" y="120" />
- <di:waypoint x="911" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="835" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="911" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="873" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1pnkpim_di" bpmnElement="SequenceFlow_1pnkpim">
- <di:waypoint x="886" y="-36" />
- <di:waypoint x="289" y="-36" />
- <di:waypoint x="289" y="80" />
+ <di:waypoint xsi:type="dc:Point" x="886" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="80" />
<bpmndi:BPMNLabel>
<dc:Bounds x="587.5" y="-57" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1dez26n_di" bpmnElement="ExclusiveGateway_1dez26n" isMarkerVisible="true">
+ <dc:Bounds x="105" y="-61" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="163" y="-48" width="61" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1lrz41x_di" bpmnElement="SequenceFlow_1lrz41x">
+ <di:waypoint xsi:type="dc:Point" x="0" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="105" y="-36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="52.5" y="-57" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0etawv5_di" bpmnElement="SequenceFlow_0etawv5">
+ <di:waypoint xsi:type="dc:Point" x="130" y="-11" />
+ <di:waypoint xsi:type="dc:Point" x="130" y="80" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="139" y="29" width="12" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_12f15tu_di" bpmnElement="EndEvent_12f15tu">
+ <dc:Bounds x="112" y="-169.83592938733125" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="120" y="-195" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ilo6lo_di" bpmnElement="SequenceFlow_0ilo6lo">
+ <di:waypoint xsi:type="dc:Point" x="130" y="-61" />
+ <di:waypoint xsi:type="dc:Point" x="130" y="-134" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="136" y="-103" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
index 8010ce62ab..a932e4ac50 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
@@ -28,6 +28,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Spliterator;
@@ -41,6 +42,9 @@ public final class JsonUtilForPnfCorrelationId {
}
static List<String> parseJsonToGelAllPnfCorrelationId(String json) {
+ if (json == null || json.isEmpty()) {
+ return Collections.emptyList();
+ }
JsonElement je = new JsonParser().parse(json);
JsonArray array = je.getAsJsonArray();
List<String> list = new ArrayList<>();
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
index 02303a6b23..bd1a45c64d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
@@ -23,12 +23,14 @@
package org.onap.so.bpmn.infrastructure.pnf.dmaap;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import javax.ws.rs.core.UriBuilder;
import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
@@ -42,6 +44,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.AAIObjectType;
+import static org.onap.so.bpmn.infrastructure.pnf.dmaap.JsonUtilForPnfCorrelationId.*;
@Component
public class PnfEventReadyDmaapClient implements DmaapClient {
@@ -129,15 +132,10 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
try {
logger.debug("dmaap listener starts listening pnf ready dmaap topic");
HttpResponse response = httpClient.execute(getRequest);
- List<String> idList = getPnfCorrelationIdListFromResponse(response);
-
- // idList is never null
- if (!idList.isEmpty()) {
- // send only body of response
- registerClientResponse(idList.get(0), EntityUtils.toString(response.getEntity(), "UTF-8"));
- }
-
- if (idList != null) {
+ if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
+ String responseString = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
+ List<String> idList = parseJsonToGelAllPnfCorrelationId(responseString);
+ idList.stream().findFirst().ifPresent(id -> registerClientResponse(id, responseString));
idList.forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound);
}
} catch (IOException e) {
@@ -147,16 +145,6 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
}
}
- private List<String> getPnfCorrelationIdListFromResponse(HttpResponse response) throws IOException {
- if (response.getStatusLine().getStatusCode() == 200) {
- String responseString = EntityUtils.toString(response.getEntity(), "UTF-8");
- if (responseString != null) {
- return JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(responseString);
- }
- }
- return Collections.emptyList();
- }
-
private void informAboutPnfReadyIfPnfCorrelationIdFound(String pnfCorrelationId) {
Runnable runnable = unregister(pnfCorrelationId);
if (runnable != null) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy
index afbace76d6..715a7dff6d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.bpmn.infrastructure.scripts
import org.camunda.bpm.engine.delegate.BpmnError
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
index 8741208d26..4edee24531 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
@@ -63,4 +63,13 @@ public class JsonUtilForPnfCorrelationIdTest {
assertThat(expectedResult).isEmpty();
}
+ @Test
+ public void shouldReturnEmptyListWhenInputIsNull() {
+ assertThat(JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(null)).isEmpty();
+ }
+
+ @Test
+ public void shouldReturnEmptyListWhenInputIsEmpty() {
+ assertThat(JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId("")).isEmpty();
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
index 19e08d9d59..cccfe0c762 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
@@ -30,8 +30,8 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -41,7 +41,7 @@ import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
-import org.apache.http.entity.StringEntity;
+import org.apache.http.entity.InputStreamEntity;
import org.apache.http.message.BasicHttpResponse;
import org.junit.Before;
import org.junit.Test;
@@ -182,8 +182,8 @@ public class PnfEventReadyDmaapClientTest {
threadRunFlag.setAccessible(false);
}
- private HttpResponse createResponse(String json) throws UnsupportedEncodingException {
- HttpEntity entity = new StringEntity(json);
+ private HttpResponse createResponse(String json) {
+ HttpEntity entity = new InputStreamEntity(new ByteArrayInputStream(json.getBytes()));
ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1);
HttpResponse response = new BasicHttpResponse(protocolVersion, 1, "");
response.setEntity(entity);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
index 4e74e5d414..c223d3ff11 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
@@ -2,14 +2,15 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) Copyright (C) 2018 Bell Canada.
+ * Copyright (C) 2018 Bell Canada.
+ * Copyright (C) 2019 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.
@@ -20,7 +21,6 @@
package org.onap.so.bpmn.buildingblock;
-import java.util.Map;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -28,37 +28,37 @@ import org.springframework.stereotype.Component;
@Component
public class HomingV2 {
- @Autowired
- private OofHomingV2 oofHomingV2;
- @Autowired
+ static final String HOMING_SNIRO = "sniro";
+ static final String HOMING_OOF = "oof";
+ static final String HOMING_SOLUTION = "Homing_Solution";
+
private SniroHomingV2 sniroHomingV2;
+ private OofHomingV2 oofHomingV2;
- private static final String HOMINGSOLUTION = "Homing_Solution";
+ @Autowired
+ public HomingV2(OofHomingV2 oofHomingV2, SniroHomingV2 sniroHomingV2) {
+ this.oofHomingV2 = oofHomingV2;
+ this.sniroHomingV2 = sniroHomingV2;
+ }
public void callHoming(BuildingBlockExecution execution) {
- if (isOof(execution)) {
- oofHomingV2.callOof(execution);
- } else {
+ if (isSniro(execution)) {
sniroHomingV2.callSniro(execution);
+ } else {
+ oofHomingV2.callOof(execution);
}
}
public void processSolution(BuildingBlockExecution execution, String asyncResponse) {
- if (isOof(execution)) {
- oofHomingV2.processSolution(execution, asyncResponse);
- } else {
+ if (isSniro(execution)) {
sniroHomingV2.processSolution(execution, asyncResponse);
+ } else {
+ oofHomingV2.processSolution(execution, asyncResponse);
}
}
- // Default solution is SNIRO. OOF gets called only if specified.
- private boolean isOof(BuildingBlockExecution execution) {
- for (Map<String, Object> params : execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters()
- .getUserParams()) {
- if (params.containsKey(HOMINGSOLUTION) && ("oof").equals(params.get(HOMINGSOLUTION))) {
- return true;
- }
- }
- return false;
+ private boolean isSniro(BuildingBlockExecution execution) {
+ return execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams().stream()
+ .anyMatch(params -> HOMING_SNIRO.equals(params.get(HOMING_SOLUTION)));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
index 9c72d229b2..79ccd9216f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
@@ -24,6 +24,7 @@ package org.onap.so.bpmn.infrastructure.appc.tasks;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
import org.onap.so.logger.LoggingAnchor;
import org.json.JSONArray;
@@ -31,6 +32,7 @@ import org.json.JSONObject;
import org.onap.aai.domain.yang.Vserver;
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
@@ -166,6 +168,10 @@ public class AppcRunTasks {
String pay = requestParameters.getPayload();
if (pay != null) {
payload = Optional.of(pay);
+ } else {
+ String payloadFromUserParams =
+ buildPayloadFromUserParams(gBBInput.getRequestContext().getUserParams());
+ payload = Optional.of(payloadFromUserParams);
}
}
logger.debug("Running APP-C action: {}", action.toString());
@@ -221,6 +227,21 @@ public class AppcRunTasks {
return payloadInfo;
}
+ protected String buildPayloadFromUserParams(Map<String, Object> userParams) {
+ if (userParams == null || userParams.size() == 0) {
+ return null;
+ }
+
+ String payload = "{}";
+ for (Map.Entry<String, Object> entry : userParams.entrySet()) {
+ payload = JsonUtils.addJsonValue(payload, entry.getKey(), (String) entry.getValue());
+ }
+
+ payload = payload.replaceAll("\"", "\\\\\"");
+ payload = payload.replaceAll("\n", "");
+ return payload;
+ }
+
protected void getVserversForAppc(BuildingBlockExecution execution, GenericVnf vnf) throws Exception {
AAIResultWrapper aaiRW = aaiVnfResources.queryVnfWrapperById(vnf);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/UnassignNetworkException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/UnassignNetworkException.java
new file mode 100644
index 0000000000..566cdccd50
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/UnassignNetworkException.java
@@ -0,0 +1,14 @@
+package org.onap.so.bpmn.infrastructure.flowspecific.exceptions;
+
+public class UnassignNetworkException extends Exception {
+
+ private static final long serialVersionUID = 2864418350216433736L;
+
+ public UnassignNetworkException() {
+ super();
+ }
+
+ public UnassignNetworkException(String message) {
+ super(message);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
index c9a937b824..f95e7afed9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
@@ -24,19 +24,22 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import java.util.Optional;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.flowspecific.exceptions.UnassignNetworkException;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAINetworkResources;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UnassignNetworkBB {
-
+ private static final Logger logger = LoggerFactory.getLogger(UnassignNetworkBB.class);
private static String messageCannotPerformUnassign =
"Cannot perform Unassign Network. Network is still related to ";
private static String messageErrorRollback = " Rollback is not possible. Please restore data manually.";
@@ -71,7 +74,8 @@ public class UnassignNetworkBB {
if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) {
String msg = messageCannotPerformUnassign + relatedToValue;
execution.setVariable("ErrorUnassignNetworkBB", msg);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ logger.error("ErrorUnassignNetworkBB: {}", msg);
+ throw new UnassignNetworkException(msg);
}
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java
index e809ecd0ae..206942fcb1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java
@@ -20,27 +20,14 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
-import java.util.ArrayList;
-import java.util.List;
-import org.camunda.bpm.engine.delegate.BpmnError;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
-import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
import org.onap.so.bpmn.core.WorkflowException;
-import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
-import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
-import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.serviceinstancebeans.RequestReferences;
-import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class FlowCompletionTasks {
@@ -50,7 +37,9 @@ public class FlowCompletionTasks {
@Autowired
private RequestsDbClient requestDbclient;
+
public void updateRequestDbStatus(BuildingBlockExecution execution) {
+
try {
String requestId = execution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId();
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 1f07166b60..11c6455474 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -197,7 +197,9 @@ public class WorkflowAction {
suppressRollback = false;
}
execution.setVariable("suppressRollback", suppressRollback);
+ boolean isResume = false;
if (isUriResume(uri)) {
+ isResume = true;
logger.debug("replacing URI {}", uri);
uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl();
logger.debug("for RESUME with original value {}", uri);
@@ -225,6 +227,12 @@ public class WorkflowAction {
if (flowsToExecute == null) {
buildAndThrowException(execution, "Could not resume Macro flow. Error loading execution path.");
}
+ } else if (aLaCarte && isResume) {
+ flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId);
+ if (flowsToExecute == null) {
+ buildAndThrowException(execution,
+ "Could not resume request with request Id: " + requestId + ". No flowsToExecute was found");
+ }
} else {
if (aLaCarte) {
if (orchFlows == null || orchFlows.isEmpty()) {
@@ -387,7 +395,7 @@ public class WorkflowAction {
flowNames.add(ebb.getBuildingBlock().getBpmnFlowName());
}
- if (!aLaCarte) {
+ if (!isResume) {
bbInputSetupUtils.persistFlowExecutionPath(requestId, flowsToExecute);
}
execution.setVariable("flowNames", flowNames);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
index be3e06c9ea..56cd9fd70f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
@@ -39,6 +39,8 @@ import org.springframework.stereotype.Component;
@Component
public class WorkflowActionBBFailure {
+ private static final String DEACTIVATE_FABRIC_CONFIGURATION_FLOW = "DeactivateFabricConfigurationBB";
+ private static final String UNASSIGN_FABRIC_CONFIGURATION_FLOW = "UnassignFabricConfigurationBB";
private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBFailure.class);
public static final String ROLLBACK_TARGET_STATE = "rollbackTargetState";
@Autowired
@@ -96,6 +98,16 @@ public class WorkflowActionBBFailure {
String rollbackTargetState = (String) execution.getVariable(ROLLBACK_TARGET_STATE);
request.setRequestStatus(rollbackTargetState);
} else if (isRollbackFailure) {
+ if (ebb != null && ebb.getBuildingBlock() != null && ebb.getBuildingBlock().getBpmnFlowName() != null) {
+ String flowName = ebb.getBuildingBlock().getBpmnFlowName();
+ if (DEACTIVATE_FABRIC_CONFIGURATION_FLOW.equalsIgnoreCase(flowName)
+ || UNASSIGN_FABRIC_CONFIGURATION_FLOW.equalsIgnoreCase(flowName)) {
+ String statusMessage = String.format(
+ "%s Warning: The vf-module is active but configuration was not removed completely for one or more VMs.",
+ request.getStatusMessage());
+ request.setStatusMessage(statusMessage);
+ }
+ }
Optional<String> rollbackErrorMsgOp = retrieveErrorMessage(execution);
if (rollbackErrorMsgOp.isPresent()) {
rollbackErrorMsg = rollbackErrorMsgOp.get();
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 d5798150d1..39aa9d6c41 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
@@ -38,6 +38,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.Configuration;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -309,7 +310,8 @@ public class WorkflowActionBBTasks {
rollbackFlowsFiltered.addAll(rollbackFlows);
if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)) {
for (int i = 0; i < rollbackFlows.size(); i++) {
- if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign")) {
+ if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign") && !rollbackFlows
+ .get(i).getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")) {
rollbackFlowsFiltered.remove(rollbackFlows.get(i));
} else if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Delete")
&& ROLLBACKTOCREATED.equals(handlingCode)) {
@@ -398,7 +400,7 @@ public class WorkflowActionBBTasks {
if (fabricConfig != null && fabricConfig.getConfigurationResource() != null
&& fabricConfig.getConfigurationResource().getToscaNodeType() != null
&& fabricConfig.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) {
- String configurationId = UUID.randomUUID().toString();
+ String configurationId = getConfigurationId(vnfc);
ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
configurationResourceKeys.setCvnfcCustomizationUUID(modelCustomizationId);
configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID);
@@ -429,6 +431,17 @@ public class WorkflowActionBBTasks {
}
}
+ protected String getConfigurationId(Vnfc vnfc) {
+ List<Configuration> configurations =
+ workflowAction.getRelatedResourcesInVnfc(vnfc, Configuration.class, AAIObjectType.CONFIGURATION);
+ if (!configurations.isEmpty()) {
+ Configuration configuration = configurations.get(0);
+ return configuration.getConfigurationId();
+ } else {
+ return UUID.randomUUID().toString();
+ }
+ }
+
protected ExecuteBuildingBlock getExecuteBBForConfig(String bbName, ExecuteBuildingBlock ebb,
String configurationId, ConfigurationResourceKeys configurationResourceKeys) {
ExecuteBuildingBlock configBB = new ExecuteBuildingBlock();
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java
new file mode 100644
index 0000000000..9dd0365e7a
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java
@@ -0,0 +1,149 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 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.buildingblock;
+
+import static org.mockito.BDDMockito.then;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.buildingblock.HomingV2.HOMING_OOF;
+import static org.onap.so.bpmn.buildingblock.HomingV2.HOMING_SNIRO;
+import static org.onap.so.bpmn.buildingblock.HomingV2.HOMING_SOLUTION;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
+
+public class HomingV2Test {
+
+ @Test
+ public void whenHomingSolutionSetToSniroShouldCallSniro() {
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put(HOMING_SOLUTION, HOMING_SNIRO);
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams);
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.callHoming(givenExecution);
+
+ then(sniroHoming).should().callSniro(givenExecution);
+ then(oofHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionSetToSniroShouldProcessSniro() {
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put(HOMING_SOLUTION, HOMING_SNIRO);
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams);
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.processSolution(givenExecution, "dummy");
+
+ then(sniroHoming).should().processSolution(givenExecution, "dummy");
+ then(oofHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionSetToOofShouldCallOof() {
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put(HOMING_SOLUTION, HOMING_OOF);
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams);
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.callHoming(givenExecution);
+
+ then(oofHoming).should().callOof(givenExecution);
+ then(sniroHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionSetToOofShouldProcessOof() {
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put(HOMING_SOLUTION, HOMING_OOF);
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams);
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.processSolution(givenExecution, "dummy");
+
+ then(oofHoming).should().processSolution(givenExecution, "dummy");
+ then(sniroHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionNotSetShouldCallOof() {
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(new HashMap<>());
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.callHoming(givenExecution);
+
+ then(oofHoming).should().callOof(givenExecution);
+ then(sniroHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionNotSetShouldProcessOof() {
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(new HashMap<>());
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.processSolution(givenExecution, "dummy");
+
+ then(oofHoming).should().processSolution(givenExecution, "dummy");
+ then(sniroHoming).shouldHaveZeroInteractions();
+ }
+
+ private BuildingBlockExecution createBuildingBlockExecutionMock(Map<String, Object> userParams) {
+ BuildingBlockExecution execution = mock(BuildingBlockExecution.class);
+ GeneralBuildingBlock generalBuildingBlock = mock(GeneralBuildingBlock.class);
+ RequestContext requestContext = mock(RequestContext.class);
+ RequestParameters requestParameters = mock(RequestParameters.class);
+ List<Map<String, Object>> userParamsList = new ArrayList<>();
+
+ userParamsList.add(userParams);
+
+ when(execution.getGeneralBuildingBlock()).thenReturn(generalBuildingBlock);
+ when(generalBuildingBlock.getRequestContext()).thenReturn(requestContext);
+ when(requestContext.getRequestParameters()).thenReturn(requestParameters);
+ when(requestParameters.getUserParams()).thenReturn(userParamsList);
+
+ return execution;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
index cc25689358..f0c333007e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
@@ -33,6 +33,8 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Optional;
import org.junit.Test;
import org.mockito.InjectMocks;
@@ -168,6 +170,21 @@ public class AppcRunTasksTest extends BaseTaskTest {
assertEquals(vmIdList, expectedVmIdList);
}
+ @Test
+ public void testUserParams() throws Exception {
+ Map<String, Object> userParams = new HashMap<String, Object>();
+ userParams.put("existing_software_version", "3.1");
+ userParams.put("new_software_version", "3.2");
+ userParams.put("operations_timeout", "150000");
+
+ String actualPayload = appcRunTasks.buildPayloadFromUserParams(userParams);
+ System.out.println(actualPayload);
+ String expectedPayload =
+ "{\\\"operations_timeout\\\":\\\"150000\\\",\\\"existing_software_version\\\":\\\"3.1\\\",\\\"new_software_version\\\":\\\"3.2\\\"}";
+ assertEquals(expectedPayload, actualPayload.replaceAll(" ", ""));
+
+ }
+
private void mockReferenceResponse() {
ControllerSelectionReference reference = new ControllerSelectionReference();
reference.setControllerName("TEST-CONTROLLER-NAME");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
index bacc57758b..ed55c56231 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
@@ -40,9 +40,7 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
-import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.springframework.beans.factory.annotation.Autowired;
public class UnassignNetworkBBTest extends BaseTaskTest {
@@ -84,6 +82,15 @@ public class UnassignNetworkBBTest extends BaseTaskTest {
}
@Test
+ public void checkRelationshipRelatedToUnassignNetworkExceptionTest() throws Exception {
+ String msg = "Cannot perform Unassign Network. Network is still related to vf-module";
+ expectedException.expect(BpmnError.class);
+ doReturn(true).when(networkBBUtils).isRelationshipRelatedToExists(any(Optional.class), eq("vf-module"));
+ unassignNetworkBB.checkRelationshipRelatedTo(execution, "vf-module");
+ assertEquals(execution.getVariable("ErrorUnassignNetworkBB"), msg);
+ }
+
+ @Test
public void getCloudSdncRegion25Test() throws Exception {
CloudRegion cloudRegion = setCloudRegion();
cloudRegion.setCloudRegionVersion("2.5");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
index 2d48d02774..573601b20f 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
@@ -41,6 +41,8 @@ import org.mockito.Spy;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
@@ -140,6 +142,31 @@ public class WorkflowActionBBFailureTest extends BaseTaskTest {
}
@Test
+ public void updateRequestStatusToFailedRollbackFabric() {
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
+ BuildingBlock bb = new BuildingBlock();
+ bb.setBpmnFlowName("UnassignFabricConfigurationBB");
+ ebb.setBuildingBlock(bb);
+ execution.setVariable("buildingBlock", ebb);
+ execution.setVariable("mso-request-id", "123");
+ execution.setVariable("isRollbackComplete", false);
+ execution.setVariable("isRollback", true);
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setStatusMessage("PINC failure.");
+ WorkflowException wfe = new WorkflowException("processKey123", 1, "error in rollback");
+ execution.setVariable("WorkflowException", wfe);
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
+ String errorMsg = (String) execution.getVariable("RollbackErrorMessage");
+ assertEquals("error in rollback", errorMsg);
+ assertEquals(
+ "PINC failure. Warning: The vf-module is active but configuration was not removed completely for one or more VMs.",
+ req.getStatusMessage());
+ assertEquals(Status.FAILED.toString(), req.getRequestStatus());
+ }
+
+ @Test
public void updateRequestStatusToRolledback() {
execution.setVariable("mso-request-id", "123");
execution.setVariable("isRollbackComplete", true);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index aac09b4475..ac7d82cd51 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -328,6 +328,51 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
+ public void rollbackExecutionRollbackToAssignedWithFabricTest() {
+ execution.setVariable("isRollback", false);
+ execution.setVariable("handlingCode", "RollbackToAssigned");
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
+ BuildingBlock bb1 = new BuildingBlock();
+ bb1.setBpmnFlowName("AssignVfModuleBB");
+ ebb1.setBuildingBlock(bb1);
+ flowsToExecute.add(ebb1);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
+ BuildingBlock bb2 = new BuildingBlock();
+ bb2.setBpmnFlowName("CreateVfModuleBB");
+ ebb2.setBuildingBlock(bb2);
+ flowsToExecute.add(ebb2);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
+ BuildingBlock bb3 = new BuildingBlock();
+ bb3.setBpmnFlowName("ActivateVfModuleBB");
+ ebb3.setBuildingBlock(bb3);
+ flowsToExecute.add(ebb3);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
+ BuildingBlock bb4 = new BuildingBlock();
+ bb4.setBpmnFlowName("AssignFabricConfigurationBB");
+ ebb4.setBuildingBlock(bb4);
+ flowsToExecute.add(ebb4);
+ ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock();
+ BuildingBlock bb5 = new BuildingBlock();
+ bb5.setBpmnFlowName("ActivateFabricConfigurationBB");
+ ebb5.setBuildingBlock(bb5);
+ flowsToExecute.add(ebb5);
+
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("gCurrentSequence", 5);
+
+ workflowActionBBTasks.rollbackExecutionPath(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(0, execution.getVariable("gCurrentSequence"));
+ assertEquals(4, ebbs.size());
+ assertEquals("DeactivateFabricConfigurationBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
+ assertEquals("UnassignFabricConfigurationBB", ebbs.get(1).getBuildingBlock().getBpmnFlowName());
+ assertEquals("DeactivateVfModuleBB", ebbs.get(2).getBuildingBlock().getBpmnFlowName());
+ assertEquals("DeleteVfModuleBB", ebbs.get(3).getBuildingBlock().getBpmnFlowName());
+
+ }
+
+ @Test
public void rollbackExecutionRollbackToCreatedTest() {
execution.setVariable("isRollback", false);
execution.setVariable("handlingCode", "RollbackToCreated");
@@ -417,4 +462,22 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
workflowActionBBTasks.updateInstanceId(execution);
Mockito.verify(reqMock, Mockito.times(1)).setServiceInstanceId(instanceId);
}
+
+ @Test
+ public void getConfigurationId() {
+ org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
+ vnfc.setModelInvariantId("modelInvariantId");
+ vnfc.setVnfcName("testVnfcName");
+ List<org.onap.aai.domain.yang.Configuration> configurations =
+ new ArrayList<org.onap.aai.domain.yang.Configuration>();
+ org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setModelCustomizationId("modelCustimizationId");
+ configuration.setConfigurationName("testConfigurationName");
+ configurations.add(configuration);
+ doReturn(configurations.get(0).getConfigurationId()).when(workflowActionBBTasks).getConfigurationId(vnfc);
+ assertEquals(workflowActionBBTasks.getConfigurationId(vnfc), "configurationId");
+ }
+
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index eea885288e..be6fc94890 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -45,11 +45,9 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.Set;
import java.util.UUID;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -66,7 +64,6 @@ import org.mockito.Spy;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.L3Network;
-import org.onap.aai.domain.yang.L3Networks;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.ServiceInstance;
@@ -80,7 +77,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
-import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
@@ -103,8 +99,6 @@ import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
-import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.db.request.beans.RequestProcessingData;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.RequestParameters;
@@ -1476,9 +1470,19 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void extractResourceIdAndTypeFromUriResumeTest() {
+ Resource resource = workflowAction.extractResourceIdAndTypeFromUri(
+ "http://localhost:9100/onap/so/infra/serviceInstantiation/v7/serviceInstances/4ff87c63-461b-4d83-8121-d351e6db216c/vnfs/eea9b93b-b5b9-4fad-9c35-12d52e4b683f/vfModules/33cb74cd-9cb3-4090-a3c0-1b8c8e235847/resume");
+ assertEquals(resource.getResourceId(), "33cb74cd-9cb3-4090-a3c0-1b8c8e235847");
+ }
+
+ @Test
public void isUriResumeTest() {
assertTrue(workflowAction.isUriResume(
"http://localhost:9100/onap/so/infra/orchestrationRequests/v7/requests/2f8ab587-ef6a-4456-b7b2-d73f9363dabd/resume"));
+ assertTrue(workflowAction.isUriResume(
+ " http://localhost:9100/onap/so/infra/serviceInstantiation/v7/serviceInstances/4ff87c63-461b-4d83-8121-d351e6db216c/vnfs/eea9b93b-b5b9-4fad-9c35-12d52e4b683f/vfModules/33cb74cd-9cb3-4090-a3c0-1b8c8e235847/resume"));
+
assertFalse(workflowAction.isUriResume("/v6/serviceInstances/123/vnfs/1234/vfmodules/5678/replace"));
}
diff --git a/common/pom.xml b/common/pom.xml
index 9e4382621a..1f7f044fc8 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -186,7 +186,7 @@
<artifactId>javatuples</artifactId>
<version>1.2</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-external-task-client</artifactId>
<version>1.1.1</version>
diff --git a/common/src/main/java/org/onap/so/client/BaseClient.java b/common/src/main/java/org/onap/so/client/BaseClient.java
index d1523a1f96..24c83cbcab 100644
--- a/common/src/main/java/org/onap/so/client/BaseClient.java
+++ b/common/src/main/java/org/onap/so/client/BaseClient.java
@@ -22,6 +22,7 @@ package org.onap.so.client;
import java.util.ArrayList;
import java.util.List;
+import org.onap.logging.filter.spring.SpringClientPayloadFilter;
import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
@@ -81,6 +82,7 @@ public class BaseClient<I, O> {
restTemplate
.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()));
restTemplate.getInterceptors().add(new SOSpringClientFilter());
+ restTemplate.getInterceptors().add((new SpringClientPayloadFilter()));
ResponseEntity<O> responseEntity =
restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef, uriVariables);
return responseEntity.getBody();
diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java
index c8d7dc9f5c..077ba24c2b 100644
--- a/common/src/main/java/org/onap/so/client/RestClient.java
+++ b/common/src/main/java/org/onap/so/client/RestClient.java
@@ -50,7 +50,6 @@ import org.onap.logging.filter.base.PayloadLoggingClientFilter;
import org.onap.so.client.policy.CommonObjectMapperProvider;
import org.onap.so.logging.jaxrs.filter.SOMetricLogClientFilter;
import org.onap.so.utils.CryptoUtils;
-import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
diff --git a/common/src/main/java/org/onap/so/client/RestTemplateConfig.java b/common/src/main/java/org/onap/so/client/RestTemplateConfig.java
index 5fbc9126cf..f8587ff776 100644
--- a/common/src/main/java/org/onap/so/client/RestTemplateConfig.java
+++ b/common/src/main/java/org/onap/so/client/RestTemplateConfig.java
@@ -20,6 +20,7 @@
package org.onap.so.client;
+import org.onap.logging.filter.spring.SpringClientPayloadFilter;
import org.onap.so.configuration.rest.HttpComponentsClientConfiguration;
import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.springframework.beans.factory.annotation.Autowired;
@@ -46,6 +47,7 @@ public class RestTemplateConfig {
restTemplate
.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()));
restTemplate.getInterceptors().add(new SOSpringClientFilter());
+ restTemplate.getInterceptors().add((new SpringClientPayloadFilter()));
return restTemplate;
}
@@ -57,6 +59,7 @@ public class RestTemplateConfig {
final RestTemplate restTemplate =
new RestTemplate(new BufferingClientHttpRequestFactory(clientHttpRequestFactory));
restTemplate.getInterceptors().add(new SOSpringClientFilter());
+ restTemplate.getInterceptors().add((new SpringClientPayloadFilter()));
return restTemplate;
}
}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
index b0ffb9358c..e0c8d4ba80 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
@@ -52,6 +52,8 @@ public class DMaaPRestClient extends RestClient {
}
String onapRequestId = UUID.randomUUID().toString();
headerMap.put(ONAPLogConstants.Headers.REQUEST_ID, onapRequestId);
- headerMap.put(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ if (MDC.get(ONAPLogConstants.MDCs.REQUEST_ID) != null) {
+ headerMap.put(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ }
}
}
diff --git a/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java b/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java
index 8d30ad35ff..9f71e61e1f 100644
--- a/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java
+++ b/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java
@@ -16,10 +16,10 @@ import org.springframework.stereotype.Component;
@Component
public class AuditMDCSetup {
- private MDCSetup mdcSetup = new MDCSetup();
-
private static final Logger logger = LoggerFactory.getLogger(AuditMDCSetup.class);
+ private MDCSetup mdcSetup = new MDCSetup();
+
public void setupMDC(ExternalTask externalTask) {
MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,
ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java
index 248e2f00bf..22a8d0405a 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java
@@ -2,7 +2,6 @@ package org.onap.so.logging.jaxrs.filter;
import javax.ws.rs.client.ClientRequestContext;
import javax.ws.rs.client.ClientResponseContext;
-import org.onap.logging.filter.base.MDCSetup;
import org.onap.logging.filter.base.MetricLogClientFilter;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.logger.MdcConstants;
@@ -15,21 +14,19 @@ import org.slf4j.MarkerFactory;
public class SOMetricLogClientFilter extends MetricLogClientFilter {
- protected static Logger logger = LoggerFactory.getLogger(MDCSetup.class);
+ protected static Logger logger = LoggerFactory.getLogger(SOMetricLogClientFilter.class);
private static final Marker INVOKE_RETURN = MarkerFactory.getMarker("INVOKE-RETURN");
- private MDCSetup mdcSetup = new MDCSetup();
-
@Override
public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) {
try {
- mdcSetup.setLogTimestamp();
- mdcSetup.setElapsedTimeInvokeTimestamp();
- mdcSetup.setResponseStatusCode(responseContext.getStatus());
- mdcSetup.setResponseDescription(responseContext.getStatus());
+ setLogTimestamp();
+ setElapsedTimeInvokeTimestamp();
+ setResponseStatusCode(responseContext.getStatus());
+ setResponseDescription(responseContext.getStatus());
MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseContext.getStatus()));
logger.info(INVOKE_RETURN, "InvokeReturn");
- mdcSetup.clearClientMDCs();
+ clearClientMDCs();
setOpenStackResponseCode();
} catch (Exception e) {
logger.warn("Error in JAX-RS request,response client filter", e);
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java
index c2b8df37c2..23df408ca5 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java
@@ -2,7 +2,6 @@ package org.onap.so.logging.jaxrs.filter;
import java.io.IOException;
import java.nio.charset.Charset;
-import org.onap.logging.filter.base.MDCSetup;
import org.onap.logging.filter.spring.SpringClientFilter;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.logger.MdcConstants;
@@ -11,6 +10,7 @@ import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;
+import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.stereotype.Component;
@@ -20,27 +20,24 @@ import org.springframework.util.StreamUtils;
public class SOSpringClientFilter extends SpringClientFilter implements ClientHttpRequestInterceptor {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
- private MDCSetup mdcSetup = new MDCSetup();
private static final Marker INVOKE_RETURN = MarkerFactory.getMarker("INVOKE-RETURN");
-
- protected void processResponse(ClientHttpResponse response) throws IOException {
- if (logger.isDebugEnabled()) {
- logger.debug("============================response begin==========================================");
- logger.debug("Status code : {}", response.getStatusCode());
- logger.debug("Status text : {}", response.getStatusText());
- logger.debug("Headers : {}", response.getHeaders());
- logger.debug("Response body: {}", StreamUtils.copyToString(response.getBody(), Charset.defaultCharset()));
- logger.debug("=======================response end=================================================");
+ @Override
+ protected void post(HttpRequest request, ClientHttpResponse response) {
+ setLogTimestamp();
+ setElapsedTimeInvokeTimestamp();
+ try {
+ setResponseStatusCode(response.getRawStatusCode());
+ int statusCode = response.getRawStatusCode();
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(statusCode));
+ setResponseDescription(statusCode);
+ } catch (IOException e) {
+ logger.error("Unable to get statusCode from response");
}
- mdcSetup.setLogTimestamp();
- mdcSetup.setElapsedTimeInvokeTimestamp();
- mdcSetup.setResponseStatusCode(response.getRawStatusCode());
- int statusCode = response.getRawStatusCode();
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(statusCode));
- mdcSetup.setResponseDescription(statusCode);
+
+
logger.info(INVOKE_RETURN, "InvokeReturn");
- mdcSetup.clearClientMDCs();
+ clearClientMDCs();
setOpenStackResponseCode();
}
diff --git a/common/src/test/java/org/onap/so/client/dmaap/rest/DMaaPRestClientTest.java b/common/src/test/java/org/onap/so/client/dmaap/rest/DMaaPRestClientTest.java
new file mode 100644
index 0000000000..8006423e75
--- /dev/null
+++ b/common/src/test/java/org/onap/so/client/dmaap/rest/DMaaPRestClientTest.java
@@ -0,0 +1,96 @@
+/*-
+ * ============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.client.dmaap.rest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import org.junit.Test;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.slf4j.MDC;
+
+public class DMaaPRestClientTest {
+
+ URL url;
+ private final String contentType = "application/json";
+ private final String auth = "";
+ private final String key = "";
+
+
+ @Test
+ public void headerMapTest() {
+
+ try {
+ url = new URL("http://testhost.com");
+ } catch (MalformedURLException e) {
+
+ throw new RuntimeException(e);
+ }
+ DMaaPRestClient client = new DMaaPRestClient(url, contentType, auth, key);
+ Map<String, String> map = new HashMap<>();
+ client.initializeHeaderMap(map);
+ map.put(ONAPLogConstants.MDCs.REQUEST_ID, "1234");
+ assertNotNull(map);
+ assertEquals("Found expected RequesttId", "1234", map.get(ONAPLogConstants.MDCs.REQUEST_ID));
+
+ }
+
+ @Test
+ public void headerMapInvocationIdNotNullTest() {
+
+ try {
+ url = new URL("http://testhost.com");
+ } catch (MalformedURLException e) {
+
+ throw new RuntimeException(e);
+ }
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, "1234");
+ DMaaPRestClient client = new DMaaPRestClient(url, contentType, auth, key);
+ Map<String, String> map = new HashMap<>();
+ client.initializeHeaderMap(map);
+
+ assertNotNull(map);
+ assertEquals("Found expected RequestId", "1234", map.get(ONAPLogConstants.Headers.INVOCATION_ID));
+
+ }
+
+ @Test
+ public void headerMapInvocationIdNullTest() {
+
+ try {
+ url = new URL("http://testhost.com");
+ } catch (MalformedURLException e) {
+
+ throw new RuntimeException(e);
+ }
+
+ DMaaPRestClient client = new DMaaPRestClient(url, contentType, auth, key);
+ Map<String, String> map = new HashMap<>();
+ client.initializeHeaderMap(map);
+
+ assertNotNull(map);
+ assertEquals("header not found as expected", null, map.get(ONAPLogConstants.Headers.INVOCATION_ID));
+
+ }
+}
diff --git a/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java b/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java
index 5e2a51a56f..c4609f0336 100644
--- a/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java
+++ b/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java
@@ -12,6 +12,7 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.logging.filter.base.MDCSetup;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.logger.MdcConstants;
import org.slf4j.MDC;
@@ -22,6 +23,9 @@ public class AuditMDCSetupTest {
@Mock
private ExternalTask externalTask;
+ @Mock
+ private MDCSetup mdcSet;
+
@Spy
@InjectMocks
private AuditMDCSetup mdcSetup;
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java
index 3880bd43b1..0f51341a61 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java
@@ -116,6 +116,9 @@ public class CamundaVIDRequest {
return serviceInput;
}
+ @JsonProperty(CommonConstants.GENERATE_IDS)
+ private CamundaBooleanInput generateIds;
+
@JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT)
public void setServiceInput(CamundaInput serviceInput) {
this.serviceInput = serviceInput;
@@ -347,6 +350,12 @@ public class CamundaVIDRequest {
return "CamundaRequest";
}
+ public CamundaBooleanInput getGenerateIds() {
+ return generateIds;
+ }
+ public void setGenerateIds(CamundaBooleanInput generateIds) {
+ this.generateIds = generateIds;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
index 5dd99f51cd..bc8af6e690 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
@@ -99,6 +99,7 @@ public class CamundaClient extends RequestClient {
return response;
}
+ @Override
public HttpResponse post(RequestClientParameter parameterObject) throws IOException {
HttpPost post = new HttpPost(url);
logger.debug(CAMUNDA_URL_MESAGE + url);
@@ -110,7 +111,7 @@ public class CamundaClient extends RequestClient {
parameterObject.getVnfType(), parameterObject.getVfModuleType(), parameterObject.getNetworkType(),
parameterObject.getRequestDetails(), parameterObject.getApiVersion(), parameterObject.isaLaCarte(),
parameterObject.getRequestUri(), parameterObject.getRecipeParamXsd(),
- parameterObject.getInstanceGroupId());
+ parameterObject.getInstanceGroupId(), parameterObject.isGenerateIdsOnly());
StringEntity input = new StringEntity(jsonReq);
input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
@@ -169,7 +170,7 @@ public class CamundaClient extends RequestClient {
String serviceInstanceId, String pnfCorrelationId, String vnfId, String vfModuleId, String volumeGroupId,
String networkId, String configurationId, String serviceType, String vnfType, String vfModuleType,
String networkType, String requestDetails, String apiVersion, boolean aLaCarte, String requestUri,
- String paramXsd, String instanceGroupId) {
+ String paramXsd, String instanceGroupId, boolean generateIdsOnly) {
String jsonReq = null;
try {
@@ -196,6 +197,8 @@ public class CamundaClient extends RequestClient {
CamundaInput requestUriInput = new CamundaInput();
CamundaInput recipeParamsInput = new CamundaInput();
CamundaInput instanceGroupIdInput = new CamundaInput();
+ CamundaBooleanInput generateIds = new CamundaBooleanInput();
+
requestIdInput.setValue(StringUtils.defaultString(requestId));
isBaseVfModuleInput.setValue(isBaseVfModule);
@@ -217,6 +220,7 @@ public class CamundaClient extends RequestClient {
requestUriInput.setValue(StringUtils.defaultString(requestUri));
recipeParamsInput.setValue(paramXsd);
instanceGroupIdInput.setValue(StringUtils.defaultString(instanceGroupId));
+ generateIds.setValue(generateIdsOnly);
serviceInput.setValue(requestDetails);
camundaRequest.setServiceInput(serviceInput);
@@ -242,6 +246,7 @@ public class CamundaClient extends RequestClient {
camundaRequest.setRequestUri(requestUriInput);
camundaRequest.setRecipeParams(recipeParamsInput);
camundaRequest.setInstanceGroupId(instanceGroupIdInput);
+ camundaRequest.setGenerateIds(generateIds);
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java
index e48c98a395..6d2bbfc613 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java
@@ -81,6 +81,7 @@ public final class CommonConstants {
public static final String X_LATEST_VERSION = "X-LatestVersion";
public static final String INSTANCE_GROUP_ID = "instanceGroupId";
public static final String INSTANCE_GROUP_INSTANCE_ID = "instanceGroupInstanceId";
+ public static final String GENERATE_IDS = "generateIdsOnly";
private CommonConstants() {
// prevent creating an instance of this class
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 20c512af37..e098ea4354 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
@@ -44,6 +44,7 @@ public class RequestClientParameter {
private String recipeParamXsd;
private String requestUri;
private String instanceGroupId;
+ private boolean generateIdsOnly;
private RequestClientParameter(Builder builder) {
requestId = builder.requestId;
@@ -67,7 +68,7 @@ public class RequestClientParameter {
aLaCarte = builder.aLaCarte;
requestUri = builder.requestUri;
instanceGroupId = builder.instanceGroupId;
-
+ generateIdsOnly = builder.generateIdsOnly;
}
public String getRequestId() {
@@ -154,6 +155,14 @@ public class RequestClientParameter {
return instanceGroupId;
}
+ public boolean isGenerateIdsOnly() {
+ return generateIdsOnly;
+ }
+
+ public void setGenerateIdsOnly(boolean generateIdsOnly) {
+ this.generateIdsOnly = generateIdsOnly;
+ }
+
public static class Builder {
private String requestId;
private boolean isBaseVfModule = false;
@@ -176,6 +185,7 @@ public class RequestClientParameter {
private String recipeParamXsd;
private String requestUri;
private String instanceGroupId;
+ private boolean generateIdsOnly;
public Builder setRequestId(String requestId) {
this.requestId = requestId;
@@ -282,6 +292,11 @@ public class RequestClientParameter {
return this;
}
+ public Builder setGenerateIds(boolean generateIdsOnly) {
+ this.generateIdsOnly = generateIdsOnly;
+ return this;
+ }
+
public RequestClientParameter build() {
return new RequestClientParameter(this);
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
index 36d004e87d..94c62a9689 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
@@ -47,11 +47,11 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.mock.env.MockEnvironment;
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
-
/**
* This class implements test methods of Camunda Beans.
*
@@ -164,10 +164,10 @@ public class CamundaClientTest {
String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction,
serviceInstanceId, pnfCorrelationId, vnfId, vfModuleId, volumeGroupId, networkId, configurationId,
serviceType, vnfType, vfModuleType, networkType, requestDetails, apiVersion, aLaCarte, requestUri, "",
- instanceGroupId);
+ instanceGroupId, false);
String expected = inputStream("/WrappedVIDRequest.json");
- assertEquals(expected, testResult);
+ JSONAssert.assertEquals(expected, testResult, false);
}
@Test
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json b/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json
index b9d0a8c3c6..3353f8c7ce 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json
+++ b/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json
@@ -1 +1,102 @@
-{"variables":{"bpmnRequest":{"value":"{requestDetails: }","type":"String"},"requestId":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"mso-request-id":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"isBaseVfModule":{"value":true,"type":"Boolean"},"recipeTimeout":{"value":10000,"type":"Integer"},"requestAction":{"value":"createInstance","type":"String"},"serviceInstanceId":{"value":"12345679","type":"String"},"pnfCorrelationId":{"value":"12345679","type":"String"},"vnfId":{"value":"234567891","type":"String"},"vfModuleId":{"value":"345678912","type":"String"},"volumeGroupId":{"value":"456789123","type":"String"},"networkId":{"value":"567891234","type":"String"},"configurationId":{"value":"678912345","type":"String"},"serviceType":{"value":"testService","type":"String"},"vnfType":{"value":"testVnf","type":"String"},"vfModuleType":{"value":"vfModuleType","type":"String"},"networkType":{"value":"networkType","type":"String"},"recipeParams":{"value":"","type":"String"},"host":{"value":null,"type":"String"},"apiVersion":{"value":"6","type":"String"},"aLaCarte":{"value":true,"type":"Boolean"},"requestUri":{"value":"v7/serviceInstances/assign","type":"String"},"instanceGroupId":{"value":"ff305d54-75b4-431b-adb2-eb6b9e5ff000","type":"String"}}} \ No newline at end of file
+{
+ "variables": {
+ "bpmnRequest": {
+ "value": "{requestDetails: }",
+ "type": "String"
+ },
+ "requestId": {
+ "value": "f7ce78bb-423b-11e7-93f8-0050569a796",
+ "type": "String"
+ },
+ "mso-request-id": {
+ "value": "f7ce78bb-423b-11e7-93f8-0050569a796",
+ "type": "String"
+ },
+ "isBaseVfModule": {
+ "value": true,
+ "type": "Boolean"
+ },
+ "recipeTimeout": {
+ "value": 10000,
+ "type": "Integer"
+ },
+ "requestAction": {
+ "value": "createInstance",
+ "type": "String"
+ },
+ "serviceInstanceId": {
+ "value": "12345679",
+ "type": "String"
+ },
+ "pnfCorrelationId": {
+ "value": "12345679",
+ "type": "String"
+ },
+ "vnfId": {
+ "value": "234567891",
+ "type": "String"
+ },
+ "vfModuleId": {
+ "value": "345678912",
+ "type": "String"
+ },
+ "volumeGroupId": {
+ "value": "456789123",
+ "type": "String"
+ },
+ "networkId": {
+ "value": "567891234",
+ "type": "String"
+ },
+ "configurationId": {
+ "value": "678912345",
+ "type": "String"
+ },
+ "serviceType": {
+ "value": "testService",
+ "type": "String"
+ },
+ "vnfType": {
+ "value": "testVnf",
+ "type": "String"
+ },
+ "vfModuleType": {
+ "value": "vfModuleType",
+ "type": "String"
+ },
+ "networkType": {
+ "value": "networkType",
+ "type": "String"
+ },
+ "recipeParams": {
+ "value": "",
+ "type": "String"
+ },
+ "host": {
+ "value": null,
+ "type": "String"
+ },
+ "apiVersion": {
+ "value": "6",
+ "type": "String"
+ },
+ "aLaCarte": {
+ "value": true,
+ "type": "Boolean"
+ },
+ "requestUri": {
+ "value": "v7/serviceInstances/assign",
+ "type": "String"
+ },
+ "instanceGroupId": {
+ "value": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "type": "String"
+ },
+ "generateIdsOnly": {
+ "value": false,
+ "type": "Boolean"
+ }
+ }
+}
+
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
index dc38d4eb82..8cdc2aaaf4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
@@ -56,13 +56,22 @@ import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
import org.onap.so.apihandlerinfra.exceptions.ClientConnectionException;
import org.onap.so.apihandlerinfra.exceptions.ContactCamundaException;
import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException;
+import org.onap.so.apihandlerinfra.exceptions.RecipeNotFoundException;
import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.exceptions.VfModuleNotFoundException;
import org.onap.so.apihandlerinfra.infra.rest.handler.AbstractRestHandler;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.beans.NetworkResource;
+import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.Recipe;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.catalog.beans.VfModule;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfRecipe;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
@@ -70,13 +79,19 @@ import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.LogConstants;
import org.onap.so.logger.MessageEnum;
+import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.Networks;
import org.onap.so.serviceinstancebeans.RelatedInstance;
import org.onap.so.serviceinstancebeans.RelatedInstanceList;
+import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.RequestParameters;
+import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
+import org.onap.so.serviceinstancebeans.VfModules;
+import org.onap.so.serviceinstancebeans.Vnfs;
import org.onap.so.utils.UUIDChecker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -95,6 +110,8 @@ public class RequestHandlerUtils extends AbstractRestHandler {
private static Logger logger = LoggerFactory.getLogger(RequestHandlerUtils.class);
private static final String SAVE_TO_DB = "save instance to db";
+ private static final String NAME = "name";
+ private static final String VALUE = "value";
@Autowired
private Environment env;
@@ -119,13 +136,14 @@ public class RequestHandlerUtils extends AbstractRestHandler {
public Response postBPELRequest(InfraActiveRequests currentActiveReq, RequestClientParameter requestClientParameter,
String orchestrationUri, String requestScope) throws ApiException {
- RequestClient requestClient = null;
HttpResponse response = null;
+ RequestClient requestClient = null;
+
try {
requestClient = reqClientFactory.getRequestClient(orchestrationUri);
response = requestClient.post(requestClientParameter);
} catch (Exception e) {
-
+ logger.error("Error posting request to BPMN", e);
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
@@ -134,7 +152,6 @@ public class RequestHandlerUtils extends AbstractRestHandler {
new ClientConnectionException.Builder(url, HttpStatus.SC_BAD_GATEWAY,
ErrorNumbers.SVC_NO_SERVER_RESOURCES).cause(e).errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, clientException.getMessage());
-
throw clientException;
}
@@ -144,9 +161,7 @@ public class RequestHandlerUtils extends AbstractRestHandler {
ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ClientConnectionException clientException = new ClientConnectionException.Builder(requestClient.getUrl(),
HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).errorInfo(errorLoggerInfo).build();
-
updateStatus(currentActiveReq, Status.FAILED, clientException.getMessage());
-
throw clientException;
}
@@ -232,6 +247,9 @@ public class RequestHandlerUtils extends AbstractRestHandler {
}
}
+
+
+ @Override
public void updateStatus(InfraActiveRequests aq, Status status, String errorMessage)
throws RequestDbFailureException {
if ((status == Status.FAILED) || (status == Status.COMPLETE)) {
@@ -412,6 +430,7 @@ public class RequestHandlerUtils extends AbstractRestHandler {
throw dupException;
}
+ @Override
public String getRequestId(ContainerRequestContext requestContext) throws ValidateException {
String requestId = null;
if (requestContext.getProperty("requestId") != null) {
@@ -686,4 +705,567 @@ public class RequestHandlerUtils extends AbstractRestHandler {
"(?s)(\"requestInfo\"\\s*?:\\s*?\\{.*?\"requestorId\"\\s*?:\\s*?\")(.*?)(\"[ ]*(?:,|\\R|\\}))",
"$1" + newRequestorId + "$3");
}
+
+ public RecipeLookupResult getServiceInstanceOrchestrationURI(ServiceInstancesRequest sir, Actions action,
+ boolean alaCarteFlag, InfraActiveRequests currentActiveReq) throws ApiException {
+ RecipeLookupResult recipeLookupResult = null;
+ // if the aLaCarte flag is set to TRUE, the API-H should choose the VID_DEFAULT recipe for the requested action
+ ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
+ // Query MSO Catalog DB
+
+ if (action == Action.applyUpdatedConfig || action == Action.inPlaceSoftwareUpdate) {
+ recipeLookupResult = getDefaultVnfUri(sir, action);
+ } else if (action == Action.addMembers || action == Action.removeMembers) {
+ recipeLookupResult = new RecipeLookupResult("/mso/async/services/WorkflowActionBB", 180);
+ } else if (modelInfo.getModelType().equals(ModelType.service)) {
+ try {
+ recipeLookupResult = getServiceURI(sir, action, alaCarteFlag);
+ } catch (IOException e) {
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ ValidateException validateException =
+ new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
+ ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
+
+ updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
+
+ throw validateException;
+ }
+ } else if (modelInfo.getModelType().equals(ModelType.vfModule)
+ || modelInfo.getModelType().equals(ModelType.volumeGroup)
+ || modelInfo.getModelType().equals(ModelType.vnf)) {
+ try {
+ recipeLookupResult = getVnfOrVfModuleUri(sir, action);
+ } catch (ValidationException e) {
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ ValidateException validateException =
+ new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
+ ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
+
+ updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
+
+ throw validateException;
+ }
+ } else if (modelInfo.getModelType().equals(ModelType.network)) {
+ try {
+ recipeLookupResult = getNetworkUri(sir, action);
+ } catch (ValidationException e) {
+
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ ValidateException validateException =
+ new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
+ ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
+ updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
+
+ throw validateException;
+ }
+ } else if (modelInfo.getModelType().equals(ModelType.instanceGroup)) {
+ recipeLookupResult = new RecipeLookupResult("/mso/async/services/WorkflowActionBB", 180);
+ }
+
+ if (recipeLookupResult == null) {
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ RecipeNotFoundException recipeNotFoundExceptionException =
+ new RecipeNotFoundException.Builder("Recipe could not be retrieved from catalog DB.",
+ HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).errorInfo(errorLoggerInfo)
+ .build();
+
+ updateStatus(currentActiveReq, Status.FAILED, recipeNotFoundExceptionException.getMessage());
+ throw recipeNotFoundExceptionException;
+ }
+ return recipeLookupResult;
+ }
+
+ protected RecipeLookupResult getServiceURI(ServiceInstancesRequest servInstReq, Actions action,
+ boolean alaCarteFlag) throws IOException {
+ // SERVICE REQUEST
+ // Construct the default service name
+ // TODO need to make this a configurable property
+ String defaultServiceModelName = getDefaultModel(servInstReq);
+ RequestDetails requestDetails = servInstReq.getRequestDetails();
+ ModelInfo modelInfo = requestDetails.getModelInfo();
+ org.onap.so.db.catalog.beans.Service serviceRecord;
+ List<org.onap.so.db.catalog.beans.Service> serviceRecordList;
+ ServiceRecipe recipe = null;
+
+ if (alaCarteFlag) {
+ serviceRecord = catalogDbClient.getFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName);
+ if (serviceRecord != null) {
+ recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(serviceRecord.getModelUUID(),
+ action.toString());
+ }
+ } else {
+ serviceRecord = catalogDbClient.getServiceByID(modelInfo.getModelVersionId());
+ recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(modelInfo.getModelVersionId(),
+ action.toString());
+ if (recipe == null) {
+ serviceRecordList = catalogDbClient
+ .getServiceByModelInvariantUUIDOrderByModelVersionDesc(modelInfo.getModelInvariantId());
+ if (!serviceRecordList.isEmpty()) {
+ for (org.onap.so.db.catalog.beans.Service record : serviceRecordList) {
+ recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(record.getModelUUID(),
+ action.toString());
+ if (recipe != null) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // if an aLaCarte flag was sent in the request, throw an error if the recipe was not found
+ RequestParameters reqParam = requestDetails.getRequestParameters();
+ if (reqParam != null && alaCarteFlag && recipe == null) {
+ return null;
+ } else if (!alaCarteFlag && recipe != null && Action.createInstance.equals(action)) {
+ mapToLegacyRequest(requestDetails);
+ } else if (recipe == null) { // aLaCarte wasn't sent, so we'll try the default
+ serviceRecord = catalogDbClient.getFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName);
+ recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(serviceRecord.getModelUUID(),
+ action.toString());
+ }
+ if (modelInfo.getModelVersionId() == null) {
+ modelInfo.setModelVersionId(serviceRecord.getModelUUID());
+ }
+ if (recipe == null) {
+ return null;
+ }
+ return new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout());
+ }
+
+ protected void mapToLegacyRequest(RequestDetails requestDetails) throws IOException {
+ RequestParameters reqParam;
+ if (requestDetails.getRequestParameters() == null) {
+ reqParam = new RequestParameters();
+ } else {
+ reqParam = requestDetails.getRequestParameters();
+ }
+ if (requestDetails.getCloudConfiguration() == null) {
+ CloudConfiguration cloudConfig = configureCloudConfig(reqParam);
+ if (cloudConfig != null) {
+ requestDetails.setCloudConfiguration(cloudConfig);
+ }
+ }
+
+ List<Map<String, Object>> userParams = configureUserParams(reqParam);
+ if (!userParams.isEmpty()) {
+ if (reqParam == null) {
+ requestDetails.setRequestParameters(new RequestParameters());
+ }
+ requestDetails.getRequestParameters().setUserParams(userParams);
+ }
+ }
+
+ private Service serviceMapper(Map<String, Object> params) throws IOException {
+ ObjectMapper obj = new ObjectMapper();
+ String input = obj.writeValueAsString(params.get("service"));
+ return obj.readValue(input, Service.class);
+ }
+
+ private void addUserParams(Map<String, Object> targetUserParams, List<Map<String, String>> sourceUserParams) {
+ for (Map<String, String> map : sourceUserParams) {
+ for (Map.Entry<String, String> entry : map.entrySet()) {
+ targetUserParams.put(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+
+ protected List<Map<String, Object>> configureUserParams(RequestParameters reqParams) throws IOException {
+ logger.debug("Configuring UserParams for Macro Request");
+ Map<String, Object> userParams = new HashMap<>();
+
+ for (Map<String, Object> params : reqParams.getUserParams()) {
+ if (params.containsKey("service")) {
+ Service service = serviceMapper(params);
+
+ addUserParams(userParams, service.getInstanceParams());
+
+ for (Networks network : service.getResources().getNetworks()) {
+ addUserParams(userParams, network.getInstanceParams());
+ }
+
+ for (Vnfs vnf : service.getResources().getVnfs()) {
+ addUserParams(userParams, vnf.getInstanceParams());
+
+ for (VfModules vfModule : vnf.getVfModules()) {
+ addUserParams(userParams, vfModule.getInstanceParams());
+ }
+ }
+ }
+ }
+
+ return mapFlatMapToNameValue(userParams);
+ }
+
+ protected List<Map<String, Object>> mapFlatMapToNameValue(Map<String, Object> flatMap) {
+ List<Map<String, Object>> targetUserParams = new ArrayList<>();
+
+ for (Map.Entry<String, Object> map : flatMap.entrySet()) {
+ Map<String, Object> targetMap = new HashMap<>();
+ targetMap.put(NAME, map.getKey());
+ targetMap.put(VALUE, map.getValue());
+ targetUserParams.add(targetMap);
+ }
+ return targetUserParams;
+ }
+
+ protected CloudConfiguration configureCloudConfig(RequestParameters reqParams) throws IOException {
+
+ for (Map<String, Object> params : reqParams.getUserParams()) {
+ if (params.containsKey("service")) {
+ Service service = serviceMapper(params);
+
+ Optional<CloudConfiguration> targetConfiguration = addCloudConfig(service.getCloudConfiguration());
+
+ if (targetConfiguration.isPresent()) {
+ return targetConfiguration.get();
+ } else {
+ for (Networks network : service.getResources().getNetworks()) {
+ targetConfiguration = addCloudConfig(network.getCloudConfiguration());
+ if (targetConfiguration.isPresent()) {
+ return targetConfiguration.get();
+ }
+ }
+
+ for (Vnfs vnf : service.getResources().getVnfs()) {
+ targetConfiguration = addCloudConfig(vnf.getCloudConfiguration());
+
+ if (targetConfiguration.isPresent()) {
+ return targetConfiguration.get();
+ }
+
+ for (VfModules vfModule : vnf.getVfModules()) {
+ targetConfiguration = addCloudConfig(vfModule.getCloudConfiguration());
+
+ if (targetConfiguration.isPresent()) {
+ return targetConfiguration.get();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private RecipeLookupResult getDefaultVnfUri(ServiceInstancesRequest sir, Actions action) {
+ String defaultSource = getDefaultModel(sir);
+ VnfRecipe vnfRecipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
+ if (vnfRecipe == null) {
+ return null;
+ }
+ return new RecipeLookupResult(vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());
+ }
+
+
+ private RecipeLookupResult getNetworkUri(ServiceInstancesRequest sir, Actions action) throws ValidationException {
+ String defaultNetworkType = getDefaultModel(sir);
+ ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
+ String modelName = modelInfo.getModelName();
+ Recipe recipe = null;
+
+ if (modelInfo.getModelCustomizationId() != null) {
+ NetworkResourceCustomization networkResourceCustomization = catalogDbClient
+ .getNetworkResourceCustomizationByModelCustomizationUUID(modelInfo.getModelCustomizationId());
+ if (networkResourceCustomization != null) {
+ NetworkResource networkResource = networkResourceCustomization.getNetworkResource();
+ if (networkResource != null) {
+ if (modelInfo.getModelVersionId() == null) {
+ modelInfo.setModelVersionId(networkResource.getModelUUID());
+ }
+ recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(networkResource.getModelName(),
+ action.toString());
+ } else {
+ throw new ValidationException("no catalog entry found");
+ }
+ } else if (action != Action.deleteInstance) {
+ throw new ValidationException("modelCustomizationId for networkResourceCustomization lookup", true);
+ }
+ } else {
+ // ok for version < 3 and action delete
+ if (modelName != null) {
+ recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(modelName, action.toString());
+ }
+ }
+
+ if (recipe == null) {
+ recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(defaultNetworkType, action.toString());
+ }
+
+ return recipe != null ? new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout()) : null;
+ }
+
+
+ private Optional<CloudConfiguration> addCloudConfig(CloudConfiguration sourceCloudConfiguration) {
+ CloudConfiguration targetConfiguration = new CloudConfiguration();
+ if (sourceCloudConfiguration != null) {
+ targetConfiguration.setAicNodeClli(sourceCloudConfiguration.getAicNodeClli());
+ targetConfiguration.setTenantId(sourceCloudConfiguration.getTenantId());
+ targetConfiguration.setLcpCloudRegionId(sourceCloudConfiguration.getLcpCloudRegionId());
+ targetConfiguration.setCloudOwner(sourceCloudConfiguration.getCloudOwner());
+ return Optional.of(targetConfiguration);
+ }
+ return Optional.empty();
+ }
+
+ private RecipeLookupResult getVnfOrVfModuleUri(ServiceInstancesRequest servInstReq, Actions action)
+ throws ValidationException {
+
+ ModelInfo modelInfo = servInstReq.getRequestDetails().getModelInfo();
+ String vnfComponentType = modelInfo.getModelType().name();
+
+ RelatedInstanceList[] instanceList = null;
+ if (servInstReq.getRequestDetails() != null) {
+ instanceList = servInstReq.getRequestDetails().getRelatedInstanceList();
+ }
+
+ Recipe recipe;
+ String defaultSource = getDefaultModel(servInstReq);
+ String modelCustomizationId = modelInfo.getModelCustomizationId();
+ String modelCustomizationName = modelInfo.getModelCustomizationName();
+ String relatedInstanceModelVersionId = null;
+ String relatedInstanceModelInvariantId = null;
+ String relatedInstanceVersion = null;
+ String relatedInstanceModelCustomizationName = null;
+
+ if (instanceList != null) {
+
+ for (RelatedInstanceList relatedInstanceList : instanceList) {
+
+ RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
+ ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo();
+ if (relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
+ relatedInstanceModelVersionId = relatedInstanceModelInfo.getModelVersionId();
+ relatedInstanceVersion = relatedInstanceModelInfo.getModelVersion();
+ }
+
+ if (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)) {
+ relatedInstanceModelVersionId = relatedInstanceModelInfo.getModelVersionId();
+ relatedInstanceModelInvariantId = relatedInstanceModelInfo.getModelInvariantId();
+ relatedInstanceVersion = relatedInstanceModelInfo.getModelVersion();
+ relatedInstanceModelCustomizationName = relatedInstanceModelInfo.getModelCustomizationName();
+ }
+ }
+
+ if (modelInfo.getModelType().equals(ModelType.vnf)) {
+ // a. For a vnf request (only create, no update currently):
+ // i. (v3-v4) If modelInfo.modelCustomizationId is provided, use it to validate catalog DB has record in
+ // vnf_resource_customization.model_customization_uuid.
+ // ii. (v2-v4) If modelInfo.modelCustomizationId is NOT provided (because it is a pre-1702 ASDC model or
+ // pre-v3), then modelInfo.modelCustomizationName must have
+ // been provided (else create request should be rejected). APIH should use the
+ // relatedInstance.modelInfo[service].modelVersionId** + modelInfo[vnf].modelCustomizationName
+ // to “join�? service_to_resource_customizations with vnf_resource_customization to confirm a
+ // vnf_resource_customization.model_customization_uuid record exists.
+ // **If relatedInstance.modelInfo[service].modelVersionId was not provided, use
+ // relatedInstance.modelInfo[service].modelInvariantId + modelVersion instead to lookup modelVersionId
+ // (MODEL_UUID) in SERVICE table.
+ // iii. Regardless of how the value was provided/obtained above, APIH must always populate
+ // vnfModelCustomizationId in bpmnRequest. It would be assumed it was MSO generated
+ // during 1707 data migration if VID did not provide it originally on request.
+ // iv. Note: continue to construct the “vnf-type�? value and pass to BPMN (must still be populated
+ // in A&AI).
+ // 1. If modelCustomizationName is NOT provided on a vnf/vfModule request, use modelCustomizationId to
+ // look it up in our catalog to construct vnf-type value to pass to BPMN.
+
+ VnfResource vnfResource = null;
+ VnfResourceCustomization vrc = null;
+ // Validation for vnfResource
+
+ if (modelCustomizationId != null) {
+ vrc = catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(modelCustomizationId);
+ if (vrc != null) {
+ vnfResource = vrc.getVnfResources();
+ }
+ } else {
+ org.onap.so.db.catalog.beans.Service service =
+ catalogDbClient.getServiceByID(relatedInstanceModelVersionId);
+ if (service == null) {
+ service = catalogDbClient.getServiceByModelVersionAndModelInvariantUUID(relatedInstanceVersion,
+ relatedInstanceModelInvariantId);
+ }
+
+ if (service == null) {
+ throw new ValidationException("service in relatedInstance");
+ }
+ for (VnfResourceCustomization vnfResourceCustom : service.getVnfCustomizations()) {
+ if (vnfResourceCustom.getModelInstanceName().equals(modelCustomizationName)) {
+ vrc = vnfResourceCustom;
+ }
+ }
+
+ if (vrc != null) {
+ vnfResource = vrc.getVnfResources();
+ modelInfo.setModelCustomizationId(vrc.getModelCustomizationUUID());
+ modelInfo.setModelCustomizationUuid(vrc.getModelCustomizationUUID());
+ }
+ }
+
+ if (vnfResource == null) {
+ throw new ValidationException("vnfResource");
+ } else {
+ if (modelInfo.getModelVersionId() == null) {
+ modelInfo.setModelVersionId(vnfResource.getModelUUID());
+ }
+ }
+
+ VnfRecipe vnfRecipe = null;
+
+ if (vrc != null) {
+ String nfRole = vrc.getNfRole();
+ if (nfRole != null) {
+ vnfRecipe =
+ catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(vrc.getNfRole(), action.toString());
+ }
+ }
+
+ if (vnfRecipe == null) {
+ vnfRecipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
+ }
+
+ if (vnfRecipe == null) {
+ return null;
+ }
+
+ return new RecipeLookupResult(vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());
+ } else {
+ /*
+ * (v5-v7) If modelInfo.modelCustomizationId is NOT provided (because it is a pre-1702 ASDC model or
+ * pre-v3), then modelInfo.modelCustomizationName must have // been provided (else create request should
+ * be rejected). APIH should use the relatedInstance.modelInfo[vnf].modelVersionId +
+ * modelInfo[vnf].modelCustomizationName // to join vnf_to_resource_customizations with
+ * vf_resource_customization to confirm a vf_resource_customization.model_customization_uuid record
+ * exists. // Once the vnfs model_customization_uuid has been obtained, use it to find all vfModule
+ * customizations for that vnf customization in the vnf_res_custom_to_vf_module_custom join table. //
+ * For each vf_module_cust_model_customization_uuid value returned, use that UUID to query
+ * vf_module_customization table along with modelInfo[vfModule|volumeGroup].modelVersionId to // confirm
+ * record matches request data (and to identify the modelCustomizationId associated with the vfModule in
+ * the request). This means taking each record found // in vf_module_customization and looking up in
+ * vf_module (using vf_module_customization’s FK into vf_module) to find a match on
+ * MODEL_INVARIANT_UUID (modelInvariantId) // and MODEL_VERSION (modelVersion).
+ */
+ VfModuleCustomization vfmc = null;
+ VnfResource vnfr;
+ VnfResourceCustomization vnfrc;
+ VfModule vfModule = null;
+
+ if (modelInfo.getModelCustomizationId() != null) {
+ vfmc = catalogDbClient
+ .getVfModuleCustomizationByModelCuztomizationUUID(modelInfo.getModelCustomizationId());
+ } else {
+ vnfr = catalogDbClient.getVnfResourceByModelUUID(relatedInstanceModelVersionId);
+ if (vnfr == null) {
+ vnfr = catalogDbClient.getFirstVnfResourceByModelInvariantUUIDAndModelVersion(
+ relatedInstanceModelInvariantId, relatedInstanceVersion);
+ }
+ vnfrc = catalogDbClient.getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources(
+ relatedInstanceModelCustomizationName, vnfr);
+
+ List<VfModuleCustomization> list = vnfrc.getVfModuleCustomizations();
+
+ String vfModuleModelUUID = modelInfo.getModelVersionId();
+ for (VfModuleCustomization vf : list) {
+ VfModuleCustomization vfmCustom;
+ if (vfModuleModelUUID != null) {
+ vfmCustom = catalogDbClient
+ .getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
+ vf.getModelCustomizationUUID(), vfModuleModelUUID);
+ if (vfmCustom != null) {
+ vfModule = vfmCustom.getVfModule();
+ }
+ } else {
+ vfmCustom = catalogDbClient
+ .getVfModuleCustomizationByModelCuztomizationUUID(vf.getModelCustomizationUUID());
+ if (vfmCustom != null) {
+ vfModule = vfmCustom.getVfModule();
+ } else {
+ vfModule = catalogDbClient.getVfModuleByModelInvariantUUIDAndModelVersion(
+ relatedInstanceModelInvariantId, relatedInstanceVersion);
+ }
+ }
+
+ if (vfModule != null) {
+ modelInfo.setModelCustomizationId(vf.getModelCustomizationUUID());
+ modelInfo.setModelCustomizationUuid(vf.getModelCustomizationUUID());
+ break;
+ }
+ }
+ }
+
+ if (vfmc == null && vfModule == null) {
+ throw new ValidationException("vfModuleCustomization");
+ } else if (vfModule == null && vfmc != null) {
+ vfModule = vfmc.getVfModule(); // can't be null as vfModuleModelUUID is not-null property in
+ // VfModuleCustomization table
+ }
+
+ if (modelInfo.getModelVersionId() == null) {
+ modelInfo.setModelVersionId(vfModule.getModelUUID());
+ }
+
+
+ recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
+ vfModule.getModelUUID(), vnfComponentType, action.toString());
+ if (recipe == null) {
+ List<VfModule> vfModuleRecords = catalogDbClient
+ .getVfModuleByModelInvariantUUIDOrderByModelVersionDesc(vfModule.getModelInvariantUUID());
+ if (!vfModuleRecords.isEmpty()) {
+ for (VfModule record : vfModuleRecords) {
+ recipe = catalogDbClient
+ .getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
+ record.getModelUUID(), vnfComponentType, action.toString());
+ if (recipe != null) {
+ break;
+ }
+ }
+ }
+ }
+ if (recipe == null) {
+ recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
+ defaultSource, vnfComponentType, action.toString());
+ if (recipe == null) {
+ recipe = catalogDbClient.getFirstVnfComponentsRecipeByVnfComponentTypeAndAction(
+ vnfComponentType, action.toString());
+ }
+
+ if (recipe == null) {
+ return null;
+ }
+ }
+ }
+ } else {
+
+ if (modelInfo.getModelType().equals(ModelType.vnf)) {
+ recipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
+ if (recipe == null) {
+ return null;
+ }
+ } else {
+ recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
+ defaultSource, vnfComponentType, action.toString());
+
+ if (recipe == null) {
+ return null;
+ }
+ }
+ }
+
+ return new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout());
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
index b462415a43..7cf9e338a8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
@@ -151,7 +151,7 @@ public class ResumeOrchestrationRequest {
Boolean aLaCarte = sir.getRequestDetails().getRequestParameters().getALaCarte();
String pnfCorrelationId = serviceInstances.getPnfCorrelationId(sir);
- RecipeLookupResult recipeLookupResult = serviceInstances.getServiceInstanceOrchestrationURI(sir, action,
+ RecipeLookupResult recipeLookupResult = requestHandlerUtils.getServiceInstanceOrchestrationURI(sir, action,
msoRequest.getAlacarteFlag(sir), currentActiveRequest);
requestDbSave(currentActiveRequest);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
index da101a2e6d..91c62180fc 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
@@ -24,10 +24,7 @@
package org.onap.so.apihandlerinfra;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import java.util.Optional;
import javax.transaction.Transactional;
import javax.ws.rs.Consumes;
@@ -47,49 +44,30 @@ import org.onap.so.apihandler.common.CommonConstants;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandler.common.RequestClientParameter;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
-import org.onap.so.apihandlerinfra.exceptions.RecipeNotFoundException;
import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.infra.rest.handler.AbstractRestHandler;
import org.onap.so.apihandlerinfra.infra.rest.validators.RequestValidatorListenerRunner;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.constants.Status;
-import org.onap.so.db.catalog.beans.NetworkResource;
-import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
-import org.onap.so.db.catalog.beans.Recipe;
-import org.onap.so.db.catalog.beans.ServiceRecipe;
-import org.onap.so.db.catalog.beans.VfModule;
-import org.onap.so.db.catalog.beans.VfModuleCustomization;
-import org.onap.so.db.catalog.beans.VnfRecipe;
-import org.onap.so.db.catalog.beans.VnfResource;
-import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
-import org.onap.so.serviceinstancebeans.Networks;
-import org.onap.so.serviceinstancebeans.RelatedInstance;
-import org.onap.so.serviceinstancebeans.RelatedInstanceList;
import org.onap.so.serviceinstancebeans.RequestDetails;
-import org.onap.so.serviceinstancebeans.RequestParameters;
import org.onap.so.serviceinstancebeans.RequestReferences;
-import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
-import org.onap.so.serviceinstancebeans.VfModules;
-import org.onap.so.serviceinstancebeans.Vnfs;
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;
import org.springframework.web.client.RestTemplate;
-import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.info.Info;
@@ -105,8 +83,6 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
public class ServiceInstances extends AbstractRestHandler {
private static Logger logger = LoggerFactory.getLogger(MsoRequest.class);
- private static String NAME = "name";
- private static String VALUE = "value";
private static String uriPrefix = "/serviceInstantiation/";
private static final String SAVE_TO_DB = "save instance to db";
@@ -891,7 +867,7 @@ public class ServiceInstances extends AbstractRestHandler {
serviceResponse.setRequestReferences(referencesResponse);
RecipeLookupResult recipeLookupResult =
- getServiceInstanceOrchestrationURI(sir, action, alaCarteFlag, currentActiveReq);
+ requestHandlerUtils.getServiceInstanceOrchestrationURI(sir, action, alaCarteFlag, currentActiveReq);
String serviceInstanceType = requestHandlerUtils.getServiceType(requestScope, sir, alaCarteFlag);
ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
@@ -1081,580 +1057,6 @@ public class ServiceInstances extends AbstractRestHandler {
.orElse("");
}
- protected RecipeLookupResult getServiceInstanceOrchestrationURI(ServiceInstancesRequest sir, Actions action,
- boolean alaCarteFlag, InfraActiveRequests currentActiveReq) throws ApiException {
- RecipeLookupResult recipeLookupResult = null;
- // if the aLaCarte flag is set to TRUE, the API-H should choose the VID_DEFAULT
- // recipe for the requested action
- ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
- // Query MSO Catalog DB
-
- if (action == Action.applyUpdatedConfig || action == Action.inPlaceSoftwareUpdate) {
- recipeLookupResult = getDefaultVnfUri(sir, action);
- } else if (action == Action.addMembers || action == Action.removeMembers) {
- recipeLookupResult = new RecipeLookupResult("/mso/async/services/WorkflowActionBB", 180);
- } else if (modelInfo.getModelType().equals(ModelType.service)) {
- try {
- recipeLookupResult = getServiceURI(sir, action, alaCarteFlag);
- } catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
- .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
- ValidateException validateException =
- new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
- ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
-
- requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
-
- throw validateException;
- }
- } else if (modelInfo.getModelType().equals(ModelType.vfModule)
- || modelInfo.getModelType().equals(ModelType.volumeGroup)
- || modelInfo.getModelType().equals(ModelType.vnf)) {
- try {
- recipeLookupResult = getVnfOrVfModuleUri(sir, action);
- } catch (ValidationException e) {
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
- .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
- ValidateException validateException =
- new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
- ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
-
- requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
-
- throw validateException;
- }
- } else if (modelInfo.getModelType().equals(ModelType.network)) {
- try {
- recipeLookupResult = getNetworkUri(sir, action);
- } catch (ValidationException e) {
-
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
- .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
- ValidateException validateException =
- new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
- ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
- requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
-
- throw validateException;
- }
- } else if (modelInfo.getModelType().equals(ModelType.instanceGroup)) {
- recipeLookupResult = new RecipeLookupResult("/mso/async/services/WorkflowActionBB", 180);
- }
-
- if (recipeLookupResult == null) {
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
- .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
- RecipeNotFoundException recipeNotFoundExceptionException =
- new RecipeNotFoundException.Builder("Recipe could not be retrieved from catalog DB.",
- HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).errorInfo(errorLoggerInfo)
- .build();
-
- requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED,
- recipeNotFoundExceptionException.getMessage());
- throw recipeNotFoundExceptionException;
- }
- return recipeLookupResult;
- }
-
- protected RecipeLookupResult getServiceURI(ServiceInstancesRequest servInstReq, Actions action,
- boolean alaCarteFlag) throws IOException {
- // SERVICE REQUEST
- // Construct the default service name
- // TODO need to make this a configurable property
- String defaultServiceModelName = requestHandlerUtils.getDefaultModel(servInstReq);
- RequestDetails requestDetails = servInstReq.getRequestDetails();
- ModelInfo modelInfo = requestDetails.getModelInfo();
- org.onap.so.db.catalog.beans.Service serviceRecord;
- List<org.onap.so.db.catalog.beans.Service> serviceRecordList;
- ServiceRecipe recipe = null;
-
- if (alaCarteFlag) {
- serviceRecord = catalogDbClient.getFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName);
- if (serviceRecord != null) {
- recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(serviceRecord.getModelUUID(),
- action.toString());
- }
- } else {
- serviceRecord = catalogDbClient.getServiceByID(modelInfo.getModelVersionId());
- recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(modelInfo.getModelVersionId(),
- action.toString());
- if (recipe == null) {
- serviceRecordList = catalogDbClient
- .getServiceByModelInvariantUUIDOrderByModelVersionDesc(modelInfo.getModelInvariantId());
- if (!serviceRecordList.isEmpty()) {
- for (org.onap.so.db.catalog.beans.Service record : serviceRecordList) {
- recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(record.getModelUUID(),
- action.toString());
- if (recipe != null) {
- break;
- }
- }
- }
- }
- }
-
- // if an aLaCarte flag was sent in the request, throw an error if the recipe was
- // not found
- RequestParameters reqParam = requestDetails.getRequestParameters();
- if (reqParam != null && alaCarteFlag && recipe == null) {
- return null;
- } else if (!alaCarteFlag && recipe != null && Action.createInstance.equals(action)) {
- mapToLegacyRequest(requestDetails);
- } else if (recipe == null) { // aLaCarte wasn't sent, so we'll try the default
- serviceRecord = catalogDbClient.getFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName);
- recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(serviceRecord.getModelUUID(),
- action.toString());
- }
- if (modelInfo.getModelVersionId() == null) {
- modelInfo.setModelVersionId(serviceRecord.getModelUUID());
- }
- if (recipe == null) {
- return null;
- }
- return new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout());
- }
-
- protected void mapToLegacyRequest(RequestDetails requestDetails) throws IOException {
- RequestParameters reqParam;
- if (requestDetails.getRequestParameters() == null) {
- reqParam = new RequestParameters();
- } else {
- reqParam = requestDetails.getRequestParameters();
- }
- if (requestDetails.getCloudConfiguration() == null) {
- CloudConfiguration cloudConfig = configureCloudConfig(reqParam);
- if (cloudConfig != null) {
- requestDetails.setCloudConfiguration(cloudConfig);
- }
- }
-
- List<Map<String, Object>> userParams = configureUserParams(reqParam);
- if (!userParams.isEmpty()) {
- if (reqParam == null) {
- requestDetails.setRequestParameters(new RequestParameters());
- }
- requestDetails.getRequestParameters().setUserParams(userParams);
- }
- }
-
- protected CloudConfiguration configureCloudConfig(RequestParameters reqParams) throws IOException {
-
- for (Map<String, Object> params : reqParams.getUserParams()) {
- if (params.containsKey("service")) {
- Service service = serviceMapper(params);
-
- Optional<CloudConfiguration> targetConfiguration = addCloudConfig(service.getCloudConfiguration());
-
- if (targetConfiguration.isPresent()) {
- return targetConfiguration.get();
- } else {
- for (Networks network : service.getResources().getNetworks()) {
- targetConfiguration = addCloudConfig(network.getCloudConfiguration());
- if (targetConfiguration.isPresent()) {
- return targetConfiguration.get();
- }
- }
-
- for (Vnfs vnf : service.getResources().getVnfs()) {
- targetConfiguration = addCloudConfig(vnf.getCloudConfiguration());
-
- if (targetConfiguration.isPresent()) {
- return targetConfiguration.get();
- }
-
- for (VfModules vfModule : vnf.getVfModules()) {
- targetConfiguration = addCloudConfig(vfModule.getCloudConfiguration());
-
- if (targetConfiguration.isPresent()) {
- return targetConfiguration.get();
- }
- }
- }
- }
- }
- }
-
- return null;
- }
-
- private Optional<CloudConfiguration> addCloudConfig(CloudConfiguration sourceCloudConfiguration) {
- CloudConfiguration targetConfiguration = new CloudConfiguration();
- if (sourceCloudConfiguration != null) {
- targetConfiguration.setAicNodeClli(sourceCloudConfiguration.getAicNodeClli());
- targetConfiguration.setTenantId(sourceCloudConfiguration.getTenantId());
- targetConfiguration.setLcpCloudRegionId(sourceCloudConfiguration.getLcpCloudRegionId());
- targetConfiguration.setCloudOwner(sourceCloudConfiguration.getCloudOwner());
- return Optional.of(targetConfiguration);
- }
- return Optional.empty();
- }
-
- protected List<Map<String, Object>> configureUserParams(RequestParameters reqParams) throws IOException {
- logger.debug("Configuring UserParams for Macro Request");
- Map<String, Object> userParams = new HashMap<>();
-
- for (Map<String, Object> params : reqParams.getUserParams()) {
- if (params.containsKey("service")) {
- Service service = serviceMapper(params);
-
- addUserParams(userParams, service.getInstanceParams());
-
- for (Networks network : service.getResources().getNetworks()) {
- addUserParams(userParams, network.getInstanceParams());
- }
-
- for (Vnfs vnf : service.getResources().getVnfs()) {
- addUserParams(userParams, vnf.getInstanceParams());
-
- for (VfModules vfModule : vnf.getVfModules()) {
- addUserParams(userParams, vfModule.getInstanceParams());
- }
- }
- }
- }
-
- return mapFlatMapToNameValue(userParams);
- }
-
- private Service serviceMapper(Map<String, Object> params) throws IOException {
- ObjectMapper obj = new ObjectMapper();
- String input = obj.writeValueAsString(params.get("service"));
- return obj.readValue(input, Service.class);
- }
-
- private void addUserParams(Map<String, Object> targetUserParams, List<Map<String, String>> sourceUserParams) {
- for (Map<String, String> map : sourceUserParams) {
- for (Map.Entry<String, String> entry : map.entrySet()) {
- targetUserParams.put(entry.getKey(), entry.getValue());
- }
- }
- }
-
- protected List<Map<String, Object>> mapFlatMapToNameValue(Map<String, Object> flatMap) {
- List<Map<String, Object>> targetUserParams = new ArrayList<>();
-
- for (Map.Entry<String, Object> map : flatMap.entrySet()) {
- Map<String, Object> targetMap = new HashMap<>();
- targetMap.put(NAME, map.getKey());
- targetMap.put(VALUE, map.getValue());
- targetUserParams.add(targetMap);
- }
- return targetUserParams;
- }
-
- private RecipeLookupResult getVnfOrVfModuleUri(ServiceInstancesRequest servInstReq, Actions action)
- throws ValidationException {
-
- ModelInfo modelInfo = servInstReq.getRequestDetails().getModelInfo();
- String vnfComponentType = modelInfo.getModelType().name();
-
- RelatedInstanceList[] instanceList = null;
- if (servInstReq.getRequestDetails() != null) {
- instanceList = servInstReq.getRequestDetails().getRelatedInstanceList();
- }
-
- Recipe recipe;
- String defaultSource = requestHandlerUtils.getDefaultModel(servInstReq);
- String modelCustomizationId = modelInfo.getModelCustomizationId();
- String modelCustomizationName = modelInfo.getModelCustomizationName();
- String relatedInstanceModelVersionId = null;
- String relatedInstanceModelInvariantId = null;
- String relatedInstanceVersion = null;
- String relatedInstanceModelCustomizationName = null;
-
- if (instanceList != null) {
-
- for (RelatedInstanceList relatedInstanceList : instanceList) {
-
- RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
- ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo();
- if (relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
- relatedInstanceModelVersionId = relatedInstanceModelInfo.getModelVersionId();
- relatedInstanceVersion = relatedInstanceModelInfo.getModelVersion();
- }
-
- if (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)) {
- relatedInstanceModelVersionId = relatedInstanceModelInfo.getModelVersionId();
- relatedInstanceModelInvariantId = relatedInstanceModelInfo.getModelInvariantId();
- relatedInstanceVersion = relatedInstanceModelInfo.getModelVersion();
- relatedInstanceModelCustomizationName = relatedInstanceModelInfo.getModelCustomizationName();
- }
- }
-
- if (modelInfo.getModelType().equals(ModelType.vnf)) {
- // a. For a vnf request (only create, no update currently):
- // i. (v3-v4) If modelInfo.modelCustomizationId is provided, use it to validate
- // catalog DB has record in
- // vnf_resource_customization.model_customization_uuid.
- // ii. (v2-v4) If modelInfo.modelCustomizationId is NOT provided (because it is
- // a pre-1702 ASDC model or
- // pre-v3), then modelInfo.modelCustomizationName must have
- // been provided (else create request should be rejected). APIH should use the
- // relatedInstance.modelInfo[service].modelVersionId** +
- // modelInfo[vnf].modelCustomizationName
- // to “join�? service_to_resource_customizations with
- // vnf_resource_customization to confirm a
- // vnf_resource_customization.model_customization_uuid record exists.
- // **If relatedInstance.modelInfo[service].modelVersionId was not provided, use
- // relatedInstance.modelInfo[service].modelInvariantId + modelVersion instead to
- // lookup modelVersionId
- // (MODEL_UUID) in SERVICE table.
- // iii. Regardless of how the value was provided/obtained above, APIH must
- // always populate
- // vnfModelCustomizationId in bpmnRequest. It would be assumed it was MSO
- // generated
- // during 1707 data migration if VID did not provide it originally on request.
- // iv. Note: continue to construct the “vnf-type�? value and pass to BPMN
- // (must still be populated
- // in A&AI).
- // 1. If modelCustomizationName is NOT provided on a vnf/vfModule request, use
- // modelCustomizationId to
- // look it up in our catalog to construct vnf-type value to pass to BPMN.
-
- VnfResource vnfResource = null;
- VnfResourceCustomization vrc = null;
- // Validation for vnfResource
-
- if (modelCustomizationId != null) {
- vrc = catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(modelCustomizationId);
- if (vrc != null) {
- vnfResource = vrc.getVnfResources();
- }
- } else {
- org.onap.so.db.catalog.beans.Service service =
- catalogDbClient.getServiceByID(relatedInstanceModelVersionId);
- if (service == null) {
- service = catalogDbClient.getServiceByModelVersionAndModelInvariantUUID(relatedInstanceVersion,
- relatedInstanceModelInvariantId);
- }
-
- if (service == null) {
- throw new ValidationException("service in relatedInstance");
- }
- for (VnfResourceCustomization vnfResourceCustom : service.getVnfCustomizations()) {
- if (vnfResourceCustom.getModelInstanceName().equals(modelCustomizationName)) {
- vrc = vnfResourceCustom;
- }
- }
-
- if (vrc != null) {
- vnfResource = vrc.getVnfResources();
- modelInfo.setModelCustomizationId(vrc.getModelCustomizationUUID());
- modelInfo.setModelCustomizationUuid(vrc.getModelCustomizationUUID());
- }
- }
-
- if (vnfResource == null) {
- throw new ValidationException("vnfResource");
- } else {
- if (modelInfo.getModelVersionId() == null) {
- modelInfo.setModelVersionId(vnfResource.getModelUUID());
- }
- }
-
- VnfRecipe vnfRecipe = null;
-
- if (vrc != null) {
- String nfRole = vrc.getNfRole();
- if (nfRole != null) {
- vnfRecipe =
- catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(vrc.getNfRole(), action.toString());
- }
- }
-
- if (vnfRecipe == null) {
- vnfRecipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
- }
-
- if (vnfRecipe == null) {
- return null;
- }
-
- return new RecipeLookupResult(vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());
- } else {
- /*
- * (v5-v7) If modelInfo.modelCustomizationId is NOT provided (because it is a pre-1702 ASDC model or
- * pre-v3), then modelInfo.modelCustomizationName must have // been provided (else create request should
- * be rejected). APIH should use the relatedInstance.modelInfo[vnf].modelVersionId +
- * modelInfo[vnf].modelCustomizationName // to join vnf_to_resource_customizations with
- * vf_resource_customization to confirm a vf_resource_customization.model_customization_uuid record
- * exists. // Once the vnfs model_customization_uuid has been obtained, use it to find all vfModule
- * customizations for that vnf customization in the vnf_res_custom_to_vf_module_custom join table. //
- * For each vf_module_cust_model_customization_uuid value returned, use that UUID to query
- * vf_module_customization table along with modelInfo[vfModule|volumeGroup].modelVersionId to // confirm
- * record matches request data (and to identify the modelCustomizationId associated with the vfModule in
- * the request). This means taking each record found // in vf_module_customization and looking up in
- * vf_module (using vf_module_customization’s FK into vf_module) to find a match on
- * MODEL_INVARIANT_UUID (modelInvariantId) // and MODEL_VERSION (modelVersion).
- */
- VfModuleCustomization vfmc = null;
- VnfResource vnfr;
- VnfResourceCustomization vnfrc;
- VfModule vfModule = null;
-
- if (modelInfo.getModelCustomizationId() != null) {
- vfmc = catalogDbClient
- .getVfModuleCustomizationByModelCuztomizationUUID(modelInfo.getModelCustomizationId());
- } else {
- vnfr = catalogDbClient.getVnfResourceByModelUUID(relatedInstanceModelVersionId);
- if (vnfr == null) {
- vnfr = catalogDbClient.getFirstVnfResourceByModelInvariantUUIDAndModelVersion(
- relatedInstanceModelInvariantId, relatedInstanceVersion);
- }
- vnfrc = catalogDbClient.getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources(
- relatedInstanceModelCustomizationName, vnfr);
-
- List<VfModuleCustomization> list = vnfrc.getVfModuleCustomizations();
-
- String vfModuleModelUUID = modelInfo.getModelVersionId();
- for (VfModuleCustomization vf : list) {
- VfModuleCustomization vfmCustom;
- if (vfModuleModelUUID != null) {
- vfmCustom = catalogDbClient
- .getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
- vf.getModelCustomizationUUID(), vfModuleModelUUID);
- if (vfmCustom != null) {
- vfModule = vfmCustom.getVfModule();
- }
- } else {
- vfmCustom = catalogDbClient
- .getVfModuleCustomizationByModelCuztomizationUUID(vf.getModelCustomizationUUID());
- if (vfmCustom != null) {
- vfModule = vfmCustom.getVfModule();
- } else {
- vfModule = catalogDbClient.getVfModuleByModelInvariantUUIDAndModelVersion(
- relatedInstanceModelInvariantId, relatedInstanceVersion);
- }
- }
-
- if (vfModule != null) {
- modelInfo.setModelCustomizationId(vf.getModelCustomizationUUID());
- modelInfo.setModelCustomizationUuid(vf.getModelCustomizationUUID());
- break;
- }
- }
- }
-
- if (vfmc == null && vfModule == null) {
- throw new ValidationException("vfModuleCustomization");
- } else if (vfModule == null && vfmc != null) {
- vfModule = vfmc.getVfModule(); // can't be null as vfModuleModelUUID is not-null property in
- // VfModuleCustomization table
- }
-
- if (modelInfo.getModelVersionId() == null) {
- modelInfo.setModelVersionId(vfModule.getModelUUID());
- }
-
- recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
- vfModule.getModelUUID(), vnfComponentType, action.toString());
- if (recipe == null) {
- List<VfModule> vfModuleRecords = catalogDbClient
- .getVfModuleByModelInvariantUUIDOrderByModelVersionDesc(vfModule.getModelInvariantUUID());
- if (!vfModuleRecords.isEmpty()) {
- for (VfModule record : vfModuleRecords) {
- recipe = catalogDbClient
- .getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
- record.getModelUUID(), vnfComponentType, action.toString());
- if (recipe != null) {
- break;
- }
- }
- }
- }
- if (recipe == null) {
- recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
- defaultSource, vnfComponentType, action.toString());
- if (recipe == null) {
- recipe = catalogDbClient.getFirstVnfComponentsRecipeByVnfComponentTypeAndAction(
- vnfComponentType, action.toString());
- }
-
- if (recipe == null) {
- return null;
- }
- }
- }
- } else {
-
- if (modelInfo.getModelType().equals(ModelType.vnf)) {
- recipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
- if (recipe == null) {
- return null;
- }
- } else {
- recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
- defaultSource, vnfComponentType, action.toString());
-
- if (recipe == null) {
- return null;
- }
- }
- }
-
- return new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout());
- }
-
- private RecipeLookupResult getDefaultVnfUri(ServiceInstancesRequest sir, Actions action) {
-
- String defaultSource = requestHandlerUtils.getDefaultModel(sir);
-
- VnfRecipe vnfRecipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
-
- if (vnfRecipe == null) {
- return null;
- }
-
- return new RecipeLookupResult(vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());
- }
-
- private RecipeLookupResult getNetworkUri(ServiceInstancesRequest sir, Actions action) throws ValidationException {
-
- String defaultNetworkType = requestHandlerUtils.getDefaultModel(sir);
-
- ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
- String modelName = modelInfo.getModelName();
- Recipe recipe = null;
-
- if (modelInfo.getModelCustomizationId() != null) {
- NetworkResourceCustomization networkResourceCustomization = catalogDbClient
- .getNetworkResourceCustomizationByModelCustomizationUUID(modelInfo.getModelCustomizationId());
- if (networkResourceCustomization != null) {
- NetworkResource networkResource = networkResourceCustomization.getNetworkResource();
- if (networkResource != null) {
- if (modelInfo.getModelVersionId() == null) {
- modelInfo.setModelVersionId(networkResource.getModelUUID());
- }
- recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(networkResource.getModelName(),
- action.toString());
- } else {
- throw new ValidationException("no catalog entry found");
- }
- } else if (action != Action.deleteInstance) {
- throw new ValidationException("modelCustomizationId for networkResourceCustomization lookup", true);
- }
- } else {
- // ok for version < 3 and action delete
- if (modelName != null) {
- recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(modelName, action.toString());
- }
- }
-
- if (recipe == null) {
- recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(defaultNetworkType, action.toString());
- }
-
- return recipe != null ? new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout()) : null;
- }
-
private Response configurationRecipeLookup(String requestJSON, Action action, HashMap<String, String> instanceIdMap,
String version, String requestId, String requestUri) throws ApiException {
String serviceInstanceId;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java
index e157d926f3..1011454906 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -100,8 +101,7 @@ public class VnfRestHandler extends AbstractRestHandler {
checkDuplicateRequest(instanceIdMap, ModelType.vnf, instanceName, requestId);
}
- public Recipe findVnfModuleRecipe(String modelCustomizationId, String modelType, String action)
- throws NoRecipeException {
+ public Recipe findVnfModuleRecipe(String modelCustomizationId, String modelType, String action) {
VnfRecipe recipe = new VnfRecipe();
recipe.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
return recipe;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java
index 1e755419be..7f5f0dc931 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java
@@ -21,6 +21,7 @@ package org.onap.so.apihandlerinfra;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyString;
@@ -30,7 +31,6 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -56,10 +56,10 @@ import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.springframework.web.client.HttpClientErrorException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.onap.so.serviceinstancebeans.ModelType;
@RunWith(MockitoJUnitRunner.class)
public class ResumeOrchestrationRequestTest {
@@ -258,7 +258,7 @@ public class ResumeOrchestrationRequestTest {
when(requestHandler.convertJsonToServiceInstanceRequest(anyString(), any(Actions.class), anyString(),
anyString())).thenReturn(sir);
when(serviceInstances.getPnfCorrelationId(any(ServiceInstancesRequest.class))).thenReturn("pnfCorrelationId");
- doReturn(lookupResult).when(serviceInstances).getServiceInstanceOrchestrationURI(sir, action, aLaCarte,
+ doReturn(lookupResult).when(requestHandler).getServiceInstanceOrchestrationURI(sir, action, aLaCarte,
currentActiveRequest);
doReturn(requestClientParameter).when(resumeReq).setRequestClientParameter(lookupResult, version,
infraActiveRequest, currentActiveRequest, "pnfCorrelationId", aLaCarte, sir);
@@ -311,7 +311,7 @@ public class ResumeOrchestrationRequestTest {
anyString())).thenReturn(sirNullALaCarte);
when(serviceInstances.getPnfCorrelationId(any(ServiceInstancesRequest.class))).thenReturn("pnfCorrelationId");
doReturn(false).when(msoRequest).getAlacarteFlag(sirNullALaCarte);
- doReturn(lookupResult).when(serviceInstances).getServiceInstanceOrchestrationURI(sirNullALaCarte, action, false,
+ doReturn(lookupResult).when(requestHandler).getServiceInstanceOrchestrationURI(sirNullALaCarte, action, false,
currentActiveRequest);
doReturn(requestClientParameter).when(resumeReq).setRequestClientParameter(lookupResult, version,
infraActiveRequest, currentActiveRequest, "pnfCorrelationId", aLaCarte, sirNullALaCarte);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index 94436d54b0..61654d18e4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -2266,7 +2266,7 @@ public class ServiceInstancesTest extends BaseTest {
RequestParameters requestParameters = request.getRequestDetails().getRequestParameters();
String userParamsTxt = inputStream("/userParams.txt");
- List<Map<String, Object>> userParams = servInstances.configureUserParams(requestParameters);
+ List<Map<String, Object>> userParams = requestHandlerUtils.configureUserParams(requestParameters);
System.out.println(userParams);
assertTrue(userParams.size() > 0);
assertTrue(userParams.get(0).containsKey("name"));
@@ -2280,7 +2280,7 @@ public class ServiceInstancesTest extends BaseTest {
ServiceInstancesRequest request =
mapper.readValue(inputStream("/MacroServiceInstance.json"), ServiceInstancesRequest.class);
CloudConfiguration cloudConfig =
- servInstances.configureCloudConfig(request.getRequestDetails().getRequestParameters());
+ requestHandlerUtils.configureCloudConfig(request.getRequestDetails().getRequestParameters());
assertEquals("mdt25b", cloudConfig.getLcpCloudRegionId());
assertEquals("aefb697db6524ddebfe4915591b0a347", cloudConfig.getTenantId());
@@ -2293,7 +2293,7 @@ public class ServiceInstancesTest extends BaseTest {
mapper.readValue(inputStream("/MacroServiceInstance.json"), ServiceInstancesRequest.class);
ServiceInstancesRequest expected =
mapper.readValue(inputStream("/LegacyMacroServiceInstance.json"), ServiceInstancesRequest.class);
- servInstances.mapToLegacyRequest(request.getRequestDetails());
+ requestHandlerUtils.mapToLegacyRequest(request.getRequestDetails());
System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(request));
assertThat(request, sameBeanAs(expected));
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
index d0a4aa2c5f..1f5fb8f77e 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
@@ -23,8 +23,8 @@ package org.onap.so.db.request.beans;
import java.util.Objects;
import javax.persistence.Entity;
import javax.persistence.Table;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.apache.commons.lang3.builder.ToStringBuilder;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/**
* InfraActiveRequests generated by hbm2java
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
index 5ea0d3c54a..99c1d1ea72 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
@@ -32,6 +32,7 @@ import javax.annotation.PostConstruct;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
import org.apache.http.HttpStatus;
+import org.onap.logging.filter.spring.SpringClientPayloadFilter;
import org.onap.so.db.request.beans.ArchivedInfraRequests;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.OperationStatus;
@@ -158,6 +159,7 @@ public class RequestsDbClient {
return Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory)
.setRestTemplateConfigurer(restTemplate -> {
restTemplate.getInterceptors().add((new SOSpringClientFilter()));
+ restTemplate.getInterceptors().add((new SpringClientPayloadFilter()));
restTemplate.getInterceptors().add((request, body, execution) -> {
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index fcafe90405..e60ef9727e 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -31,6 +31,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
import org.apache.http.HttpStatus;
import org.onap.logging.filter.base.Constants;
+import org.onap.logging.filter.spring.SpringClientPayloadFilter;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.CloudifyManager;
@@ -368,6 +369,7 @@ public class CatalogDbClient {
ClientFactory clientFactory =
Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> {
restTemplate.getInterceptors().add((new SOSpringClientFilter()));
+ restTemplate.getInterceptors().add((new SpringClientPayloadFilter()));
restTemplate.getInterceptors().add((request, body, execution) -> {
@@ -417,6 +419,7 @@ public class CatalogDbClient {
ClientFactory clientFactory = Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory)
.setRestTemplateConfigurer(restTemplate -> {
restTemplate.getInterceptors().add((new SOSpringClientFilter()));
+ restTemplate.getInterceptors().add((new SpringClientPayloadFilter()));
restTemplate.getInterceptors().add((request, body, execution) -> {
@@ -763,6 +766,11 @@ public class CatalogDbClient {
this.postSingleResource(cloudSiteClient, cloudSite);
}
+ public List<CloudSite> getCloudSites() {
+ return this.getMultipleResources(cloudSiteClient, UriBuilder.fromUri(endpoint + CLOUD_SITE).build());
+ }
+
+
public CloudSite getCloudSiteByClliAndAicVersion(String clli, String cloudVersion) {
return this.getSingleResource(cloudSiteClient, getUri(UriBuilder.fromUri(findByClliAndCloudVersion)
.queryParam(CLLI, clli).queryParam(CLOUD_VERSION, cloudVersion).build().toString()));
diff --git a/pom.xml b/pom.xml
index 01f44f94b7..87571932fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -635,11 +635,11 @@
<!-- *********************************************************************************************************** -->
<!-- Dependencies -->
<dependencies>
- <dependency>
- <groupId>org.onap.logging-analytics</groupId>
- <artifactId>logging-slf4j</artifactId>
- <version>1.5.0-SNAPSHOT</version>
- </dependency>
+ <dependency>
+ <groupId>org.onap.logging-analytics</groupId>
+ <artifactId>logging-slf4j</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-filter-base</artifactId>