2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Copyright (C) 2017 Amdocs
8 * =============================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 * ============LICENSE_END=========================================================
25 package org.onap.appc.aai.client.node;
27 import java.io.IOException;
28 import java.util.ArrayList;
29 import java.util.Arrays;
30 import java.util.Collections;
31 import java.util.Comparator;
32 import java.util.HashMap;
33 import java.util.List;
36 import org.apache.commons.lang3.StringUtils;
38 import org.onap.appc.aai.client.AppcAaiClientConstant;
39 import org.onap.appc.aai.client.aai.AaiService;
42 import com.att.eelf.configuration.EELFLogger;
43 import com.att.eelf.configuration.EELFManager;
45 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
46 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
47 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
49 //import com.fasterxml.jackson.databind.ObjectMapper;
52 public class AAIResourceNode implements SvcLogicJavaPlugin {
54 private static final EELFLogger log = EELFManager.getInstance().getLogger(AAIResourceNode.class);
57 public AaiService getAaiService() {
58 return new AaiService();
60 /* Gets VNF Info and All VServers associated with Vnf */
61 public void getVnfInfo(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
63 log.info("Received getVnfInfo call with params : " + inParams);
65 String responsePrefix = inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX);
69 responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
70 AaiService aai = getAaiService();
71 aai.getGenericVnfInfo(inParams,ctx);
73 ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_STATUS,
74 AppcAaiClientConstant.OUTPUT_STATUS_SUCCESS);
75 log.info("getVnfInfo Successful ");
76 } catch (Exception e) {
77 ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_STATUS,
78 AppcAaiClientConstant.OUTPUT_STATUS_FAILURE);
79 ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
80 log.error("Failed in getVnfInfo " + e.getMessage());
82 throw new SvcLogicException(e.getMessage());
87 public void getAllVServersVnfcsInfo(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
89 log.info("Received getAllVServersVnfcsInfo call with params : " + inParams);
91 String responsePrefix = inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX);
94 responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
95 AaiService aai = getAaiService();
99 ArrayList<Map<String, String>> vservers = new ArrayList<Map<String, String>>();
101 int vmWithNoVnfcsCount = 0;
102 String vmCountStr = ctx.getAttribute(responsePrefix + "vm-count");
104 if ( vmCountStr == null )
105 throw new Exception("Unable to get VServers for the VNF");
107 int vmCount = Integer.parseInt(vmCountStr);
108 for ( int i = 0; i < vmCount; i++ ) {
110 SvcLogicContext vmServerCtx = new SvcLogicContext();
112 Map<String, String> paramsVm = new HashMap<String, String>();
113 paramsVm.put("vserverId", ctx.getAttribute(responsePrefix + "vm[" + i + "].vserver-id"));
114 paramsVm.put("tenantId", ctx.getAttribute(responsePrefix +"vm[" + i + "].tenant-id"));
115 paramsVm.put("cloudOwner", ctx.getAttribute(responsePrefix +"vm[" + i + "].cloud-owner"));
116 paramsVm.put("cloudRegionId", ctx.getAttribute(responsePrefix +"vm[" + i + "].cloud-region-id"));
117 paramsVm.put(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX, inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX));
121 aai.getVMInfo(paramsVm, vmServerCtx);
123 HashMap<String, String> vserverMap = new HashMap<String, String>();
124 vserverMap.put("vserver-id", ctx.getAttribute(responsePrefix + "vm[" + i + "].vserver-id"));
125 vserverMap.put("tenant-id", ctx.getAttribute(responsePrefix +"vm[" + i + "].tenant-id"));
126 vserverMap.put("cloud-owner", ctx.getAttribute(responsePrefix +"vm[" + i + "].cloud-owner"));
127 vserverMap.put("cloud-region-id", ctx.getAttribute(responsePrefix +"vm[" + i + "].cloud-region-id"));
129 // Parameters returned by getVMInfo
130 vserverMap.put("vserver-name", vmServerCtx.getAttribute(responsePrefix + "vm.vserver-name"));
131 vserverMap.put("vf-module-id", vmServerCtx.getAttribute(responsePrefix + "vm.vf-module-id"));
134 // as Per 17.07 requirements we are supporting only one VNFC per VM.
136 String vnfcName = vmServerCtx.getAttribute(responsePrefix + "vm.vnfc[0].vnfc-name");
137 vserverMap.put("vnfc-name", vnfcName);
140 String vnfcCount = vmServerCtx.getAttribute(responsePrefix + "vm.vnfc-count");
141 if ( vnfcCount == null )
144 vserverMap.put("vnfc-count", vnfcCount);
146 if ( vnfcName != null ) {
147 Map<String, String> paramsVnfc = new HashMap<String, String>();
148 paramsVnfc.put("vnfcName", vnfcName);
150 paramsVnfc.put(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX, inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX));
152 SvcLogicContext vnfcCtx = new SvcLogicContext();
154 aai.getVnfcInfo(paramsVnfc, vnfcCtx);
156 vserverMap.put("vnfc-type", vnfcCtx.getAttribute(responsePrefix + "vnfc.vnfc-type"));
157 vserverMap.put("vnfc-function-code", vnfcCtx.getAttribute(responsePrefix + "vnfc.vnfc-function-code"));
158 vserverMap.put("group-notation", vnfcCtx.getAttribute(responsePrefix + "vnfc.group-notation"));
159 vserverMap.put("vnfc-ipaddress-v4-oam-vip", vnfcCtx.getAttribute(responsePrefix + "vnfc.ipaddress-v4-oam-vip"));
163 vmWithNoVnfcsCount++;
164 vservers.add(vserverMap);
168 Collections.sort(vservers, new Comparator<Map<String, String>>() {
170 public int compare(Map<String, String> o1, Map<String, String> o2) {
171 return o1.get("vserver-name").compareTo(o2.get("vserver-name"));
175 log.info("SORTED VSERVERS " + vservers.toString());
177 populateContext(vservers, ctx, responsePrefix);
179 log.info("VMCOUNT IN GETALLVSERVERS " + vmCount);
180 log.info("VMSWITHNOVNFCSCOUNT IN GETALLVSERVERS " + vmWithNoVnfcsCount);
181 ctx.setAttribute(responsePrefix+"vnf.vm-count", String.valueOf(vmCount));
182 ctx.setAttribute(responsePrefix+"vnf.vm-with-no-vnfcs-count", String.valueOf(vmWithNoVnfcsCount));
185 } catch (Exception e) {
186 ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_STATUS,
187 AppcAaiClientConstant.OUTPUT_STATUS_FAILURE);
188 ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
189 log.error("Failed in getAllVServersVnfcsInfo " + e.getMessage());
191 throw new SvcLogicException(e.getMessage());
195 public void populateContext(ArrayList<Map<String, String>> vservers, SvcLogicContext ctx, String prefix) {
198 log.info("Populating Final Context");
201 for (Map<String, String> entry : vservers) {
202 for (String key : entry.keySet()) {
203 String value = entry.get(key);
205 ctx.setAttribute(prefix+ "vm[" + ctr + "]."+ key, value);
206 log.info("Populating Context Key = " + prefix+ "vm[" + ctr + "]."+ key + " Value = " + value);
212 String firstVServerName = null;
213 for ( int i =0; i < ctr; i++ ) {
214 String vnfcName = ctx.getAttribute(prefix + "vm[" + i + "].vnfc-name");
215 log.info("VNFCNAME " + i + vnfcName);
216 if ( vnfcName == null && firstVServerName == null ) {
217 firstVServerName = ctx.getAttribute(prefix + "vm[" + i + "].vserver-name");
218 ctx.setAttribute("vm-name" , firstVServerName);
219 log.info("Populating Context Key = " + "vm-name" + " Value = " + firstVServerName);
226 public void addVnfcs(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
228 log.info("Received addVnfcs call with params : " + inParams);
230 String responsePrefix = inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX);
234 int vmWithNoVnfcCount = 0;
238 responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
239 AaiService aai = getAaiService();
241 //no:of vnfcs from the vnfc_reference table
242 String vnfcRefLenStr = ctx.getAttribute("vnfcReference_length");
244 if ( vnfcRefLenStr == null) {
245 log.info("Vnfc Reference data is missing");
246 throw new Exception("Vnfc Reference data is missing");
250 vnfcRefLen = Integer.parseInt(vnfcRefLenStr);
252 //Vms without vnfc from A&AI
253 String vmWithNoVnfcCountStr = ctx.getAttribute(responsePrefix+"vnf.vm-with-no-vnfcs-count");
255 //Commented for backward compatibility
257 /*if ( vmWithNoVnfcCountStr == null) {
258 throw new Exception("VNFCs to be added data from A&AI is missing");
259 //log.info("VNFCs to be added data from A&AI is missing");
262 vmWithNoVnfcCount = Integer.parseInt(vmWithNoVnfcCountStr);
264 if ( vmWithNoVnfcCount!= vnfcRefLen )
265 throw new Exception("Unable to Add Vnfcs to A&AI. Reference data mismatch.");
267 String vmCountStr = ctx.getAttribute(responsePrefix+"vnf.vm-count");
269 if ( vmCountStr == null)
270 throw new Exception("VM data from A&AI is missing");
272 vmCount = Integer.parseInt(vmCountStr);
275 log.info("VMCOUNT " + vmCount);
276 log.info("VNFCREFLEN " + vnfcRefLen);
277 aai.insertVnfcs(inParams,ctx, vnfcRefLen, vmCount);
284 if ( vmWithNoVnfcCountStr == null) {
285 log.info("Parameter VM without VNFCs(vmWithNoVnfcCountStr) from A&AI is Null");
288 vmWithNoVnfcCount = Integer.parseInt(vmWithNoVnfcCountStr);
290 log.info("No of VM without VNFCs(vmWithNoVnfcCount) from A&AI is " +vmWithNoVnfcCount);
292 String vmCountStr = ctx.getAttribute(responsePrefix+"vnf.vm-count");
294 if ( vmCountStr == null)
295 throw new Exception("VM data from A&AI is missing");
297 vmCount = Integer.parseInt(vmCountStr);
298 if(vmCount<vnfcRefLen)
299 throw new Exception("Vnfc and VM count mismatch");
302 log.info("VMCOUNT " + vmCount);
303 log.info("VNFCREFLEN " + vnfcRefLen);
304 if(StringUtils.isBlank(ctx.getAttribute("vnfc-type"))){
305 aai.updateVnfStatusWithOAMAddress(inParams, ctx);
309 aai.insertVnfcs(inParams,ctx, vnfcRefLen, vmCount);
313 ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_STATUS,
314 AppcAaiClientConstant.OUTPUT_STATUS_SUCCESS);
316 log.info("addVnfcs Successful ");
317 } catch (Exception e) {
318 ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_STATUS,
319 AppcAaiClientConstant.OUTPUT_STATUS_FAILURE);
320 ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
321 log.error("Failed in addVnfcs " + e.getMessage());
323 throw new SvcLogicException(e.getMessage());
328 public void updateVnfAndVServerStatus(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
330 log.info("Received updateVnfAndVServerStatus call with params : " + inParams);
332 String responsePrefix = inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX);
340 responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
341 AaiService aai = getAaiService();
345 String vmCountStr = ctx.getAttribute(responsePrefix+"vnf.vm-count");
347 if ( vmCountStr == null)
348 throw new Exception("VM data from A&AI is missing");
350 vmCount = Integer.parseInt(vmCountStr);
353 log.info("VMCOUNT " + vmCount);
356 aai.updateVnfStatus(inParams, ctx);
357 aai.updateVServerStatus(inParams,ctx, vmCount);
359 ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_STATUS,
360 AppcAaiClientConstant.OUTPUT_STATUS_SUCCESS);
362 log.info("updateVnfAndVServerStatus Successful ");
363 } catch (Exception e) {
364 ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_STATUS,
365 AppcAaiClientConstant.OUTPUT_STATUS_FAILURE);
366 ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
367 log.error("Failed in updateVnfAndVServerStatus " + e.getMessage());
369 throw new SvcLogicException(e.getMessage());
373 /*public void getDummyValues(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
375 log.info("Received getDummyValues call with params : " + inParams);
377 String responsePrefix = inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX);
381 responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
382 String instarKeys = inParams.get("instarKeys");
383 ObjectMapper mapper = new ObjectMapper();
384 if ( instarKeys != null ) {
386 List<String> keyList = mapper.readValue(instarKeys, ArrayList.class);
388 Map<String, String> instarParams =new HashMap<String, String>();
390 //System.out.println(keyList.toString());
393 for(int i=0;i<keyList.size();i++)
395 log.info(" -->"+keyList.get(i));
397 //ctx.setAttribute(keyList.get(i), "test" + i);
399 instarParams.put( keyList.get(i), "test" + i);
403 log.info("INSTARPARAMMAP " + instarParams);
404 String jsonString = mapper.writeValueAsString(instarParams);
405 log.info(jsonString);
406 ctx.setAttribute(responsePrefix + "configuration-parameters", jsonString);
410 log.info("getDummyValues Successful ");
411 } catch (Exception e) {
412 ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_STATUS,
413 AppcAaiClientConstant.OUTPUT_STATUS_FAILURE);
414 ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
415 log.error("Failed in getDummyValues " + e.getMessage());
417 throw new SvcLogicException(e.getMessage());
423 /*public void getRequestKeys(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
425 log.info("Received getRequestKeys call with params : " + inParams);
427 String responsePrefix = inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX);
431 responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
432 String instarKeys = inParams.get("instarKeys");
434 ObjectMapper mapper = new ObjectMapper();
435 if ( instarKeys != null ) {
437 List<String> keyList = mapper.readValue(instarKeys, ArrayList.class);
439 //Map<String, String> instarParams =new HashMap<String, String>();
443 for(int i=0;i<keyList.size();i++)
445 log.info("INSTARKEY -->"+keyList.get(i));
448 String instarParameter = ctx.getAttribute("INSTAR." + keyList.get(i));
449 log.info("INSTARPARAMETER " + instarParameter);
450 Parameter param = parseParameterContent(instarParameter);
452 log.info("PARAMETER KEY SIZE " + param.getRequestKeys().size());
453 log.info("RULE TYPE " + param.getClassType());
455 for ( int j =0 ; j < param.getRequestKeys().size() ; j++ ) {
457 log.info(" PARAM KEY NAME " + param.getRequestKeys().get(j).getKeyName());
458 log.info(" PARAM KEY VALUE " + param.getRequestKeys().get(j).getKeyValue());
461 // instarParams.put( keyList.get(i), "test" + i);
465 //log.info("INSTARPARAMMAP " + instarParams);
466 //String jsonString = mapper.writeValueAsString(instarParams);
467 //log.info(jsonString);
468 //ctx.setAttribute(responsePrefix + "configuration-parameters", jsonString);
472 log.info("getRequestKeys Successful ");
473 } catch (Exception e) {
474 ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_STATUS,
475 AppcAaiClientConstant.OUTPUT_STATUS_FAILURE);
476 ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
477 log.error("Failed in getRequestKeys " + e.getMessage());
479 throw new SvcLogicException(e.getMessage());
485 public Parameter parseParameterContent(String parameter) throws JsonParseException, JsonMappingException, IOException{
486 Parameter parameterDefinition = null;
487 if(StringUtils.isNotBlank(parameter)){
488 ObjectMapper mapper = new ObjectMapper();
489 parameterDefinition = mapper.readValue(parameter, Parameter.class);
491 return parameterDefinition;
493 public void getVserverInfo(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
494 log.info("getVserverInfo()::Retrieving vm and vnfc information for vserver:" + inParams.toString());
495 String responsePrefix = inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX);
497 responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
498 AaiService aaiService = getAaiService();
499 String vServerId = inParams.get("vserverId");
500 Map<String, String> params = setVmParams(ctx, vServerId);
501 Map<String, String> vnfcParams = new HashMap<String, String>();
502 if (null == params) {
503 log.error("getVserverInfo()::No Vm Info found!!");
504 throw new SvcLogicException("No Vm Info in Context");
506 params.put(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX,
507 inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX));
508 SvcLogicContext newVmCtx = new SvcLogicContext();
509 aaiService.getVMInfo(params, newVmCtx);
511 String vnfcName = newVmCtx.getAttribute(responsePrefix + "vm.vnfc[0].vnfc-name");
512 log.info("getVnfcFunctionCodeForVserver()::vnfcName=" + vnfcName);
513 SvcLogicContext newVnfcCtx = new SvcLogicContext();
514 if (StringUtils.isNotBlank(vnfcName)) {
515 vnfcParams.put("vnfcName", vnfcName);
517 log.info("getVserverInfo()::vnfc Name is blank, not setting vnfc info !!!!");
520 getVnfcInformationForVserver(vnfcParams, newVnfcCtx, inParams, ctx, aaiService, responsePrefix);
521 } catch (Exception e) {
522 ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_STATUS,
523 AppcAaiClientConstant.OUTPUT_STATUS_FAILURE);
524 ctx.setAttribute(responsePrefix + AppcAaiClientConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
525 log.error("Failed in getVserverInfo " + e.getMessage());
529 public void getVnfcInformationForVserver(Map<String, String> vnfcParams, SvcLogicContext newVnfcCtx,
530 Map<String, String> inParams, SvcLogicContext ctx, AaiService aaiService, String responsePrefix)
532 log.info("getVnfcInformationForVserver()::vnfcParams:" + vnfcParams.toString());
533 vnfcParams.put(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX,
534 inParams.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX));
536 aaiService.getVnfcInfo(vnfcParams, newVnfcCtx);
538 String vnfcType = newVnfcCtx.getAttribute(responsePrefix + "vnfc.vnfc-type");
539 String vnfcFunctionCode = newVnfcCtx.getAttribute(responsePrefix + "vnfc.vnfc-function-code");
540 String vnfcGroupNotation = newVnfcCtx.getAttribute(responsePrefix + "vnfc.group-notation");
541 String vnfcV4OamIp = newVnfcCtx.getAttribute(responsePrefix + "vnfc.ipaddress-v4-oam-vip");
543 if (StringUtils.isBlank(vnfcType) || StringUtils.isBlank(vnfcFunctionCode)
544 || StringUtils.isBlank(vnfcGroupNotation) || StringUtils.isBlank(vnfcV4OamIp)) {
545 log.info("getVnfcInformationForVserver()::Some vnfc parameters are blank!!!!");
547 log.info("getVnfcInformationForVserver()::vnfcType=" + vnfcType + ",vnfcFunctionCode=" + vnfcFunctionCode,
548 ", vnfc-ipaddress-v4-oam-vip=" + vnfcV4OamIp);
549 ctx.setAttribute(responsePrefix + "vm.vnfc.vnfc-name", vnfcParams.get("vnfcName"));
550 ctx.setAttribute(responsePrefix + "vm.vnfc.vnfc-type", vnfcType);
551 ctx.setAttribute(responsePrefix + "vm.vnfc.vnfc-function-code", vnfcFunctionCode);
552 ctx.setAttribute(responsePrefix + "vm.vnfc.vnfc-group-notation", vnfcGroupNotation);
553 ctx.setAttribute(responsePrefix + "vm.vnfc.vnfc-ipaddress-v4-oam-vip", vnfcV4OamIp);
557 public Map<String, String> setVmParams(SvcLogicContext ctx, String vServerId) {
558 log.info("setVmParams()::setVmParamsVM level action:" + vServerId);
559 Map<String, String> params = new HashMap<String, String>();
560 int vmCount = 0, arrayIndex = -1;
561 String vmCountStr = ctx.getAttribute("tmp.vnfInfo.vm-count");
562 if (StringUtils.isNotBlank(vmCountStr))
563 vmCount = Integer.parseInt(vmCountStr);
564 for (int cnt = 0; cnt < vmCount; cnt++) {
565 String vsId = ctx.getAttribute("tmp.vnfInfo.vm[" + cnt + "].vserver-id");
566 log.info("setVmParams():::vserver details::" + cnt + ":" + vsId);
567 if (StringUtils.equals(vServerId, vsId)) {
571 if (arrayIndex < 0) {
572 log.info("setVmParams()::VserverId not found in context!! Returning null for params!!");
575 String tenantId = ctx.getAttribute("tmp.vnfInfo.vm[" + arrayIndex + "].tenant-id");
576 String cloudOwner = ctx.getAttribute("tmp.vnfInfo.vm[" + arrayIndex + "].cloud-region-id");
577 String cloudRegionId = ctx.getAttribute("tmp.vnfInfo.vm[" + arrayIndex + "].cloud-owner");
578 log.info("setVmParams()::tenantId=" + tenantId + " cloudOwner=" + cloudOwner + " cloudRegiodId= "
580 params.put("vserverId", vServerId);
581 params.put("tenantId", tenantId);
582 params.put("cloudOwner", cloudOwner);
583 params.put("cloudRegionId", cloudRegionId);
584 log.info("setVmParams()::setVmParamsVM level action:" + params.toString());