Replace logic for subinterface_indicator ingestion
Changes made:
Replace ingestion logic for VFC_TO_NETWORK_ROLE_MAPPING.subinterface_indicator
with alternate logic suggested by ASDC.
Change-Id: Ied21e9361091c3fe4c05c6d9a2ee35c6491a7e10
Issue-ID: CCSDK-630
Signed-off-by: lalena.aria <lalena.aria@att.com>
diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java
index 5977e28..db50043 100644
--- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java
+++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
@@ -113,9 +114,17 @@
SdncBaseModel.addParameter("network_role", networkRole, commonParams); // can not be null
SdncBaseModel.addParameter("network_role_tag", nullCheck(propsMap.get("network_role_tag")), commonParams);
SdncBaseModel.addParameter("extcp_subnetpool_id", nullCheck(propsMap.get("subnetpoolid")), commonParams);
- String subinterfaceIndicator = nullCheck(propsMap.get("subinterface_indicator"));
- if (!subinterfaceIndicator.isEmpty()) {
- SdncBaseModel.addParameter("subinterface_indicator", subinterfaceIndicator.contains("true") ? "Y" : "N", commonParams); // boolean Y|N
+
+ // Loop thru all CPs using getNodeTemplateChildren and match the network_role on the CP with network_role from
+ // getCpPropertiesFromVfcAsObject output, then get subinterface_indicator for this CP
+ List<NodeTemplate> cpNodesList = sdcCsarHelper.getNodeTemplateChildren(vfcNode);
+ for (NodeTemplate cpNode : cpNodesList){
+ String cpNetworkRole = extractValue(cpNode, "network_role");
+
+ if (cpNetworkRole == networkRole) {
+ String subinterfaceIndicator = extractBooleanValue (cpNode, "subinterface_indicator");
+ addParameter("subinterface_indicator", subinterfaceIndicator, commonParams);
+ }
}
// Extract IP Version specific parameters