Merge "Update the version.properties"
[so.git] / bpmn / MSOInfrastructureBPMN / src / main / groovy / org / openecomp / mso / bpmn / vcpe / scripts / CreateVcpeResCustService.groovy
index dba1a8b..dd6d451 100644 (file)
@@ -40,6 +40,7 @@ import org.json.JSONArray;
 import org.apache.commons.lang3.*\r
 import org.apache.commons.codec.binary.Base64;\r
 import org.springframework.web.util.UriUtils;\r
+import static org.apache.commons.lang3.StringUtils.*\r
 \r
 /**\r
  * This groovy class supports the <class>CreateVcpeResCustService.bpmn</class> process.\r
@@ -93,6 +94,16 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
                        // initialize flow variables\r
                        InitializeProcessVariables(execution)\r
 \r
+                       //Config Inputs\r
+                       String aaiDistDelay = execution.getVariable('URN_mso_workflow_aai_distribution_delay')\r
+                       if (isBlank(aaiDistDelay)) {\r
+                               msg = "URN_mso_workflow_aai_distribution_delay is null"\r
+                               utils.log("DEBUG", msg, isDebugEnabled)\r
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)\r
+                       }\r
+                       execution.setVariable("aaiDistDelay", aaiDistDelay)\r
+                       utils.log("DEBUG","AAI distribution delay: " + aaiDistDelay, isDebugEnabled)\r
+\r
                        // check for incoming json message/input\r
                        String createVcpeServiceRequest = execution.getVariable("bpmnRequest")\r
                        utils.logAudit(createVcpeServiceRequest)\r
@@ -332,6 +343,9 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
 \r
                        // VNFs\r
                        List<VnfResource> vnfList = serviceDecomposition.getServiceVnfs()\r
+                       filterVnfs(vnfList)\r
+                       serviceDecomposition.setServiceVnfs(vnfList)\r
+                       \r
                        execution.setVariable("vnfList", vnfList)\r
                        execution.setVariable("vnfListString", vnfList.toString())\r
 \r
@@ -361,24 +375,24 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
                   exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
                }\r
        }\r
-\r
-\r
-       public void awaitAaiDistribution(Execution execution) {\r
-               def isDebugEnabled=execution.getVariable(DebugFlag)\r
-\r
-               try {\r
-                       String tsleep = execution.getVariable("junitSleepMs")\r
-                       \r
-                       //workaround for aai replication issue\r
-                       utils.log("DEBUG", "sleeping while AAI distributes data", isDebugEnabled)\r
-                       sleep(tsleep == null ? 30000 : tsleep as Long)\r
+       \r
+       private void filterVnfs(List<VnfResource> vnfList) {\r
+               if(vnfList == null) {\r
+                       return\r
+               }\r
+               \r
+               // remove BRG & TXC from VNF list\r
+               \r
+               Iterator<VnfResource> it = vnfList.iterator()\r
+               while(it.hasNext()) {\r
+                       VnfResource vr = it.next()\r
                        \r
-               } catch (Exception ex) {\r
-                       // try error in method block\r
-                       String exceptionMessage = "Unexpected Error from method awaitAaiDistribution() - " + ex.getMessage()\r
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
+                       String role = vr.getNfRole()\r
+                       if(role == "BRG" || role == "TunnelXConn") {\r
+                               it.remove()\r
+                       }\r
                }\r
-        }\r
+       }\r
 \r
 \r
        public void prepareCreateAllottedResourceTXC(Execution execution) {\r