From e4211cdd64e59989bb03dfbdd8c255aea8152c63 Mon Sep 17 00:00:00 2001 From: "Balaji, Ramya (rb111y)" Date: Tue, 6 Mar 2018 15:20:22 -0500 Subject: 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) --- .../org/onap/appc/aai/client/aai/AaiService.java | 47 +++++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'appc-outbound/appc-aai-client/provider/src/main/java') 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