diff options
-rw-r--r-- | ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebClient.java | 59 | ||||
-rw-r--r-- | ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java | 14 |
2 files changed, 37 insertions, 36 deletions
diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebClient.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebClient.java index 2078a798f..e5dec14c7 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebClient.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebClient.java @@ -37,66 +37,59 @@ public class SdncUebClient { SdncUebConfiguration config = new SdncUebConfiguration(); - IDistributionClient client = DistributionClientFactory.createDistributionClient(); - SdncUebCallback cb = new SdncUebCallback(client, config); - - LOG.info("Scanning for local distribution artifacts before starting client"); - cb.deployDownloadedFiles(null, null, null); - - LOG.info("Initializing ASDC distribution client"); - - IDistributionClientResult result = client.init(config, cb); - - LOG.info("Initialized ASDC distribution client - results = {}", result.getDistributionMessageResult()); - long startTm = System.currentTimeMillis(); int sleepTm = config.getPollingInterval() * 1000; long maxWaitTm = config.getClientStartupTimeout() * 1000L; boolean keepWaiting = true; boolean listenerStarted = false; + boolean processDownloads = true; while (keepWaiting) { + LOG.info("Initializing ASDC distribution client"); + + IDistributionClient client = DistributionClientFactory.createDistributionClient(); + SdncUebCallback cb = new SdncUebCallback(client, config); + IDistributionClientResult result = client.init(config, cb); + LOG.info("Initialized ASDC distribution client - results = {}", result.getDistributionMessageResult()); + if (result.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS) { + if (processDownloads) { + LOG.info("Scanning for local distribution artifacts before starting client"); + cb.deployDownloadedFiles(null, null, null); + processDownloads = false; + } LOG.info("Starting client..."); try { IDistributionClientResult start = client.start(); LOG.info("Client startup result = {}", start.getDistributionMessageResult()); - + // Only stop waiting if the result is success if (start.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS) { - + keepWaiting = false; listenerStarted = true; } else { - LOG.info("SDC returned {} - exitting",start.getDistributionActionResult().toString()); + LOG.info("SDC returned {} - exitting", start.getDistributionActionResult().toString()); try { client.stop(); - } catch(Exception e1) { + } catch (Exception e1) { // Ignore exception on stop } - client = DistributionClientFactory.createDistributionClient(); - cb = new SdncUebCallback(client, config); - LOG.info("Initializing ASDC distribution client"); - - result = client.init(config, cb); - - LOG.info("Initialized ASDC distribution client - results = {}", result.getDistributionMessageResult()); - } - } catch(Exception e) { + } catch (Exception e) { LOG.info("Client startup failure", e); } + } - if (System.currentTimeMillis() - startTm < maxWaitTm) { - keepWaiting = false; - } else { + if (System.currentTimeMillis() - startTm < maxWaitTm) { + keepWaiting = false; + } else { - try { - Thread.sleep(sleepTm); - } catch (InterruptedException e) { - // Ignore - } + try { + Thread.sleep(sleepTm); + } catch (InterruptedException e) { + // Ignore } } 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 b23a913ff..94392262e 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 @@ -114,9 +114,17 @@ public class SdncVFCModel extends SdncBaseModel { 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 |