summaryrefslogtreecommitdiffstats
path: root/examples/examples-onap-bbs/src/main/resources
diff options
context:
space:
mode:
authorRam Krishna Verma <ram.krishna.verma@est.tech>2019-07-01 15:21:39 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-01 15:21:39 +0000
commit3e60ff607e30e020d5909bf23bf571504e635c23 (patch)
tree6bd79f227891bf13ec3a5c7b03c8546254771fe3 /examples/examples-onap-bbs/src/main/resources
parent5052634e60545f5b483660700d47eb4fff5d0d38 (diff)
parentf08984b16abf954b7b351f21a3822e21d9d4f7c2 (diff)
Merge "Fix issues from Checkstyle reviews"
Diffstat (limited to 'examples/examples-onap-bbs/src/main/resources')
-rw-r--r--examples/examples-onap-bbs/src/main/resources/logic/AAIServiceAssignedTask.js19
-rw-r--r--examples/examples-onap-bbs/src/main/resources/logic/AAIServiceCreateTask.js4
-rw-r--r--examples/examples-onap-bbs/src/main/resources/logic/SdncResourceUpdateTask.js13
-rw-r--r--examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js42
4 files changed, 31 insertions, 47 deletions
diff --git a/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceAssignedTask.js b/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceAssignedTask.js
index 6e72e618c..a4be3707f 100644
--- a/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceAssignedTask.js
+++ b/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceAssignedTask.js
@@ -84,7 +84,7 @@ try {
executor.logger.info("Query url" + urlGet);
- result = client.httpRequest(urlGet, "GET", null, AAI_USERNAME, AAI_PASSWORD, "application/json", true);
+ result = client.httpRequest(urlGet, "GET", null, AAI_USERNAME, AAI_PASSWORD, "application/json");
executor.logger.info("Data received From " + urlGet + " " + result);
jsonObj = JSON.parse(result.toString());
@@ -116,7 +116,7 @@ try {
executor.logger.info("ready to putAfter Parse " + JSON.stringify(putUpddateServInstance, null, 4));
var urlPut = HTTP_PROTOCOL + AAI_URL + putUrl + "?resource_version=" + resource_version;
result = client.httpRequest(urlPut, "PUT", JSON.stringify(putUpddateServInstance), AAI_USERNAME, AAI_PASSWORD,
- "application/json", true);
+ "application/json");
executor.logger.info("Data received From " + urlPut + " " + result);
/* If failure to retrieve data proceed to Failure */
if (result != "") {
@@ -157,7 +157,7 @@ try {
/* 1. Get PNF */
var urlGetPnf = HTTP_PROTOCOL + AAI_URL + "/aai/" + AAI_VERSION + "/network/pnfs/pnf/" + pnfName;
- pnfResponse = client.httpRequest(urlGetPnf, "GET", null, AAI_USERNAME, AAI_PASSWORD, "application/json", true);
+ pnfResponse = client.httpRequest(urlGetPnf, "GET", null, AAI_USERNAME, AAI_PASSWORD, "application/json");
executor.logger.info("Data received From " + urlGetPnf + " " + pnfResponse);
/* If failure to retrieve data proceed to Failure */
if (result != "") {
@@ -166,7 +166,7 @@ try {
pnfUpdate = JSON.parse(pnfResponse.toString());
executor.logger.info(JSON.stringify(pnfUpdate, null, 4));
- /*2. Create logical link */
+ /* 2. Create logical link */
var link_name = attachmentPoint;
var logicalLink = {
"link-name" : link_name,
@@ -176,14 +176,14 @@ try {
var urlNewLogicalLink = HTTP_PROTOCOL + AAI_URL + "/aai/" + AAI_VERSION
+ "/network/logical-links/logical-link/" + link_name;
result = client.httpRequest(urlNewLogicalLink, "PUT", JSON.stringify(logicalLink), AAI_USERNAME, AAI_PASSWORD,
- "application/json", true);
+ "application/json");
executor.logger.info("Data received From " + urlNewLogicalLink + " " + result);
/* If failure to retrieve data proceed to Failure */
if (result != "") {
aaiUpdateResult = false;
}
- /*3. Update pnf with new relation*/
+ /* 3. Update pnf with new relation */
for (var i = 0; i < pnfUpdate["relationship-list"]["relationship"].length; i++) {
if (pnfUpdate["relationship-list"]["relationship"][i]['related-to'] == 'logical-link') {
pnfUpdate["relationship-list"]["relationship"][i]['related-link'] = "/aai/" + AAI_VERSION
@@ -202,7 +202,7 @@ try {
executor.logger.info("Put pnf to aai " + JSON.stringify(pnfUpdate, null, 4));
var urlPutPnf = HTTP_PROTOCOL + AAI_URL + "/aai/" + AAI_VERSION + "/network/pnfs/pnf/" + pnfName;
result = client.httpRequest(urlPutPnf, "PUT", JSON.stringify(pnfUpdate), AAI_USERNAME, AAI_PASSWORD,
- "application/json", true);
+ "application/json");
executor.logger.info("Data received From " + urlPutPnf + " " + result);
/* If failure to retrieve data proceed to Failure */
@@ -215,8 +215,7 @@ try {
var linkResult;
var urlOldLogicalLink = HTTP_PROTOCOL + AAI_URL + "/aai/" + AAI_VERSION
+ "/network/logical-links/logical-link/" + oldLinkName;
- linkResult = client
- .httpRequest(urlOldLogicalLink, "GET", null, AAI_USERNAME, AAI_PASSWORD, "application/json", true);
+ linkResult = client.httpRequest(urlOldLogicalLink, "GET", null, AAI_USERNAME, AAI_PASSWORD, "application/json");
executor.logger.info("Data received From " + urlOldLogicalLink + " " + linkResult + " "
+ linkResult.hasOwnProperty("link-name"));
oldLinkResult = JSON.parse(linkResult.toString());
@@ -225,7 +224,7 @@ try {
var urlDelOldLogicalLink = urlOldLogicalLink + "?resource-version=" + res_version;
executor.logger.info("Delete called for " + urlDelOldLogicalLink);
result = client.httpRequest(urlDelOldLogicalLink, "DELETE", null, AAI_USERNAME, AAI_PASSWORD,
- "application/json", true);
+ "application/json");
executor.logger.info("Delete called for " + urlDelOldLogicalLink + " result " + result);
}
}
diff --git a/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceCreateTask.js b/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceCreateTask.js
index 7e116f0ea..a7809bf1b 100644
--- a/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceCreateTask.js
+++ b/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceCreateTask.js
@@ -78,7 +78,7 @@ try {
executor.logger.info("Query url" + urlGet);
- result = client.httpRequest(urlGet, "GET", null, AAI_USERNAME, AAI_PASSWORD, "application/json", true);
+ result = client.httpRequest(urlGet, "GET", null, AAI_USERNAME, AAI_PASSWORD, "application/json");
executor.logger.info("Data received From " + urlGet + " " + result);
jsonObj = JSON.parse(result);
@@ -110,7 +110,7 @@ try {
executor.logger.info("ready to putAfter Parse " + JSON.stringify(putUpddateServInstance, null, 4));
var urlPut = HTTP_PROTOCOL + AAI_URL + putUrl + "?resource_version=" + resource_version;
result = client.httpRequest(urlPut, "PUT", JSON.stringify(putUpddateServInstance), AAI_USERNAME, AAI_PASSWORD,
- "application/json", true);
+ "application/json");
executor.logger.info("Data received From " + urlPut + " " + result);
/* If failure to retrieve data proceed to Failure */
if (result != "") {
diff --git a/examples/examples-onap-bbs/src/main/resources/logic/SdncResourceUpdateTask.js b/examples/examples-onap-bbs/src/main/resources/logic/SdncResourceUpdateTask.js
index d588eaf48..02fc05839 100644
--- a/examples/examples-onap-bbs/src/main/resources/logic/SdncResourceUpdateTask.js
+++ b/examples/examples-onap-bbs/src/main/resources/logic/SdncResourceUpdateTask.js
@@ -1,7 +1,6 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Huawei. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -124,8 +123,7 @@ executor.logger.info(client.toPrettyString(xmlDeleteAccess, 4));
try {
var urlPost1 = HTTP_PROTOCOL + SDNC_URL + "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation";
- result = client.httpRequest(urlPost1, "POST", xmlDeleteAccess, SDNC_USERNAME, SDNC_PASSWORD, "application/xml",
- false);
+ result = client.httpRequest(urlPost1, "POST", xmlDeleteAccess, SDNC_USERNAME, SDNC_PASSWORD, "application/xml");
executor.logger.info("Data received From " + urlPost1 + " " + result);
if (result == "") {
sdncUpdateResult = false;
@@ -190,8 +188,7 @@ try {
if (sdncUpdateResult == true) {
var urlPost2 = HTTP_PROTOCOL + SDNC_URL
+ "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation";
- result = client.httpRequest(urlPost2, "POST", xmlCreateAccess, SDNC_USERNAME, SDNC_PASSWORD, "application/xml",
- false);
+ result = client.httpRequest(urlPost2, "POST", xmlCreateAccess, SDNC_USERNAME, SDNC_PASSWORD, "application/xml");
executor.logger.info("Data received From " + urlPost2 + " " + result);
if (result == "") {
sdncUpdateResult = false;
@@ -265,8 +262,8 @@ try {
if (sdncUpdateResult == true) {
var urlPost3 = HTTP_PROTOCOL + SDNC_URL
+ "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation";
- result = client.httpRequest(urlPost3, "POST", xmlChangeProfile, SDNC_USERNAME, SDNC_PASSWORD,
- "application/xml", false);
+ result = client
+ .httpRequest(urlPost3, "POST", xmlChangeProfile, SDNC_USERNAME, SDNC_PASSWORD, "application/xml");
executor.logger.info("Data received From " + urlPost3 + " " + result);
if (result == "") {
sdncUpdateResult = false;
@@ -344,4 +341,4 @@ function IsValidJSONString(str) {
}
return true;
}
-/* Utility functions End */
+/* Utility functions End */ \ No newline at end of file
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 90b1b0075..871e146a7 100644
--- a/examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js
+++ b/examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js
@@ -28,12 +28,10 @@ executor.logger.info("Begin Execution ServiceUpdateStateCpeAuthTask.js");
executor.logger.info(executor.subject.id);
executor.logger.info(executor.inFields);
-var clEventType = Java.type(
- "org.onap.policy.controlloop.VirtualControlLoopEvent");
+var clEventType = Java.type("org.onap.policy.controlloop.VirtualControlLoopEvent");
var clEvent = executor.inFields.get("VirtualControlLoopEvent");
-var serviceInstanceId = clEvent.getAai().get(
- "service-information.hsia-cfs-service-instance-id");
+var serviceInstanceId = clEvent.getAai().get("service-information.hsia-cfs-service-instance-id");
var requestID = clEvent.getRequestId();
var jsonObj;
@@ -53,8 +51,7 @@ var putUrl;
var service_instance;
var AAI_VERSION = "v14";
try {
- var br = Files.newBufferedReader(Paths.get(
- "/home/apexuser/examples/config/ONAPBBS/config.txt"));
+ var br = Files.newBufferedReader(Paths.get("/home/apexuser/examples/config/ONAPBBS/config.txt"));
var line;
while ((line = br.readLine()) != null) {
if (line.startsWith("AAI_URL")) {
@@ -66,11 +63,11 @@ try {
} else if (line.startsWith("AAI_PASSWORD")) {
var str = line.split("=");
AAI_PASSWORD = str[str.length - 1];
- }else if (line.startsWith("AAI_VERSION")) {
+ } else if (line.startsWith("AAI_VERSION")) {
var str = line.split("=");
AAI_VERSION = str[str.length - 1];
- }
- }
+ }
+ }
} catch (err) {
executor.logger.info("Failed to retrieve data " + err);
}
@@ -79,25 +76,21 @@ executor.logger.info("AAI_URL=>" + AAI_URL);
/* Get service instance Id from AAI */
try {
- var urlGet = HTTP_PROTOCOL + AAI_URL +
- "/aai/" + AAI_VERSION + "/nodes/service-instances/service-instance/" +
- SERVICE_INSTANCE_ID + "?format=resource_and_url"
+ var urlGet = HTTP_PROTOCOL + AAI_URL + "/aai/" + AAI_VERSION + "/nodes/service-instances/service-instance/"
+ + SERVICE_INSTANCE_ID + "?format=resource_and_url"
executor.logger.info("Query url" + urlGet);
- result = client.httpRequest(urlGet, "GET", null, AAI_USERNAME, AAI_PASSWORD,
- "application/json", true);
+ result = client.httpRequest(urlGet, "GET", null, AAI_USERNAME, AAI_PASSWORD, "application/json");
executor.logger.info("Data received From " + urlGet + " " + result);
jsonObj = JSON.parse(result);
-
/* Retrieve the service instance id */
results = jsonObj['results'][0];
putUrl = results["url"];
service_instance = results['service-instance'];
resource_version = service_instance['resource-version'];
- executor.logger.info("After Parse service_instance " + JSON.stringify(
- service_instance, null, 4) + "\n url " + putUrl +
- "\n Service instace Id " + SERVICE_INSTANCE_ID);
+ executor.logger.info("After Parse service_instance " + JSON.stringify(service_instance, null, 4) + "\n url "
+ + putUrl + "\n Service instace Id " + SERVICE_INSTANCE_ID);
if (result == "") {
aaiUpdateResult = false;
@@ -112,19 +105,15 @@ var putUpddateServInstance;
putUpddateServInstance = service_instance;
if (newState == 'inService') {
putUpddateServInstance['orchestration-status'] = "active";
-}
-else
-{
+} else {
putUpddateServInstance['orchestration-status'] = "inActive";
}
try {
if (aaiUpdateResult == true) {
- executor.logger.info("ready to put After Parse " + JSON.stringify(
- putUpddateServInstance, null, 4));
- var urlPut = HTTP_PROTOCOL + AAI_URL +
- putUrl + "?resource_version=" + resource_version;
+ executor.logger.info("ready to put After Parse " + JSON.stringify(putUpddateServInstance, null, 4));
+ var urlPut = HTTP_PROTOCOL + AAI_URL + putUrl + "?resource_version=" + resource_version;
result = client.httpRequest(urlPut, "PUT", JSON.stringify(putUpddateServInstance), AAI_USERNAME, AAI_PASSWORD,
- "application/json", true);
+ "application/json");
executor.logger.info("Data received From " + urlPut + " " + result);
/* If failure to retrieve data proceed to Failure */
if (result != "") {
@@ -145,4 +134,3 @@ if (aaiUpdateResult == true) {
executor.logger.info(executor.outFields);
var returnValue = executor.isTrue;
executor.logger.info("End Execution ServiceUpdateStateCpeAuthTask.js");
-