summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common/src/main/groovy
diff options
context:
space:
mode:
authormarios.iakovidis <marios.iakovidis@huawei.com>2019-06-03 00:31:21 +0300
committermarios.iakovidis <marios.iakovidis@huawei.com>2019-06-03 00:34:15 +0300
commit6f0f3ab69de1013f6d3e5951223e014f2b3daa48 (patch)
treeb66b2bf0a7962e099f2b9ca23fdacbe4b655a486 /bpmn/so-bpmn-infrastructure-common/src/main/groovy
parentf8aefb2f8773bf2a4b56b6d4e9657df6eff2170e (diff)
Added orchestration status to service
Issue-ID: SO-1938 Signed-off-by: MariosIakovidis <marios.iakovidis@huawei.com> Change-Id: I78cc401a746ef4dbca41a869729b9791210038f4
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/main/groovy')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy43
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy5
3 files changed, 50 insertions, 3 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
index bd465eb9a8..a771741e18 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
@@ -23,6 +23,13 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.VnfResource
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.ErrorCode;
import static org.apache.commons.lang3.StringUtils.*
@@ -332,5 +339,41 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
}
logger.trace("finished prepareInitServiceOperationStatus")
}
+
+ public void updateAAIOrchStatus (DelegateExecution execution){
+ logger.debug(" ***** start updateAAIOrchStatus ***** ")
+ String msg = ""
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ logger.debug("serviceInstanceId: "+serviceInstanceId)
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+
+ try {
+ ServiceInstance si = execution.getVariable("serviceInstanceData")
+ boolean allActive = true
+ for (VnfResource resource : serviceDecomposition.vnfResources) {
+ logger.debug("resource.modelInfo.getModelName: " + resource.modelInfo.getModelName() +" | resource.getOrchestrationStatus: "+resource.getOrchestrationStatus())
+ if (resource.getOrchestrationStatus() != "Active") {
+ allActive = false
+ }
+ }
+
+ if (allActive){
+ si.setOrchestrationStatus("Active")
+ }else {
+ si.setOrchestrationStatus("Pending")
+ }
+ 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 org.onap.so.bpmn.common.scripts.CompleteMsoProcess.updateAAIOrchStatus " + ex.getMessage()
+ logger.info( msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.debug(" ***** end updateAAIOrchStatus ***** ")
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
index b0749ded86..b70797c63b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
@@ -243,12 +243,11 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String ontsn = jsonUtil.getJsonValue(serInput,
"service.parameters.requestInputs.ont_ont_serial_num")
- String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.c_vlan", cvlan)
- uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.s_vlan", svlan)
+ String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.CVLAN", cvlan)
+ uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.SVLAN", svlan)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.remote_id", remoteId)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.manufacturer", manufacturer)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ONTSN", ontsn)
-
logger.debug("old resource input:" + resourceInputObj.toString())
resourceInputObj.setResourceParameters(uResourceInput)
execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString())
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
index 98def612de..b49f00a247 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -280,5 +280,10 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
public void postConfigRequest(DelegateExecution execution){
//now do noting
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ for (VnfResource resource : serviceDecomposition.vnfResources) {
+ resource.setOrchestrationStatus("Active")
+ }
+ execution.setVariable("serviceDecomposition", serviceDecomposition)
}
}