summaryrefslogtreecommitdiffstats
path: root/examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js
diff options
context:
space:
mode:
authors00370346 <swarup.nayak1@huawei.com>2019-04-24 19:10:05 +0530
committers00370346 <swarup.nayak1@huawei.com>2019-04-26 19:57:18 +0530
commitad178d97b872542a57356dd0b24493d3fd4d925f (patch)
tree1ea456a64321f391cb8d9509828cb329a5f5b866 /examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js
parentca558cfb1ea47de081527771af47abb37a8cd964 (diff)
ONAP BBS: Apex Nomadic ONT bug fixes
Issue-ID: DCAEGEN2-1237 Change-Id: Ibc1b5a221af5eb28799764498b2751d99f5764f3 Signed-off-by: s00370346 <swarup.nayak1@huawei.com>
Diffstat (limited to 'examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js')
-rw-r--r--examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js b/examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js
index 62c280531..86e4dfe1c 100644
--- a/examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js
+++ b/examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js
@@ -37,6 +37,8 @@ var requestID = clEvent.getRequestId();
var jsonObj;
var aaiUpdateResult = true;
+var wbClient = Java.type("org.onap.policy.apex.examples.bbs.WebClient");
+var client = new wbClient();
/* Get AAI URL from Configuration file. */
var AAI_URL = "localhost:8080";
@@ -50,15 +52,19 @@ var service_instance;
try {
var br = Files.newBufferedReader(Paths.get(
"/home/apexuser/examples/config/ONAPBBS/config.txt"));
- // read line by line
var line;
while ((line = br.readLine()) != null) {
if (line.startsWith("AAI_URL")) {
var str = line.split("=");
AAI_URL = str[str.length - 1];
- break;
+ } else if (line.startsWith("AAI_USERNAME")) {
+ var str = line.split("=");
+ AAI_USERNAME = str[str.length - 1];
+ } else if (line.startsWith("AAI_PASSWORD")) {
+ var str = line.split("=");
+ AAI_PASSWORD = str[str.length - 1];
+ }
}
- }
} catch (err) {
executor.logger.info("Failed to retrieve data " + err);
}
@@ -73,7 +79,7 @@ try {
executor.logger.info("Query url" + urlGet);
result = httpGet(urlGet).data;
- executor.logger.info("Data received From " + urlGet + " " + result.toString());
+ executor.logger.info("Data received From " + urlGet + " " + result);
jsonObj = JSON.parse(result);
@@ -102,13 +108,11 @@ try {
putUpddateServInstance, null, 4));
var urlPut = HTTP_PROTOCOL + AAI_URL +
putUrl + "?resource_version=" + resource_version;
- result = httpPut(urlPut, JSON.stringify(putUpddateServInstance)).data;
- executor.logger.info("Data received From " + urlPut + " " + result.toString());
- jsonObj = JSON.parse(result);
- executor.logger.info("After Parse " + JSON.stringify(jsonObj, null, 4));
-
+ result = client.httpsRequest(urlPut, "PUT", JSON.stringify(putUpddateServInstance), AAI_USERNAME, AAI_PASSWORD,
+ "application/json", true, true);
+ executor.logger.info("Data received From " + urlPut + " " + result);
/* If failure to retrieve data proceed to Failure */
- if (result == "") {
+ if (result != "") {
aaiUpdateResult = false;
}
}