Code changes for A&AI add/update
[appc.git] / appc-outbound / appc-aai-client / provider / src / main / java / org / onap / appc / aai / client / aai / AaiService.java
index c1f42a7..a77aa9c 100644 (file)
@@ -216,7 +216,7 @@ public class AaiService {
 
     }
 
-    public void insertVnfcs(Map<String, String> params, SvcLogicContext ctx, int vnfcRefLen, int vmCount)
+    public void insertVnfcs(Map<String, String> params, SvcLogicContext ctx, int vnfcRefLen, int vmCount, String vfModuleIdFromRequest)
             throws Exception {
         log.info("Received insertVnfcs call with params : " + params);
 
@@ -228,6 +228,15 @@ public class AaiService {
         for (int i = 0; i < vmCount; i++) {
             String aaiRefKey = prefix + "vm[" + i + "].";
 
+            //ConfigScaleOut - Do not process vms that are not associated with vfmodule id if vfmodule id is present
+            if (StringUtils.isNotBlank(vfModuleIdFromRequest)){
+                String vmVfModuleId = ctx.getAttribute(aaiRefKey+"vf-module-id");
+                log.info("insertVnfcs():::vfModule for vm is="+vmVfModuleId);
+                if (StringUtils.isBlank(vmVfModuleId) || !StringUtils.equalsIgnoreCase(vmVfModuleId,vfModuleIdFromRequest)) {
+                    continue;
+                }
+            }
+
             log.info("VNFCNAME IN INSERTVNFCS " + ctx.getAttribute(aaiRefKey + "vnfc-name"));
             String vnfcNameAAI = ctx.getAttribute(aaiRefKey + "vnfc-name");