summaryrefslogtreecommitdiffstats
path: root/appc-outbound/appc-aai-client/provider/src/main
diff options
context:
space:
mode:
authorBalaji, Ramya (rb111y) <rb111y@att.com>2018-03-06 15:20:22 -0500
committerRanda Maher <rx196w@att.com>2018-03-06 21:58:27 +0000
commite4211cdd64e59989bb03dfbdd8c255aea8152c63 (patch)
treec432597e79a5df8800b18b45c0ba438dac7e8761 /appc-outbound/appc-aai-client/provider/src/main
parentcaece93b98a0c7ad1ae762ff1f29571e1bca8e0f (diff)
Code changes to processing new group notation type
Code and Unit Test cases to proces for group notation type existing-value Issue-ID: APPC-621 Change-Id: I8446f5f66c7b240018b0bee00d8b28c6baf673df Signed-off-by: Balaji, Ramya (rb111y) <rb111y@att.com>
Diffstat (limited to 'appc-outbound/appc-aai-client/provider/src/main')
-rw-r--r--appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/aai/AaiService.java47
1 files changed, 45 insertions, 2 deletions
diff --git a/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/aai/AaiService.java b/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/aai/AaiService.java
index cb439ee16..c1f42a73d 100644
--- a/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/aai/AaiService.java
+++ b/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/aai/AaiService.java
@@ -247,7 +247,7 @@ public class AaiService {
String vserverName = ctx.getAttribute(aaiRefKey + "vserver-name");
String vnfcName = vserverName + vnfcFuncCode + "001";
String groupNotation = getGroupNotation(groupNotationType, groupNotationValue, vnfcName, vserverName,
- prefix, ctx, vnfcType);
+ prefix, ctx, vnfcType, vnfcFuncCode, vmCount);
String ipAddressV4OamVip = null;
if ("Y".equals(populateIpAddressV4OamVip)) {
@@ -372,7 +372,7 @@ public class AaiService {
}
public String getGroupNotation(String groupNotationType, String groupNotationValue, String vnfcName,
- String vserverName, String prefix, SvcLogicContext ctx, String vnfcRefVnfcType) throws Exception {
+ String vserverName, String prefix, SvcLogicContext ctx, String vnfcRefVnfcType, String vnfcFuncCode, int vmCount) throws Exception {
String grpNotation = null;
@@ -446,11 +446,54 @@ public class AaiService {
}
}
}
+ else if ("existing-value".equals(groupNotationType)) {
+ /* This is a new value being added. Find the existing vnfc records in A&AI inventory with the same vnfc-function code as the value in vnfc_reference table.
+ * Verify that the group-notation value is the same for all such records found in inventory.
+ * if all records do not have the same group-notation value, write the new vnfc record to A&AI inventory without a group-notation value and continue to the next VM in the vnfc_reference table. A 501 intermediate error message should be sent after all new VNFC records have been added to A&AI.
+ If all records match, use the same group-notation value for the new vnfc record as found in the existing vnfc records.
+*/
+ grpNotation = getGroupNotationForExistigValue(ctx, prefix, vnfcFuncCode, vmCount);
+ }
log.info("RETURNED GROUPNOTATION " + grpNotation);
return grpNotation;
}
+ public String getGroupNotationForExistigValue(SvcLogicContext ctx, String prefix, String vnfcFuncCode, int vmCount) {
+ String vfModuleId = ctx.getAttribute("req-vf-module-id"); //Coming from request-params
+ boolean first=true;
+ String aaiGroupNotationValue=null;
+ for (int i=0;i<vmCount;i++ )
+ {
+ String ind = "tmp.vnfInfo.vm["+i+"].";
+ String aaiFuncCode = ctx.getAttribute(ind+"vnfc-function-code");
+ String aaiGroupNotation = ctx.getAttribute(ind+"group-notation");
+ String aaiVfModuleId = ctx.getAttribute(ind+"vf-module-id");
+
+ log.info("getGroupNotationForExistigValue()::: vfModuleId="+vfModuleId+", aaiFuncCode="+aaiFuncCode
+ +", aaiGroupNotation="+aaiGroupNotation+",aaiVfMOduleId="+aaiVfModuleId);
+
+ if (StringUtils.isNotBlank(aaiFuncCode) && aaiFuncCode.equals(vnfcFuncCode) &&
+ (StringUtils.isNotBlank(vfModuleId) && StringUtils.isNotBlank(aaiVfModuleId) && aaiVfModuleId.equals(vfModuleId))) {
+ if (null==aaiGroupNotationValue && first) {
+ if (null == aaiGroupNotation) {//Return if null
+ return null;
+ }
+ aaiGroupNotationValue = ctx.getAttribute(ind+"group-notation");
+ first=false;
+ }
+ else {
+ if (!StringUtils.equals(aaiGroupNotationValue, ctx.getAttribute(ind+"group-notation"))) {
+ log.info("Values are different, returning null");
+ return null;
+ }
+ }
+ }
+ }
+
+ return aaiGroupNotationValue;
+ }
+
public String getGroupNotationForVServer(SvcLogicContext ctx, String prefix, String vserverName) {
String vmCountStr = ctx.getAttribute(prefix + "vnf.vm-count");