- String vnfId = params.get("vnfId");
- if(StringUtils.isBlank(vnfId)){
- throw new Exception("VnfId is missing");
- }
- String prefix = params.get(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX);
- prefix = StringUtils.isNotBlank(prefix) ? (prefix+".") : "";
- //String resourceKey = "generic-vnf.vnf-id = '" + vnfId + "' AND relationship-key = 'vserver.vserver-id'";
- String resourceKey = "generic-vnf.vnf-id = '" + vnfId + "'";
- String resourceType = "generic-vnf";
- String queryPrefix = "vnfInfo";
- SvcLogicContext vnfCtx = readResource(resourceKey,queryPrefix,resourceType);
-
- ctx.setAttribute(prefix + "vnf.vnf-name", vnfCtx.getAttribute("vnfInfo.vnf-name"));
- ctx.setAttribute(prefix + "vnf.vnf-type", vnfCtx.getAttribute("vnfInfo.vnf-type"));
- ctx.setAttribute(prefix + "vnf.prov-status", vnfCtx.getAttribute("vnfInfo.prov-status"));
- ctx.setAttribute(prefix + "vnf.orchestration-status", vnfCtx.getAttribute("vnfInfo.orchestration-status"));
- ctx.setAttribute(prefix + "vnf.ipv4-oam-address", vnfCtx.getAttribute("vnfInfo.ipv4-oam-address"));
-
- int vmCount = 0;
- String relLen = vnfCtx.getAttribute("vnfInfo.relationship-list.relationship_length");
- int relationshipLength = 0;
- if ( relLen != null )
- relationshipLength = Integer.parseInt(relLen);
- log.info("RELLEN " + relationshipLength);
- for ( int i=0; i < relationshipLength; i++ ) {
- String vserverId = getRelationshipValue(i, vnfCtx, "vserver", "vserver.vserver-id", "vnfInfo");
- String tenantId = getRelationshipValue(i, vnfCtx, "vserver", "tenant.tenant-id", "vnfInfo");
- String cloudOwner = getRelationshipValue(i, vnfCtx, "vserver", "cloud-region.cloud-owner", "vnfInfo");
- String cloudRegionId = getRelationshipValue(i, vnfCtx, "vserver", "cloud-region.cloud-region-id", "vnfInfo");
- if ( vserverId != null ) {
- log.info("VSERVER KEYS " + vserverId + " " + tenantId + " " + cloudOwner + " " + cloudRegionId);
- String vnfPrefix = prefix + "vm[" + vmCount + "].";
- ctx.setAttribute(vnfPrefix + "vserver-id", vserverId);
- ctx.setAttribute(vnfPrefix + "tenant-id", tenantId);
- ctx.setAttribute(vnfPrefix + "cloud-owner", cloudOwner);
- ctx.setAttribute(vnfPrefix + "cloud-region-id", cloudRegionId);
- vmCount++;
- }
- }
- ctx.setAttribute(prefix + "vm-count", String.valueOf(vmCount));
- log.info("VMCOUNT FROM VNF INFO " + ctx.getAttribute(prefix + "vm-count"));
- }