aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common/src
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-10-12 15:11:07 +0000
committerGerrit Code Review <gerrit@onap.org>2018-10-12 15:11:07 +0000
commitd6c21ac6f38474841d3b9ced0524fe7671ae8682 (patch)
treeac5a12fd0acdc5e0f07fe5089637b7da279e37bc /bpmn/so-bpmn-infrastructure-common/src
parentea7f1ce7584deb1e4896ffcddb8c45e64422a9d0 (diff)
parent6ba0a22bc952232d14d2d24c5f73a42aae2791a9 (diff)
Merge "Dynamic Cloud Owner Support"
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy33
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy77
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy228
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy152
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy428
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy15
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy67
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy40
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy204
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy25
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy26
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy94
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy62
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy85
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy64
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy220
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy88
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy177
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java121
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstanceTest.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceTest.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy15
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/resources/application-test.yml619
41 files changed, 1410 insertions, 1528 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy
index d665de2ba7..bdb44ca3e2 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy
@@ -280,6 +280,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
String requestId = execution.getVariable("mso-request-id")
String source = execution.getVariable(Prefix + "source")
+ String networkId = execution.getVariable("networkId") !=null ? execution.getVariable("networkId") : ""
String msoCompletionRequest =
"""<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
@@ -290,6 +291,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
<source>VID</source>
</request-info>
<aetgt:status-message>Network has been created successfully.</aetgt:status-message>
+ <aetgt:networkId>${MsoUtils.xmlEscape(networkId)}</aetgt:networkId>
<aetgt:mso-bpel-name>BPMN Network action: CREATE</aetgt:mso-bpel-name>
</aetgt:MsoCompletionRequest>"""
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy
index 6acabe14a0..ffac4c0174 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy
@@ -186,6 +186,10 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration
def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId
execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId)
+
+ def cloudOwner = cloudConfiguration.cloudOwner
+ execution.setVariable(prefix + 'cloudOwner', cloudOwner)
+
def tenantId = cloudConfiguration.tenantId
execution.setVariable(prefix + 'tenantId', tenantId)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy
index aa569655f4..965d178cce 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy
@@ -109,6 +109,10 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
def lcpCloudRegionId = requestMap.requestDetails.cloudConfiguration.lcpCloudRegionId
execution.setVariable('lcpCloudRegionId', lcpCloudRegionId)
+ // cloudOwner
+ def cloudOwner = requestMap.requestDetails.cloudConfiguration.cloudOwner
+ execution.setVariable('cloudOwner', cloudOwner)
+
// tenant
def tenantId = requestMap.requestDetails.cloudConfiguration.tenantId
execution.setVariable('tenantId', tenantId)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy
index 2cbfeac239..7ddfdece9a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,11 +30,16 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.VidUtils;
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.constants.Defaults
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
import org.onap.so.rest.APIResponse
import org.springframework.web.util.UriUtils
+
import groovy.json.JsonSlurper
/**
@@ -135,7 +140,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
execution.setVariable('DELVfModVol_cloudRegion', utils.getNodeText(request, 'aic-cloud-region'))
setBasicDBAuthHeader(execution, isDebugLogEnabled)
-
+
msoLogger.debug('Request: ' + createVolumeIncoming)
}
@@ -184,12 +189,12 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
String cloudRegion = execution.getVariable('DELVfModVol_cloudRegion')
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUtil = new AaiUtil(this)
- String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution)
- String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+ def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
+
execution.setVariable("DELVfModVol_queryCloudRegionRequest", queryCloudRegionRequest)
- msoLogger.debug(" DELVfModVol_queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest)
cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
@@ -229,8 +234,9 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
String cloudRegion = execution.getVariable('DELVfModVol_aicCloudRegion')
AaiUtil aaiUtil = new AaiUtil(this)
- String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution)
- String queryAAIVolumeGroupRequest = aaiEndpoint + '/' + URLEncoder.encode(cloudRegion, "UTF-8") + "/volume-groups/volume-group/" + UriUtils.encode(volumeGroupId, "UTF-8")
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion, volumeGroupId)
+ def queryAAIVolumeGroupRequest = aaiUtil.createAaiUri(uri)
msoLogger.debug('Query AAI volume group by ID: ' + queryAAIVolumeGroupRequest)
@@ -351,7 +357,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
def serviceId = execution.getVariable('DELVfModVol_serviceId')
def messageId = execution.getVariable('DELVfModVol_messageId')
- def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
+ def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host", execution)
if ('true'.equals(useQualifiedHostName)) {
notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
@@ -388,8 +394,9 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
String cloudRegion = execution.getVariable('DELVfModVol_aicCloudRegion')
AaiUtil aaiUtil = new AaiUtil(this)
- String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution)
- String deleteAAIVolumeGrpIdRequest = aaiEndpoint + '/' + URLEncoder.encode(cloudRegion, "UTF-8") + "/volume-groups/volume-group/" + UriUtils.encode(groupId, "UTF-8")
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion, groupId).queryParam("resource-version", resourceVersion)
+ def deleteAAIVolumeGrpIdRequest = aaiUtil.createAaiUri(uri)
if(resourceVersion !=null){
deleteAAIVolumeGrpIdRequest = deleteAAIVolumeGrpIdRequest +'?resource-version=' + UriUtils.encode(resourceVersion, 'UTF-8')
@@ -436,7 +443,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
requestStatus = "FAILURE"
progress = ""
}
-
+
String updateInfraRequest = """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:req="http://org.onap.so/requestsdb">
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
index b6a02f29e7..856ff6c063 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
@@ -152,26 +152,15 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
oStatus = "Created"
}
- String statusLine = isBlank(oStatus) ? "" : "<orchestration-status>${MsoUtils.xmlEscape(oStatus)}</orchestration-status>"
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
- String serviceInstanceData =
- """<service-instance xmlns=\"${namespace}\">
- <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <service-instance-name>${MsoUtils.xmlEscape(serviceInstanceName)}</service-instance-name>
- <service-type>${MsoUtils.xmlEscape(aaiServiceType)}</service-type>
- <service-role>${MsoUtils.xmlEscape(aaiServiceRole)}</service-role>
- ${statusLine}
- <model-invariant-id>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-id>
- <model-version-id>${MsoUtils.xmlEscape(modelUuid)}</model-version-id>
- <input-parameters>${MsoUtils.xmlEscape(uuiRequest)}</input-parameters>
- </service-instance>""".trim()
- execution.setVariable("serviceInstanceData", serviceInstanceData)
- msoLogger.debug(serviceInstanceData)
- msoLogger.info(" aai_uri " + aai_uri + " namespace:" + namespace)
- msoLogger.info(" 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData)
+ org.onap.aai.domain.yang.ServiceInstance si = new org.onap.aai.domain.yang.ServiceInstance()
+ si.setServiceInstanceName(serviceInstanceName)
+ si.setServiceType(aaiServiceType)
+ si.setServiceRole(aaiServiceRole)
+ si.setOrchestrationStatus(oStatus)
+ si.setModelInvariantId(modelInvariantUuid)
+ si.setModelVersionId(modelUuid)
+ si.setInputParameters(uuiRequest)
+ execution.setVariable("serviceInstanceData", si)
} catch (BpmnError e) {
throw e;
@@ -273,41 +262,35 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
}
//TODO use create if not exist
- public void postProcessAAIPUT(DelegateExecution execution) {
- msoLogger.trace("postProcessAAIPUT ")
+ public void createServiceInstance(DelegateExecution execution) {
+ msoLogger.trace("createServiceInstance ")
String msg = ""
+ String serviceInstanceId = UUID.randomUUID().toString()
try {
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator")
- if(!succInAAI){
- msoLogger.info("Error putting Service-instance in AAI", + serviceInstanceId)
- WorkflowException workflowException = execution.getVariable("WorkflowException")
- msoLogger.debug("workflowException: " + workflowException)
- if(workflowException != null){
- exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
- }
- }
- else
- {
- //start rollback set up
- RollbackData rollbackData = new RollbackData()
- def disableRollback = execution.getVariable("disableRollback")
- rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
- rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
- rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId)
- rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
- rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
- execution.setVariable("rollbackData", rollbackData)
- }
+ org.onap.aai.domain.yang.ServiceInstance si = execution.getVariable("serviceInstanceData")
+
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), serviceInstanceId)
+ client.create(uri, si)
} catch (BpmnError e) {
throw e;
} catch (Exception ex) {
- msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage()
+ //start rollback set up
+ RollbackData rollbackData = new RollbackData()
+ def disableRollback = execution.getVariable("disableRollback")
+ rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
+ rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
+ rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId)
+ rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
+ rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
+ execution.setVariable("rollbackData", rollbackData)
+
+ msg = "Exception in DoCreateServiceInstance.createServiceInstance. " + ex.getMessage()
msoLogger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit postProcessAAIPUT ")
+ msoLogger.trace("Exit createServiceInstance ")
}
/**
@@ -469,7 +452,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
msoLogger.trace("COMPLETED preInitResourcesOperStatus Process ")
}
- // if site location is in local Operator, create all resources in local ONAP;
+ // if site location is in local Operator, create all resources in local ONAP;
// if site location is in 3rd Operator, only process sp-partner to create all resources in 3rd ONAP
public void doProcessSiteLocation(DelegateExecution execution){
msoLogger.trace("======== Start doProcessSiteLocation Process ======== ")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
index 731d9c24de..51574f63f8 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
@@ -20,6 +20,8 @@
package org.onap.so.bpmn.infrastructure.scripts;
+import javax.ws.rs.core.UriBuilder
+
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
@@ -33,22 +35,27 @@ import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.logger.MsoLogger
-import org.onap.so.rest.APIResponse;
-import org.springframework.web.util.UriUtils
-import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
-import org.onap.so.client.aai.entities.AAIResultWrapper
-import org.onap.so.client.aai.entities.Relationships
+import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.json.JSONObject
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.graphinventory.entities.uri.Depth
+import org.onap.so.constants.Defaults
+import org.onap.so.logger.MsoLogger
+import org.onap.so.rest.APIResponse;
+import org.springframework.web.util.UriUtils
+import org.onap.aai.domain.yang.VpnBinding
+import org.onap.aai.domain.yang.RouteTarget
+
+import com.fasterxml.jackson.jaxrs.util.EndpointAsBeanProperty
+
import javax.ws.rs.NotFoundException
import groovy.json.*
import groovy.xml.XmlUtil
-
/**
* This groovy class supports the <class>DoCreateNetworkInstance.bpmn</class> process.
*
@@ -360,8 +367,11 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
// Prepare AA&I url with network-name
String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String queryAAINameRequest = "${aai_endpoint}${aai_uri}" + "?network-name=" + networkName
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK)
+ uri.queryParam("network-name", networkName)
+ String queryAAINameRequest = aaiUriUtil.createAaiUri(uri)
+
execution.setVariable(Prefix + "queryNameAAIRequest", queryAAINameRequest)
msoLogger.debug(Prefix + "queryNameAAIRequest - " + "\n" + queryAAINameRequest)
@@ -429,15 +439,14 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
try {
String networkInputs = execution.getVariable(Prefix + "networkInputs")
String cloudRegion = utils.getNodeText(networkInputs, "aic-cloud-region")
- cloudRegion = UriUtils.encode(cloudRegion,"UTF-8")
// Prepare AA&I url
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUtil = new AaiUtil(this)
- String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution)
- String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+ def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
+
execution.setVariable(Prefix + "queryCloudRegionRequest", queryCloudRegionRequest)
- msoLogger.debug(Prefix + "queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest)
String cloudRegionPo = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
String cloudRegionSdnc = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "SDNC", cloudRegion)
@@ -508,11 +517,11 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
networkId = UriUtils.encode(networkId,"UTF-8")
- // Prepare AA&I url
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String queryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all"
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId)
+ uri.depth(Depth.ALL)
+ String queryIdAAIRequest = aaiUriUtil.createAaiUri(uri)
+
execution.setVariable(Prefix + "queryIdAAIRequest", queryIdAAIRequest)
msoLogger.debug(Prefix + "queryIdAAIRequest - " + "\n" + queryIdAAIRequest)
@@ -580,10 +589,11 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
networkId = UriUtils.encode(networkId,"UTF-8")
// Prepare AA&I url
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String requeryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all"
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId)
+ uri.depth(Depth.ALL)
+ String requeryIdAAIRequest = aaiUriUtil.createAaiUri(uri)
+
execution.setVariable(Prefix + "requeryIdAAIRequest", requeryIdAAIRequest)
msoLogger.debug(Prefix + "requeryIdAAIRequest - " + "\n" + requeryIdAAIRequest)
@@ -660,91 +670,37 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "vpnCount", vpnCount)
msoLogger.debug(Prefix + "vpnCount - " + vpnCount)
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
- AaiUtil aaiUriUtil = new AaiUtil(this)
-
if (vpnCount > 0) {
execution.setVariable(Prefix + "vpnBindings", vpnBindingUri)
msoLogger.debug(" vpnBindingUri List - " + vpnBindingUri)
String routeTargets = ""
// AII loop call using list vpnBindings
- for (i in 0..vpnBindingUri.size()-1) {
-
+ for(i in 0..vpnBindingUri.size()-1) {
int counting = i+1
- // prepare url using vpnBinding
- String queryVpnBindingAAIRequest = ""
- String aai_uri = aaiUriUtil.getNetworkVpnBindingUri(execution)
-
- // Note: By default, the vpnBinding url is found in 'related-link' of the response,
- // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping.
- if (aai_uri == null || aai_uri == "") {
- // using value of 'related-link' from response
- if (vpnBindingUri[i].charAt(vpnBindingUri[i].length()-1) == '/') {
- queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i].substring(0, vpnBindingUri[i].length()-1) + "?depth=all"
- } else {
- queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i] + "?depth=all"
- }
-
- } else {
- // using uri value in URN mapping
- String vpnBindingId = vpnBindingUri[i].substring(vpnBindingUri[i].indexOf("/vpn-binding/")+13, vpnBindingUri[i].length())
- if (vpnBindingId.charAt(vpnBindingId.length()-1) == '/') {
- vpnBindingId = vpnBindingId.substring(0, vpnBindingId.length()-1)
- }
- queryVpnBindingAAIRequest = "${aai_endpoint}${aai_uri}/" + vpnBindingId + "?depth=all"
+ String vpnBindingId = vpnBindingUri[i].substring(vpnBindingUri[i].indexOf("/vpn-binding/")+13, vpnBindingUri[i].length())
+ if (vpnBindingId.charAt(vpnBindingId.length()-1) == '/') {
+ vpnBindingId = vpnBindingId.substring(0, vpnBindingId.length()-1)
}
- execution.setVariable(Prefix + "queryVpnBindingAAIRequest", queryVpnBindingAAIRequest)
- msoLogger.debug(Prefix + "queryVpnBindingAAIRequest, , vpnBinding #" + counting + " : " + "\n" + queryVpnBindingAAIRequest)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryVpnBindingAAIRequest)
- String returnCode = response.getStatusCode()
- execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", returnCode)
- msoLogger.debug(" ***** AAI query vpn binding Response Code, vpnBinding #" + counting + " : " + returnCode)
-
- String aaiResponseAsString = response.getResponseBodyAsString()
-
- if (returnCode=='200') {
- execution.setVariable(Prefix + "queryVpnBindingAAIResponse", aaiResponseAsString)
- msoLogger.debug(" AAI Query Vpn Binding Success REST Response, , vpnBinding #" + counting + " : " + "\n" + aaiResponseAsString)
-
- String routeTarget = ""
- String routeRole = ""
- if (utils.nodeExists(aaiResponseAsString, "route-targets")) {
- String aaiRouteTargets = utils.getNodeXml(aaiResponseAsString, "route-targets", false)
- def aaiRouteTargetsXml = new XmlSlurper().parseText(aaiRouteTargets)
- def aaiRouteTarget = aaiRouteTargetsXml.'**'.findAll {it.name() == "route-target"}
- for (j in 0..aaiRouteTarget.size()-1) {
- routeTarget = utils.getNodeText(XmlUtil.serialize(aaiRouteTarget[j]), "global-route-target")
- routeRole = utils.getNodeText(XmlUtil.serialize(aaiRouteTarget[j]), "route-target-role")
- routeTargets += "<routeTargets>" + '\n' +
- " <routeTarget>" + routeTarget + "</routeTarget>" + '\n' +
- " <routeTargetRole>" + routeRole + "</routeTargetRole>" + '\n' +
- "</routeTargets>" + '\n'
- }
- }
-
- } else {
- if (returnCode=='404') {
- String dataErrorMessage = "Response Error from AAINetworkVpnBinding is 404 (Not Found)."
- msoLogger.debug(dataErrorMessage)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
-
- } else {
- if (aaiResponseAsString.contains("RESTFault")) {
- WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution)
- execution.setVariable("WorkflowException", exceptionObject)
- throw new BpmnError("MSOWorkflowException")
-
- } else {
- // aai all errors
- String dataErrorMessage = " Unexpected Response from AAINetworkVpnBinding - " + returnCode
- msoLogger.debug(dataErrorMessage)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
-
- }
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnBindingId)
+ AAIResultWrapper wrapper = resourceClient.get(uri.depth(Depth.TWO), NotFoundException.class)
+
+ Optional<VpnBinding> binding = wrapper.asBean(VpnBinding.class)
+
+ String routeTarget = ""
+ String routeRole = ""
+ if(binding.get().getRouteTargets() != null) {
+ List<RouteTarget> targets = binding.get().getRouteTargets().getRouteTarget()
+ for(RouteTarget target : targets) {
+ routeTarget = target.getGlobalRouteTarget()
+ routeRole = target.getRouteTargetRole()
+ routeTargets += "<routeTargets>" + '\n' +
+ " <routeTarget>" + routeTarget + "</routeTarget>" + '\n' +
+ " <routeTargetRole>" + routeRole + "</routeTargetRole>" + '\n' +
+ "</routeTargets>" + '\n'
}
}
@@ -756,8 +712,8 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
} else {
// reset return code to success
execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200")
- String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri)
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ String schemaVersion = aaiUriUtil.getNamespace()
String aaiStubResponse =
""" <rest:payload contentType="text/xml" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd">
<vpn-binding xmlns="${schemaVersion}">
@@ -771,9 +727,9 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
}
- } catch (BpmnError e) {
- throw e;
-
+ } catch (NotFoundException e) {
+ msoLogger.debug("Response Error from AAINetworkVpnBinding is 404 (Not Found).")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Response Error from AAINetworkVpnBinding is 404 (Not Found).")
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkVpnBinding() - " + ex.getMessage()
msoLogger.debug(exceptionMessage)
@@ -801,7 +757,6 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "networkPolicyCount", networkPolicyCount)
msoLogger.debug(Prefix + "networkPolicyCount - " + networkPolicyCount)
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUriUtil = new AaiUtil(this)
if (networkPolicyCount > 0) {
@@ -814,31 +769,14 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
int counting = i+1
- // prepare url using vpnBinding
- String queryNetworkPolicyAAIRequest = ""
-
- String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution)
-
// Note: By default, the network policy url is found in 'related-link' of the response,
// so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping.
- if (aai_uri == null || aai_uri == "") {
- // using value of 'related-link' from response
- if (networkPolicyUriList[i].charAt(networkPolicyUriList[i].length()-1) == '/') {
- queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i].substring(0, networkPolicyUriList[i].length()-1) + "?depth=all"
- } else {
- queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i] + "?depth=all"
- }
- } else {
- // using uri value in URN mapping
- String networkPolicyId = networkPolicyUriList[i].substring(networkPolicyUriList[i].indexOf("/network-policy/")+16, networkPolicyUriList[i].length())
- println " networkPolicyId - " + networkPolicyId
- if (networkPolicyId.charAt(networkPolicyId.length()-1) == '/') {
- networkPolicyId = networkPolicyId.substring(0, networkPolicyId.length()-1)
- }
- queryNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + networkPolicyId + "?depth=all"
- }
+ URI uri = UriBuilder.fromUri(networkPolicyUriList[i]).build()
+ AAIResourceUri aaiUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.NETWORK_POLICY, uri)
+ aaiUri.depth(Depth.ALL)
+ String queryNetworkPolicyAAIRequest = aaiUriUtil.createAaiUri(aaiUri)
execution.setVariable(Prefix + "queryNetworkPolicyAAIRequest", queryNetworkPolicyAAIRequest)
msoLogger.debug(Prefix + "queryNetworkPolicyAAIRequest, , NetworkPolicy #" + counting + " : " + "\n" + queryNetworkPolicyAAIRequest)
@@ -890,8 +828,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
} else {
// reset return code to success
execution.setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "200")
- String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri)
+ String schemaVersion = aaiUriUtil.getNamespace()
String aaiStubResponse =
""" <rest:payload contentType="text/xml" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd">
<network-policy xmlns="${schemaVersion}">
@@ -949,30 +886,11 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
int counting = i+1
// prepare url using tableRef
- String queryNetworkTableRefAAIRequest = ""
-
- String aai_uri = aaiUriUtil.getNetworkTableReferencesUri(execution)
-
- // Note: By default, the network policy url is found in 'related-link' of the response,
- // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping.
- if (aai_uri == null || aai_uri == "") {
- // using value of 'related-link' from response
- if (networkTableRefUriList[i].charAt(networkTableRefUriList[i].length()-1) == '/') {
- queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i].substring(0, networkTableRefUriList[i].length()-1) + "?depth=all"
- } else {
- queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i] + "?depth=all"
- }
- } else {
- // using uri value in URN mapping
- String networkTableRefId = networkTableRefUriList[i].substring(networkTableRefUriList[i].indexOf("/route-table-reference/")+23, networkTableRefUriList[i].length())
-
- if (networkTableRefId.charAt(networkTableRefId.length()-1) == '/') {
- networkTableRefId = networkTableRefId.substring(0, networkTableRefId.length()-1)
- }
- queryNetworkTableRefAAIRequest = "${aai_endpoint}${aai_uri}/" + networkTableRefId + "?depth=all"
-
- }
+ URI uri = UriBuilder.fromUri(networkTableRefUriList[i]).build()
+ AAIResourceUri aaiUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ROUTE_TABLE_REFERENCE, uri)
+ aaiUri.depth(Depth.ALL)
+ String queryNetworkTableRefAAIRequest = aaiUriUtil.createAaiUri(aaiUri)
execution.setVariable(Prefix + "queryNetworkTableRefAAIRequest", queryNetworkTableRefAAIRequest)
msoLogger.debug(Prefix + "queryNetworkTableRefAAIRequest, , NetworkTableRef #" + counting + " : " + "\n" + queryNetworkTableRefAAIRequest)
@@ -1024,8 +942,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
} else {
// reset return code to success
execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "200")
- String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri)
+ String schemaVersion = aaiUriUtil.getNamespace()
String aaiStubResponse =
""" <rest:payload contentType="text/xml" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd">
<route-table-references xmlns="${schemaVersion}">
@@ -1066,16 +983,17 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String createNetworkResponse = execution.getVariable(Prefix + "createNetworkResponse")
// Prepare url
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String updateContrailAAIUrlRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all"
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId)
+ uri.depth(Depth.ALL)
+ String updateContrailAAIUrlRequest = aaiUriUtil.createAaiUri(uri)
execution.setVariable(Prefix + "updateContrailAAIUrlRequest", updateContrailAAIUrlRequest)
msoLogger.debug(Prefix + "updateContrailAAIUrlRequest - " + "\n" + updateContrailAAIUrlRequest)
//Prepare payload (PUT)
- String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri)
+ String schemaVersion = aaiUriUtil.getNamespaceFromUri(updateContrailAAIUrlRequest)
String payload = networkUtils.ContrailNetworkCreatedUpdate(requeryIdAAIResponse, createNetworkResponse, schemaVersion)
String payloadXml = utils.formatXml(payload)
execution.setVariable(Prefix + "updateContrailAAIPayloadRequest", payloadXml)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
index b44940eb20..38836c3650 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
@@ -40,10 +40,15 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.domain.ServiceInstance
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
import org.onap.so.rest.APIResponse
-import org.springframework.web.util.UriUtils
import groovy.json.*
@@ -267,58 +272,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
if (siParamsXml == null)
siParamsXml = ""
execution.setVariable("siParamsXml", siParamsXml)
-
- //AAI PUT
- String oStatus = execution.getVariable("initialStatus") ?: "Active"
- if ("TRANSPORT".equalsIgnoreCase(serviceType))
- {
- oStatus = "Created"
- }
-
- String statusLine = isBlank(oStatus) ? "" : "<orchestration-status>${MsoUtils.xmlEscape(oStatus)}</orchestration-status>"
- String serviceTypeLine = isBlank(serviceType) ? "" : "<service-type>${MsoUtils.xmlEscape(serviceType)}</service-type>"
- String serviceRoleLine = isBlank(serviceRole) ? "" : "<service-role>${MsoUtils.xmlEscape(serviceRole)}</service-role>"
-
- //QUERY CATALOG DB AND GET WORKLOAD / ENVIRONMENT CONTEXT
- String environmentContext = ""
- String workloadContext =""
-
- try{
- String json = cutils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
-
- msoLogger.debug("JSON IS: "+json)
-
- environmentContext = jsonUtil.getJsonValue(json, "serviceResources.environmentContext") ?: ""
- workloadContext = jsonUtil.getJsonValue(json, "serviceResources.workloadContext") ?: ""
- msoLogger.debug("Env Context is: "+ environmentContext)
- msoLogger.debug("Workload Context is: "+ workloadContext)
- }catch(BpmnError e){
- throw e
- } catch (Exception ex){
- msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
-
- //Create AAI Payload
- AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
- String serviceInstanceData =
- """<service-instance xmlns=\"${namespace}\">
- <service-instance-name>${MsoUtils.xmlEscape(serviceInstanceName)}</service-instance-name>
- ${serviceTypeLine}
- ${serviceRoleLine}
- ${statusLine}
- <model-invariant-id>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-id>
- <model-version-id>${MsoUtils.xmlEscape(modelUuid)}</model-version-id>
- <environment-context>${MsoUtils.xmlEscape(environmentContext)}</environment-context>
- <workload-context>${MsoUtils.xmlEscape(workloadContext)}</workload-context>
- </service-instance>""".trim()
-
- execution.setVariable("serviceInstanceData", serviceInstanceData)
- msoLogger.debug(" 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData)
-
+
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
@@ -338,16 +292,17 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
String globalCustomerId = execution.getVariable("globalSubscriberId") //VID to AAI name map
msoLogger.debug(" ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId)
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- if (isBlank(aai_endpoint) || isBlank(aai_uri))
+
+ AAIUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalCustomerId)
+ String getAAICustomerUrl = aaiUriUtil.createAaiUri(uri)
+
+ if (isBlank(getAAICustomerUrl))
{
- msg = "AAI URL is invalid. Endpoint:" + aai_endpoint + aai_uri
+ msg = "AAI URL is invalid. Endpoint:" + getAAICustomerUrl
msoLogger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
- String getAAICustomerUrl = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8")
msoLogger.debug("getAAICustomerById Url:" + getAAICustomerUrl)
APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getAAICustomerUrl)
@@ -399,42 +354,75 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
}
- public void postProcessAAIPUT(DelegateExecution execution) {
+ public void putServiceInstance(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("postProcessAAIPUT")
+ msoLogger.trace("putServiceInstance")
String msg = ""
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
try {
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator")
- if(!succInAAI){
- msoLogger.debug("Error putting Service-instance in AAI", + serviceInstanceId)
- WorkflowException workflowException = execution.getVariable("WorkflowException")
- msoLogger.debug("workflowException: " + workflowException)
- if(workflowException != null){
- exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
- }
- }
- else
+
+ String serviceType = execution.getVariable("serviceType")
+ //AAI PUT
+ String oStatus = execution.getVariable("initialStatus") ?: "Active"
+ if ("TRANSPORT".equalsIgnoreCase(serviceType))
{
- //start rollback set up
- RollbackData rollbackData = new RollbackData()
- def disableRollback = execution.getVariable("disableRollback")
- rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
- rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
- rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId)
- rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
- rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
- execution.setVariable("rollbackData", rollbackData)
+ oStatus = "Created"
}
+
+ //QUERY CATALOG DB AND GET WORKLOAD / ENVIRONMENT CONTEXT
+ String environmentContext = ""
+ String workloadContext =""
+ String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+
+ try{
+ String json = cutils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
+
+ msoLogger.debug("JSON IS: "+json)
+
+ environmentContext = jsonUtil.getJsonValue(json, "serviceResources.environmentContext") ?: ""
+ workloadContext = jsonUtil.getJsonValue(json, "serviceResources.workloadContext") ?: ""
+ msoLogger.debug("Env Context is: "+ environmentContext)
+ msoLogger.debug("Workload Context is: "+ workloadContext)
+ }catch(BpmnError e){
+ throw e
+ } catch (Exception ex){
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ msoLogger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ org.onap.aai.domain.yang.ServiceInstance si = new org.onap.aai.domain.yang.ServiceInstance()
+ si.setServiceInstanceName(execution.getVariable("serviceInstanceName"))
+ si.setServiceType(serviceType)
+ si.setServiceRole(execution.getVariable("serviceRole"))
+ si.setOrchestrationStatus(oStatus)
+ si.setModelInvariantId(modelInvariantUuid)
+ si.setModelVersionId(execution.getVariable("modelUuid"))
+ si.setEnvironmentContext(environmentContext)
+ si.setWorkloadContext(workloadContext)
+
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), serviceInstanceId)
+ client.create(uri, si)
} catch (BpmnError e) {
throw e;
} catch (Exception ex) {
- msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage()
+ //start rollback set up
+ RollbackData rollbackData = new RollbackData()
+ def disableRollback = execution.getVariable("disableRollback")
+ rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
+ rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
+ rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId)
+ rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
+ rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
+ execution.setVariable("rollbackData", rollbackData)
+
+ msg = "Exception in DoCreateServiceInstance.putServiceInstance. " + ex.getMessage()
msoLogger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit postProcessAAIPUT")
+ msoLogger.trace("Exit putServiceInstance")
}
public void preProcessSDNCAssignRequest(DelegateExecution execution) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
index da3ecbaef0..6783808826 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,6 +27,7 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.json.JSONArray
import org.json.JSONObject
+import org.onap.aai.domain.yang.GenericVnf
import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.CatalogDbUtils
import org.onap.so.bpmn.common.scripts.ExceptionUtil
@@ -41,11 +42,15 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.DecomposeJsonUtil
import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.graphinventory.entities.uri.Depth
+import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.constants.Defaults
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
import org.onap.so.rest.APIResponse
@@ -65,7 +70,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
public class DoCreateVfModule extends VfModuleBase {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVfModule.class);
-
+
String Prefix="DCVFM_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -81,7 +86,7 @@ public class DoCreateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
-
+
msoLogger.trace('Entered ' + method)
execution.setVariable('prefix', Prefix)
@@ -100,13 +105,13 @@ public class DoCreateVfModule extends VfModuleBase {
if (request == null || request.isEmpty()) {
// Building Block-type request
- String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo")
-
+ String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo")
+
def serviceModelInfo = execution.getVariable("serviceModelInfo")
msoLogger.debug("serviceModelInfo: " + serviceModelInfo)
String modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid")
msoLogger.debug("modelInvariantUuid: " + modelInvariantUuid)
-
+
def vnfModelInfo = execution.getVariable("vnfModelInfo")
//tenantId
@@ -124,6 +129,11 @@ public class DoCreateVfModule extends VfModuleBase {
execution.setVariable("DCVFM_cloudSiteId", cloudSiteId)
rollbackData.put("VFMODULE", "aiccloudregion", cloudSiteId)
msoLogger.debug("cloudSiteId: " + cloudSiteId)
+ //cloudOwner
+ def cloudOwner = execution.getVariable("cloudOwner")
+ execution.setVariable("DCVFM_cloudOwner", cloudOwner)
+ rollbackData.put("VFMODULE", "cloudOwner", cloudOwner)
+ msoLogger.debug("cloudOwner: " + cloudOwner)
//vnfType
def vnfType = execution.getVariable("vnfType")
execution.setVariable("DCVFM_vnfType", vnfType)
@@ -238,15 +248,15 @@ public class DoCreateVfModule extends VfModuleBase {
execution.setVariable("DCVFM_usePreload", usePreload)
msoLogger.debug("usePreload: " + usePreload)
//aLaCarte
- def aLaCarte = execution.getVariable("aLaCarte")
+ def aLaCarte = execution.getVariable("aLaCarte")
execution.setVariable("DCVFM_aLaCarte", aLaCarte)
msoLogger.debug("aLaCarte: " + aLaCarte)
-
+
//get workload and environment context from parent SI
String environmentContext = ""
String workloadContext =""
String serviceType =""
-
+
try{
String json = catalog.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
serviceType = jsonUtil.getJsonValue(json, "serviceResources.serviceType")
@@ -257,7 +267,7 @@ public class DoCreateVfModule extends VfModuleBase {
msoLogger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
-
+
try{
AAIUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId)
AAIResourcesClient aaiRC = new AAIResourcesClient()
@@ -265,14 +275,14 @@ public class DoCreateVfModule extends VfModuleBase {
Map<String, Object> aaiJson = aaiRW.asMap()
environmentContext = aaiJson.getOrDefault("environment-context","")
workloadContext = aaiJson.getOrDefault("workload-context","")
-
+
}catch (Exception ex) {
msoLogger.debug("Error retreiving parent service instance information")
}
-
+
execution.setVariable("DCVFM_environmentContext",environmentContext)
execution.setVariable("DCVFM_workloadContext",workloadContext)
-
+
}
else {
// The info is inside the request - DEAD CODE
@@ -400,7 +410,7 @@ public class DoCreateVfModule extends VfModuleBase {
isBaseVfModule = utils.getNodeText(request, "is-base-vf-module")
}
execution.setVariable("DCVFM_isBaseVfModule", isBaseVfModule)
- msoLogger.debug("isBaseVfModule: " + isBaseVfModule)
+ msoLogger.debug("isBaseVfModule: " + isBaseVfModule)
//asdcServiceModelVersion
def asdcServiceModelVersion = ""
if (utils.nodeExists(request, "asdc-service-model-version")) {
@@ -479,7 +489,7 @@ public class DoCreateVfModule extends VfModuleBase {
}
msoLogger.debug("sdncVersion: " + sdncVersion)
execution.setVariable("DCVFM_sdncVersion", sdncVersion)
-
+
execution.setVariable("DCVFM_uuid", uuid)
execution.setVariable("DCVFM_baseVfModuleId", "")
execution.setVariable("DCVFM_baseVfModuleHeatStackId", "")
@@ -544,7 +554,7 @@ public class DoCreateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.sendResponse(' +
'execution=' + execution.getId() +
')'
-
+
msoLogger.trace('Entered ' + method)
try {
@@ -554,7 +564,7 @@ public class DoCreateVfModule extends VfModuleBase {
throw e;
} catch (Exception e) {
msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
-
+
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Internal Error')
}
}
@@ -570,7 +580,7 @@ public class DoCreateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.getVfModule(' +
'execution=' + execution.getId() +
')'
-
+
msoLogger.trace('Entered ' + method)
try {
@@ -614,7 +624,7 @@ public class DoCreateVfModule extends VfModuleBase {
* @param execution The flow's execution instance.
*/
public void queryAAIVfModule(DelegateExecution execution) {
-
+
def method = getClass().getSimpleName() + '.getVfModule(' +
'execution=' + execution.getId() +
')'
@@ -625,10 +635,8 @@ public class DoCreateVfModule extends VfModuleBase {
def vfModuleId = execution.getVariable('DCVFM_vfModuleId')
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- msoLogger.debug('AAI URI is: ' + aai_uri)
-
- String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
+ String endPoint = aaiUriUtil.createAaiUri(uri)
try {
RESTConfig config = new RESTConfig(endPoint);
@@ -688,23 +696,23 @@ public class DoCreateVfModule extends VfModuleBase {
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage())
}
}
-
+
/**
- * Using the vnfId and vfModuleName provided in the inputs,
+ * Using the vnfId and vfModuleName provided in the inputs,
* query AAI to get the corresponding VF Module info.
- * A 200 response is expected with the VF Module info in the response body,
- * or a 404 response if the module does not exist yet. Will determine VF Module's
+ * A 200 response is expected with the VF Module info in the response body,
+ * or a 404 response if the module does not exist yet. Will determine VF Module's
* orchestration status if one exists
*
* @param execution The flow's execution instance.
*/
public void queryAAIVfModuleForStatus(DelegateExecution execution) {
-
+
def method = getClass().getSimpleName() + '.queryAAIVfModuleForStatus(' +
'execution=' + execution.getId() +
')'
msoLogger.trace('Entered ' + method)
-
+
execution.setVariable('DCVFM_orchestrationStatus', '')
try {
@@ -712,12 +720,8 @@ public class DoCreateVfModule extends VfModuleBase {
def vfModuleName = execution.getVariable('DCVFM_vfModuleName')
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- msoLogger.debug('AAI URI is: ' + aai_uri)
-
- String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") +
- "/vf-modules/vf-module?vf-module-name=" + UriUtils.encode(vfModuleName, "UTF-8")
- msoLogger.debug("AAI endPoint: " + endPoint)
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULES, vnfId).queryParam("vf-module-name",vfModuleName)
+ String endPoint = aaiUriUtil.createAaiUri(uri)
try {
RESTConfig config = new RESTConfig(endPoint);
@@ -755,7 +759,7 @@ public class DoCreateVfModule extends VfModuleBase {
def vfModuleId = utils.getNodeText(vfModuleText, "vf-module-id")
execution.setVariable("DCVFM_vfModuleId", vfModuleId)
msoLogger.debug("Received orchestration status from A&AI: " + orchestrationStatus)
-
+
}
}
} catch (Exception ex) {
@@ -774,7 +778,7 @@ public class DoCreateVfModule extends VfModuleBase {
public void preProcessSDNCAssignRequest(DelegateExecution execution){
-
+
execution.setVariable("prefix", Prefix)
msoLogger.trace("STARTED preProcessSDNCAssignRequest")
def vnfId = execution.getVariable("DCVFM_vnfId")
@@ -801,30 +805,30 @@ public class DoCreateVfModule extends VfModuleBase {
msoLogger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage())
}
msoLogger.trace("COMPLETED preProcessSDNCAssignRequest")
}
public void preProcessSDNCGetRequest(DelegateExecution execution, String element){
-
+
String sdncVersion = execution.getVariable("DCVFM_sdncVersion")
execution.setVariable("prefix", Prefix)
msoLogger.trace("STARTED preProcessSDNCGetRequest Process")
try{
def serviceInstanceId = execution.getVariable('DCVFM_serviceInstanceId')
-
+
String uuid = execution.getVariable('testReqId') // for junits
if(uuid==null){
uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis()
}
-
+
def callbackUrl = execution.getVariable("DCVFM_sdncCallbackUrl")
msoLogger.debug("callbackUrl:" + callbackUrl)
-
+
def vfModuleId = execution.getVariable('DCVFM_vfModuleId')
-
+
def svcInstId = ""
if (serviceInstanceId == null || serviceInstanceId.isEmpty()) {
svcInstId = vfModuleId
@@ -832,7 +836,7 @@ public class DoCreateVfModule extends VfModuleBase {
else {
svcInstId = serviceInstanceId
}
-
+
def msoAction = ""
if (!sdncVersion.equals("1707")) {
msoAction = "mobility"
@@ -840,33 +844,36 @@ public class DoCreateVfModule extends VfModuleBase {
else {
msoAction = "vfmodule"
}
- // For VNF, serviceOperation (URI for topology GET) will be retrieved from "selflink" element
- // in the response from GenericGetVnf
+ // For VNF, serviceOperation (URI for topology GET) will be retrieved from "selflink" element
// For VF Module, in 1707 serviceOperation will be retrieved from "object-path" element
// in SDNC Assign Response
// For VF Module for older versions, serviceOperation is constructed using vfModuleId
-
+
String serviceOperation = ""
if (element.equals("vnf")) {
- def vnfQueryResponse = execution.getVariable("DCVFM_vnfQueryResponse")
- serviceOperation = utils.getNodeText(vnfQueryResponse, "selflink")
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, execution.getVariable('DCVFM_vnfId'))
+ AAIResultWrapper wrapper = resourceClient.get(uri)
+
+ Optional<GenericVnf> vnf = wrapper.asBean(GenericVnf.class)
+ serviceOperation = vnf.get().getSelflink()
msoLogger.debug("VNF - service operation: " + serviceOperation)
}
else if (element.equals("vfmodule")) {
String response = execution.getVariable("DCVFM_assignSDNCAdapterResponse")
- msoLogger.debug("DCVFM_assignSDNCAdapterResponse is: \n" + response)
-
+ msoLogger.debug("DCVFM_assignSDNCAdapterResponse is: \n" + response)
+
if (!sdncVersion.equals("1707")) {
serviceOperation = "/VNF-API:vnfs/vnf-list/" + vfModuleId
msoLogger.debug("VF Module with sdncVersion before 1707 - service operation: " + serviceOperation)
}
- else {
- String data = utils.getNodeXml(response, "response-data")
+ else {
+ String data = utils.getNodeXml(response, "response-data")
msoLogger.debug("responseData: " + data)
serviceOperation = utils.getNodeText(data, "object-path")
msoLogger.debug("VF Module with sdncVersion of 1707 - service operation: " + serviceOperation)
- }
- }
+ }
+ }
//!!!! TEMPORARY WORKAROUND FOR SDNC REPLICATION ISSUE
sleep(5000)
@@ -890,7 +897,7 @@ public class DoCreateVfModule extends VfModuleBase {
msoLogger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage())
}
msoLogger.trace("COMPLETED preProcessSDNCGetRequest Process")
@@ -901,7 +908,7 @@ public class DoCreateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.VNFAdapterCreateVfModule(' +
'execution=' + execution.getId() +
')'
-
+
msoLogger.trace('Entered ' + method)
//def xml = execution.getVariable("DoCreateVfModuleRequest")
@@ -952,7 +959,7 @@ public class DoCreateVfModule extends VfModuleBase {
String workloadContext = execution.getVariable("DCVFM_workloadContext")
msoLogger.debug("workloadContext: " + workloadContext)
msoLogger.debug("environmentContext: " + environmentContext)
-
+
def messageId = execution.getVariable('mso-request-id') + '-' +
System.currentTimeMillis()
@@ -972,9 +979,9 @@ public class DoCreateVfModule extends VfModuleBase {
String vfModuleSdncGetResponse = execution.getVariable('DCVFM_getSDNCAdapterResponse')
msoLogger.debug("sdncGetResponse: " + vfModuleSdncGetResponse)
def sdncVersion = execution.getVariable("sdncVersion")
-
+
if (!sdncVersion.equals("1707")) {
-
+
vfModuleParams = buildVfModuleParams(vnfParamsMap, vfModuleSdncGetResponse, vnfId, vnfName,
vfModuleId, vfModuleName, vfModuleIndex, environmentContext, workloadContext)
}
@@ -982,9 +989,9 @@ public class DoCreateVfModule extends VfModuleBase {
//Get SDNC Response Data for Vnf Topology
String vnfSdncGetResponse = execution.getVariable('DCVFM_getVnfSDNCAdapterResponse')
msoLogger.debug("vnfSdncGetResponse: " + vnfSdncGetResponse)
-
+
vfModuleParams = buildVfModuleParamsFromCombinedTopologies(vnfParamsMap, vnfSdncGetResponse, vfModuleSdncGetResponse, vnfId, vnfName,
- vfModuleId, vfModuleName, vfModuleIndex, environmentContext, workloadContext)
+ vfModuleId, vfModuleName, vfModuleIndex, environmentContext, workloadContext)
}
def svcInstId = ""
@@ -1041,7 +1048,7 @@ public class DoCreateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.validateInfraRequest(' +
'execution=' + execution.getId() +
')'
-
+
msoLogger.trace('Entered ' + method)
String processKey = getProcessKey(execution);
@@ -1103,7 +1110,7 @@ public class DoCreateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.isVolumeGroupIdPresent(' +
'execution=' + execution.getId() +
')'
-
+
msoLogger.trace('Entered ' + method)
def request = execution.getVariable('DoCreateVfModuleRequest')
@@ -1124,7 +1131,7 @@ public class DoCreateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.isVolumeGroupNamePresent(' +
'execution=' + execution.getId() +
')'
-
+
msoLogger.trace('Entered ' + method)
def request = execution.getVariable('DoCreateVfModuleRequest')
@@ -1187,9 +1194,9 @@ public class DoCreateVfModule extends VfModuleBase {
}else{
sdncVNFParamsXml = ""
}
-
+
String sdncRequest = ""
-
+
if (!sdncVersion.equals("1707")) {
sdncRequest =
@@ -1231,10 +1238,10 @@ public class DoCreateVfModule extends VfModuleBase {
</vnf-request-information>
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
-
+
}
- else {
-
+ else {
+
sdncRequest =
"""<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
@@ -1259,28 +1266,28 @@ public class DoCreateVfModule extends VfModuleBase {
<subscription-service-type>${MsoUtils.xmlEscape(serviceId)}</subscription-service-type>
${serviceEcompModelInformation}
<service-instance-id>${MsoUtils.xmlEscape(svcInstId)}</service-instance-id>
- <global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id>
- </service-information>
+ <global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id>
+ </service-information>
<vnf-information>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type>
- ${vnfEcompModelInformation}
+ ${vnfEcompModelInformation}
</vnf-information>
<vf-module-information>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
<vf-module-type>${MsoUtils.xmlEscape(vfModuleModelName)}</vf-module-type>
- ${vfModuleEcompModelInformation}
+ ${vfModuleEcompModelInformation}
</vf-module-information>
- <vf-module-request-input>
+ <vf-module-request-input>
<vf-module-name>${MsoUtils.xmlEscape(vfModuleName)}</vf-module-name>
<tenant>${MsoUtils.xmlEscape(tenantId)}</tenant>
- <aic-cloud-region>${MsoUtils.xmlEscape(cloudSiteId)}</aic-cloud-region>
+ <aic-cloud-region>${MsoUtils.xmlEscape(cloudSiteId)}</aic-cloud-region>
${sdncVNFParamsXml}
</vf-module-request-input>
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
-
-
+
+
/*
sdncRequest =
"""<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
@@ -1303,30 +1310,30 @@ public class DoCreateVfModule extends VfModuleBase {
<service-information>
<service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
<service-type>${MsoUtils.xmlEscape(serviceId)}</service-type>
- ${serviceEcompModelInformation}
+ ${serviceEcompModelInformation}
<service-instance-id>${MsoUtils.xmlEscape(svcInstId)}</service-instance-id>
<global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id>
</service-information>
<vnf-information>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type>
- ${vnfEcompModelInformation}
+ ${vnfEcompModelInformation}
</vnf-information>
<vf-module-information>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
<vf-module-type>${MsoUtils.xmlEscape(vfModuleModelName)}</vf-module-type>
- ${vfModuleEcompModelInformation}
+ ${vfModuleEcompModelInformation}
</vf-module-information>
- <vf-module-request-input>
+ <vf-module-request-input>
<vf-module-name>${MsoUtils.xmlEscape(vfModuleName)}</vf-module-name>
<tenant>${MsoUtils.xmlEscape(tenantId)}</tenant>
- <aic-cloud-region>${MsoUtils.xmlEscape(cloudSiteId)}</aic-cloud-region>
+ <aic-cloud-region>${MsoUtils.xmlEscape(cloudSiteId)}</aic-cloud-region>
${sdncVNFParamsXml}
- </vf-module-request-input>
+ </vf-module-request-input>
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
*/
-
+
}
msoLogger.debug("sdncRequest: " + sdncRequest)
@@ -1338,7 +1345,7 @@ public class DoCreateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' +
'execution=' + execution.getId() +
')'
-
+
msoLogger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
msoLogger.trace("STARTED preProcessSDNCActivateRequest Process")
@@ -1370,7 +1377,7 @@ public class DoCreateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' +
'execution=' + execution.getId() +
')'
-
+
msoLogger.trace('Entered ' + method)
execution.setVariable("prefix",Prefix)
try{
@@ -1458,7 +1465,7 @@ public class DoCreateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.preProcessUpdateAAIVfModuleRequestOrch(' +
'execution=' + execution.getId() +
')'
-
+
msoLogger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
msoLogger.trace("STARTED preProcessUpdateAAIVfModuleRequestOrch")
@@ -1471,7 +1478,7 @@ public class DoCreateVfModule extends VfModuleBase {
if (!contrailServiceInstanceFqdn.equals("")) {
setContrailServiceInstanceFqdn = true
}
-
+
execution.setVariable("DCVFM_orchestrationStatus", "Created")
String updateAAIVfModuleRequest = buildUpdateAAIVfModuleRequest(execution, false, true, true, setContrailServiceInstanceFqdn)
@@ -1481,18 +1488,18 @@ public class DoCreateVfModule extends VfModuleBase {
msoLogger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessUpdateAAIVfModuleRequestOrch", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessUpdateAAIVfModuleRequestOrch", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestOrch Method:\n" + e.getMessage())
}
msoLogger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestOrch")
}
-
+
public void preProcessUpdateAAIVfModuleRequestStatus(DelegateExecution execution, String status) {
def method = getClass().getSimpleName() + '.preProcessUpdateAAIVfModuleStatus(' +
'execution=' + execution.getId() +
')'
-
+
msoLogger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
msoLogger.trace("STARTED preProcessUpdateAAIVfModuleStatus")
@@ -1521,7 +1528,7 @@ public class DoCreateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.preProcessUpdateAAIVfModuleRequestGroup(' +
'execution=' + execution.getId() +
')'
-
+
msoLogger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
msoLogger.trace("STARTED preProcessUpdateAAIVfModuleRequestGroup")
@@ -1537,7 +1544,7 @@ public class DoCreateVfModule extends VfModuleBase {
msoLogger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessUpdateAAIVfModuleRequestGroup", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessUpdateAAIVfModuleRequestGroup", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestGroup Method:\n" + e.getMessage())
}
msoLogger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestGroup")
@@ -1545,7 +1552,7 @@ public class DoCreateVfModule extends VfModuleBase {
}
public void validateSDNCResponse(DelegateExecution execution, String response, String method){
-
+
execution.setVariable("prefix",Prefix)
msoLogger.debug("STARTED ValidateSDNCResponse Process")
@@ -1578,7 +1585,7 @@ public class DoCreateVfModule extends VfModuleBase {
}
public void preProcessUpdateAfterCreateRequest(DelegateExecution execution){
-
+
execution.setVariable("prefix", Prefix)
msoLogger.trace("STARTED preProcessRequest Process")
try{
@@ -1684,25 +1691,25 @@ public class DoCreateVfModule extends VfModuleBase {
}
return params
}
-
+
public String buildCompleteSDNCParamsXml(DelegateExecution execution){
-
+
String params = ""
StringBuilder sb = new StringBuilder()
Map<String, String> paramsMap = execution.getVariable("DCVFM_vnfParamsMap")
-
+
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
String paramsXml
- String key = entry.getKey();
+ String key = entry.getKey();
String value = entry.getValue()
- paramsXml = """<${key}>$value</$key>"""
+ paramsXml = """<${key}>$value</$key>"""
params = sb.append(paramsXml)
}
return params
}
public void queryCloudRegion (DelegateExecution execution) {
-
+
execution.setVariable("prefix", Prefix)
msoLogger.trace("STARTED queryCloudRegion")
@@ -1710,13 +1717,12 @@ public class DoCreateVfModule extends VfModuleBase {
String cloudRegion = execution.getVariable("DCVFM_cloudSiteId")
// Prepare AA&I url
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUtil = new AaiUtil(this)
- String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution)
- String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+ def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
execution.setVariable("DCVFM_queryCloudRegionRequest", queryCloudRegionRequest)
- msoLogger.debug("DCVFM_queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest)
cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
@@ -1773,7 +1779,7 @@ public class DoCreateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.prepareCreateAAIVfModuleVolumeGroupRequest(' +
'execution=' + execution.getId() +
')'
-
+
msoLogger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
msoLogger.trace("STARTED prepareCreateAAIVfModuleVolumeGroupRequest")
@@ -1787,12 +1793,14 @@ public class DoCreateVfModule extends VfModuleBase {
def volumeGroupId = execution.getVariable("DCVFM_volumeGroupId")
//def aicCloudRegion = execution.getVariable("DCVFM_cloudSiteId")
def aicCloudRegion = execution.getVariable("DCVFM_cloudRegionForVolume")
+ def cloudOwner = execution.getVariable("DCVFM_cloudOwner")
String createAAIVfModuleVolumeGroupRequest =
"""<CreateAAIVfModuleVolumeGroupRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
<volume-group-id>${MsoUtils.xmlEscape(volumeGroupId)}</volume-group-id>
<aic-cloud-region>${MsoUtils.xmlEscape(aicCloudRegion)}</aic-cloud-region>
+ <cloud-owner>${MsoUtils.xmlEscape(cloudOwner)}</cloud-owner>
</CreateAAIVfModuleVolumeGroupRequest>"""
createAAIVfModuleVolumeGroupRequest = utils.formatXml(createAAIVfModuleVolumeGroupRequest)
@@ -1811,7 +1819,7 @@ public class DoCreateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.createNetworkPoliciesInAAI(' +
'execution=' + execution.getId() +
')'
-
+
msoLogger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
msoLogger.trace("STARTED createNetworkPoliciesInAAI")
@@ -1825,109 +1833,81 @@ public class DoCreateVfModule extends VfModuleBase {
execution.setVariable("DCVFM_networkPolicyFqdnCount", fqdnCount)
msoLogger.debug("DCVFM_networkPolicyFqdnCount - " + fqdnCount)
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution)
-
- if (fqdnCount > 0) {
-
- // AII loop call over contrail network policy fqdn list
- for (i in 0..fqdnCount-1) {
-
- int counting = i+1
- String fqdn = fqdnList[i]
-
- // Query AAI for this network policy FQDN
-
- String queryNetworkPolicyByFqdnAAIRequest = "${aai_endpoint}${aai_uri}?network-policy-fqdn=" + UriUtils.encode(fqdn, "UTF-8")
-
- def aaiRequestId = UUID.randomUUID().toString()
- RESTConfig config = new RESTConfig(queryNetworkPolicyByFqdnAAIRequest);
- RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId)
- .addHeader("X-FromAppId", "MSO")
- .addHeader("Content-Type", "application/xml")
- .addHeader("Accept","application/xml");
- APIResponse response = client.get()
- int returnCode = response.getStatusCode()
- execution.setVariable("DCVFM_aaiQqueryNetworkPolicyByFqdnReturnCode", returnCode)
- msoLogger.debug(" ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode)
-
- String aaiResponseAsString = response.getResponseBodyAsString()
-
- if (isOneOf(returnCode, 200, 201)) {
- msoLogger.debug("The return code is: " + returnCode)
- // This network policy FQDN already exists in AAI
- execution.setVariable("DCVFM_queryNetworkPolicyByFqdnAAIResponse", aaiResponseAsString)
- msoLogger.debug(" QueryAAINetworkPolicyByFQDN Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString)
-
- } else {
- if (returnCode == 404) {
- // This network policy FQDN is not in AAI yet. Add it now
- msoLogger.debug("The return code is: " + returnCode)
- msoLogger.debug("This network policy FQDN is not in AAI yet: " + fqdn)
- // Add the network policy with this FQDN to AAI
- def networkPolicyId = UUID.randomUUID().toString()
- msoLogger.debug("Adding network-policy with network-policy-id " + networkPolicyId)
-
- String aaiNamespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri)
- msoLogger.debug('AAI namespace is: ' + aaiNamespace)
- String payload = """<network-policy xmlns="${aaiNamespace}">
+
+ if (fqdnCount > 0) {
+
+ // AII loop call over contrail network policy fqdn list
+ for (i in 0..fqdnCount-1) {
+
+ int counting = i+1
+ String fqdn = fqdnList[i]
+
+ // Query AAI for this network policy FQDN
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ uri.queryParam("network-policy-fqdn", fqdn)
+
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
+
+
+ if (resourceClient.exists(uri)) {
+
+ msoLogger.debug(" QueryAAINetworkPolicyByFQDN Success REST Response, , NetworkPolicy #" + counting)
+
+ } else {
+ // This network policy FQDN is not in AAI yet. Add it now
+ msoLogger.debug("This network policy FQDN is not in AAI yet: " + fqdn)
+ // Add the network policy with this FQDN to AAI
+ def networkPolicyId = UUID.randomUUID().toString()
+ msoLogger.debug("Adding network-policy with network-policy-id " + networkPolicyId)
+
+ String aaiNamespace = aaiUriUtil.getNamespace()
+ msoLogger.debug('AAI namespace is: ' + aaiNamespace)
+ String payload = """<network-policy xmlns="${aaiNamespace}">
<network-policy-id>${MsoUtils.xmlEscape(networkPolicyId)}</network-policy-id>
<network-policy-fqdn>${MsoUtils.xmlEscape(fqdn)}</network-policy-fqdn>
<heat-stack-id>${MsoUtils.xmlEscape(execution.getVariable("DCVFM_heatStackId"))}</heat-stack-id>
</network-policy>""" as String
- execution.setVariable("DCVFM_addNetworkPolicyAAIRequestBody", payload)
-
- String addNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(networkPolicyId, "UTF-8")
- msoLogger.debug("AAI request endpoint: " + addNetworkPolicyAAIRequest)
-
- def aaiRequestIdPut = UUID.randomUUID().toString()
- RESTConfig configPut = new RESTConfig(addNetworkPolicyAAIRequest);
- RESTClient clientPut = new RESTClient(configPut).addHeader("X-TransactionId", aaiRequestIdPut)
- .addHeader("X-FromAppId", "MSO")
- .addHeader("Content-Type", "application/xml")
- .addHeader("Accept","application/xml");
- msoLogger.debug("invoking PUT call to AAI with payload:"+System.lineSeparator()+payload)
- APIResponse responsePut = clientPut.httpPut(payload)
- int returnCodePut = responsePut.getStatusCode()
- execution.setVariable("DCVFM_aaiAddNetworkPolicyReturnCode", returnCodePut)
- msoLogger.debug(" ***** AAI add network policy Response Code, NetworkPolicy #" + counting + " : " + returnCodePut)
-
- String aaiResponseAsStringPut = responsePut.getResponseBodyAsString()
- if (isOneOf(returnCodePut, 200, 201)) {
- msoLogger.debug("The return code from adding network policy is: " + returnCodePut)
- // This network policy was created in AAI successfully
- execution.setVariable("DCVFM_addNetworkPolicyAAIResponse", aaiResponseAsStringPut)
- msoLogger.debug(" AddAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsStringPut)
- rollbackData.put("VFMODULE", "rollbackCreateNetworkPoliciesAAI", "true")
- rollbackData.put("VFMODULE", "contrailNetworkPolicyFqdn" + i, fqdn)
- execution.setVariable("rollbackData", rollbackData)
-
- } else {
- // aai all errors
- String putErrorMessage = "Unable to add network-policy to AAI createNetworkPoliciesInAAI - " + returnCodePut
- msoLogger.debug(putErrorMessage)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, putErrorMessage)
- }
-
- } else {
- if (aaiResponseAsString.contains("RESTFault")) {
- WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution)
- execution.setVariable("WorkflowException", exceptionObject)
- throw new BpmnError("MSOWorkflowException")
-
- } else {
- // aai all errors
- String dataErrorMessage = "Unexpected Response from createNetworkPoliciesInAAI - " + returnCode
- msoLogger.debug(dataErrorMessage)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
-
- }
- }
- }
+ execution.setVariable("DCVFM_addNetworkPolicyAAIRequestBody", payload)
+
+ AAIResourceUri addUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId)
+ String addNetworkPolicyAAIRequest = aaiUriUtil.createAaiUri(addUri)
+
+ msoLogger.debug("AAI request endpoint: " + addNetworkPolicyAAIRequest)
+
+ def aaiRequestIdPut = UUID.randomUUID().toString()
+ RESTConfig configPut = new RESTConfig(addNetworkPolicyAAIRequest);
+ RESTClient clientPut = new RESTClient(configPut).addHeader("X-TransactionId", aaiRequestIdPut)
+ .addHeader("X-FromAppId", "MSO")
+ .addHeader("Content-Type", "application/xml")
+ .addHeader("Accept","application/xml");
+ msoLogger.debug("invoking PUT call to AAI with payload:"+System.lineSeparator()+payload)
+ APIResponse responsePut = clientPut.httpPut(payload)
+ int returnCodePut = responsePut.getStatusCode()
+ execution.setVariable("DCVFM_aaiAddNetworkPolicyReturnCode", returnCodePut)
+ msoLogger.debug(" ***** AAI add network policy Response Code, NetworkPolicy #" + counting + " : " + returnCodePut)
+
+ String aaiResponseAsStringPut = responsePut.getResponseBodyAsString()
+ if (isOneOf(returnCodePut, 200, 201)) {
+ msoLogger.debug("The return code from adding network policy is: " + returnCodePut)
+ // This network policy was created in AAI successfully
+ execution.setVariable("DCVFM_addNetworkPolicyAAIResponse", aaiResponseAsStringPut)
+ msoLogger.debug(" AddAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsStringPut)
+ rollbackData.put("VFMODULE", "rollbackCreateNetworkPoliciesAAI", "true")
+ rollbackData.put("VFMODULE", "contrailNetworkPolicyFqdn" + i, fqdn)
+ execution.setVariable("rollbackData", rollbackData)
+
+ } else {
+ // aai all errors
+ String putErrorMessage = "Unable to add network-policy to AAI createNetworkPoliciesInAAI - " + returnCodePut
+ msoLogger.debug(putErrorMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, putErrorMessage)
+ }
+
+ }
- } // end loop
+ } // end loop
} else {
@@ -1955,7 +1935,7 @@ public class DoCreateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' +
'execution=' + execution.getId() +
')'
-
+
msoLogger.trace('Entered ' + method)
try {
@@ -2008,7 +1988,7 @@ public class DoCreateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.postProcessUpdateAAIGenericVnf(' +
'execution=' + execution.getId() +
')'
-
+
msoLogger.trace('Entered ' + method)
try {
@@ -2040,37 +2020,37 @@ public class DoCreateVfModule extends VfModuleBase {
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in postProcessUpdateAAIGenericVnf(): ' + e.getMessage())
}
}
-
+
public void queryCatalogDB (DelegateExecution execution) {
-
+
String msg = ""
msoLogger.trace("queryCatalogDB ")
try {
boolean twoPhaseDesign = false
// check for input
-
+
String vfModuleModelName = execution.getVariable("DCVFM_vfModuleModelName")
msoLogger.debug("vfModuleModelName: " + vfModuleModelName)
def vnfModelInfo = execution.getVariable("vnfModelInfo")
def vnfModelCustomizationUuid = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationUuid")
-
- msoLogger.debug("vnfModelCustomizationUuid: " + vnfModelCustomizationUuid)
-
+
+ msoLogger.debug("vnfModelCustomizationUuid: " + vnfModelCustomizationUuid)
+
JSONArray vnfs = catalog.getAllVnfsByVnfModelCustomizationUuid(execution, vnfModelCustomizationUuid, "v2")
-
- msoLogger.debug("Incoming Query Catalog DB for Vnf Response is: " + vnfModelCustomizationUuid)
+
+ msoLogger.debug("Incoming Query Catalog DB for Vnf Response is: " + vnfModelCustomizationUuid)
// Only one match here
if (vnfs != null) {
JSONObject vnfObject = vnfs.get(0)
if (vnfObject != null) {
String vnfJson = vnfObject.toString()
//
- ObjectMapper om = new ObjectMapper();
+ ObjectMapper om = new ObjectMapper();
VnfResource vnf = om.readValue(vnfJson, VnfResource.class);
-
+
// Get multiStageDesign flag
-
+
String multiStageDesignValue = vnf.getMultiStageDesign()
msoLogger.debug("multiStageDesign value from Catalog DB is: " + multiStageDesignValue)
if (multiStageDesignValue != null) {
@@ -2080,10 +2060,10 @@ public class DoCreateVfModule extends VfModuleBase {
}
}
}
-
+
msoLogger.debug("setting twoPhaseDesign flag to: " + twoPhaseDesign)
-
- execution.setVariable("DCVFM_twoPhaseDesign", twoPhaseDesign)
+
+ execution.setVariable("DCVFM_twoPhaseDesign", twoPhaseDesign)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
@@ -2091,13 +2071,13 @@ public class DoCreateVfModule extends VfModuleBase {
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryCatalogDB(): ' + e.getMessage())
}
}
-
-
+
+
public void preProcessRollback (DelegateExecution execution) {
msoLogger.trace("preProcessRollback")
try {
-
+
Object workflowException = execution.getVariable("WorkflowException");
if (workflowException instanceof WorkflowException) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
index a0b7dabb32..a553127c5c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
@@ -28,6 +28,10 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.client.aai.AAIObjectPlurals
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
import org.onap.so.rest.APIResponse
@@ -477,9 +481,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
execution.setVariable(Prefix + "networkPolicyFqdnCount", fqdnCount)
msoLogger.debug("networkPolicyFqdnCount - " + fqdnCount)
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution)
if (fqdnCount > 0) {
// AII loop call over contrail network policy fqdn list
@@ -489,8 +491,10 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
String fqdn = fqdnList[i]
// Query AAI for this network policy FQDN
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ uri.queryParam("network-policy-fqdn", fqdn)
+ String queryNetworkPolicyByFqdnAAIRequest = aaiUriUtil.createAaiUri(uri)
- String queryNetworkPolicyByFqdnAAIRequest = "${aai_endpoint}${aai_uri}?network-policy-fqdn=" + UriUtils.encode(fqdn, "UTF-8")
msoLogger.debug("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest)
def aaiRequestId = UUID.randomUUID().toString()
@@ -514,8 +518,9 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
def resourceVersion = utils.getNodeText(aaiResponseAsString, "resource-version")
msoLogger.debug("Deleting network-policy with resource-version " + resourceVersion)
- String delNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(networkPolicyId, "UTF-8") +
- "?resource-version=" + UriUtils.encode(resourceVersion, "UTF-8")
+ AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId)
+ delUri.resourceVersion(resourceVersion)
+ String delNetworkPolicyAAIRequest = aaiUriUtil.createAaiUri(delUri)
msoLogger.debug("AAI request endpoint: " + delNetworkPolicyAAIRequest)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy
index 5995b6b099..3b0707a529 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,6 +38,11 @@ import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.RollbackData
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIObjectPlurals
+import org.onap.so.constants.Defaults
import org.onap.so.rest.APIResponse
import org.springframework.web.util.UriUtils
import org.onap.so.logger.MsoLogger
@@ -46,14 +51,14 @@ import org.onap.so.logger.MessageEnum
public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVfModuleVolumeRollback.class);
-
+
String Prefix="DCVFMODVOLRBK_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
VidUtils vidUtils = new VidUtils(this)
def className = getClass().getSimpleName()
-
+
/**
* This method is executed during the preProcessRequest task of the <class>DoCreateVfModuleVolumeRollback.bpmn</class> process.
* @param execution
@@ -80,7 +85,7 @@ public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor
InitializeProcessVariables(execution)
// rollbackData.put("DCVFMODULEVOL", "aiccloudregion", cloudSiteId)
RollbackData rollbackData = execution.getVariable("rollbackData")
-
+
// String vnfId = rollbackData.get("DCVFMODULEVOL", "vnfid")
// execution.setVariable("DCVFMODVOLRBK_vnfId", vnfId)
// String vfModuleId = rollbackData.get("DCVFMODULEVOL", "vfmoduleid")
@@ -107,47 +112,48 @@ public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor
// execution.setVariable("DCVFMODVOLRBK_heatStackId", heatStackId)
// String requestId = rollbackData.get("DCVFMODULEVOL", "msorequestid")
// execution.setVariable("DCVFMODVOLRBK_requestId", requestId)
-
+
String volumeGroupName = rollbackData.get("DCVFMODULEVOL", "volumeGroupName")
execution.setVariable("DCVFMODVOLRBK_volumeGroupName", volumeGroupName)
String lcpCloudRegionId = rollbackData.get("DCVFMODULEVOL", "aiccloudregion")
execution.setVariable("DCVFMODVOLRBK_lcpCloudRegionId", lcpCloudRegionId)
-
+
execution.setVariable("DCVFMODVOLRBK_rollbackVnfARequest", rollbackData.get("DCVFMODULEVOL", "rollbackVnfARequest"))
execution.setVariable("DCVFMODVOLRBK_backoutOnFailure", rollbackData.get("DCVFMODULEVOL", "backoutOnFailure"))
execution.setVariable("DCVFMODVOLRBK_isCreateVnfRollbackNeeded", rollbackData.get("DCVFMODULEVOL", "isCreateVnfRollbackNeeded"))
execution.setVariable("DCVFMODVOLRBK_isAAIRollbackNeeded", rollbackData.get("DCVFMODULEVOL", "isAAIRollbackNeeded"))
}
-
+
/**
* Query AAI volume group by name
* @param execution
* @param isDebugEnabled
*/
public void callRESTQueryAAIVolGrpName(DelegateExecution execution, isDebugEnabled) {
-
+
def volumeGroupName = execution.getVariable('DCVFMODVOLRBK_volumeGroupName')
def cloudRegion = execution.getVariable('DCVFMODVOLRBK_lcpCloudRegionId')
-
+
// This is for stub testing
def testVolumeGroupName = execution.getVariable('test-volume-group-name')
if (testVolumeGroupName != null && testVolumeGroupName.length() > 0) {
volumeGroupName = testVolumeGroupName
}
-
+
AaiUtil aaiUtil = new AaiUtil(this)
- String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution)
- String queryAAIVolumeNameRequest = aaiEndpoint + '/' + cloudRegion + "/volume-groups" + "?volume-group-name=" + UriUtils.encode(volumeGroupName, 'UTF-8')
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName)
+ def queryAAIVolumeNameRequest = aaiUtil.createAaiUri(uri)
msoLogger.debug('Query AAI volume group by name: ' + queryAAIVolumeNameRequest)
-
+
APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIVolumeNameRequest)
-
+
String returnCode = response.getStatusCode()
String aaiResponseAsString = response.getResponseBodyAsString()
-
+
msoLogger.debug("AAI query volume group by name return code: " + returnCode)
msoLogger.debug("AAI query volume group by name response: " + aaiResponseAsString)
@@ -171,31 +177,32 @@ public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor
}
}
}
-
-
-
+
+
+
public void callRESTDeleteAAIVolumeGroup(DelegateExecution execution, isDebugEnabled) {
callRESTQueryAAIVolGrpName(execution, isDebugEnabled)
-
+
def queryAaiVolumeGroupResponse = execution.getVariable(prefix+'queryAAIVolGrpNameResponse')
-
+
def volumeGroupId = utils.getNodeText(queryAaiVolumeGroupResponse, "volume-group-id")
def resourceVersion = utils.getNodeText(queryAaiVolumeGroupResponse, "resource-version")
def cloudRegion = execution.getVariable("DCVFMODVOLRBK_lcpCloudRegionId")
-
+
AaiUtil aaiUtil = new AaiUtil(this)
- String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution)
- String deleteAAIVolumeGrpIdRequest = aaiEndpoint + '/' + cloudRegion + "/volume-groups/volume-group" + '/' + volumeGroupId + "?resource-version=" + UriUtils.encode(resourceVersion, "UTF-8")
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion, volumeGroupId).queryParam("resource-version", resourceVersion)
+ def deleteAAIVolumeGrpIdRequest = aaiUtil.createAaiUri(uri)
msoLogger.debug('Delete AAI volume group : ' + deleteAAIVolumeGrpIdRequest)
-
+
APIResponse response = aaiUtil.executeAAIDeleteCall(execution, deleteAAIVolumeGrpIdRequest)
-
+
String returnCode = response.getStatusCode()
String aaiResponseAsString = response.getResponseBodyAsString()
-
+
msoLogger.debug("AAI delete volume group return code: " + returnCode)
msoLogger.debug("AAI delete volume group response: " + aaiResponseAsString)
@@ -219,18 +226,18 @@ public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor
// *******************************
-
+
public void processJavaException(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
-
+
try{
msoLogger.debug("Caught a Java Exception in " + Prefix)
msoLogger.debug("Started processJavaException Method")
msoLogger.debug("Variables List: " + execution.getVariables())
execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception")
-
+
}catch(Exception e){
msoLogger.debug("Caught Exception during processJavaException Method: " + e)
execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
index f87f32c610..cf5c214d3f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
@@ -37,10 +37,12 @@ import org.onap.so.rest.APIResponse
import org.springframework.web.util.UriUtils
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.aai.entities.Relationships
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.constants.Defaults
import org.json.JSONObject
import javax.ws.rs.NotFoundException
@@ -82,7 +84,9 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
if (cloudSiteId == null) {
String cloudConfiguration = execution.getVariable("cloudConfiguration")
cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.lcpCloudRegionId")
+ def cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.cloudOwner")
execution.setVariable("lcpCloudRegionId", cloudSiteId)
+ execution.setVariable("cloudOwner", cloudOwner)
}
// Extract attributes from modelInfo
@@ -171,10 +175,9 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
msoLogger.debug('Request cloud region is: ' + cloudRegion)
AaiUtil aaiUtil = new AaiUtil(this)
- String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution)
- String queryCloudRegionRequest = aaiEndpoint + '/' + cloudRegion
- msoLogger.debug(queryCloudRegionRequest)
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+ def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
@@ -220,8 +223,9 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
}
AaiUtil aaiUtil = new AaiUtil(this)
- String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution)
- String queryAAIVolumeNameRequest = aaiEndpoint + '/' + cloudRegion + "/volume-groups" + "?volume-group-name=" + UriUtils.encode(volumeGroupName, 'UTF-8')
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName)
+ def queryAAIVolumeNameRequest = aaiUtil.createAaiUri(uri)
msoLogger.debug('Query AAI volume group by name: ' + queryAAIVolumeNameRequest)
@@ -292,7 +296,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
def vnfType = execution.getVariable("vnfType")
def tenantId = execution.getVariable("tenantId")
def cloudRegion = execution.getVariable('lcpCloudRegionId')
-
+ def cloudOwner = execution.getVariable('cloudOwner')
msoLogger.debug("volumeGroupId: " + volumeGroupId)
def testGroupId = execution.getVariable('test-volume-group-id')
@@ -305,16 +309,17 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
msoLogger.debug("volumeGroupId to be used: " + volumeGroupId)
AaiUtil aaiUtil = new AaiUtil(this)
- String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution)
- String createAAIVolumeGrpNameUrlRequest = aaiEndpoint + '/' + cloudRegion + "/volume-groups/volume-group/" + UriUtils.encode(volumeGroupId, "UTF-8")
- String namespace = aaiUtil.getNamespaceFromUri(aaiUtil.getCloudInfrastructureCloudRegionUri(execution))
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion, volumeGroupId)
+ def createAAIVolumeGrpNameUrlRequest = aaiUtil.createAaiUri(uri)
+
+ String namespace = aaiUtil.getNamespaceFromUri(createAAIVolumeGrpNameUrlRequest)
msoLogger.debug("AAI namespace is: " + namespace)
msoLogger.debug("Request URL for PUT: " + createAAIVolumeGrpNameUrlRequest)
NetworkUtils networkUtils = new NetworkUtils()
- String payload = networkUtils.createCloudRegionVolumeRequest(volumeGroupId, volumeName, vnfType, vnfId, tenantId, cloudRegion, namespace, modelCustomizationId)
+ String payload = networkUtils.createCloudRegionVolumeRequest(volumeGroupId, volumeName, vnfType, vnfId, tenantId, cloudOwner, cloudRegion, namespace, modelCustomizationId)
String payloadXml = utils.formatXml(payload)
msoLogger.debug("Request payload for PUT: " + payloadXml)
@@ -541,10 +546,11 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
String cloudRegion = execution.getVariable("lcpCloudRegionId")
AaiUtil aaiUtil = new AaiUtil(this)
- String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution)
- String updateAAIVolumeGroupUrlRequest = aaiEndpoint + '/' + cloudRegion + "/volume-groups/volume-group/" + UriUtils.encode(volumeGroupId, 'UTF-8')
- String namespace = aaiUtil.getNamespaceFromUri(aaiUtil.getCloudInfrastructureCloudRegionUri(execution))
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion, volumeGroupId)
+ def updateAAIVolumeGroupUrlRequest = aaiUtil.createAaiUri(uri)
+
+ String namespace = aaiUtil.getNamespaceFromUri(updateAAIVolumeGroupUrlRequest)
msoLogger.debug("updateAAIVolumeGroupUrlRequest - " + updateAAIVolumeGroupUrlRequest)
@@ -595,11 +601,11 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
def vnfId = execution.getVariable('vnfId')
AaiUtil aaiUtil = new AaiUtil(this)
- String aaiEndpoint = aaiUtil.getNetworkGenericVnfEndpoint(execution)
- def String queryAAIRequest = aaiEndpoint + "/" + UriUtils.encode(vnfId, "UTF-8")
-
- msoLogger.debug("AAI query generic vnf request: " + queryAAIRequest)
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ String queryAAIRequest = aaiUtil.createAaiUri(uri)
+ msoLogger.debug("AAI query generic vnf endpoint: " + queryAAIRequest)
+
APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIRequest)
String returnCode = response.getStatusCode()
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
index 1585a7bb74..b35aab1176 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
@@ -24,6 +24,7 @@ import static org.apache.commons.lang3.StringUtils.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.GenericVnf
import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
@@ -105,7 +106,13 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
String vnfName = execution.getVariable("vnfName")
if (vnfName.equals("") || vnfName.equals("null")) {
- vnfName = null
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, execution.getVariable("vnfId"))
+ if(resourceClient.exists(uri)){
+ exceptionUtil.buildWorkflowException(execution, 5000, "Generic Vnf Already Exist.")
+ }
+
+
}
execution.setVariable("DoCVNF_vnfName", vnfName)
msoLogger.debug("Incoming Vnf Name is: " + vnfName)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
index 3ee059cb02..3812c081f5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,6 +33,11 @@ import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.client.graphinventory.entities.uri.Depth
+import org.onap.so.constants.Defaults
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
import org.onap.so.rest.APIResponse;
@@ -44,7 +49,7 @@ import groovy.json.*
public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteNetworkInstance.class);
-
+
String Prefix= "DELNWKI_"
String groovyClassName = "DoDeleteNetworkInstance"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -93,13 +98,13 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "deactivateSDNCResponse", "")
execution.setVariable(Prefix + "deactivateSdncReturnCode", "")
execution.setVariable(Prefix + "isSdncDeactivateRollbackNeeded", "")
-
+
execution.setVariable(Prefix + "rollbackDeactivateSDNCRequest", "")
execution.setVariable(Prefix + "isException", false)
-
+
}
-
+
// **************************************************
// Pre or Prepare Request Section
// **************************************************
@@ -112,19 +117,19 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
// initialize flow variables
InitializeProcessVariables(execution)
-
+
try {
// get incoming message/input
execution.setVariable("action", "DELETE")
String deleteNetwork = execution.getVariable("bpmnRequest")
if (deleteNetwork != null) {
if (deleteNetwork.contains("requestDetails")) {
- // JSON format request is sent, create xml
+ // JSON format request is sent, create xml
try {
def prettyJson = JsonOutput.prettyPrint(deleteNetwork.toString())
msoLogger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson)
deleteNetwork = vidUtils.createXmlNetworkRequestInfra(execution, deleteNetwork)
-
+
} catch (Exception ex) {
String dataErrorMessage = " Invalid json format Request - " + ex.getMessage()
msoLogger.debug(dataErrorMessage)
@@ -132,26 +137,26 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
}
} else {
// XML format request is sent
-
+
}
} else {
// vIPR format request is sent, create xml from individual variables
deleteNetwork = vidUtils.createXmlNetworkRequestInstance(execution)
}
-
+
deleteNetwork = utils.formatXml(deleteNetwork)
msoLogger.debug(deleteNetwork)
execution.setVariable(Prefix + "networkRequest", deleteNetwork)
msoLogger.debug(Prefix + "networkRequest - " + '\n' + deleteNetwork)
-
+
// validate 'backout-on-failure' to override 'mso.rollback'
boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, deleteNetwork)
execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled)
msoLogger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled)
-
+
String networkInputs = utils.getNodeXml(deleteNetwork, "network-inputs", false).replace("tag0:","").replace(":tag0","")
execution.setVariable(Prefix + "networkInputs", networkInputs)
-
+
// prepare messageId
String messageId = execution.getVariable("testMessageId") // for testing
if (messageId == null || messageId == "") {
@@ -161,11 +166,11 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
msoLogger.debug(Prefix + "messageId, pre-assigned: " + messageId)
}
execution.setVariable(Prefix + "messageId", messageId)
-
+
String source = utils.getNodeText(deleteNetwork, "source")
execution.setVariable(Prefix + "source", source)
msoLogger.debug(Prefix + "source - " + source)
-
+
String networkId = ""
if (utils.nodeExists(networkInputs, "network-id")) {
networkId = utils.getNodeText(networkInputs, "network-id")
@@ -188,7 +193,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
}
execution.setVariable(Prefix + "lcpCloudRegion", lcpCloudRegion)
msoLogger.debug("lcpCloudRegion : " + lcpCloudRegion)
-
+
String tenantId = null
if (utils.nodeExists(networkInputs, "tenant-id")) {
tenantId = utils.getNodeText(networkInputs, "tenant-id")
@@ -199,18 +204,18 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
}
execution.setVariable(Prefix + "tenantId", tenantId)
msoLogger.debug("tenantId : " + tenantId)
-
+
String sdncVersion = execution.getVariable("sdncVersion")
msoLogger.debug("sdncVersion? : " + sdncVersion)
-
+
// PO Authorization Info / headers Authorization=
String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
-
+
try {
def encodedString = utils.getBasicAuth(basicAuthValuePO, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable("BasicAuthHeaderValuePO",encodedString)
execution.setVariable("BasicAuthHeaderValueSDNC", encodedString)
-
+
} catch (IOException ex) {
String dataErrorMessage = " Unable to encode PO/SDNC user/password string - " + ex.getMessage()
msoLogger.debug(dataErrorMessage )
@@ -227,7 +232,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
-
+
}
@@ -243,10 +248,11 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
networkId = UriUtils.encode(networkId,"UTF-8")
// Prepare AA&I url
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String queryAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all"
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId)
+ uri.depth(Depth.ALL)
+
+ String queryAAIRequest = aaiUriUtil.createAaiUri(uri)
msoLogger.debug(queryAAIRequest)
execution.setVariable(Prefix + "queryAAIRequest", queryAAIRequest)
msoLogger.debug(Prefix + "AAIRequest - " + "\n" + queryAAIRequest)
@@ -279,7 +285,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
exceptionUtil.buildWorkflowException(execution, 2500, relationshipMessage)
} else {
- // verify if lcpCloudRegion was sent as input, if not get value from AAI Response
+ // verify if lcpCloudRegion was sent as input, if not get value from AAI Response
if (execution.getVariable(Prefix + "lcpCloudRegion") == null ) {
String lcpCloudRegion = networkUtils.getCloudRegion(aaiResponseAsString)
execution.setVariable(Prefix + "lcpCloudRegion", lcpCloudRegion)
@@ -290,7 +296,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "tenantId", tenantId)
msoLogger.debug(" Get AAI getTenantId() : " + tenantId)
}
-
+
}
}
msoLogger.debug(Prefix + "isVfRelationshipExist - " + isVfRelationshipExist)
@@ -339,15 +345,13 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
String networkInputs = execution.getVariable(Prefix + "networkInputs")
// String cloudRegion = utils.getNodeText(networkInputs, "aic-cloud-region")
String cloudRegion = execution.getVariable(Prefix + "lcpCloudRegion")
- cloudRegion = UriUtils.encode(cloudRegion,"UTF-8")
// Prepare AA&I url
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUtil = new AaiUtil(this)
- String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution)
- String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion
- msoLogger.debug(queryCloudRegionRequest)
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+ def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
+
execution.setVariable(Prefix + "queryCloudRegionRequest", queryCloudRegionRequest)
- msoLogger.debug(Prefix + "queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest)
String cloudRegionPo = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
String cloudRegionSdnc = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "SDNC", cloudRegion)
@@ -392,7 +396,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
String networkType = utils.getNodeText(queryAAIResponse, "network-type")
String networkId = utils.getNodeText(queryAAIResponse, "network-id")
String backoutOnFailure = execution.getVariable(Prefix + "rollbackEnabled")
-
+
String networkStackId = ""
networkStackId = utils.getNodeText(queryAAIResponse, "heat-stack-id")
if (networkStackId == 'null' || networkStackId == "" || networkStackId == null) {
@@ -412,14 +416,14 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
String notificationUrl = "" //TODO - is this coming from URN? What variable/value to use?
//String notificationUrl = execution.getVariable("URN_?????") //TODO - is this coming from URN? What variable/value to use?
- String modelCustomizationUuid = ""
+ String modelCustomizationUuid = ""
if (utils.nodeExists(networkRequest, "networkModelInfo")) {
String networkModelInfo = utils.getNodeXml(networkRequest, "networkModelInfo", false).replace("tag0:","").replace(":tag0","")
modelCustomizationUuid = utils.getNodeText(networkModelInfo, "modelCustomizationUuid")
} else {
modelCustomizationUuid = utils.getNodeText(networkRequest, "modelCustomizationId")
}
-
+
String deleteNetworkRequest = """
<deleteNetworkRequest>
<cloudSiteId>${MsoUtils.xmlEscape(cloudSiteId)}</cloudSiteId>
@@ -515,7 +519,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
networkId = utils.getNodeText(deleteNetworkInput, "network-id")
}
if (networkId == 'null') {networkId = ""}
-
+
String serviceInstanceId = utils.getNodeText(deleteNetworkInput, "service-instance-id")
// get/set 'msoRequestId' and 'mso-request-id'
@@ -524,11 +528,11 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("mso-request-id", requestId)
} else {
requestId = execution.getVariable("mso-request-id")
- }
+ }
execution.setVariable(Prefix + "requestId", requestId)
msoLogger.debug(Prefix + "requestId " + requestId)
String queryAAIResponse = execution.getVariable(Prefix + "queryAAIResponse")
-
+
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc")
// 1. prepare delete topology via SDNC Adapter SUBFLOW call
@@ -567,7 +571,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
if (networkId == 'null') {networkId = ""}
String serviceInstanceId = utils.getNodeText(deleteNetworkInput, "service-instance-id")
-
+
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc")
// 1. prepare delete topology via SDNC Adapter SUBFLOW call
@@ -587,8 +591,8 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
}
}
-
-
+
+
public void prepareRpcSDNCDeactivate(DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
@@ -596,7 +600,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
msoLogger.trace("Inside prepareRpcSDNCDeactivate() of DoDeleteNetworkInstance ")
try {
-
+
// get variables
String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest")
@@ -607,7 +611,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
}
if (networkId == 'null') {networkId = ""}
String serviceInstanceId = utils.getNodeText(deleteNetworkInput, "service-instance-id")
-
+
String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "deactivate", "DeleteNetworkInstance", cloudRegionId, networkId, null)
String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest)
execution.setVariable(Prefix + "deactivateSDNCRequest", sndcTopologyRollbackRpcRequestAsString)
@@ -622,7 +626,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
}
}
-
+
// **************************************************
// Post or Validate Response Section
// **************************************************
@@ -640,7 +644,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
msoLogger.debug(" Network Adapter responseCode: " + returnCode)
msoLogger.debug("Network Adapter Response - " + "\n" + networkResponse)
msoLogger.debug(networkResponse)
-
+
String errorMessage = ""
if (returnCode == "200") {
msoLogger.debug(" Network Adapter Response is successful - " + "\n" + networkResponse)
@@ -658,9 +662,9 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
String rollbackNetworkXml = utils.formatXml(rollbackNetwork)
execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkXml)
msoLogger.debug(" Network Adapter rollback data - " + "\n" + rollbackNetworkXml)
- }
-
-
+ }
+
+
} else { // network error
if (returnCode.toInteger() > 399 && returnCode.toInteger() < 600) { //4xx, 5xx
if (networkResponse.contains("deleteNetworkError") ) {
@@ -756,7 +760,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
}
}
-
+
public void prepareRpcSDNCDeactivateRollback(DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
@@ -764,7 +768,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
msoLogger.trace("Inside prepareRpcSDNCDeactivateRollback() of DoDeleteNetworkInstance ")
try {
-
+
// get variables
String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest")
@@ -789,43 +793,43 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
}
}
-
+
public void prepareRollbackData(DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
-
+
msoLogger.trace("Inside prepareRollbackData() of DoDeleteNetworkInstance ")
-
+
try {
-
+
Map<String, String> rollbackData = new HashMap<String, String>();
String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest")
if (rollbackNetworkRequest != null) {
if (rollbackNetworkRequest != "") {
rollbackData.put("rollbackNetworkRequest", execution.getVariable(Prefix + "rollbackNetworkRequest"))
}
- }
+ }
String rollbackDeactivateSDNCRequest = execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest")
if (rollbackDeactivateSDNCRequest != null) {
if (rollbackDeactivateSDNCRequest != "") {
rollbackData.put("rollbackDeactivateSDNCRequest", execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest"))
}
- }
+ }
execution.setVariable("rollbackData", rollbackData)
msoLogger.debug("** rollbackData : " + rollbackData)
-
+
execution.setVariable("WorkflowException", execution.getVariable("WorkflowException"))
msoLogger.debug("** WorkflowException : " + execution.getVariable("WorkflowException"))
-
+
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRollbackData() - " + ex.getMessage()
msoLogger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
-
+
}
-
+
}
-
+
public void postProcessResponse (DelegateExecution execution) {
execution.setVariable("prefix", Prefix)
@@ -833,7 +837,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
msoLogger.trace("Inside postProcessResponse of DoDeleteNetworkInstance ")
try {
-
+
msoLogger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException"))
if (execution.getVariable(Prefix + "isException") == false) {
execution.setVariable(Prefix + "Success", true)
@@ -841,10 +845,10 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
if (execution.getVariable(Prefix + "isSilentSuccess") == true) {
execution.setVariable("rolledBack", false)
} else {
- execution.setVariable("rolledBack", true)
+ execution.setVariable("rolledBack", true)
}
prepareSuccessRollbackData(execution) // populate rollbackData
-
+
} else {
execution.setVariable(Prefix + "Success", false)
execution.setVariable("rollbackData", null)
@@ -864,25 +868,25 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
}
}
}
-
+
// going to the Main flow: a-la-carte or macro
msoLogger.debug(" ***** postProcessResponse(), BAD !!!")
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
throw new BpmnError("MSOWorkflowException")
-
- }
-
+
+ }
+
} catch(BpmnError b){
msoLogger.debug("Rethrowing MSOWorkflowException")
throw b
-
+
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, postProcessResponse() - " + ex.getMessage()
msoLogger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
throw new BpmnError("MSOWorkflowException")
-
+
}
}
@@ -890,18 +894,18 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
public void prepareSuccessRollbackData(DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
-
+
msoLogger.trace("Inside prepareSuccessRollbackData() of DoDeleteNetworkInstance ")
-
+
try {
-
+
if (execution.getVariable("sdncVersion") != '1610') {
prepareRpcSDNCDeactivateRollback(execution)
prepareRpcSDNCUnassignRollback(execution)
} else {
prepareSDNCRollback(execution)
- }
-
+ }
+
Map<String, String> rollbackData = new HashMap<String, String>();
String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest")
if (rollbackSDNCRequest != null) {
@@ -914,26 +918,26 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
if (rollbackNetworkRequest != "") {
rollbackData.put("rollbackNetworkRequest", execution.getVariable(Prefix + "rollbackNetworkRequest"))
}
- }
+ }
String rollbackDeactivateSDNCRequest = execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest")
if (rollbackDeactivateSDNCRequest != null) {
if (rollbackDeactivateSDNCRequest != "") {
rollbackData.put("rollbackDeactivateSDNCRequest", execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest"))
}
- }
+ }
execution.setVariable("rollbackData", rollbackData)
-
+
msoLogger.debug("** rollbackData : " + rollbackData)
execution.setVariable("WorkflowException", null)
-
+
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage()
msoLogger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
-
+
}
-
+
}
public void prepareRpcSDNCUnassignRollback(DelegateExecution execution) {
@@ -943,7 +947,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
msoLogger.trace("Inside prepareRpcSDNCUnassignRollbac() of DoDeleteNetworkInstance ")
try {
-
+
// get variables
String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest")
@@ -952,7 +956,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
String networkId = utils.getNodeText(deleteSDNCResponse, "network-id")
if (networkId == 'null') {networkId = ""}
String serviceInstanceId = utils.getNodeText(deleteNetworkInput, "service-instance-id")
-
+
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc")
// 1. prepare delete topology via SDNC Adapter SUBFLOW call
@@ -962,7 +966,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyDeleteRequesAsString)
msoLogger.debug(Prefix + "rollbackSDNCRequest" + "\n" + sndcTopologyDeleteRequesAsString)
msoLogger.debug(" Preparing request for RPC SDNC Topology 'assign-CreateNetworkInstance' rollback . . . - " + "\n" + sndcTopologyDeleteRequesAsString)
-
+
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRpcSDNCUnassignRollback() - " + ex.getMessage()
@@ -972,7 +976,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
}
}
-
+
public void prepareSDNCRollback (DelegateExecution execution) {
execution.setVariable("prefix", Prefix)
@@ -980,7 +984,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
msoLogger.trace("Inside prepareSDNCRollback of DoDeleteNetworkInstance ")
try {
-
+
// get variables
String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest")
@@ -990,7 +994,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
networkId = utils.getNodeText(deleteNetworkInput, "network-id")
}
if (networkId == 'null') {networkId = ""}
-
+
String serviceInstanceId = utils.getNodeText(deleteNetworkInput, "service-instance-id")
// get/set 'msoRequestId' and 'mso-request-id'
@@ -999,11 +1003,11 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("mso-request-id", requestId)
} else {
requestId = execution.getVariable("mso-request-id")
- }
+ }
execution.setVariable(Prefix + "requestId", requestId)
-
+
String queryAAIResponse = execution.getVariable(Prefix + "queryAAIResponse")
-
+
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc")
// 1. prepare delete topology via SDNC Adapter SUBFLOW call
@@ -1025,33 +1029,33 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
}
}
-
+
public void setExceptionFlag(DelegateExecution execution){
execution.setVariable("prefix",Prefix)
-
+
msoLogger.trace("Inside setExceptionFlag() of DoDeleteNetworkInstance ")
-
+
try {
execution.setVariable(Prefix + "isException", true)
-
+
if (execution.getVariable("SavedWorkflowException1") != null) {
execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1"))
} else {
execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException"))
}
msoLogger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException"))
-
+
} catch(Exception ex){
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance flow. setExceptionFlag(): " + ex.getMessage()
msoLogger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
-
+
}
-
-
+
+
// *******************************
// Build Error Section
// *******************************
@@ -1065,7 +1069,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
msoLogger.debug("Variables List: " + execution.getVariables())
execution.setVariable("UnexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception")
-
+
}catch(Exception e){
msoLogger.debug("Caught Exception during processJavaException Method: " + e)
execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
index b41b74e509..1a3e8aa4e6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
@@ -34,6 +34,10 @@ import org.onap.so.bpmn.common.scripts.VfModule
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.aai.AAIObjectPlurals
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
import org.onap.so.rest.APIResponse
@@ -470,9 +474,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("DoDVfMod_networkPolicyFqdnCount", fqdnCount)
msoLogger.debug("DoDVfMod_networkPolicyFqdnCount - " + fqdnCount)
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution)
if (fqdnCount > 0) {
// AII loop call over contrail network policy fqdn list
@@ -482,10 +484,10 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
String fqdn = fqdnList[i]
// Query AAI for this network policy FQDN
-
- String queryNetworkPolicyByFqdnAAIRequest = "${aai_endpoint}${aai_uri}?network-policy-fqdn=" + UriUtils.encode(fqdn, "UTF-8")
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ uri.queryParam("network-policy-fqdn", fqdn)
+ String queryNetworkPolicyByFqdnAAIRequest = aaiUriUtil.createAaiUri(uri)
msoLogger.debug("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest)
- msoLogger.debug("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest)
APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkPolicyByFqdnAAIRequest)
int returnCode = response.getStatusCode()
@@ -508,9 +510,10 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
def resourceVersion = utils.getNodeText(aaiResponseAsString, "resource-version")
msoLogger.debug("Deleting network-policy with resource-version " + resourceVersion)
- String delNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(networkPolicyId, "UTF-8") +
- "?resource-version=" + UriUtils.encode(resourceVersion, "UTF-8")
- msoLogger.debug("AAI request endpoint: " + delNetworkPolicyAAIRequest)
+ AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId)
+ delUri.resourceVersion(resourceVersion)
+ String delNetworkPolicyAAIRequest = aaiUriUtil.createAaiUri(delUri)
+
msoLogger.debug("AAI request endpoint: " + delNetworkPolicyAAIRequest)
msoLogger.debug("invoking DELETE call to AAI")
@@ -644,11 +647,9 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
def vfModuleId = execution.getVariable('vfModuleId')
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- msoLogger.debug('AAI URI is: ' + aai_uri)
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
+ String endPoint = aaiUriUtil.createAaiUri(uri)
- String endPoint = UrnPropertiesReader.getVariable("aai.endpoint",execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") +
- "/vf-modules/vf-module/" + UriUtils.encode(vfModuleId, "UTF-8")
msoLogger.debug("AAI endPoint: " + endPoint)
try {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
index 1024fc57da..d90c316832 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
@@ -33,6 +33,11 @@ import org.onap.so.bpmn.common.scripts.VfModuleBase
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.graphinventory.entities.uri.Depth
+import org.onap.so.client.aai.AAIObjectPlurals
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
import org.onap.so.rest.APIResponse
@@ -129,10 +134,9 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
def vnfId = execution.getVariable('vnfId')
AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- msoLogger.debug('AAI URI is: ' + aai_uri)
-
- String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
+
+ String endPoint = aaiUriUtil.createAaiUri(uri)
msoLogger.debug("DoDeleteVfModuleFromVnf: AAI endPoint : " + endPoint)
@@ -490,9 +494,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
execution.setVariable("DDVFMV_networkPolicyFqdnCount", fqdnCount)
msoLogger.debug("DDVFMV_networkPolicyFqdnCount - " + fqdnCount)
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution)
if (fqdnCount > 0) {
// AII loop call over contrail network policy fqdn list
@@ -503,10 +505,12 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
// Query AAI for this network policy FQDN
- String queryNetworkPolicyByFqdnAAIRequest = "${aai_endpoint}${aai_uri}?network-policy-fqdn=" + UriUtils.encode(fqdn, "UTF-8")
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ uri.queryParam("network-policy-fqdn", fqdn)
+ String queryNetworkPolicyByFqdnAAIRequest = aaiUriUtil.createAaiUri(uri)
+
msoLogger.debug("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest)
-
APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkPolicyByFqdnAAIRequest)
int returnCode = response.getStatusCode()
execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", returnCode)
@@ -528,8 +532,10 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
def resourceVersion = utils.getNodeText(aaiResponseAsString, "resource-version")
msoLogger.debug("Deleting network-policy with resource-version " + resourceVersion)
- String delNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(networkPolicyId, "UTF-8") +
- "?resource-version=" + UriUtils.encode(resourceVersion, "UTF-8")
+ AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId)
+ delUri.resourceVersion(resourceVersion)
+ String delNetworkPolicyAAIRequest = aaiUriUtil.createAaiUri(delUri)
+
msoLogger.debug("AAI request endpoint: " + delNetworkPolicyAAIRequest)
msoLogger.debug("invoking DELETE call to AAI")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy
index b1cef477be..03e47cf141 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,31 +30,35 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.constants.Defaults
import org.onap.so.logger.MsoLogger
import org.onap.so.rest.APIResponse
import org.springframework.web.util.UriUtils
class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVfModuleVolumeV2.class);
-
+
String prefix="DDVMV_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
XmlParser xmlParser = new XmlParser()
JsonUtils jsonUtil = new JsonUtils()
-
+
@Override
public void preProcessRequest(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- preProcessRequest(execution, isDebugEnabled)
+ preProcessRequest(execution, isDebugEnabled)
}
-
+
/**
* Set default variable values
* @param execution
* @param isDebugLogEnabled
*/
public void preProcessRequest (DelegateExecution execution, isDebugEnabled) {
-
+
//Input:
// msoRequestId
// isDebugLogEnabled
@@ -71,13 +75,13 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
// workflowException @TODO: actual variable name is WorkflowException
// rolledBack
// wasDeleted
-
+
execution.setVariable('prefix', prefix)
execution.setVariable('wasDeleted', 'false')
-
+
def tenantId = execution.getVariable("tenantId")
def cloudSiteId = execution.getVariable("lcpCloudRegionId")
-
+
// if tenantId or lcpCloudregionId is not passed, get it from cloudRegionConfiguration variable
if(!tenantId || !cloudSiteId) {
def cloudConfiguration = execution.getVariable("cloudConfiguration")
@@ -86,10 +90,12 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
execution.setVariable("tenantId", tenantId)
cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId")
execution.setVariable("lcpCloudRegionId", cloudSiteId)
+ cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudOwner")
+ execution.setVariable("cloudOwner", cloudOwner)
}
}
-
-
+
+
/**
* Set out 'wasDeleted' variable to 'true'
* @param execution
@@ -98,8 +104,8 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
public void postProcess(DelegateExecution execution, isDebugLogEnabled) {
execution.setVariable('wasDeleted', 'true')
}
-
-
+
+
/**
* Query and set cloud region to use for AAI calls
* Output variables: prefix+'aicCloudRegion', prefix+'cloudRegion'
@@ -107,14 +113,12 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
* @param isDebugEnabled
*/
public void callRESTQueryAAICloudRegion(DelegateExecution execution, isDebugEnabled) {
-
- String cloudRegion = execution.getVariable('lcpCloudRegionId')
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint",execution)
+
+ String cloudRegion = execution.getVariable('lcpCloudRegionId')
AaiUtil aaiUtil = new AaiUtil(this)
- String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution)
- String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion
- msoLogger.debug(queryCloudRegionRequest)
- msoLogger.debug("AAI query cloud region URI - " + queryCloudRegionRequest)
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+ def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
@@ -125,14 +129,14 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
else{
execution.setVariable(prefix+"aicCloudRegion", cloudRegion)
}
- }
+ }
else {
msoLogger.debug("AAI Query Cloud Region Unsuccessful.")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode"))
}
}
-
-
+
+
/**
* Query AAI Volume Group
* Output variables: prefix+'queryAAIVolGrpResponse'; prefix+'volumeGroupHeatStackId'
@@ -140,9 +144,9 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
* @param isDebugLogEnabled
*/
public void callRESTQueryAAIForVolumeGroup(DelegateExecution execution, isDebugLogEnabled) {
-
- def tenantId = execution.getVariable('tenantId')
- def volumeGroupId = execution.getVariable('volumeGroupId')
+
+ def tenantId = execution.getVariable('tenantId')
+ def volumeGroupId = execution.getVariable('volumeGroupId')
if(volumeGroupId == null) {
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, 'volumeGroupId is not provided in the request')
throw new Exception('volume-group-id is not provided in the request')
@@ -150,8 +154,9 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
String cloudRegion = execution.getVariable(prefix+'aicCloudRegion')
AaiUtil aaiUtil = new AaiUtil(this)
- String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution)
- String queryAAIVolumeGroupRequest = aaiEndpoint + '/' + URLEncoder.encode(cloudRegion, "UTF-8") + "/volume-groups/volume-group/" + UriUtils.encode(volumeGroupId, "UTF-8")
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion, volumeGroupId)
+ def queryAAIVolumeGroupRequest = aaiUtil.createAaiUri(uri)
msoLogger.debug('Query AAI volume group by ID: ' + queryAAIVolumeGroupRequest)
msoLogger.debug('Query AAI volume group by ID: ' + queryAAIVolumeGroupRequest)
@@ -174,7 +179,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
execution.setVariable(prefix+'volumeGroupHeatStackId', heatStackId)
msoLogger.debug('Heat stack id from AAI response: ' + heatStackId)
-
+
if(hasVfModuleRelationship(aaiResponseAsString)){
msoLogger.debug('Volume Group ' + volumeGroupId + ' currently in use')
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} currently in use - found vf-module relationship.")
@@ -182,12 +187,12 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
def volumeGroupTenantId = getTenantIdFromVolumeGroup(aaiResponseAsString)
msoLogger.debug('Tenant ID from AAI response: ' + volumeGroupTenantId)
-
+
if (volumeGroupTenantId == null) {
msoLogger.debug("Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}")
}
-
+
if (volumeGroupTenantId != tenantId) {
def String errorMessage = 'TenantId ' + tenantId + ' in incoming request does not match Tenant Id ' + volumeGroupTenantId + ' retrieved from AAI for Volume Group Id ' + volumeGroupId
msoLogger.debug("Error in DeleteVfModuleVolume: " + errorMessage)
@@ -206,7 +211,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
}
}
}
-
+
/**
* Format VNF Adapter subflow request XML
* Variables: prefix+'deleteVnfARequest'
@@ -216,7 +221,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
public void prepareVnfAdapterDeleteRequest(DelegateExecution execution, isDebugLogEnabled) {
def cloudRegion = execution.getVariable(prefix+'aicCloudRegion')
def tenantId = execution.getVariable('tenantId') // input parameter (optional) - see preProcessRequest
- def volumeGroupId = execution.getVariable('volumeGroupId') // input parameter (required)
+ def volumeGroupId = execution.getVariable('volumeGroupId') // input parameter (required)
def volumeGroupHeatStackId = execution.getVariable(prefix+'volumeGroupHeatStackId') // from AAI query volume group
def requestId = execution.getVariable('msoRequestId') // input parameter (required)
def serviceId = execution.getVariable('serviceInstanceId') // imput parameter (optional)
@@ -247,30 +252,27 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
execution.setVariable(prefix+'deleteVnfARequest', vnfAdapterRestRequest)
msoLogger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest)
}
-
-
+
+
/**
* Delete volume group in AAI
* @param execution
* @param isDebugEnabled
*/
public void callRESTDeleteAAIVolumeGroup(DelegateExecution execution, isDebugEnabled) {
-
+
// get variables
String queryAAIVolGrpIdResponse = execution.getVariable(prefix+"queryAAIVolGrpResponse")
String groupId = utils.getNodeText(queryAAIVolGrpIdResponse, "volume-group-id")
String resourceVersion = utils.getNodeText(queryAAIVolGrpIdResponse, "resource-version")
-
+
String messageId = UUID.randomUUID().toString()
String cloudRegion = execution.getVariable(prefix+'aicCloudRegion')
AaiUtil aaiUtil = new AaiUtil(this)
- String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution)
- String deleteAAIVolumeGrpIdRequest = aaiEndpoint + '/' + URLEncoder.encode(cloudRegion, "UTF-8") + "/volume-groups/volume-group/" + UriUtils.encode(groupId, "UTF-8")
- if(resourceVersion !=null){
- deleteAAIVolumeGrpIdRequest = deleteAAIVolumeGrpIdRequest +'?resource-version=' + UriUtils.encode(resourceVersion, 'UTF-8')
- }
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion, groupId).queryParam("resource-version", resourceVersion)
+ def deleteAAIVolumeGrpIdRequest = aaiUtil.createAaiUri(uri)
msoLogger.debug('Delete AAI volume group : ' + deleteAAIVolumeGrpIdRequest)
msoLogger.debug("Delete AAI volume group : " + deleteAAIVolumeGrpIdRequest)
@@ -297,8 +299,8 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
}
}
}
-
-
+
+
/**
* Check if volume group has a relationship to vf-module
* @param volumeGroupXml
@@ -322,7 +324,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
return false
}
-
+
/**
* Extract the Tenant Id from the Volume Group information returned by AAI.
* @param volumeGroupXml Volume Group XML returned by AAI.
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy
index 699e9bf40a..456a9cfabf 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy
@@ -27,12 +27,15 @@ import javax.xml.parsers.DocumentBuilderFactory
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.GenericVnf
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.graphinventory.entities.uri.Depth;
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.w3c.dom.Document
@@ -80,8 +83,6 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor {
execution.setVariable("DoDVNF_vnfId", vnfId)
msoLogger.debug("Incoming Vnf(Instance) Id is: " + vnfId)
- // Setting for sub flow calls
- execution.setVariable("DoDVNF_type", "generic-vnf")
}catch(BpmnError b){
msoLogger.debug("Rethrowing MSOWorkflowException")
throw b
@@ -94,49 +95,42 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor {
}
- public void processGetVnfResponse(DelegateExecution execution){
+ public void getVnf(DelegateExecution execution){
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED DoDeleteVnf processGetVnfResponse Process ")
+ msoLogger.trace("STARTED DoDeleteVnf getVnf Process ")
try {
- String vnf = execution.getVariable("DoDVNF_genericVnf")
- String resourceVersion = utils.getNodeText(vnf, "resource-version")
- execution.setVariable("DoDVNF_resourceVersion", resourceVersion)
-
- if(utils.nodeExists(vnf, "relationship")){
- InputSource source = new InputSource(new StringReader(vnf));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document vnfXml = docBuilder.parse(source)
-
- NodeList nodeList = vnfXml.getElementsByTagName("relationship")
- for (int x = 0; x < nodeList.getLength(); x++) {
- Node node = nodeList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- def e = eElement.getElementsByTagName("related-to").item(0).getTextContent()
- if(e.equals("volume-group") || e.equals("l3-network")){
- msoLogger.debug("Generic Vnf still has relationship to OpenStack.")
- execution.setVariable("DoDVNF_vnfInUse", true)
- }else{
- msoLogger.debug("Relationship NOT related to OpenStack")
- }
+
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, execution.getVariable('vnfId'))
+
+ if(resourceClient.exists(uri)){
+ execution.setVariable("GENGV_FoundIndicator", true)
+ AAIResultWrapper wrapper = resourceClient.get(uri.depth(Depth.ONE))
+ if(wrapper.getRelationships().isPresent()){
+ List<AAIResourceUri> relationships = wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.CLOUD_REGION)
+ relationships.addAll(wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.L3_NETWORK))
+ if(!relationships.isEmpty()){
+ execution.setVariable("DoDVNF_vnfInUse", true)
+ }else{
+ msoLogger.debug("Relationship NOT related to OpenStack")
}
}
- }
- if(utils.nodeExists(vnf, "vf-module")){
- execution.setVariable("DoDVNF_vnfInUse", true)
- msoLogger.debug("Generic Vnf still has vf-modules.")
+ Optional<GenericVnf> vnf = wrapper.asBean(GenericVnf.class)
+ if(!vnf.get().getVfModules().getVfModule().isEmpty()){
+ execution.setVariable("DoDVNF_vnfInUse", true)
+ }
+ }else{
+ execution.setVariable("GENGV_FoundIndicator", false)
}
-
} catch (Exception ex) {
- msoLogger.debug("Error Occured in DoDeleteVnf processGetVnfResponse Process " + ex.getMessage())
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoDeleteVnf processGetVnfResponse Process")
+ msoLogger.debug("Error Occured in DoDeleteVnf getVnf Process " + ex.getMessage())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoDeleteVnf getVnf Process")
}
- msoLogger.trace("COMPLETED DoDeleteVnf processGetVnfResponse Process ")
+ msoLogger.trace("COMPLETED DoDeleteVnf getVnf Process ")
}
/**
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy
index d448dd3e79..ddf2706635 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy
@@ -39,6 +39,10 @@ import org.onap.so.bpmn.core.domain.ModuleResource
import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.graphinventory.entities.uri.Depth
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.client.aai.AAIObjectType
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
import org.onap.so.rest.APIResponse
@@ -255,10 +259,9 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
def vnfId = execution.getVariable('vnfId')
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- msoLogger.debug('AAI URI is: ' + aai_uri)
-
- String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
+ String endPoint = aaiUriUtil.createAaiUri(uri)
+
msoLogger.debug("AAI endPoint: " + endPoint)
try {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
index cb50fbbee6..5b7fdb2c22 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
@@ -32,6 +32,11 @@ import org.onap.so.bpmn.core.RollbackData
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.domain.Resource
import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.springframework.web.util.UriUtils;
import groovy.json.*
@@ -269,11 +274,8 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
utils.log("INFO","Entered " + method, isDebugEnabled)
String msg = ""
- utils.log("INFO"," ***** preProcessAAIPUT *****", isDebugEnabled)
-
String serviceInstanceVersion = execution.getVariable("serviceInstanceVersion")
- //execution.setVariable("GENPS_serviceResourceVersion", serviceInstanceVersion)
//requestDetails.modelInfo.for AAI PUT servieInstanceData
//requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData
@@ -285,71 +287,48 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
String modelUuid = execution.getVariable("modelUuid")
+ org.onap.aai.domain.yang.ServiceInstance si = new org.onap.aai.domain.yang.ServiceInstance()
+ si.setServiceInstanceId(serviceInstanceId)
+ si.setServiceInstanceName(serviceInstanceName)
+ si.setServiceType(aaiServiceType)
+ si.setServiceRole(aaiServiceRole)
+ si.setModelInvariantId(modelInvariantUuid)
+ si.setModelVersionId(modelUuid)
- AaiUtil aaiUriUtil = new AaiUtil(this)
- utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled)
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- utils.log("INFO","aai_uri: " + aai_uri, isDebugEnabled)
- String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
- utils.log("INFO","namespace: " + namespace, isDebugEnabled)
-
- //update target model to aai
- String serviceInstanceData =
- """<service-instance xmlns=\"${namespace}\">
- <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <service-instance-name>${MsoUtils.xmlEscape(serviceInstanceName)}</service-instance-name>
- <service-type>${MsoUtils.xmlEscape(aaiServiceType)}</service-type>
- <service-role>${MsoUtils.xmlEscape(aaiServiceRole)}</service-role>
- <resource-version>${MsoUtils.xmlEscape(serviceInstanceVersion)}</resource-version>
- <model-invariant-id>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-id>
- <model-version-id>${MsoUtils.xmlEscape(modelUuid)}</model-version-id>
- </service-instance>""".trim()
-
- execution.setVariable("serviceInstanceData", serviceInstanceData)
- utils.log("INFO","serviceInstanceData: " + serviceInstanceData, isDebugEnabled)
- utils.logAudit(serviceInstanceData)
- utils.log("INFO", " aai_uri " + aai_uri + " namespace:" + namespace, isDebugEnabled)
- utils.log("INFO", " 'payload' to update Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled)
+ execution.setVariable("serviceInstanceData", si)
utils.log("INFO", "Exited " + method, isDebugEnabled)
}
- public void postProcessAAIPUT(DelegateExecution execution) {
+ public void updateServiceInstance(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** postProcessAAIPUT ***** ", isDebugEnabled)
+ utils.log("INFO"," ***** createServiceInstance ***** ", isDebugEnabled)
String msg = ""
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
try {
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator")
- if(!succInAAI){
- utils.log("INFO","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled)
- WorkflowException workflowException = execution.getVariable("WorkflowException")
- utils.logAudit("workflowException: " + workflowException)
- if(workflowException != null){
- exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
- }
- }
- else
- {
- //start rollback set up
- RollbackData rollbackData = new RollbackData()
- def disableRollback = execution.getVariable("disableRollback")
- rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
- rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
- rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId)
- rollbackData.put("SERVICEINSTANCE", "serviceType", execution.getVariable("serviceType"))
- rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
- execution.setVariable("rollbackData", rollbackData)
- }
+ org.onap.aai.domain.yang.ServiceInstance si = execution.getVariable("serviceInstanceData")
+
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ client.update(uri, si)
} catch (BpmnError e) {
throw e;
} catch (Exception ex) {
- msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage()
+ RollbackData rollbackData = new RollbackData()
+ def disableRollback = execution.getVariable("disableRollback")
+ rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
+ rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
+ rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId)
+ rollbackData.put("SERVICEINSTANCE", "serviceType", execution.getVariable("serviceType"))
+ rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
+ execution.setVariable("rollbackData", rollbackData)
+
+ msg = "Exception in DoCreateServiceInstance.createServiceInstance. " + ex.getMessage()
utils.log("INFO", msg, isDebugEnabled)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- utils.log("INFO"," *** Exit postProcessAAIPUT *** ", isDebugEnabled)
+ utils.log("INFO"," *** Exit createServiceInstance *** ", isDebugEnabled)
}
public void preProcessRollback (DelegateExecution execution) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy
index 257142e8bd..949a566711 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy
@@ -25,9 +25,16 @@ import static org.apache.commons.lang3.StringUtils.*;
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MsoLogger
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
import groovy.json.*
@@ -210,61 +217,38 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce
String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
String modelUuid = execution.getVariable("model-version-id-original")
- //AAI PUT
- AaiUtil aaiUriUtil = new AaiUtil(this)
- utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled)
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- utils.log("INFO","aai_uri: " + aai_uri, isDebugEnabled)
- String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
- utils.log("INFO","namespace: " + namespace, isDebugEnabled)
-
- String serviceInstanceData =
- """<service-instance xmlns=\"${namespace}\">
- <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <service-instance-name>${MsoUtils.xmlEscape(serviceInstanceName)}</service-instance-name>
- <service-type>${MsoUtils.xmlEscape(aaiServiceType)}</service-type>
- <service-role>${MsoUtils.xmlEscape(aaiServiceRole)}</service-role>
- <resource-version>${MsoUtils.xmlEscape(serviceInstanceVersion)}</resource-version>
- <model-invariant-id>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-id>
- <model-version-id>${MsoUtils.xmlEscape(modelUuid)}</model-version-id>
- </service-instance>""".trim()
-
- execution.setVariable("serviceInstanceData", serviceInstanceData)
- msoLogger.info("serviceInstanceData: " + serviceInstanceData)
- msoLogger.debug(serviceInstanceData)
- msoLogger.info(" aai_uri " + aai_uri + " namespace:" + namespace)
- msoLogger.info(" 'payload' to update Service Instance in AAI - " + "\n" + serviceInstanceData)
+ org.onap.aai.domain.yang.ServiceInstance si = new org.onap.aai.domain.yang.ServiceInstance()
+ si.setServiceInstanceId(serviceInstanceId)
+ si.setServiceInstanceName(serviceInstanceName)
+ si.setServiceType(aaiServiceType)
+ si.setServiceRole(aaiServiceRole)
+ si.setModelInvariantId(modelInvariantUuid)
+ si.setModelVersionId(modelUuid)
+
+ execution.setVariable("serviceInstanceData", si)
msoLogger.info("Exited " + method)
}
- public void postProcessAAIPUT(DelegateExecution execution) {
- msoLogger.trace("postProcessAAIPUT ")
+ public void updateServiceInstance(DelegateExecution execution) {
+ msoLogger.trace("updateServiceInstance ")
String msg = ""
try {
String serviceInstanceId = execution.getVariable("serviceInstanceId")
- boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator")
- if(!succInAAI){
- msoLogger.info("Error putting Service-instance in AAI", + serviceInstanceId)
- WorkflowException workflowException = execution.getVariable("WorkflowException")
- msoLogger.debug("workflowException: " + workflowException)
- if(workflowException != null){
- exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
- }
- }
- else
- {
+ org.onap.aai.domain.yang.ServiceInstance si = execution.getVariable("serviceInstanceData")
- }
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ client.update(uri, si)
} catch (BpmnError e) {
throw e;
} catch (Exception ex) {
- msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage()
+ msg = "Exception in DoCreateServiceInstance.updateServiceInstance. " + ex.getMessage()
msoLogger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit postProcessAAIPUT ")
+ msoLogger.trace("Exit updateServiceInstance ")
}
public void processRollbackException(DelegateExecution execution){
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy
index d7f2087c05..dbacd48809 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy
@@ -20,6 +20,8 @@
package org.onap.so.bpmn.infrastructure.scripts;
+import javax.ws.rs.core.UriBuilder
+
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
@@ -33,17 +35,18 @@ import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.logger.MsoLogger
-import org.onap.so.rest.APIResponse
-import org.springframework.web.util.UriUtils
-
-import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.AAIObjectType
-import org.onap.so.client.aai.entities.AAIResultWrapper
-import org.onap.so.client.aai.entities.Relationships
+import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.json.JSONObject
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.graphinventory.entities.uri.Depth
+import org.onap.so.constants.Defaults
+import org.onap.so.logger.MsoLogger
+import org.onap.so.rest.APIResponse
+import org.springframework.web.util.UriUtils
+import org.onap.aai.domain.yang.VpnBinding
+import org.onap.aai.domain.yang.RouteTarget
import javax.ws.rs.NotFoundException
import groovy.json.*
@@ -352,16 +355,15 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
try {
String networkInputs = execution.getVariable(Prefix + "networkInputs")
String cloudRegion = utils.getNodeText(networkInputs, "aic-cloud-region")
- cloudRegion = UriUtils.encode(cloudRegion,"UTF-8")
// Prepare AA&I url
String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUtil = new AaiUtil(this)
- String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution)
- String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion
- msoLogger.debug(queryCloudRegionRequest)
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+ def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
+
execution.setVariable(Prefix + "queryCloudRegionRequest", queryCloudRegionRequest)
- msoLogger.debug(" UPDNETI_queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest)
String cloudRegionPo = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
String cloudRegionSdnc = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "SDNC", cloudRegion)
@@ -407,10 +409,11 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "networkId", networkId)
// Prepare AA&I url
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String queryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all"
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId)
+ uri.depth(Depth.ALL)
+ String queryIdAAIRequest = aaiUriUtil.createAaiUri(uri)
+
msoLogger.debug(queryIdAAIRequest)
execution.setVariable(Prefix + "queryIdAAIRequest", queryIdAAIRequest)
msoLogger.debug(Prefix + "queryIdAAIRequest - " + "\n" + queryIdAAIRequest)
@@ -474,10 +477,11 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
networkId = UriUtils.encode(networkId,"UTF-8")
// Prepare AA&I url
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String requeryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all"
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId)
+ uri.depth(Depth.ALL)
+ String requeryIdAAIRequest = aaiUriUtil.createAaiUri(uri)
+
msoLogger.debug(requeryIdAAIRequest)
execution.setVariable(Prefix + "requeryIdAAIRequest", requeryIdAAIRequest)
msoLogger.debug(" UPDNETI_requeryIdAAIRequest - " + "\n" + requeryIdAAIRequest)
@@ -557,93 +561,37 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "vpnCount", vpnCount)
msoLogger.debug(" UPDNETI_vpnCount - " + vpnCount)
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
- AaiUtil aaiUriUtil = new AaiUtil(this)
-
if (vpnCount > 0) {
execution.setVariable(Prefix + "vpnBindings", vpnBindingUri)
msoLogger.debug(" vpnBindingUri List - " + vpnBindingUri)
String routeTargets = ""
// AII loop call using list vpnBindings
- for (i in 0..vpnBindingUri.size()-1) {
-
+ for(i in 0..vpnBindingUri.size()-1) {
int counting = i+1
- // prepare url using vpnBinding
- String queryVpnBindingAAIRequest = ""
- String aai_uri = aaiUriUtil.getNetworkVpnBindingUri(execution)
-
- // Note: By default, the vpnBinding url is found in 'related-link' of the response,
- // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping.
- if (aai_uri == null || aai_uri == "") {
- // using value of 'related-link' from response
- if (vpnBindingUri[i].charAt(vpnBindingUri[i].length()-1) == '/') {
- queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i].substring(0, vpnBindingUri[i].length()-1) + "?depth=all"
- } else {
- queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i] + "?depth=all"
- }
-
- } else {
- // using uri value in URN mapping
- String vpnBindingId = vpnBindingUri[i].substring(vpnBindingUri[i].indexOf("/vpn-binding/")+13, vpnBindingUri[i].length())
- if (vpnBindingId.charAt(vpnBindingId.length()-1) == '/') {
- vpnBindingId = vpnBindingId.substring(0, vpnBindingId.length()-1)
- }
- queryVpnBindingAAIRequest = "${aai_endpoint}${aai_uri}/" + vpnBindingId + "?depth=all"
+ String vpnBindingId = vpnBindingUri[i].substring(vpnBindingUri[i].indexOf("/vpn-binding/")+13, vpnBindingUri[i].length())
+ if (vpnBindingId.charAt(vpnBindingId.length()-1) == '/') {
+ vpnBindingId = vpnBindingId.substring(0, vpnBindingId.length()-1)
}
- msoLogger.debug(queryVpnBindingAAIRequest)
- execution.setVariable(Prefix + "queryVpnBindingAAIRequest", queryVpnBindingAAIRequest)
- msoLogger.debug(" UPDNETI_queryVpnBindingAAIRequest, , vpnBinding #" + counting + " : " + "\n" + queryVpnBindingAAIRequest)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryVpnBindingAAIRequest)
- String returnCode = response.getStatusCode()
- execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", returnCode)
- msoLogger.debug(" ***** AAI query vpn binding Response Code, vpnBinding #" + counting + " : " + returnCode)
-
- String aaiResponseAsString = response.getResponseBodyAsString()
-
- if (returnCode=='200') {
- msoLogger.debug(aaiResponseAsString)
- execution.setVariable(Prefix + "queryVpnBindingAAIResponse", aaiResponseAsString)
- msoLogger.debug(" AAI Query Vpn Binding Success REST Response, , vpnBinding #" + counting + " : " + "\n" + aaiResponseAsString)
-
- String routeTarget = ""
- String routeRole = ""
- if (utils.nodeExists(aaiResponseAsString, "route-targets")) {
- String aaiRouteTargets = utils.getNodeXml(aaiResponseAsString, "route-targets", false)
- def aaiRouteTargetsXml = new XmlSlurper().parseText(aaiRouteTargets)
- def aaiRouteTarget = aaiRouteTargetsXml.'**'.findAll {it.name() == "route-target"}
- for (j in 0..aaiRouteTarget.size()-1) {
- routeTarget = utils.getNodeText(XmlUtil.serialize(aaiRouteTarget[j]), "global-route-target")
- routeRole = utils.getNodeText(XmlUtil.serialize(aaiRouteTarget[j]), "route-target-role")
- routeTargets += "<routeTargets>" + '\n' +
- " <routeTarget>" + routeTarget + "</routeTarget>" + '\n' +
- " <routeTargetRole>" + routeRole + "</routeTargetRole>" + '\n' +
- "</routeTargets>" + '\n'
- }
- }
-
- } else {
- if (returnCode=='404') {
- String dataErrorMessage = "Response Error from AAINetworkVpnBinding is 404 (Not Found)."
- msoLogger.debug(dataErrorMessage)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
-
- } else {
- if (aaiResponseAsString.contains("RESTFault")) {
- WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution)
- execution.setVariable("WorkflowException", exceptionObject)
- throw new BpmnError("MSOWorkflowException")
-
- } else {
- // aai all errors
- String dataErrorMessage = " Unexpected Response from AAINetworkVpnBinding - " + returnCode
- msoLogger.debug(dataErrorMessage)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
-
- }
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnBindingId)
+ AAIResultWrapper wrapper = resourceClient.get(uri.depth(Depth.TWO), NotFoundException.class)
+
+ Optional<VpnBinding> binding = wrapper.asBean(VpnBinding.class)
+
+ String routeTarget = ""
+ String routeRole = ""
+ if(binding.get().getRouteTargets() != null) {
+ List<RouteTarget> targets = binding.get().getRouteTargets().getRouteTarget()
+ for(RouteTarget target : targets) {
+ routeTarget = target.getGlobalRouteTarget()
+ routeRole = target.getRouteTargetRole()
+ routeTargets += "<routeTargets>" + '\n' +
+ " <routeTarget>" + routeTarget + "</routeTarget>" + '\n' +
+ " <routeTargetRole>" + routeRole + "</routeTargetRole>" + '\n' +
+ "</routeTargets>" + '\n'
}
}
@@ -655,8 +603,8 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
} else {
// reset return code to success
execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200")
- String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri)
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ String schemaVersion = aaiUriUtil.getNamespace()
String aaiStubResponse =
""" <rest:payload contentType="text/xml" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd">
<vpn-binding xmlns="${schemaVersion}">
@@ -670,9 +618,9 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
}
- } catch (BpmnError e) {
- throw e;
-
+ } catch (NotFoundException e) {
+ msoLogger.debug("Response Error from AAINetworkVpnBinding is 404 (Not Found).")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Response Error from AAINetworkVpnBinding is 404 (Not Found).")
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkVpnBinding() - " + ex.getMessage()
msoLogger.debug(exceptionMessage)
@@ -700,7 +648,6 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "networkPolicyCount", networkPolicyCount)
msoLogger.debug(" UPDNETI_networkPolicyCount - " + networkPolicyCount)
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUriUtil = new AaiUtil(this)
if (networkPolicyCount > 0) {
@@ -713,31 +660,11 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
int counting = i+1
- // prepare url using vpnBinding
- String queryNetworkPolicyAAIRequest = ""
-
- String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution)
-
- // Note: By default, the network policy url is found in 'related-link' of the response,
- // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping.
- if (aai_uri == null || aai_uri == "") {
- // using value of 'related-link' from response
- if (networkPolicyUriList[i].charAt(networkPolicyUriList[i].length()-1) == '/') {
- queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i].substring(0, networkPolicyUriList[i].length()-1) + "?depth=all"
- } else {
- queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i] + "?depth=all"
- }
- } else {
- // using uri value in URN mapping
- String networkPolicyId = networkPolicyUriList[i].substring(networkPolicyUriList[i].indexOf("/network-policy/")+16, networkPolicyUriList[i].length())
- println " networkPolicyId - " + networkPolicyId
- if (networkPolicyId.charAt(networkPolicyId.length()-1) == '/') {
- networkPolicyId = networkPolicyId.substring(0, networkPolicyId.length()-1)
- }
- queryNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + networkPolicyId + "?depth=all"
-
- }
+ URI uri = UriBuilder.fromUri(networkPolicyUriList[i]).build()
+ AAIResourceUri aaiUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.NETWORK_POLICY, uri)
+ aaiUri.depth(Depth.ALL)
+ String queryNetworkPolicyAAIRequest = aaiUriUtil.createAaiUri(aaiUri)
msoLogger.debug(queryNetworkPolicyAAIRequest)
execution.setVariable(Prefix + "queryNetworkPolicyAAIRequest", queryNetworkPolicyAAIRequest)
@@ -791,8 +718,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
} else {
// reset return code to success
execution.setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "200")
- String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri)
+ String schemaVersion = aaiUriUtil.getNamespace()
String aaiStubResponse =
""" <rest:payload contentType="text/xml" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd">
<network-policy xmlns="${schemaVersion}">
@@ -850,30 +776,11 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
int counting = i+1
// prepare url using tableRef
- String queryNetworkTableRefAAIRequest = ""
-
- String aai_uri = aaiUriUtil.getNetworkTableReferencesUri(execution)
-
- // Note: By default, the network policy url is found in 'related-link' of the response,
- // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping.
- if (aai_uri == null || aai_uri == "") {
- // using value of 'related-link' from response
- if (networkTableRefUriList[i].charAt(networkTableRefUriList[i].length()-1) == '/') {
- queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i].substring(0, networkTableRefUriList[i].length()-1) + "?depth=all"
- } else {
- queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i] + "?depth=all"
- }
- } else {
- // using uri value in URN mapping
- String networkTableRefId = networkTableRefUriList[i].substring(networkTableRefUriList[i].indexOf("/route-table-reference/")+23, networkTableRefUriList[i].length())
-
- if (networkTableRefId.charAt(networkTableRefId.length()-1) == '/') {
- networkTableRefId = networkTableRefId.substring(0, networkTableRefId.length()-1)
- }
- queryNetworkTableRefAAIRequest = "${aai_endpoint}${aai_uri}/" + networkTableRefId + "?depth=all"
-
- }
+ URI uri = UriBuilder.fromUri(networkTableRefUriList[i]).build()
+ AAIResourceUri aaiUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ROUTE_TABLE_REFERENCE, uri)
+ aaiUri.depth(Depth.ALL)
+ String queryNetworkTableRefAAIRequest = aaiUriUtil.createAaiUri(aaiUri)
msoLogger.debug(queryNetworkTableRefAAIRequest)
execution.setVariable(Prefix + "queryNetworkTableRefAAIRequest", queryNetworkTableRefAAIRequest)
@@ -927,8 +834,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
} else {
// reset return code to success
execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "200")
- String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri)
+ String schemaVersion = aaiUriUtil.getNamespace()
String aaiStubResponse =
""" <rest:payload contentType="text/xml" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd">
<route-table-references xmlns="${schemaVersion}">
@@ -969,17 +875,17 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
String updateNetworkResponse = execution.getVariable(Prefix + "updateNetworkResponse")
// Prepare url
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String updateContrailAAIUrlRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all"
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId)
+ uri.depth(Depth.ALL)
+ String updateContrailAAIUrlRequest = aaiUriUtil.createAaiUri(uri)
msoLogger.debug(updateContrailAAIUrlRequest)
execution.setVariable(Prefix + "updateContrailAAIUrlRequest", updateContrailAAIUrlRequest)
msoLogger.debug(" UPDNETI_updateContrailAAIUrlRequest - " + "\n" + updateContrailAAIUrlRequest)
//Prepare payload (PUT)
- String schemaVersion = aaiUriUtil.getNamespaceFromUri(execution, aai_uri)
+ String schemaVersion = aaiUriUtil.getNamespaceFromUri(updateContrailAAIUrlRequest)
String payload = networkUtils.ContrailNetworkCreatedUpdate(requeryIdAAIResponse, updateNetworkResponse, schemaVersion)
String payloadXml = utils.formatXml(payload)
msoLogger.debug(payloadXml)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
index 451e0293ef..bce19795ac 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,11 +33,15 @@ import org.onap.so.bpmn.common.scripts.VfModuleBase
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils;
+import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.constants.Defaults
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
import org.onap.so.rest.APIResponse
@@ -111,56 +115,56 @@ public class DoUpdateVfModule extends VfModuleBase {
def xml = getVariable(execution, 'DoUpdateVfModuleRequest')
msoLogger.debug("DoUpdateVfModule request: " + xml)
msoLogger.debug('Received request xml:\n' + xml)
-
+
if (xml == null || xml.isEmpty()) {
// Building Block-type request
String cloudConfiguration = execution.getVariable("cloudConfiguration")
String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo")
-
+
def serviceModelInfo = execution.getVariable("serviceModelInfo")
msoLogger.debug("serviceModelInfo: " + serviceModelInfo)
String modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid")
msoLogger.debug("modelInvariantUuid: " + modelInvariantUuid)
def vnfModelInfo = execution.getVariable("vnfModelInfo")
-
+
//tenantId
def tenantId = execution.getVariable("tenantId")
execution.setVariable("DOUPVfMod_tenantId", tenantId)
-
+
//volumeGroupId
def volumeGroupId = execution.getVariable("volumeGroupId")
execution.setVariable("DOUPVfMod_volumeGroupId", volumeGroupId)
-
+
//cloudSiteId
def cloudSiteId = execution.getVariable("lcpCloudRegionId")
execution.setVariable("DOUPVfMod_aicCloudRegion", cloudSiteId)
-
+
msoLogger.debug("cloudSiteId: " + cloudSiteId)
//vnfType
def vnfType = execution.getVariable("vnfType")
execution.setVariable("DOUPVfMod_vnfType", vnfType)
-
+
msoLogger.debug("vnfType: " + vnfType)
//vnfName
def vnfName = execution.getVariable("vnfName")
execution.setVariable("DOUPVfMod_vnfName", vnfName)
-
+
msoLogger.debug("vnfName: " + vnfName)
//vnfId
def vnfId = execution.getVariable("vnfId")
execution.setVariable("DOUPVfMod_vnfId", vnfId)
-
+
msoLogger.debug("vnfId: " + vnfId)
//vfModuleName
def vfModuleName = execution.getVariable("vfModuleName")
execution.setVariable("DOUPVfMod_vfModuleName", vfModuleName)
-
+
msoLogger.debug("vfModuleName: " + vfModuleName)
//vfModuleModelName
def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName")
execution.setVariable("DOUPVfMod_vfModuleModelName", vfModuleModelName)
-
+
msoLogger.debug("vfModuleModelName: " + vfModuleModelName)
//modelCustomizationUuid
def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid")
@@ -168,7 +172,7 @@ public class DoUpdateVfModule extends VfModuleBase {
modelCustomizationUuid = ""
}
execution.setVariable("DOUPVfMod_modelCustomizationUuid", modelCustomizationUuid)
-
+
msoLogger.debug("modelCustomizationUuid: " + modelCustomizationUuid)
//vfModuleId
def vfModuleId = execution.getVariable("vfModuleId")
@@ -186,12 +190,12 @@ public class DoUpdateVfModule extends VfModuleBase {
//serviceInstanceId
def serviceInstanceId = execution.getVariable("serviceInstanceId")
execution.setVariable("DOUPVfMod_serviceInstanceId", serviceInstanceId)
-
+
msoLogger.debug("serviceInstanceId: " + serviceInstanceId)
//source - HARDCODED
def source = "VID"
execution.setVariable("DOUPVfMod_source", source)
-
+
msoLogger.debug("source: " + source)
//backoutOnFailure
def disableRollback = execution.getVariable("disableRollback")
@@ -239,16 +243,16 @@ public class DoUpdateVfModule extends VfModuleBase {
String vnfQueryPath = execution.getVariable("vnfQueryPath")
execution.setVariable("DOUPVfMod_vnfQueryPath", vnfQueryPath)
msoLogger.debug("vnfQueryPath: " + vnfQueryPath)
-
+
Map<String,String> vfModuleInputParams = execution.getVariable("vfModuleInputParams")
if (vfModuleInputParams != null) {
- execution.setVariable("DOUPVfMod_vnfParamsMap", vfModuleInputParams)
- }
+ execution.setVariable("DOUPVfMod_vnfParamsMap", vfModuleInputParams)
+ }
//get workload and environment context from parent SI
String environmentContext = ""
String workloadContext =""
String serviceType =""
-
+
try{
String json = catalog.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
serviceType = jsonUtil.getJsonValue(json, "serviceResources.serviceType")
@@ -259,7 +263,7 @@ public class DoUpdateVfModule extends VfModuleBase {
msoLogger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
-
+
try{
AAIUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId)
AAIResourcesClient aaiRC = new AAIResourcesClient()
@@ -267,11 +271,11 @@ public class DoUpdateVfModule extends VfModuleBase {
Map<String, Object> aaiJson = aaiRW.asMap()
environmentContext = aaiJson.getOrDefault("environment-context","")
workloadContext = aaiJson.getOrDefault("workload-context","")
-
+
}catch (Exception ex) {
msoLogger.debug("Error retreiving parent service instance information")
}
-
+
execution.setVariable("DCVFM_environmentContext",environmentContext)
execution.setVariable("DCVFM_workloadContext",workloadContext)
}
@@ -285,7 +289,7 @@ public class DoUpdateVfModule extends VfModuleBase {
serviceInstanceId = ''
}
execution.setVariable('DOUPVfMod_serviceInstanceId', serviceInstanceId)
-
+
def vnfInputs = getRequiredNodeXml(execution, xml, 'vnf-inputs')
execution.setVariable('DOUPVfMod_vnfInputs', vnfInputs)
execution.setVariable('DOUPVfMod_vnfId', getRequiredNodeText(execution, vnfInputs, 'vnf-id'))
@@ -306,14 +310,14 @@ public class DoUpdateVfModule extends VfModuleBase {
execution.setVariable("DOUPVfMod_isBaseVfModule", isBaseVfModule)
}
msoLogger.debug("isBaseVfModule: " + isBaseVfModule)
-
+
NetworkUtils networkUtils = new NetworkUtils()
def backoutOnFailure = networkUtils.isRollbackEnabled(execution, xml)
execution.setVariable("DOUPVfMod_backoutOnFailure", backoutOnFailure)
-
+
def String vgi = getNodeTextForce(vnfInputs, 'volume-group-id')
execution.setVariable('DOUPVfMod_volumeGroupId', vgi)
-
+
execution.setVariable('DOUPVfMod_vnfParams', utils.getNodeXml(xml, 'vnf-params', false))
}
@@ -382,7 +386,7 @@ public class DoUpdateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.prepConfirmVolumeGroupTenant(' +
'execution=' + execution.getId() +
')'
-
+
def prefix = execution.getVariable("prefix")
msoLogger.trace('Entered ' + method)
@@ -391,14 +395,12 @@ public class DoUpdateVfModule extends VfModuleBase {
String cloudRegion = execution.getVariable(prefix + "aicCloudRegion")
// Prepare AA&I url
- String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
AaiUtil aaiUtil = new AaiUtil(this)
- String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution)
- String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion
- msoLogger.debug("CloudRegion Request: " + queryCloudRegionRequest)
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+ def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
execution.setVariable(prefix + "queryCloudRegionRequest", queryCloudRegionRequest)
- msoLogger.debug(prefix + "queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest)
cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "AAI", cloudRegion)
@@ -427,9 +429,9 @@ public class DoUpdateVfModule extends VfModuleBase {
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during prepConfirmVolumeGroupTenant(): " + e.getMessage())
}
msoLogger.trace('Exited ' + method)
-
+
}
-
+
/**
* Prepare a Request for invoking the SDNC Adapter subflow to perform
* a VNF topology 'changeassign' operation.
@@ -625,19 +627,19 @@ public class DoUpdateVfModule extends VfModuleBase {
def asdcServiceModelVersion = execution.getVariable('DOUPVfMod_asdcServiceModelVersion')
def modelCustomizationUuid = execution.getVariable('DOUPVfMod_modelCustomizationUuid')
def backoutOnFailure = execution.getVariable("DOUPVfMod_backoutOnFailure")
-
+
def messageId = execution.getVariable('mso-request-id') + '-' + System.currentTimeMillis()
def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
if ('true'.equals(useQualifiedHostName)) {
notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
}
-
+
String environmentContext = execution.getVariable("DOUPVEnvironment_context")
String workloadContext = execution.getVariable("DOUPVWorkload_context")
msoLogger.debug("workloadContext: " + workloadContext)
msoLogger.debug("environmentContext: " + environmentContext)
-
+
Map<String, String> vnfParamsMap = execution.getVariable("DOUPVfMod_vnfParamsMap")
String sdncGetResponse = execution.getVariable('DOUPVfMod_sdncTopologyResponse')
@@ -791,7 +793,7 @@ public class DoUpdateVfModule extends VfModuleBase {
${personaModelCustomizationIdElement}
</UpdateAAIVfModuleRequest>
"""
-
+
msoLogger.debug('Unformatted updateAAIVfModuleRequest: ' + updateAAIVfModuleRequest)
updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest)
execution.setVariable('DOUPVfMod_updateAAIVfModuleRequest', updateAAIVfModuleRequest)
@@ -846,7 +848,7 @@ public class DoUpdateVfModule extends VfModuleBase {
if (!usePreload) {
modelCustomizationUuidString = "<modelCustomizationUuid>" + modelCustomizationUuid + "</modelCustomizationUuid>"
}
-
+
def vnfParamsXml = execution.getVariable('DOUPVfMod_vnfParams')
def vnfNetworks = transformNetworkParamsToVnfNetworks(vnfParamsXml)
@@ -974,10 +976,10 @@ public class DoUpdateVfModule extends VfModuleBase {
def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId')
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- msoLogger.debug('AAI URI is: ' + aai_uri)
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
+ String endPoint = aaiUriUtil.createAaiUri(uri)
- String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
msoLogger.debug("AAI endPoint: " + endPoint)
try {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
index 6b42406883..afe01b9243 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
@@ -33,6 +33,11 @@ import org.onap.so.bpmn.core.domain.ModelInfo
import org.onap.so.bpmn.core.domain.ModuleResource
import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.graphinventory.entities.uri.Depth
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
import org.onap.so.rest.APIResponse
@@ -152,10 +157,8 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
def vnfId = execution.getVariable('vnfId')
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- msoLogger.debug('AAI URI is: ' + aai_uri)
-
- String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
+ String endPoint = aaiUriUtil.createAaiUri(uri)
msoLogger.debug("AAI endPoint: " + endPoint)
try {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy
index 8673ee7662..f45e97fa6e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy
@@ -190,6 +190,8 @@ public class ReplaceVnfInfra extends VnfCmBase {
execution.setVariable('cloudConfiguration', cloudConfiguration)
def lcpCloudRegionId = jsonUtils.getJsonValue(cloudConfiguration, "lcpCloudRegionId")
execution.setVariable('lcpCloudRegionId', lcpCloudRegionId)
+ def cloudOwner = jsonUtils.getJsonValue(cloudConfiguration, "cloudOwner")
+ execution.setVariable('cloudOwner', cloudOwner)
def tenantId = jsonUtils.getJsonValue(cloudConfiguration, "tenantId")
execution.setVariable('tenantId', tenantId)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy
index 416d0d6e60..566afb0d9c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy
@@ -175,6 +175,10 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration
def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId
execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId)
+
+ def cloudOwner = cloudConfiguration.cloudOwner
+ execution.setVariable(prefix + 'cloudOwner', cloudOwner)
+
def tenantId = cloudConfiguration.tenantId
execution.setVariable(prefix + 'tenantId', tenantId)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy
index a926030924..0972ee184e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy
@@ -191,6 +191,10 @@ public class UpdateVfModuleInfraV2 {
def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration
def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId
execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId)
+
+ def cloudOwner = cloudConfiguration.cloudOwner
+ execution.setVariable(prefix + 'cloudOwner', cloudOwner)
+
def tenantId = cloudConfiguration.tenantId
execution.setVariable(prefix + 'tenantId', tenantId)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy
index 7b2d1b78e4..ce93db522e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,6 +30,10 @@ import org.onap.so.bpmn.common.scripts.VfModuleBase;
import org.onap.so.bpmn.common.scripts.VidUtils;
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
import org.onap.so.rest.APIResponse
@@ -39,10 +43,10 @@ import groovy.json.JsonSlurper
class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModuleVolumeInfraV1.class);
-
+
/**
* Initialize the flow's variables.
- *
+ *
* @param execution The flow's execution instance.
*/
private void initProcessVariables(DelegateExecution execution) {
@@ -62,7 +66,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
execution.setVariable('UPDVfModVol_volumeGroupTenantId', null)
execution.setVariable('UpdateVfModuleVolumeSuccessIndicator', false)
}
-
+
/**
* Perform initial processing, such as request validation, initialization of variables, etc.
@@ -72,33 +76,33 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
preProcessRequest(execution, isDebugEnabled)
}
-
+
public void preProcessRequest(DelegateExecution execution, isDebugLogEnabled) {
initProcessVariables(execution)
String jsonRequest = validateRequest(execution)
-
+
def request = ""
-
+
try {
def jsonSlurper = new JsonSlurper()
Map reqMap = jsonSlurper.parseText(jsonRequest)
-
+
def serviceInstanceId = execution.getVariable('serviceInstanceId')
def volumeGroupId = execution.getVariable('volumeGroupId')
//def vnfId = execution.getVariable('vnfId')
-
+
def vidUtils = new VidUtils(this)
request = vidUtils.createXmlVolumeRequest(reqMap, 'UPDATE_VF_MODULE_VOL', serviceInstanceId, volumeGroupId)
-
+
execution.setVariable('UPDVfModVol_Request', request)
execution.setVariable("UPDVfModVol_isVidRequest", true)
-
+
//need to get persona-model-id aka model-invariantId to use later to validate vf-module relation in AAI
-
+
def modelInvariantId = reqMap.requestDetails.modelInfo.modelInvariantUuid ?: ''
execution.setVariable('UPDVfModVol_modelInvariantId', modelInvariantId)
-
+
msoLogger.debug("modelInvariantId from request: " + modelInvariantId)
msoLogger.debug("XML request:\n" + request)
}
@@ -106,15 +110,15 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
msoLogger.debug(" Request is in XML format.")
// assume request is in XML format - proceed as usual to process XML request
}
-
+
def requestId = execution.getVariable('mso-request-id')
-
+
def requestInfo = getRequiredNodeXml(execution, request, 'request-info')
execution.setVariable('UPDVfModVol_requestInfo', requestInfo)
execution.setVariable('UPDVfModVol_requestId', requestId)
//execution.setVariable('UPDVfModVol_requestId', getRequiredNodeText(execution, requestInfo, 'request-id'))
execution.setVariable('UPDVfModVol_source', getNodeTextForce(requestInfo, 'source'))
-
+
def volumeInputs = getRequiredNodeXml(execution, request, 'volume-inputs')
execution.setVariable('UPDVfModVol_volumeInputs', volumeInputs)
execution.setVariable('UPDVfModVol_volumeGroupId', getRequiredNodeText(execution, volumeInputs, 'volume-group-id'))
@@ -126,14 +130,14 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
//execution.setVariable('UPDVfModVol_modelCustomizationId', getRequiredNodeText(execution, volumeInputs, 'model-customization-id'))
setBasicDBAuthHeader(execution, isDebugLogEnabled)
-
+
def volumeParams = utils.getNodeXml(request, 'volume-params')
execution.setVariable('UPDVfModVol_volumeParams', volumeParams)
}
/**
* Prepare and send the synchronous response.
- *
+ *
* @param execution The flow's execution instance.
*/
public void sendSynchResponse(DelegateExecution execution, isDebugLogEnabled) {
@@ -150,7 +154,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
startTime = System.currentTimeMillis()
}
def volumeInputs = execution.getVariable('UPDVfModVol_volumeInputs')
-
+
String xmlSyncResponse = """
<volume-request xmlns="http://org.onap/so/infra/vnf-request/v1">
<request-info>
@@ -167,20 +171,20 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
def syncResponse = ''
def isVidRequest = execution.getVariable('UPDVfModVol_isVidRequest')
-
+
if(isVidRequest) {
def volumeGroupId = execution.getVariable('volumeGroupId')
syncResponse = """{"requestReferences":{"instanceId":"${volumeGroupId}","requestId":"${requestId}"}}""".trim()
- }
+ }
else {
syncResponse = utils.formatXml(xmlSyncResponse)
}
-
+
msoLogger.debug('Sync response: ' + syncResponse)
execution.setVariable('UPDVfModVol_syncResponseSent', true)
sendWorkflowResponse(execution, 200, syncResponse)
}
-
+
/**
* Prepare a Request for querying AAI for Volume Group information using the
* Volume Group Id and Aic Cloud Region.
@@ -192,31 +196,32 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion')
AaiUtil aaiUtil = new AaiUtil(this)
- String aaiEndpoint = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(execution)
- String queryAAIVolumeGroupRequest = aaiEndpoint + '/' + URLEncoder.encode(aicCloudRegion, "UTF-8") + "/volume-groups/volume-group/" + UriUtils.encode(volumeGroupId, "UTF-8")
-
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), aicCloudRegion, volumeGroupId)
+ def queryAAIVolumeGroupRequest = aaiUtil.createAaiUri(uri)
+
msoLogger.debug('Query AAI volume group by ID: ' + queryAAIVolumeGroupRequest)
msoLogger.debug('Query AAI volume group by ID: ' + queryAAIVolumeGroupRequest)
-
+
APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIVolumeGroupRequest)
-
+
String returnCode = response.getStatusCode()
String aaiResponseAsString = response.getResponseBodyAsString()
-
+
msoLogger.debug("AAI query volume group by id return code: " + returnCode)
msoLogger.debug("AAI query volume group by id response: " + aaiResponseAsString)
-
+
msoLogger.debug("AAI Volume Group return code: " + returnCode)
msoLogger.debug("AAI Volume Group response: " + aaiResponseAsString)
-
+
ExceptionUtil exceptionUtil = new ExceptionUtil()
-
+
if ((returnCode == '200') || (returnCode == '204')) {
-
+
execution.setVariable('UPDVfModVol_aaiVolumeGroupResponse', aaiResponseAsString)
//def heatStackId = getNodeTextForce(aaiResponseAsString, 'heat-stack-id')
//execution.setVariable('UPDVfModVol_volumeGroupHeatStackId', heatStackId)
-
+
def volumeGroupTenantId = getTenantIdFromVolumeGroup(aaiResponseAsString)
if (volumeGroupTenantId == null) {
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id " + volumeGroupId
@@ -228,42 +233,42 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
def relatedVfModuleLink = getRelatedVfModuleRelatedLink(aaiResponseAsString)
msoLogger.debug("Related VF Module link: " + relatedVfModuleLink)
execution.setVariable('UPDVfModVol_relatedVfModuleLink', relatedVfModuleLink)
-
- }
+
+ }
else if (returnCode == '404') {
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group " + volumeGroupId + " not found at AAI")
- }
+ }
else {
WorkflowException aWorkflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution)
throw new BpmnError("MSOWorkflowException")
}
}
-
+
/**
* Query AAI service instance
* @param execution
* @param isDebugEnabled
*/
public void queryAAIForGenericVnf(DelegateExecution execution, isDebugEnabled) {
-
+
def vnfId = execution.getVariable('vnfId')
-
+
AaiUtil aaiUtil = new AaiUtil(this)
- String aaiEndpoint = aaiUtil.getNetworkGenericVnfEndpoint(execution)
- def String queryAAIRequest = aaiEndpoint + "/" + UriUtils.encode(vnfId, "UTF-8")
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ String queryAAIRequest = aaiUtil.createAaiUri(uri)
msoLogger.debug("AAI query generic vnf request: " + queryAAIRequest)
-
+
APIResponse response = aaiUtil.executeAAIGetCall(execution, queryAAIRequest)
-
+
String returnCode = response.getStatusCode()
String aaiResponseAsString = response.getResponseBodyAsString()
-
+
msoLogger.debug("AAI query generic vnf return code: " + returnCode)
msoLogger.debug("AAI query generic vnf response: " + aaiResponseAsString)
ExceptionUtil exceptionUtil = new ExceptionUtil()
-
+
if (returnCode=='200') {
msoLogger.debug('Generic vnf ' + vnfId + ' found in AAI.')
execution.setVariable('UPDVfModVol_AAIQueryGenericVfnResponse', aaiResponseAsString)
@@ -278,40 +283,40 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
}
}
}
-
+
/**
* Query AAI for VF Module using vf-module-id
* @param execution
* @param isDebugLogEnabled
*/
public void queryAAIForVfModule(DelegateExecution execution, isDebugLogEnabled) {
-
+
AaiUtil aaiUtil = new AaiUtil(this)
String queryAAIVfModuleRequest = execution.getVariable('UPDVfModVol_relatedVfModuleLink')
execution.setVariable('UPDVfModVol_personaModelId', '')
-
+
msoLogger.debug('Query AAI VF Module: ' + queryAAIVfModuleRequest)
msoLogger.debug('Query AAI VF Module: ' + queryAAIVfModuleRequest)
-
+
def aaiUrl = UrnPropertiesReader.getVariable("aai.endpoint", execution)
msoLogger.debug('A&AI URL: ' + aaiUrl)
-
+
def requestEndpoint = aaiUrl + queryAAIVfModuleRequest
msoLogger.debug('A&AI request endpoint: ' + requestEndpoint)
-
+
APIResponse response = aaiUtil.executeAAIGetCall(execution, requestEndpoint)
-
+
String returnCode = response.getStatusCode()
String aaiResponseAsString = response.getResponseBodyAsString()
-
+
msoLogger.debug("AAI query vf-module: " + returnCode)
msoLogger.debug("AAI query vf-module response: " + aaiResponseAsString)
-
+
msoLogger.debug("AAI query vf-module:: " + returnCode)
msoLogger.debug("AAI query vf-module response: " + aaiResponseAsString)
-
+
ExceptionUtil exceptionUtil = new ExceptionUtil()
-
+
if ((returnCode == '200') || (returnCode == '204')) {
def personaModelId = utils.getNodeText(aaiResponseAsString, 'model-invariant-id')
if(personaModelId == null) {
@@ -330,14 +335,14 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
}
}
/**
- *
+ *
*/
public String getRelatedVfModuleRelatedLink(xml) {
def list = new XmlSlurper().parseText(xml)
def vfModuleRelationship = list.'**'.find { node -> node.'related-to'.text() == 'vf-module' }
return vfModuleRelationship?.'related-link'?.text() ?: ''
}
-
+
/**
* Prepare a Request for invoking the VnfAdapterRest subflow to do
* a Volume Group update.
@@ -345,11 +350,11 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
* @param execution The flow's execution instance.
*/
public void prepVnfAdapterRest(DelegateExecution execution, isDebugLogEnabled) {
-
+
def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion')
def tenantId = execution.getVariable('UPDVfModVol_tenantId')
def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId')
-
+
def aaiVolumeGroupResponse = execution.getVariable('UPDVfModVol_aaiVolumeGroupResponse')
def volumeGroupHeatStackId = getNodeTextForce(aaiVolumeGroupResponse, 'heat-stack-id')
def volumeGroupName = getNodeTextForce(aaiVolumeGroupResponse, 'volume-group-name')
@@ -358,21 +363,21 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
// Check old attribute name
modelCustomizationId = getNodeTextForce(aaiVolumeGroupResponse, 'vf-module-persona-model-customization-id')
}
-
+
def vnfType = execution.getVariable('UPDVfModVol_vnfType')
def vnfVersion = execution.getVariable('UPDVfModVol_vnfVersion')
-
+
def aaiGenericVnfResponse = execution.getVariable('UPDVfModVol_AAIQueryGenericVfnResponse')
def vnfId = utils.getNodeText(aaiGenericVnfResponse, 'vnf-id')
def vnfName = utils.getNodeText(aaiGenericVnfResponse, 'vnf-name')
-
+
def volumeParamsXml = execution.getVariable('UPDVfModVol_volumeParams')
def volumeGroupParams = transformVolumeParamsToEntries(volumeParamsXml)
-
+
def requestId = execution.getVariable('UPDVfModVol_requestId')
def serviceId = execution.getVariable('UPDVfModVol_serviceId')
-
+
def messageId = execution.getVariable('mso-request-id') + '-' + System.currentTimeMillis()
def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
@@ -425,7 +430,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
execution.setVariable('UPDVfModVol_vnfAdapterRestRequest', vnfAdapterRestRequest)
msoLogger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest)
}
-
+
/**
* Prepare a Request for updating the DB for this Infra request.
*
@@ -435,7 +440,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
def requestId = execution.getVariable('UPDVfModVol_requestId')
ExceptionUtil exceptionUtil = new ExceptionUtil();
-
+
String updateInfraRequest = """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:req="http://org.onap.so/requestsdb">
@@ -455,7 +460,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
execution.setVariable('UPDVfModVol_updateInfraRequest', updateInfraRequest)
msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest)
}
-
+
/**
* Build a "CompletionHandler" request.
* @param execution The flow's execution instance.
@@ -471,14 +476,14 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
<source>${MsoUtils.xmlEscape(source)}</source>
</request-info>
<aetgt:mso-bpel-name>BPMN VF Module Volume action: UPDATE</aetgt:mso-bpel-name>
- </aetgt:MsoCompletionRequest>
+ </aetgt:MsoCompletionRequest>
"""
content = utils.formatXml(content)
msoLogger.debug('Request for Completion Handler:\n' + content)
execution.setVariable('UPDVfModVol_CompletionHandlerRequest', content)
}
-
+
/**
* Build a "FalloutHandler" request.
@@ -487,14 +492,14 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
public void prepFalloutHandler(DelegateExecution execution, isDebugLogEnabled) {
def requestId = execution.getVariable('UPDVfModVol_requestId')
def source = execution.getVariable('UPDVfModVol_source')
-
+
String requestInfo = """
<request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
<request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
<action>UPDATE</action>
<source>${MsoUtils.xmlEscape(source)}</source>
</request-info>"""
-
+
def WorkflowException workflowException = execution.getVariable("WorkflowException")
def errorResponseCode = workflowException.getErrorCode()
def errorResponseMsg = workflowException.getErrorMessage()
@@ -507,55 +512,55 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
xmlns:reqtype="http://org.onap/so/request/types/v1"
xmlns:msoservtypes="http://org.onap/so/request/types/v1"
- xmlns:structuredtypes="http://org.onap/so/structured/types/v1">
+ xmlns:structuredtypes="http://org.onap/so/structured/types/v1">
${requestInfo}
<sdncadapterworkflow:WorkflowException>
<sdncadapterworkflow:ErrorMessage>${MsoUtils.xmlEscape(encErrorResponseMsg)}</sdncadapterworkflow:ErrorMessage>
<sdncadapterworkflow:ErrorCode>${MsoUtils.xmlEscape(errorResponseCode)}</sdncadapterworkflow:ErrorCode>
- </sdncadapterworkflow:WorkflowException>
+ </sdncadapterworkflow:WorkflowException>
</sdncadapterworkflow:FalloutHandlerRequest>
"""
content = utils.formatXml(content)
msoLogger.debug('Request for Fallout Handler:\n' + content)
execution.setVariable('UPDVfModVol_FalloutHandlerRequest', content)
}
-
+
/**
* Create a WorkflowException for the error case where the Tenant Id from
* AAI did not match the Tenant Id in the incoming request.
* @param execution The flow's execution instance.
*/
public void handleTenantIdMismatch(DelegateExecution execution, isDebugLogEnabled) {
-
+
def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId')
def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion')
def tenantId = execution.getVariable('UPDVfModVol_tenantId')
def volumeGroupTenantId = execution.getVariable('UPDVfModVol_volumeGroupTenantId')
-
+
def String errorMessage = "TenantId " + tenantId + " in incoming request does not match Tenant Id " + volumeGroupTenantId +
- " retrieved from AAI for Volume Group Id " + volumeGroupId + ", AIC Cloud Region " + aicCloudRegion
-
+ " retrieved from AAI for Volume Group Id " + volumeGroupId + ", AIC Cloud Region " + aicCloudRegion
+
ExceptionUtil exceptionUtil = new ExceptionUtil()
msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Error in UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception");
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage)
}
-
+
/**
* Create a WorkflowException for the error case where the Personal Model Id from
* AAI did not match the model invariant ID in the incoming request.
* @param execution The flow's execution instance.
*/
public void handlePersonaModelIdMismatch(DelegateExecution execution, isDebugLogEnabled) {
-
+
def modelInvariantId = execution.getVariable('UPDVfModVol_modelInvariantId')
def personaModelId = execution.getVariable('UPDVfModVol_personaModelId')
-
+
def String errorMessage = "Model Invariant ID " + modelInvariantId + " in incoming request does not match persona model ID " + personaModelId +
" retrieved from AAI for Volume Group Id "
-
+
ExceptionUtil exceptionUtil = new ExceptionUtil()
msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Error in UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception");
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage)
}
-
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy
index f251dc46f8..548f521c33 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy
@@ -170,6 +170,8 @@ public class UpdateVnfInfra extends VnfCmBase {
def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration
def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId
execution.setVariable('lcpCloudRegionId', lcpCloudRegionId)
+ def cloudOwner = jsonUtils.getJsonValue(cloudConfiguration, "cloudOwner")
+ execution.setVariable('cloudOwner', cloudOwner)
def tenantId = cloudConfiguration.tenantId
execution.setVariable('tenantId', tenantId)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy
index 68d5c19b80..2c1b66ded5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy
@@ -143,6 +143,8 @@ public class VnfInPlaceUpdate extends VnfCmBase {
def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration
def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId
execution.setVariable('lcpCloudRegionId', lcpCloudRegionId)
+ def cloudOwner = cloudConfiguration.cloudOwner
+ execution.setVariable('cloudOwner', cloudOwner)
def tenantId = cloudConfiguration.tenantId
execution.setVariable('tenantId', tenantId)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
index 85993d6c92..8a3dcbab5d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
@@ -146,6 +146,9 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
String lcpCloudRegionId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId")
execution.setVariable("lcpCloudRegionId", lcpCloudRegionId)
msoLogger.debug("lcpCloudRegionId: "+ lcpCloudRegionId)
+ String cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudOwner")
+ execution.setVariable("cloudOwner", cloudOwner)
+ msoLogger.debug("cloudOwner: "+ cloudOwner)
String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId")
execution.setVariable("tenantId", tenantId)
msoLogger.debug("tenantId: "+ tenantId)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java
index c04c2dc15b..6062129a71 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java
@@ -70,7 +70,7 @@ public class AAICreateResources {
AAIResourcesClient aaiRC = new AAIResourcesClient();
return aaiRC.get(OwningEntities.class,
AAIUriFactory
- .createResourceUri(AAIObjectPlurals.OWNING_ENTITIES)
+ .createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
.queryParam("owning-entity-name", owningEntityName))
.orElseGet(() -> {
msoLogger.debug("No Owning Entity matched by name");
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
index 5fe28b918b..e753f79ebd 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
@@ -28,6 +28,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Optional;
+
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.ParseException;
@@ -45,17 +47,27 @@ import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.runtime.Execution;
+import org.onap.aai.domain.yang.LogicalLink;
+import org.onap.aai.domain.yang.LogicalLinks;
+import org.onap.aai.domain.yang.PInterface;
import org.onap.so.bpmn.core.UrnPropertiesReader;
-import org.onap.so.bpmn.core.domain.ServiceDecomposition;
import org.onap.so.bpmn.core.domain.Resource;
+import org.onap.so.bpmn.core.domain.ServiceDecomposition;
import org.onap.so.bpmn.core.json.JsonUtils;
+import org.onap.so.client.aai.AAIObjectPlurals;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.Relationships;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
-import org.onap.so.bpmn.common.scripts.AaiUtil;
+import org.springframework.web.util.UriUtils;
+
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-import org.springframework.web.util.UriUtils;
public class ServicePluginFactory {
@@ -307,8 +319,7 @@ public class ServicePluginFactory {
@SuppressWarnings("unchecked")
private void allocateCrossTPResources(DelegateExecution execution, Map<String, Object> serviceRequestInputs) {
- AaiUtil aai = new AaiUtil();
- Map<String, Object> crossTPs = aai.getTPsfromAAI(execution);
+ Map<String, Object> crossTPs = this.getTPsfromAAI();
if(crossTPs == null || crossTPs.isEmpty()) {
serviceRequestInputs.put("local-access-provider-id", "");
@@ -338,6 +349,106 @@ public class ServicePluginFactory {
return;
}
+ // This method returns Local and remote TPs information from AAI
+ public Map getTPsfromAAI() {
+ Map<String, Object> tpInfo = new HashMap<>();
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.LOGICAL_LINK);
+ AAIResourcesClient client = new AAIResourcesClient();
+ Optional<LogicalLinks> result = client.get(LogicalLinks.class, uri);
+
+ if (result.isPresent()) {
+ LogicalLinks links = result.get();
+ boolean isRemoteLink = false;
+
+ links.getLogicalLink();
+
+ for (LogicalLink link : links.getLogicalLink()) {
+ AAIResultWrapper wrapper = new AAIResultWrapper(link);
+ Optional<Relationships> optRelationships = wrapper.getRelationships();
+ List<AAIResourceUri> pInterfaces = new ArrayList<>();
+ if (optRelationships.isPresent()) {
+ Relationships relationships = optRelationships.get();
+ if (!relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty()) {
+ isRemoteLink = true;
+ }
+ pInterfaces.addAll(relationships.getRelatedAAIUris(AAIObjectType.P_INTERFACE));
+ }
+
+ if (isRemoteLink) {
+ // find remote p interface
+ AAIResourceUri localTP = null;
+ AAIResourceUri remoteTP = null;
+
+ AAIResourceUri pInterface0 = pInterfaces.get(0);
+
+ if (isRemotePInterface(client, pInterface0)) {
+ remoteTP = pInterfaces.get(0);
+ localTP = pInterfaces.get(1);
+ } else {
+ localTP = pInterfaces.get(0);
+ remoteTP = pInterfaces.get(1);
+ }
+
+ if (localTP != null && remoteTP != null) {
+ // give local tp
+ String tpUrl = localTP.build().toString();
+ PInterface intfLocal = client.get(PInterface.class, localTP).get();
+ tpInfo.put("local-access-node-id", tpUrl.split("/")[6]);
+
+ String[] networkRef = intfLocal.getNetworkRef().split("/");
+ if (networkRef.length == 6) {
+ tpInfo.put("local-access-provider-id", networkRef[1]);
+ tpInfo.put("local-access-client-id", networkRef[3]);
+ tpInfo.put("local-access-topology-id", networkRef[5]);
+ }
+ String ltpIdStr = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
+ if (ltpIdStr.contains("-")) {
+ tpInfo.put("local-access-ltp-id", ltpIdStr.substring(ltpIdStr.lastIndexOf("-") + 1));
+ }
+
+ // give remote tp
+ tpUrl = remoteTP.build().toString();
+ PInterface intfRemote = client.get(PInterface.class, remoteTP).get();
+ tpInfo.put("remote-access-node-id", tpUrl.split("/")[6]);
+
+ String[] networkRefRemote = intfRemote.getNetworkRef().split("/");
+
+ if (networkRefRemote.length == 6) {
+ tpInfo.put("remote-access-provider-id", networkRefRemote[1]);
+ tpInfo.put("remote-access-client-id", networkRefRemote[3]);
+ tpInfo.put("remote-access-topology-id", networkRefRemote[5]);
+ }
+ String ltpIdStrR = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
+ if (ltpIdStrR.contains("-")) {
+ tpInfo.put("remote-access-ltp-id", ltpIdStrR.substring(ltpIdStr.lastIndexOf("-") + 1));
+ }
+ return tpInfo;
+ }
+ }
+ }
+ }
+ return tpInfo;
+ }
+
+ // this method check if pInterface is remote
+ private boolean isRemotePInterface(AAIResourcesClient client, AAIResourceUri uri) {
+
+ Map<String, String> keys = uri.getURIKeys();
+ String uriString = uri.build().toString();
+ AAIResourceUri parent = AAIUriFactory.createResourceUri(AAIObjectType.PNF, keys.get("pnf-name"));
+
+ AAIResultWrapper wrapper = client.get(parent);
+ Optional<Relationships> optRelationships = wrapper.getRelationships();
+ if (optRelationships.isPresent()) {
+ Relationships relationships = optRelationships.get();
+
+ return !relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty();
+ }
+
+ return false;
+ }
+
public String preProcessService(ServiceDecomposition serviceDecomposition, String uuiRequest) {
// now only for sotn
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstanceTest.groovy
index 4d5f506599..2f07842cb6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstanceTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstanceTest.groovy
@@ -85,6 +85,7 @@ class CreateNetworkInstanceTest {
<source>VID</source>
</request-info>
<aetgt:status-message>Network has been created successfully.</aetgt:status-message>
+ <aetgt:networkId>fb03f6f0-9012-41c4-87d8-1dbf3c22b889</aetgt:networkId>
<aetgt:mso-bpel-name>BPMN Network action: CREATE</aetgt:mso-bpel-name>
</aetgt:MsoCompletionRequest>"""
@@ -272,6 +273,7 @@ String jsonIncomingRequest =
when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
when(mockExecution.getVariable(Prefix + "dbReturnCode")).thenReturn("200")
+ when(mockExecution.getVariable("networkId")).thenReturn("fb03f6f0-9012-41c4-87d8-1dbf3c22b889")
// postProcessResponse(DelegateExecution execution)
CreateNetworkInstance CreateNetworkInstance = new CreateNetworkInstance()
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceTest.groovy
index 72f79c80d9..d8a82acfa7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceTest.groovy
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -76,7 +76,6 @@ class DoCreateE2EServiceInstanceTest {
when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("/mso/sdncadapter/")
when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/")
when(mockExecution.getVariable("mso.workflow.default.aai.customer.version")).thenReturn("8")
- when(mockExecution.getVariable("mso.workflow.default.aai.v8.customer.uri")).thenReturn('/aai/v8/business/customers/customer')
DoCreateE2EServiceInstance obj = new DoCreateE2EServiceInstance()
obj.preProcessRequest(mockExecution)
Mockito.verify(mockExecution, times(7)).setVariable(captor.capture(), captor.capture())
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy
index cc6f89865f..587abbee52 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -83,7 +83,6 @@ class DoCreateServiceInstanceTest {
when(mockExecution.getVariable("serviceDecomposition")).thenReturn(decomposition)
when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/")
when(mockExecution.getVariable("mso.workflow.default.aai.customer.version")).thenReturn("8")
- when(mockExecution.getVariable("mso.workflow.default.aai.v8.customer.uri")).thenReturn('/aai/v8/business/customers/customer')
DoCreateServiceInstance obj = new DoCreateServiceInstance()
@@ -93,7 +92,7 @@ class DoCreateServiceInstanceTest {
verify(mockExecution).setVariable("sdncCallbackUrl", "http://localhost:28080/mso/SDNCAdapterCallbackService")
}
-
+
@Test
void testGetAAICustomerById() {
@@ -101,7 +100,6 @@ class DoCreateServiceInstanceTest {
when(mockExecution.getVariable("prefix")).thenReturn(prefix)
when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
when(mockExecution.getVariable("globalSubscriberId")).thenReturn("12345")
- when(mockExecution.getVariable("mso.workflow.default.aai.v8.customer.uri")).thenReturn("/aai/v9/business/customers/customer")
when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090")
when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/")
when(mockExecution.getVariable("mso.workflow.custom.DoCreateServiceInstance.aai.version")).thenReturn('8')
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy
index fcb0fb0940..447463a079 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -85,7 +85,7 @@ class DoDeleteVfModuleFromVnfTest {
Mockito.verify(mockExecution).setVariable("sdncCallbackUrl", "http://localhost:8090/SDNCAdapterCallback")
}
-
+
@Test
void testDeleteNetworkPoliciesFromAAI() {
@@ -106,7 +106,7 @@ class DoDeleteVfModuleFromVnfTest {
Mockito.verify(mockExecution).setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 200)
}
-
+
@Test
void testQueryAAIForVfModule() {
ExecutionEntity mockExecution = setupMock()
@@ -115,7 +115,6 @@ class DoDeleteVfModuleFromVnfTest {
when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090")
when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("mso.workflow.global.default.aai.namespace")
when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn("8")
- when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf")
when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7")
when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC")
@@ -126,7 +125,7 @@ class DoDeleteVfModuleFromVnfTest {
Mockito.verify(mockExecution, atLeastOnce()).setVariable("DDVMFV_getVnfResponseCode", 200)
}
-
+
private ExecutionEntity setupMock() {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy
index beaebceaf7..67b1c23ae1 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -77,7 +77,7 @@ class DoUpdateVfModuleTest {
Mockito.verify(mockExecution, atLeastOnce()).getVariable("mso.workflow.sdncadapter.callback")
}
-
+
@Test
void testPrepConfirmVolumeGroupTenant() {
@@ -100,7 +100,7 @@ class DoUpdateVfModuleTest {
Mockito.verify(mockExecution).setVariable(prefix + "isCloudRegionGood", true)
}
-
+
@Test
void testPrepSDNCTopologyChg() {
ExecutionEntity mockExecution = setupMock()
@@ -148,7 +148,7 @@ class DoUpdateVfModuleTest {
XmlComparator.assertXMLEquals(sdncChangeAssignRequest, captor.getValue())
}
-
+
@Test
void testPrepSDNCTopologyQuery() {
@@ -168,7 +168,7 @@ class DoUpdateVfModuleTest {
XmlComparator.assertXMLEquals(sdncTopologyRequest, captor.getValue())
}
-
+
@Test
void testPrepVnfAdapterRest() {
@@ -219,7 +219,7 @@ class DoUpdateVfModuleTest {
XmlComparator.assertXMLEquals(createVnfARequest, captor.getValue(), "messageId", "notificationUrl")
}
-
+
@Test
void testPrepSDNCTopologyAct() {
@@ -263,7 +263,6 @@ class DoUpdateVfModuleTest {
when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("12345")
when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn("8")
- when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf")
when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090")
when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy
index ba54787dc1..a86029ea30 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -61,7 +61,7 @@ class DoUpdateVnfAndModulesTest {
when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
when(mockExecution.getVariable("vnfId")).thenReturn("12345")
when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn("8")
- when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf")
+
when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090")
when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/")
@@ -78,7 +78,7 @@ class DoUpdateVnfAndModulesTest {
when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
when(mockExecution.getVariable("vnfId")).thenReturn("12345")
when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn("8")
- when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf")
+
when(mockExecution.getVariable("aai.endpoint")).thenReturn(null)
when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy
index 523c791efc..84da045450 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy
@@ -576,6 +576,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
verify(mex).setVariable("lcpCloudRegionId", "mdt1")
+ verify(mex).setVariable("cloudOwner", "my-cloud-owner")
verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
}
@@ -594,6 +595,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
verify(mex).setVariable("lcpCloudRegionId", "mdt1")
+ verify(mex).setVariable("cloudOwner", "my-cloud-owner")
verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
}
@@ -612,6 +614,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
verify(mex).setVariable("lcpCloudRegionId", "mdt1")
+ verify(mex).setVariable("cloudOwner", "my-cloud-owner")
verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy
index b7c754938a..c2384b63a5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy
@@ -145,6 +145,7 @@ class DeleteVcpeResCustServiceTest extends GroovyTestBase {
verify(mex).setVariable("subscriptionServiceType", SVC)
verify(mex).setVariable("lcpCloudRegionId", "mdt1")
+ verify(mex).setVariable("cloudOwner", "my-cloud-owner")
verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
assertEquals("""{"tenantId":"8b1df54faa3b49078e3416e21370a3ba","lcpCloudRegionId":"mdt1"}""", map.get("cloudConfiguration"))
verify(mex).setVariable("sdncVersion", "1707")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/application-test.yml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/application-test.yml
index 96cdebcc1e..78ecd6ce88 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/application-test.yml
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/application-test.yml
@@ -1,334 +1,287 @@
-aai:
- auth: 757A94191D685FD2092AC1490730A4FC
- dme2:
- timeout: '30000'
- endpoint: http://localhost:${wiremock.server.port}
-camunda:
- bpm:
- admin-user:
- id: admin
- password: admin
- database:
- type: h2
- history-level: FULL
- metrics:
- enabled: false
- db-reporter-activate: false
-canopi:
- auth: 757A94191D685FD2092AC1490730A4FC
-csi:
- aots:
- addincidentmanagement:
- endpoint: http://localhost:${wiremock.server.port}/AddIncidentManagementTicketRequest
- networkstatus:
- endpoint: http://localhost:${wiremock.server.port}/SendManagedNetworkStatusNotification
-entitymanager:
- packagesToScan: com
-mso:
- correlation:
- timeout: PT60S
- logPath: logs
- async:
- core-pool-size: 50
- max-pool-size: 50
- queue-capacity: 500
- adapters:
- completemsoprocess:
- endpoint: http://localhost:30253/CompleteMsoProcess
- db:
- auth: 757A94191D685FD2092AC1490730A4FC
- password: wLg4sjrAFUS8rfVfdvTXeQ==
- endpoint: http://localhost:${wiremock.server.port}/services/RequestsDbAdapter
- spring:
- endpoint: http://localhost:${wiremock.server.port}
- network:
- endpoint: http://localhost:30253/services/NetworkAdapter
- rest:
- endpoint: http://localhost:30253/services/rest/v1/networks
- openecomp:
- db:
- endpoint: http://localhost:${wiremock.server.port}/services/RequestsDbAdapter
- po:
- auth: 757A94191D685FD2092AC1490730A4FC
- password: 3141634BF7E070AA289CF2892C986C0B
- sdnc:
- endpoint: http://localhost:${wiremock.server.port}/adapters/SDNCAdapter
- rest:
- endpoint: http://localhost:${wiremock.server.port}/adapters/rest/v1/sdnc
- timeout: PT150S
- tenant:
- endpoint: http://localhost:30253/services/TenantAdapter
- vnf:
- endpoint: http://localhost:${wiremock.server.port}/services/VnfAdapter
- rest:
- endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/vnfs
- volume-groups:
- rest:
- endpoint: http://localhost:30253/services/rest/v1/volume-groups
- vnf-async:
- endpoint: http://localhost:30253/services/VnfAdapterAsync
- adiod:
- vce:
- service:
- model:
- invariant:
- uuid: 1cc4e2e4-eb6e-404d-a66f-c8733cedcce8
- version: '5.0'
- bpmn:
- process:
- historyTimeToLive: '30'
- callbackRetryAttempts: '5'
- catalog:
- db:
- endpoint: http://localhost:${wiremock.server.port}/ecomp/mso/catalog
- spring:
- endpoint: http://localhost:30258
- csi:
- pwd: 4EA237303511EFBBC37F17A351562131
- sendmanagednetworkstatusnotification:
- applicationname: NetworkManagementEthernetOverFiber
- version: '212'
- usrname: mso
- db:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
- default:
- adapter:
- namespace: http://com.att.mso
- gateway:
- service:
- model:
- name: HNGWaaS for DHV Test
- healthcheck:
- log:
- debug: 'false'
- infra:
- customer:
- id: testCustIdInfra
- msoKey: 07a7159d3bf51a0e53be7a8f89699be7
- oam:
- network:
- role:
- gateway: HngwOamNetVto.OAM
- portal: HnportalOamNetVto.OAM
- po:
- timeout: PT60S
- portal:
- service:
- model:
- name: HNPortalaaS for DHV Test
- request:
- db:
- endpoint: http://localhost:${wiremock.server.port}/
- rollback: 'true'
- sdnc:
- firewall:
- yang:
- model:
- version: '2015-05-15'
- password: 3141634BF7E070AA289CF2892C986C0B
- timeout:
- firewall:
- minutes: '20'
- ucpe:
- async:
- hours: '120'
- minutes: '5'
- site-name: CamundaEngine
- sriov:
- network:
- role:
- gateway1: HngwSriovProviderNet.SR_IOV_Provider2_1
- gateway2: HngwSriovProviderNet.SR_IOV_Provider2_2
- portal1: HnportalSriovProviderNet3.SR_IOV_Provider2_1
- portal2: HnportalSriovProviderNet3.SR_IOV_Provider2_2
- workflow:
- sdnc:
- replication:
- delay: PT5S
- aai:
- distribution:
- delay: PT5S
- CreateGenericVNFV1:
- aai:
- volume-group:
- uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group
- DHVCreateService:
- aai:
- customer:
- uri: /aai/v9/business/customers/customer
- createvce:
- delay:
- seconds: '1'
- default:
- aai:
- version: '8'
- cloud-region:
- version: '9'
- generic-vnf:
- version: '9'
- v11:
- customer:
- uri: /aai/v11/business/customers/customer
- generic-query:
- uri: /aai/v11/search/generic-query
- generic-vnf:
- uri: /aai/v11/network/generic-vnfs/generic-vnf
- l3-network:
- uri: /aai/v11/network/l3-networks/l3-network
- network-policy:
- uri: /aai/v11/network/network-policies/network-policy
- nodes-query:
- uri: /aai/v11/search/nodes-query
- route-table-reference:
- uri: /aai/v11/network/route-table-references/route-table-reference
- tenant:
- uri: /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant
- vce:
- uri: /aai/v11/network/vces/vce
- vpn-binding:
- uri: /aai/v11/network/vpn-bindings/vpn-binding
- v8:
- configuration:
- uri: /aai/v11/network/configurations/configuration
- customer:
- uri: /aai/v8/business/customers/customer
- generic-query:
- uri: /aai/v8/search/generic-query
- l3-network:
- uri: /aai/v8/network/l3-networks/l3-network
- network-policy:
- uri: /aai/v8/network/network-policies/network-policy
- nodes-query:
- uri: /aai/v8/search/nodes-query
- route-table-reference:
- uri: /aai/v8/network/route-table-references/route-table-reference
- tenant:
- uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant
- vce:
- uri: /aai/v8/network/vces/vce
- vpn-binding:
- uri: /aai/v8/network/vpn-bindings/vpn-binding
- v9:
- cloud-region:
- uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic
- generic-vnf:
- uri: /aai/v9/network/generic-vnfs/generic-vnf
- retry:
- attempts: '1'
- deleteCinderVolumeV1:
- aai:
- volume-group:
- uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group
- global:
- default:
- aai:
- namespace: http://org.openecomp.aai.inventory/
- l3ToHigherLayerAddBonding:
- model:
- invariantid: 50359538-066f-4a8d-807f-f2bc8eaa79dc
- name: WAN Bonding v0.1
- version: '0.1'
- versionid: 52dbec20-47aa-42e4-936c-331d8e350d44
- message:
- endpoint: http://localhost:30252/mso/WorkflowMessage
- notification:
- name: GenericNotificationServiceATT
- sdncadapter:
- callback: http://localhost:${wiremock.server.port}/mso/SDNCAdapterCallbackService
- vnfadapter:
- create:
- callback: http://localhost:30253/mso/vnfAdapterNotify
- delete:
- callback: http://localhost:30253/mso/vnfAdapterNotify
- query:
- callback: http://localhost:30253/mso/vnfAdapterNotify
- rollback:
- callback: http://localhost:30253/mso/vnfAdapterNotify
-policy:
- auth: Basic dGVzdHBkcDphbHBoYTEyMw==
- client:
- auth: Basic bTAzNzQzOnBvbGljeVIwY2sk
- endpoint: https://localhost:8081/pdp/api/
- environment: TEST
-sdnc:
- auth: Basic YWRtaW46YWRtaW4=
- host: https://localhost:8443
- path: /restconf/operations/GENERIC-RESOURCE-API
-sdno:
- health-check:
- dmaap:
- password: eHQ1cUJrOUc
- publisher:
- topic: com.att.sdno.test-health-diagnostic-v02
- subscriber:
- topic: com.att.sdno.test-health-diagnostic-v02
- username: testuser
-pnf:
- dmaap:
- host:
- port:
-sniro:
- conductor:
- host: http://localhost:30253
- uri: /release
- manager:
- timeout: PT30M
- host: http://localhost:${wiremock.server.port}
- uri.v1: /sniro/api/v2/placement
- uri.v2: /sniro/api/placement/v2
- headers.auth: Basic dGVzdDp0ZXN0cHdk
- headers.patchVersion: 1
- headers.minorVersion: 1
- headers.latestVersion: 2
-server:
- port: 8080
- tomcat:
- max-threads: 50
- # ssl:
- # key-store: /app/msoClientKeyStore.jks
- # key-store-password: mso4you
- # key-store-type: JKS
- # trust-store: /app/msoTrustStore.jks
- # trust-store-password: mso_Domain2.0_4you
-spring:
- h2:
- console:
- enabled: true
- path: /h2
- datasource:
- url: jdbc:h2:mem:AZ;;DB_CLOSE_ON_EXIT=FALSE
- username: sa
- password: sa
- driverClassName: org.h2.Driver
- security:
- usercredentials:
- -
- username: test
- password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu'
- role: BPMN-Client
-# Hibernate
-hibernate:
- dialect: org.hibernate.dialect.MySQL5Dialect
- show_sql: false
-
-management:
- security:
- enabled: false
-
-security:
- basic:
- enabled: false
-
-appc:
- client:
- topic:
- read:
- name: APPC-TEST-AMDOCS2
- timeout: 360000
- write: APPC-TEST-AMDOCS1-IST
- response:
- timeout: 360000
- key: LSl8QKolmKcC0yJR
- secret: lgjXraD1HutKxv8jEN6tVouu
- service: ueb
+aai:
+ auth: 757A94191D685FD2092AC1490730A4FC
+ dme2:
+ timeout: '30000'
+ endpoint: http://localhost:${wiremock.server.port}
+camunda:
+ bpm:
+ admin-user:
+ id: admin
+ password: admin
+ database:
+ type: h2
+ history-level: FULL
+ metrics:
+ enabled: false
+ db-reporter-activate: false
+canopi:
+ auth: 757A94191D685FD2092AC1490730A4FC
+csi:
+ aots:
+ addincidentmanagement:
+ endpoint: http://localhost:${wiremock.server.port}/AddIncidentManagementTicketRequest
+ networkstatus:
+ endpoint: http://localhost:${wiremock.server.port}/SendManagedNetworkStatusNotification
+entitymanager:
+ packagesToScan: com
+mso:
+ correlation:
+ timeout: PT60S
+ logPath: logs
+ async:
+ core-pool-size: 50
+ max-pool-size: 50
+ queue-capacity: 500
+ adapters:
+ completemsoprocess:
+ endpoint: http://localhost:30253/CompleteMsoProcess
+ db:
+ auth: 757A94191D685FD2092AC1490730A4FC
+ password: wLg4sjrAFUS8rfVfdvTXeQ==
+ endpoint: http://localhost:${wiremock.server.port}/services/RequestsDbAdapter
+ spring:
+ endpoint: http://localhost:${wiremock.server.port}
+ network:
+ endpoint: http://localhost:30253/services/NetworkAdapter
+ rest:
+ endpoint: http://localhost:30253/services/rest/v1/networks
+ openecomp:
+ db:
+ endpoint: http://localhost:${wiremock.server.port}/services/RequestsDbAdapter
+ po:
+ auth: 757A94191D685FD2092AC1490730A4FC
+ password: 3141634BF7E070AA289CF2892C986C0B
+ sdnc:
+ endpoint: http://localhost:${wiremock.server.port}/adapters/SDNCAdapter
+ rest:
+ endpoint: http://localhost:${wiremock.server.port}/adapters/rest/v1/sdnc
+ timeout: PT150S
+ tenant:
+ endpoint: http://localhost:30253/services/TenantAdapter
+ vnf:
+ endpoint: http://localhost:${wiremock.server.port}/services/VnfAdapter
+ rest:
+ endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/vnfs
+ volume-groups:
+ rest:
+ endpoint: http://localhost:30253/services/rest/v1/volume-groups
+ vnf-async:
+ endpoint: http://localhost:30253/services/VnfAdapterAsync
+ adiod:
+ vce:
+ service:
+ model:
+ invariant:
+ uuid: 1cc4e2e4-eb6e-404d-a66f-c8733cedcce8
+ version: '5.0'
+ bpmn:
+ process:
+ historyTimeToLive: '30'
+ callbackRetryAttempts: '5'
+ catalog:
+ db:
+ endpoint: http://localhost:${wiremock.server.port}/ecomp/mso/catalog
+ spring:
+ endpoint: http://localhost:30258
+ csi:
+ pwd: 4EA237303511EFBBC37F17A351562131
+ sendmanagednetworkstatusnotification:
+ applicationname: NetworkManagementEthernetOverFiber
+ version: '212'
+ usrname: mso
+ db:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ default:
+ adapter:
+ namespace: http://com.att.mso
+ gateway:
+ service:
+ model:
+ name: HNGWaaS for DHV Test
+ healthcheck:
+ log:
+ debug: 'false'
+ infra:
+ customer:
+ id: testCustIdInfra
+ msoKey: 07a7159d3bf51a0e53be7a8f89699be7
+ oam:
+ network:
+ role:
+ gateway: HngwOamNetVto.OAM
+ portal: HnportalOamNetVto.OAM
+ po:
+ timeout: PT60S
+ portal:
+ service:
+ model:
+ name: HNPortalaaS for DHV Test
+ request:
+ db:
+ endpoint: http://localhost:${wiremock.server.port}/
+ rollback: 'true'
+ sdnc:
+ firewall:
+ yang:
+ model:
+ version: '2015-05-15'
+ password: 3141634BF7E070AA289CF2892C986C0B
+ timeout:
+ firewall:
+ minutes: '20'
+ ucpe:
+ async:
+ hours: '120'
+ minutes: '5'
+ site-name: CamundaEngine
+ sriov:
+ network:
+ role:
+ gateway1: HngwSriovProviderNet.SR_IOV_Provider2_1
+ gateway2: HngwSriovProviderNet.SR_IOV_Provider2_2
+ portal1: HnportalSriovProviderNet3.SR_IOV_Provider2_1
+ portal2: HnportalSriovProviderNet3.SR_IOV_Provider2_2
+ workflow:
+ sdnc:
+ replication:
+ delay: PT5S
+ aai:
+ distribution:
+ delay: PT5S
+ CreateGenericVNFV1:
+ aai:
+ volume-group:
+ uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group
+ DHVCreateService:
+ aai:
+ customer:
+ uri: /aai/v9/business/customers/customer
+ createvce:
+ delay:
+ seconds: '1'
+ default:
+ aai:
+ version: '8'
+ cloud-region:
+ version: '9'
+ generic-vnf:
+ version: '9'
+ retry:
+ attempts: '1'
+ deleteCinderVolumeV1:
+ aai:
+ volume-group:
+ uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group
+ global:
+ default:
+ aai:
+ namespace: http://org.openecomp.aai.inventory/
+ l3ToHigherLayerAddBonding:
+ model:
+ invariantid: 50359538-066f-4a8d-807f-f2bc8eaa79dc
+ name: WAN Bonding v0.1
+ version: '0.1'
+ versionid: 52dbec20-47aa-42e4-936c-331d8e350d44
+ message:
+ endpoint: http://localhost:30252/mso/WorkflowMessage
+ notification:
+ name: GenericNotificationServiceATT
+ sdncadapter:
+ callback: http://localhost:${wiremock.server.port}/mso/SDNCAdapterCallbackService
+ vnfadapter:
+ create:
+ callback: http://localhost:30253/mso/vnfAdapterNotify
+ delete:
+ callback: http://localhost:30253/mso/vnfAdapterNotify
+ query:
+ callback: http://localhost:30253/mso/vnfAdapterNotify
+ rollback:
+ callback: http://localhost:30253/mso/vnfAdapterNotify
+policy:
+ auth: Basic dGVzdHBkcDphbHBoYTEyMw==
+ client:
+ auth: Basic bTAzNzQzOnBvbGljeVIwY2sk
+ endpoint: https://localhost:8081/pdp/api/
+ environment: TEST
+sdnc:
+ auth: Basic YWRtaW46YWRtaW4=
+ host: https://localhost:8443
+ path: /restconf/operations/GENERIC-RESOURCE-API
+sdno:
+ health-check:
+ dmaap:
+ password: eHQ1cUJrOUc
+ publisher:
+ topic: com.att.sdno.test-health-diagnostic-v02
+ subscriber:
+ topic: com.att.sdno.test-health-diagnostic-v02
+ username: testuser
+pnf:
+ dmaap:
+ host:
+ port:
+sniro:
+ conductor:
+ host: http://localhost:30253
+ uri: /release
+ manager:
+ timeout: PT30M
+ host: http://localhost:${wiremock.server.port}
+ uri.v1: /sniro/api/v2/placement
+ uri.v2: /sniro/api/placement/v2
+ headers.auth: Basic dGVzdDp0ZXN0cHdk
+ headers.patchVersion: 1
+ headers.minorVersion: 1
+ headers.latestVersion: 2
+server:
+ port: 8080
+ tomcat:
+ max-threads: 50
+ # ssl:
+ # key-store: /app/msoClientKeyStore.jks
+ # key-store-password: mso4you
+ # key-store-type: JKS
+ # trust-store: /app/msoTrustStore.jks
+ # trust-store-password: mso_Domain2.0_4you
+spring:
+ h2:
+ console:
+ enabled: true
+ path: /h2
+ datasource:
+ url: jdbc:h2:mem:AZ;;DB_CLOSE_ON_EXIT=FALSE
+ username: sa
+ password: sa
+ driverClassName: org.h2.Driver
+ security:
+ usercredentials:
+ -
+ username: test
+ password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu'
+ role: BPMN-Client
+# Hibernate
+hibernate:
+ dialect: org.hibernate.dialect.MySQL5Dialect
+ show_sql: false
+
+management:
+ security:
+ enabled: false
+
+security:
+ basic:
+ enabled: false
+
+appc:
+ client:
+ topic:
+ read:
+ name: APPC-TEST-AMDOCS2
+ timeout: 360000
+ write: APPC-TEST-AMDOCS1-IST
+ response:
+ timeout: 360000
+ key: LSl8QKolmKcC0yJR
+ secret: lgjXraD1HutKxv8jEN6tVouu
+ service: ueb
poolMembers: localhost:3904,localhost:3904,localhost:3904 \ No newline at end of file