diff options
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy')
-rw-r--r-- | bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy | 81 |
1 files changed, 42 insertions, 39 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 269cb80..1fd5ab0 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -17,12 +17,12 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -
+ package org.openecomp.mso.bpmn.infrastructure.scripts; -
-import javax.xml.parsers.DocumentBuilder
-import javax.xml.parsers.DocumentBuilderFactory
-
+ +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution @@ -37,15 +37,15 @@ import org.openecomp.mso.bpmn.core.json.JsonUtils import org.openecomp.mso.rest.APIResponse import org.openecomp.mso.rest.RESTClient import org.openecomp.mso.rest.RESTConfig -import org.springframework.web.util.UriUtils
-import org.w3c.dom.Document
-import org.w3c.dom.Element
-import org.w3c.dom.NamedNodeMap
-import org.w3c.dom.Node
+import org.springframework.web.util.UriUtils +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.NamedNodeMap +import org.w3c.dom.Node import org.w3c.dom.NodeList -import org.xml.sax.InputSource
-
-
+import org.xml.sax.InputSource + + public class DoCreateVfModule extends VfModuleBase { @@ -140,7 +140,7 @@ public class DoCreateVfModule extends VfModuleBase { def requestId = execution.getVariable("msoRequestId") execution.setVariable("DCVFM_requestId", requestId) logDebug("requestId: " + requestId, isDebugLogEnabled) - // Set mso-request-id to request-id for VNF Adapter interface + // Set mso-request-id to request-id for VNF Adapter interface execution.setVariable("mso-request-id", requestId) //serviceId def serviceId = execution.getVariable("serviceId") @@ -175,7 +175,7 @@ public class DoCreateVfModule extends VfModuleBase { //personaModelId execution.setVariable("DCVFM_personaModelId", jsonUtil.getJsonValue(vfModuleModelInfo, "modelInvariantId")) //personaModelVersion - execution.setVariable("DCVFM_personaModelVersion", jsonUtil.getJsonValue(vfModuleModelInfo, "modelVersion")) + execution.setVariable("DCVFM_personaModelVersion", jsonUtil.getJsonValue(vfModuleModelInfo, "modelVersionId")) //vfModuleLabel def vfModuleLabel = execution.getVariable("vfModuleLabel") if (vfModuleLabel != null) { @@ -665,7 +665,7 @@ public class DoCreateVfModule extends VfModuleBase { String uuid = execution.getVariable('testReqId') // for junits if(uuid==null){ - uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() } def callbackUrl = execution.getVariable("DCVFM_sdncCallbackUrl") @@ -680,6 +680,14 @@ public class DoCreateVfModule extends VfModuleBase { else { svcInstId = serviceInstanceId } + + def msoAction = "" + if (!sdncVersion.equals("1707")) { + msoAction = "mobility" + } + else { + msoAction = "vfmodule" + } // For VNF, serviceOperation (URI for topology GET) will be retrieved from "selflink" element // in the response from GenericGetVnf // For VF Module, in 1707 serviceOperation will be retrieved from "object-path" element @@ -723,7 +731,7 @@ public class DoCreateVfModule extends VfModuleBase { <sdncadapter:SvcAction>query</sdncadapter:SvcAction> <sdncadapter:SvcOperation>${serviceOperation}</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>${callbackUrl}</sdncadapter:CallbackUrl> - <sdncadapter:MsoAction>mobility</sdncadapter:MsoAction> + <sdncadapter:MsoAction>${msoAction}</sdncadapter:MsoAction> </sdncadapter:RequestHeader> <sdncadapterworkflow:SDNCRequestData></sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" @@ -902,13 +910,13 @@ public class DoCreateVfModule extends VfModuleBase { def requestId = execution.getVariable("mso-request-id") if (requestId == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request has no mso-request-id")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request has no mso-request-id") } def serviceInstanceId = execution.getVariable("mso-service-instance-id") if (serviceInstanceId == null) { - exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request message has no mso-service-instance-id")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request message has no mso-service-instance-id") } utils.logContext(requestId, serviceInstanceId) @@ -1014,9 +1022,9 @@ public class DoCreateVfModule extends VfModuleBase { if (!sdncVersion.equals("1707")) { sdncRequest = - """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1" - xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1" - xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
+ """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1" + xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1" + xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> <sdncadapter:RequestHeader> <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId> <sdncadapter:SvcInstanceId>${svcInstId}</sdncadapter:SvcInstanceId> @@ -1057,14 +1065,14 @@ public class DoCreateVfModule extends VfModuleBase { else { sdncRequest = - """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1" - xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1" - xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
+ """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1" + xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1" + xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> <sdncadapter:RequestHeader> <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId> <sdncadapter:SvcInstanceId>${svcInstId}</sdncadapter:SvcInstanceId> <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:SvcOperation>vf-module-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> </sdncadapter:RequestHeader> @@ -1081,10 +1089,7 @@ public class DoCreateVfModule extends VfModuleBase { ${serviceEcompModelInformation} <service-instance-id>${svcInstId}</service-instance-id> <global-customer-id>${globalSubscriberId}</global-customer-id> - </service-information> - <vnf-request-information> - <vnf-type>${vfModuleModelName}</vnf-type> - </vnf-request-information> + </service-information> <vnf-information> <vnf-id>${vnfId}</vnf-id> <vnf-type>${vnfType}</vnf-type> @@ -1095,11 +1100,10 @@ public class DoCreateVfModule extends VfModuleBase { <vf-module-type>${vfModuleModelName}</vf-module-type> ${vfModuleEcompModelInformation} </vf-module-information> - <vf-module-request-input> - <request-version>${sdncVersion}</request-version> + <vf-module-request-input> <vf-module-name>${vfModuleName}</vf-module-name> <tenant>${tenantId}</tenant> - <aic-cloud-region>${cloudSiteId}</aic-cloud-region> + <aic-cloud-region>${cloudSiteId}</aic-cloud-region> ${sdncVNFParamsXml} </vf-module-request-input> </sdncadapterworkflow:SDNCRequestData> @@ -1108,9 +1112,9 @@ public class DoCreateVfModule extends VfModuleBase { /* sdncRequest = - """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1"
- xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
+ """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1" + xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1" + xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> <sdncadapter:RequestHeader> <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId> <sdncadapter:SvcInstanceId>${svcInstId}</sdncadapter:SvcInstanceId> @@ -1142,8 +1146,7 @@ public class DoCreateVfModule extends VfModuleBase { <vf-module-type>${vfModuleModelName}</vf-module-type> ${vfModuleEcompModelInformation} </vf-module-information> - <vf-module-request-input> - <request-version>${sdncVersion}</request-version> + <vf-module-request-input> <vf-module-name>${vfModuleName}</vf-module-name> <tenant>${tenantId}</tenant> <aic-cloud-region>${cloudSiteId}</aic-cloud-region> @@ -1662,7 +1665,7 @@ public class DoCreateVfModule extends VfModuleBase { def networkPolicyId = UUID.randomUUID().toString() logDebug("Adding network-policy with network-policy-id " + networkPolicyId, isDebugLogEnabled) - String aaiNamespace = aaiUriUtil.getNamespaceFromUri(aai_uri) + String aaiNamespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) logDebug('AAI namespace is: ' + aaiNamespace, isDebugLogEnabled) String payload = """<network-policy xmlns="${aaiNamespace}"> <network-policy-id>${networkPolicyId}</network-policy-id> |