aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ueb-listener/src/assembly/assemble_zip.xml6
-rw-r--r--ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebClient.java35
-rw-r--r--ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java13
-rwxr-xr-xueb-listener/src/test/resources/ueb-listener.properties1
4 files changed, 48 insertions, 7 deletions
diff --git a/ueb-listener/src/assembly/assemble_zip.xml b/ueb-listener/src/assembly/assemble_zip.xml
index 97a229d2..7a21aca4 100644
--- a/ueb-listener/src/assembly/assemble_zip.xml
+++ b/ueb-listener/src/assembly/assemble_zip.xml
@@ -8,9 +8,9 @@
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,7 +34,7 @@
<fileSets>
<fileSet>
- <directory>src/main/bin</directory>
+ <directory>src/main/scripts</directory>
<outputDirectory>bin</outputDirectory>
</fileSet>
<fileSet>
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 d2989048..1d1f4763 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
@@ -39,6 +39,7 @@ public class SdncUebClient {
SdncUebCallback cb = new SdncUebCallback(client, config);
+
LOG.info("Scanning for local distribution artifacts before starting client");
cb.deployDownloadedFiles(null, null, null);
@@ -48,13 +49,39 @@ public class SdncUebClient {
LOG.info("Initialized ASDC distribution client - results = {}", result.getDistributionMessageResult());
- if (result.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS) {
- LOG.info("Starting client...");
- IDistributionClientResult start = client.start();
- LOG.info("Client startup result = {}", start.getDistributionMessageResult());
+ long startTm = System.currentTimeMillis();
+ int sleepTm = config.getPollingInterval() * 1000;
+ long maxWaitTm = config.getClientStartupTimeout() * 1000;
+
+ boolean keepWaiting = true;
+
+ while (keepWaiting) {
+ if (result.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS) {
+ LOG.info("Starting client...");
+ try {
+ IDistributionClientResult start = client.start();
+ LOG.info("Client startup result = {}", start.getDistributionMessageResult());
+ keepWaiting = false;
+ } catch(Exception e) {
+ LOG.info("Client startup failure", e);
+ }
+
+ if (System.currentTimeMillis() - startTm < maxWaitTm) {
+ keepWaiting = false;
+ } else {
+
+ try {
+ Thread.sleep(sleepTm);
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+ }
+ }
+
}
+
}
}
diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java
index 75cb9c97..bf7dc88a 100644
--- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java
+++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java
@@ -46,6 +46,7 @@ public class SdncUebConfiguration implements IConfiguration{
private String password = null;
private int pollingInterval = 30;
private int pollingTimeout = 15;
+ private int clientStartupTimeout = 900;
private List<String> relevantArtifactTypes = null;
private String user = null;
@@ -154,6 +155,14 @@ public class SdncUebConfiguration implements IConfiguration{
}
}
+ curval = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.client-startup-timeout");
+ if ((curval != null) && (curval.length() > 0)) {
+ try {
+ clientStartupTimeout = Integer.parseInt(curval);
+ } catch (Exception e) {
+ LOG.warn("Illegal value for org.onap.ccsdk.sli.northbound.uebclient.polling-timeout ({}) ", curval, e);
+ }
+ }
curval = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.relevant-artifact-types");
if ((curval != null) && (curval.length() > 0)) {
String[] artifactTypes = curval.split(",");
@@ -225,6 +234,10 @@ public class SdncUebConfiguration implements IConfiguration{
return relevantArtifactTypes;
}
+ public int getClientStartupTimeout() {
+ return clientStartupTimeout;
+ }
+
@Override
public String getUser() {
return user;
diff --git a/ueb-listener/src/test/resources/ueb-listener.properties b/ueb-listener/src/test/resources/ueb-listener.properties
index 4b9886ee..35c38059 100755
--- a/ueb-listener/src/test/resources/ueb-listener.properties
+++ b/ueb-listener/src/test/resources/ueb-listener.properties
@@ -12,6 +12,7 @@ org.onap.ccsdk.sli.northbound.uebclient.spool.incoming=src/test/resources/incomi
org.onap.ccsdk.sli.northbound.uebclient.spool.archive=src/test/resources/archive
org.onap.ccsdk.sli.northbound.uebclient.polling-interval=30
org.onap.ccsdk.sli.northbound.uebclient.polling-timeout=15
+org.onap.ccsdk.sli.northbound.uebclient.client-startup-timeout=60
org.onap.ccsdk.sli.northbound.uebclient.relevant-artifact-types=YANG_XML,VF_LICENSE,TOSCA_TEMPLATE,TOSCA_CSAR,UCPE_LAYER_2_CONFIGURATION
org.onap.ccsdk.sli.northbound.uebclient.activate-server-tls-auth=false
org.onap.ccsdk.sli.northbound.uebclient.keystore-path=