aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy89
1 files changed, 40 insertions, 49 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
index ed65dbc79b..2d5ddf0d0c 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
@@ -1,37 +1,37 @@
-/*-
- * ============LICENSE_START=======================================================
- * OPENECOMP - MSO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.bpmn.infrastructure.scripts;
+package org.openecomp.mso.bpmn.infrastructure.scripts;
import groovy.xml.XmlUtil
import groovy.json.*
-import org.openecomp.mso.bpmn.core.json.JsonUtils
-import org.openecomp.mso.bpmn.common.scripts.AaiUtil
-import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
-import org.openecomp.mso.bpmn.common.scripts.NetworkUtils
-import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
-import org.openecomp.mso.bpmn.common.scripts.VidUtils
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.rest.APIResponse;
-import org.openecomp.mso.rest.RESTClient
-import org.openecomp.mso.rest.RESTConfig
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.bpmn.common.scripts.AaiUtil
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.common.scripts.NetworkUtils
+import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
+import org.openecomp.mso.bpmn.common.scripts.VidUtils
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.rest.APIResponse;
+import org.openecomp.mso.rest.RESTClient
+import org.openecomp.mso.rest.RESTConfig
import java.util.HashMap;
import java.util.Map;
@@ -223,8 +223,6 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "networkInputs", networkInputs)
utils.log("DEBUG", Prefix + "networkInputs - " + '\n' + networkInputs, isDebugEnabled)
-
-
// prepare messageId
String messageId = execution.getVariable("testMessageId") // for testing
if (messageId == null || messageId == "") {
@@ -491,7 +489,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String aai_endpoint = execution.getVariable("URN_aai_endpoint")
AaiUtil aaiUriUtil = new AaiUtil(this)
String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String queryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId
+ String queryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=1"
utils.logAudit(queryIdAAIRequest)
execution.setVariable(Prefix + "queryIdAAIRequest", queryIdAAIRequest)
utils.log("DEBUG", Prefix + "queryIdAAIRequest - " + "\n" + queryIdAAIRequest, isDebugEnabled)
@@ -570,7 +568,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String aai_endpoint = execution.getVariable("URN_aai_endpoint")
AaiUtil aaiUriUtil = new AaiUtil(this)
String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String requeryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId
+ String requeryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=1"
utils.logAudit(requeryIdAAIRequest)
execution.setVariable(Prefix + "requeryIdAAIRequest", requeryIdAAIRequest)
utils.log("DEBUG", Prefix + "requeryIdAAIRequest - " + "\n" + requeryIdAAIRequest, isDebugEnabled)
@@ -1078,7 +1076,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String aai_endpoint = execution.getVariable("URN_aai_endpoint")
AaiUtil aaiUriUtil = new AaiUtil(this)
String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String updateContrailAAIUrlRequest = "${aai_endpoint}${aai_uri}/" + networkId
+ String updateContrailAAIUrlRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=1"
utils.logAudit(updateContrailAAIUrlRequest)
execution.setVariable(Prefix + "updateContrailAAIUrlRequest", updateContrailAAIUrlRequest)
@@ -1092,18 +1090,11 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "updateContrailAAIPayloadRequest", payloadXml)
utils.log("DEBUG", " 'payload' to Update Contrail - " + "\n" + payloadXml, isDebugEnabled)
- RESTConfig config = new RESTConfig(updateContrailAAIUrlRequest);
- RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId)
- .addHeader("X-FromAppId", "MSO")
- .addHeader("Content-Type", "application/xml")
- .addHeader("Accept","application/xml");
-
- APIResponse response = client.httpPut(payload)
+ APIResponse response = aaiUriUtil.executeAAIPutCall(execution, updateContrailAAIUrlRequest, payloadXml)
+
String returnCode = response.getStatusCode()
execution.setVariable(Prefix + "aaiUpdateContrailReturnCode", returnCode)
-
utils.log("DEBUG", " ***** AAI Update Contrail Response Code : " + returnCode, isDebugEnabled)
-
String aaiUpdateContrailResponseAsString = response.getResponseBodyAsString()
if (returnCode=='200') {
@@ -1117,7 +1108,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
} else {
execution.setVariable(Prefix + "isPONR", true)
}
-
+ utils.log("DEBUG", Prefix + "isPONR" + ": " + execution.getVariable(Prefix + "isPONR"), isDebugEnabled)
} else {
if (returnCode=='404') {
String dataErrorMessage = " Response Error from UpdateContrailAAINetwork is 404 (Not Found)."
@@ -1162,7 +1153,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
// get variables
String requestId = execution.getVariable("msoRequestId")
if (requestId == null) {
- requestId = execution.getVariable("mso-request-id")
+ requestId = execution.getVariable("mso-request-id")
}
String messageId = execution.getVariable(Prefix + "messageId")
String source = execution.getVariable(Prefix + "source")
@@ -1209,12 +1200,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String networkId = execution.getVariable(Prefix + "networkId")
String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId")
- // get/set 'msoRequestId' and 'mso-request-id'
+ // get/set 'msoRequestId' and 'mso-request-id'
String requestId = execution.getVariable("msoRequestId")
if (requestId != null) {
- execution.setVariable("mso-request-id", requestId)
+ execution.setVariable("mso-request-id", requestId)
} else {
- requestId = execution.getVariable("mso-request-id")
+ requestId = execution.getVariable("mso-request-id")
}
execution.setVariable(Prefix + "requestId", requestId)