summaryrefslogtreecommitdiffstats
path: root/examples/examples-onap-bbs/src
diff options
context:
space:
mode:
authors00370346 <swarup.nayak1@huawei.com>2019-05-03 11:40:28 +0530
committers00370346 <swarup.nayak1@huawei.com>2019-05-03 19:08:01 +0530
commit27bace73bcc915aac85b48d7857cce2b26a44644 (patch)
treef510a00ecdd462dd86c6dbbaea292c6064181e17 /examples/examples-onap-bbs/src
parent62bc4a162b169971349bce415f97ace15c15eeef (diff)
ONAP BBS Policy: CPE-Authentication event throwing error
Issue-ID: POLICY-1734 Change-Id: I8d209afb67e9b46a7db516fce76977e679d7ab7b Signed-off-by: s00370346 <swarup.nayak1@huawei.com>
Diffstat (limited to 'examples/examples-onap-bbs/src')
-rw-r--r--examples/examples-onap-bbs/src/main/resources/examples/config/ONAPBBS/sdnc_ChangeInternetProfileInstance.txt4
-rw-r--r--examples/examples-onap-bbs/src/main/resources/examples/config/ONAPBBS/sdnc_CreateAccessConnectivityInstance.txt4
-rw-r--r--examples/examples-onap-bbs/src/main/resources/logic/SdncResourceUpdateTask.js4
-rw-r--r--examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js78
4 files changed, 23 insertions, 67 deletions
diff --git a/examples/examples-onap-bbs/src/main/resources/examples/config/ONAPBBS/sdnc_ChangeInternetProfileInstance.txt b/examples/examples-onap-bbs/src/main/resources/examples/config/ONAPBBS/sdnc_ChangeInternetProfileInstance.txt
index 193e3bb2d..9e71a5309 100644
--- a/examples/examples-onap-bbs/src/main/resources/examples/config/ONAPBBS/sdnc_ChangeInternetProfileInstance.txt
+++ b/examples/examples-onap-bbs/src/main/resources/examples/config/ONAPBBS/sdnc_ChangeInternetProfileInstance.txt
@@ -44,8 +44,8 @@
<value>service_id_value</value>
</param>
<param>
- <name>access_id</name>
- <value>access_id_value</value>
+ <name>remote_id</name>
+ <value>remote_id_value</value>
</param>
<param>
<name>ont_sn</name>
diff --git a/examples/examples-onap-bbs/src/main/resources/examples/config/ONAPBBS/sdnc_CreateAccessConnectivityInstance.txt b/examples/examples-onap-bbs/src/main/resources/examples/config/ONAPBBS/sdnc_CreateAccessConnectivityInstance.txt
index 9168ff17d..b747c45ea 100644
--- a/examples/examples-onap-bbs/src/main/resources/examples/config/ONAPBBS/sdnc_CreateAccessConnectivityInstance.txt
+++ b/examples/examples-onap-bbs/src/main/resources/examples/config/ONAPBBS/sdnc_CreateAccessConnectivityInstance.txt
@@ -52,8 +52,8 @@
<value>s_vlan_value</value>
</param>
<param>
- <name>accessID</name>
- <value>access_id_value</value>
+ <name>remoteID</name>
+ <value>remote_id_value</value>
</param>
</network-input-parameters>
</network-request-input>
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 60d4efed9..85977097f 100644
--- a/examples/examples-onap-bbs/src/main/resources/logic/SdncResourceUpdateTask.js
+++ b/examples/examples-onap-bbs/src/main/resources/logic/SdncResourceUpdateTask.js
@@ -218,7 +218,7 @@ xmlCreateAccess = xmlCreateAccess.replace("s_vlan_value", getMetaValue(
putUpddateServInstance['metadata']['metadatum'], 'svlan'));
xmlCreateAccess = xmlCreateAccess.replace("c_vlan_value", getMetaValue(
putUpddateServInstance['metadata']['metadatum'], 'cvlan'));
-xmlCreateAccess = xmlCreateAccess.replace("access_id_value", getMetaValue(
+xmlCreateAccess = xmlCreateAccess.replace("remote_id_value", getMetaValue(
putUpddateServInstance['metadata']['metadatum'], 'remote-id'));
executor.logger.info(client.toPrettyString(xmlCreateAccess, 4));
@@ -299,7 +299,7 @@ xmlChangeProfile = xmlChangeProfile.replace("vendor_value", input_param[
xmlChangeProfile = xmlChangeProfile.replace("service_id_value", getMetaValue(
putUpddateServInstance['metadata']['metadatum'],
'controller-service-id'));
-xmlChangeProfile = xmlChangeProfile.replace("access_id_value", getMetaValue(
+xmlChangeProfile = xmlChangeProfile.replace("remote_id_value", getMetaValue(
putUpddateServInstance['metadata']['metadatum'], 'remote-id'));
xmlChangeProfile = xmlChangeProfile.replace("ont_sn_value", input_param[
'service']['parameters']['requestInputs']['ont_ont_serial_num']);
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 86e4dfe1c..839956cc9 100644
--- a/examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js
+++ b/examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js
@@ -39,7 +39,8 @@ var jsonObj;
var aaiUpdateResult = true;
var wbClient = Java.type("org.onap.policy.apex.examples.bbs.WebClient");
var client = new wbClient();
-
+var oldState = clEvent.getAai().get("cpe.old-authentication-state");
+var newState = clEvent.getAai().get("cpe.new-authentication-state");
/* Get AAI URL from Configuration file. */
var AAI_URL = "localhost:8080";
var CUSTOMER_ID = requestID;
@@ -78,17 +79,20 @@ try {
SERVICE_INSTANCE_ID + "?format=resource_and_url"
executor.logger.info("Query url" + urlGet);
- result = httpGet(urlGet).data;
+ result = client.httpsRequest(urlGet, "GET", null, AAI_USERNAME, AAI_PASSWORD,
+ "application/json", true, true);
executor.logger.info("Data received From " + urlGet + " " + result);
jsonObj = JSON.parse(result);
/* Retrieve the service instance id */
- results = jsonObj['results'];
+ results = jsonObj['results'][0];
putUrl = results["url"];
- service_instance = results["service-instance"];
+ service_instance = results['service-instance'];
resource_version = service_instance['resource-version'];
- executor.logger.info("After Parse " + JSON.stringify(jsonObj, null, 4));
+ 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;
@@ -101,10 +105,16 @@ try {
/* BBS Policy updates orchestration status of {{bbs-cfs-service-instance-UUID}} [ active --> assigned ] */
var putUpddateServInstance;
putUpddateServInstance = service_instance;
-putUpddateServInstance["orchestration-status"] = "active";
+if (newState == 'inService') {
+ putUpddateServInstance['orchestration-status'] = "active";
+}
+else
+{
+ putUpddateServInstance['orchestration-status'] = "inActive";
+}
try {
if (aaiUpdateResult == true) {
- executor.logger.info("ready to putAfter Parse " + JSON.stringify(
+ executor.logger.info("ready to put After Parse " + JSON.stringify(
putUpddateServInstance, null, 4));
var urlPut = HTTP_PROTOCOL + AAI_URL +
putUrl + "?resource_version=" + resource_version;
@@ -131,57 +141,3 @@ executor.logger.info(executor.outFields);
var returnValue = executor.isTrue;
executor.logger.info("End Execution ServiceUpdateStateCpeAuthTask.js");
-
-function httpGet(theUrl) {
- var con = new java.net.URL(theUrl).openConnection();
- con.requestMethod = "GET";
- return asResponse(con);
-}
-
-function httpPost(theUrl, data, contentType) {
- contentType = contentType || "application/json";
- var con = new java.net.URL(theUrl).openConnection();
- con.requestMethod = "POST";
- con.setRequestProperty("Content-Type", contentType);
- con.doOutput = true;
- write(con.outputStream, data);
- return asResponse(con);
-}
-
-function httpPut(theUrl, data, contentType) {
- contentType = contentType || "application/json";
- var con = new java.net.URL(theUrl).openConnection();
- con.requestMethod = "PUT";
- con.setRequestProperty("Content-Type", contentType);
- con.doOutput = true;
- write(con.outputStream, data);
- return asResponse(con);
-}
-
-function asResponse(con) {
- var d = read(con.inputStream);
- return {
- data: d,
- statusCode: con.resultCode
- };
-}
-
-function write(outputStream, data) {
- var wr = new java.io.DataOutputStream(outputStream);
- wr.writeBytes(data);
- wr.flush();
- wr.close();
-}
-
-function read(inputStream) {
- var inReader = new java.io.BufferedReader(new java.io.InputStreamReader(
- inputStream));
- var inputLine;
- var result = new java.lang.StringBuffer();
-
- while ((inputLine = inReader.readLine()) != null) {
- result.append(inputLine);
- }
- inReader.close();
- return result.toString();
-} \ No newline at end of file