aboutsummaryrefslogtreecommitdiffstats
path: root/examples/examples-onap-bbs/src/main/resources
diff options
context:
space:
mode:
authorRam Krishna Verma <ram_krishna.verma@bell.ca>2020-03-11 20:52:09 +0000
committerGerrit Code Review <gerrit@onap.org>2020-03-11 20:52:09 +0000
commit4e6bd1d02227591d1517245f5bda690ec4eb770e (patch)
tree2903208d905a385ed38e12d700881f00867b7e4b /examples/examples-onap-bbs/src/main/resources
parentee817eb18923cb1c0423f9f7d9ea93681dafd302 (diff)
parentb87ab1696010ca0bbed5db99c140cf908722df57 (diff)
Merge "Convert examples to Rhino Javascript format"
Diffstat (limited to 'examples/examples-onap-bbs/src/main/resources')
-rw-r--r--examples/examples-onap-bbs/src/main/resources/logic/AAIServiceAssignedTask.js15
-rw-r--r--examples/examples-onap-bbs/src/main/resources/logic/AAIServiceCreateTask.js16
-rw-r--r--examples/examples-onap-bbs/src/main/resources/logic/ErrorAAIServiceAssignedLogTask.js4
-rw-r--r--examples/examples-onap-bbs/src/main/resources/logic/ErrorSdncResourceUpdateTaskLogTask.js4
-rw-r--r--examples/examples-onap-bbs/src/main/resources/logic/GetBBSCloseLoopEventTask.js11
-rw-r--r--examples/examples-onap-bbs/src/main/resources/logic/NomadicEventSuccessTask.js14
-rw-r--r--examples/examples-onap-bbs/src/main/resources/logic/RUorInitStateSelect.js8
-rw-r--r--examples/examples-onap-bbs/src/main/resources/logic/SU2orInitStateSelect.js8
-rw-r--r--examples/examples-onap-bbs/src/main/resources/logic/SdncResourceUpdateTask.js18
-rw-r--r--examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js14
10 files changed, 51 insertions, 61 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 a4be3707f..9ad41b59e 100644
--- a/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceAssignedTask.js
+++ b/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceAssignedTask.js
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Huawei. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,12 +18,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-load("nashorn:mozilla_compat.js");
-importClass(org.apache.avro.Schema);
-importClass(java.io.BufferedReader);
-importClass(java.io.IOException);
-importClass(java.nio.file.Files);
-importClass(java.nio.file.Paths);
executor.logger.info("Begin Execution AAIServiceAssignedTask.js");
executor.logger.info(executor.subject.id);
@@ -39,7 +33,7 @@ executor.logger.info(NomadicONTContext);
var jsonObj;
var aaiUpdateResult = true;
-var wbClient = Java.type("org.onap.policy.apex.examples.bbs.WebClient");
+var wbClient = org.onap.policy.apex.examples.bbs.WebClient;
var client = new wbClient();
/* Get AAI URL from Configuration file. */
@@ -234,7 +228,7 @@ try {
}
/* If Success then Fill output schema */
-if (aaiUpdateResult === true) {
+if (aaiUpdateResult == true) {
executor.outFields.put("result", "SUCCESS");
NomadicONTContext.put("result", "SUCCESS");
NomadicONTContext.put("aai_message", JSON.stringify(service_instance));
@@ -248,10 +242,11 @@ executor.outFields.put("requestID", requestID);
executor.outFields.put("attachmentPoint", attachmentPoint);
executor.outFields.put("serviceInstanceId", executor.inFields.get("serviceInstanceId"));
-var returnValue = executor.isTrue;
executor.logger.info(executor.outFields);
executor.logger.info("End Execution AAIServiceAssignedTask.js");
+true;
+
/* Utility functions Begin */
function IsValidJSONString(str) {
try {
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 a7809bf1b..4205342e1 100644
--- a/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceCreateTask.js
+++ b/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceCreateTask.js
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Huawei. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,12 +18,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-load("nashorn:mozilla_compat.js");
-importClass(org.apache.avro.Schema);
-importClass(java.io.BufferedReader);
-importClass(java.io.IOException);
-importClass(java.nio.file.Files);
-importClass(java.nio.file.Paths);
executor.logger.info("Begin Execution AAIServiceCreateTask.js");
executor.logger.info(executor.subject.id);
@@ -43,7 +37,7 @@ var BBS_CFS_SERVICE_TYPE = "BBS-CFS-Access_Test";
var SERVICE_INSTANCE_ID = serviceInstanceId;
var AAI_VERSION = "v14";
var HTTP_PROTOCOL = "https://";
-var wbClient = Java.type("org.onap.policy.apex.examples.bbs.WebClient");
+var wbClient = org.onap.policy.apex.examples.bbs.WebClient;
var client = new wbClient();
var AAI_USERNAME = null;
var AAI_PASSWORD = null;
@@ -122,7 +116,7 @@ try {
aaiUpdateResult = false;
}
/* If Success then Fill output schema */
-if (aaiUpdateResult === true) {
+if (aaiUpdateResult == true) {
NomadicONTContext.put("result", "SUCCESS");
} else {
NomadicONTContext.put("result", "FAILURE");
@@ -133,6 +127,8 @@ executor.outFields.put("requestID", requestID);
executor.outFields.put("attachmentPoint", attachmentPoint);
executor.outFields.put("serviceInstanceId", executor.inFields.get("serviceInstanceId"));
-var returnValue = executor.isTrue;
executor.logger.info(executor.outFields);
executor.logger.info("End Execution AAIServiceCreateTask.js");
+
+true;
+
diff --git a/examples/examples-onap-bbs/src/main/resources/logic/ErrorAAIServiceAssignedLogTask.js b/examples/examples-onap-bbs/src/main/resources/logic/ErrorAAIServiceAssignedLogTask.js
index 91316bc40..a9d7f31a4 100644
--- a/examples/examples-onap-bbs/src/main/resources/logic/ErrorAAIServiceAssignedLogTask.js
+++ b/examples/examples-onap-bbs/src/main/resources/logic/ErrorAAIServiceAssignedLogTask.js
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Huawei. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,5 +24,6 @@ executor.logger.info(executor.inFields);
executor.logger.info(executor.outFields);
-var returnValue = executor.isTrue;
executor.logger.info("Begin Execution ErrorServiceUpdateOneLogTask.js");
+
+true;
diff --git a/examples/examples-onap-bbs/src/main/resources/logic/ErrorSdncResourceUpdateTaskLogTask.js b/examples/examples-onap-bbs/src/main/resources/logic/ErrorSdncResourceUpdateTaskLogTask.js
index 946d956b1..3fbb0dfbe 100644
--- a/examples/examples-onap-bbs/src/main/resources/logic/ErrorSdncResourceUpdateTaskLogTask.js
+++ b/examples/examples-onap-bbs/src/main/resources/logic/ErrorSdncResourceUpdateTaskLogTask.js
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Huawei. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,5 +22,6 @@ executor.logger.info("Begin Execution ErrorResourceUpdateLogTask.js");
executor.logger.info(executor.subject.id);
executor.logger.info(executor.inFields);
-var returnValue = executor.isTrue;
executor.logger.info("End Execution ErrorResourceUpdateLogTask.js");
+
+true;
diff --git a/examples/examples-onap-bbs/src/main/resources/logic/GetBBSCloseLoopEventTask.js b/examples/examples-onap-bbs/src/main/resources/logic/GetBBSCloseLoopEventTask.js
index 57fe182e1..da0a955b1 100644
--- a/examples/examples-onap-bbs/src/main/resources/logic/GetBBSCloseLoopEventTask.js
+++ b/examples/examples-onap-bbs/src/main/resources/logic/GetBBSCloseLoopEventTask.js
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Huawei. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,15 +18,13 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-load("nashorn:mozilla_compat.js");
executor.logger.info("Begin Execution GetBBSCloseLoopEventTask.js");
executor.logger.info(executor.subject.id);
executor.logger.info(executor.inFields);
-var returnValue = executor.isTrue;
+var returnValue = true;
-var clEventType = Java.type(
- "org.onap.policy.controlloop.VirtualControlLoopEvent");
+var clEventType = org.onap.policy.controlloop.VirtualControlLoopEvent;
var clEvent = executor.inFields.get("VirtualControlLoopEvent");
executor.logger.info(clEvent.toString());
executor.logger.info(clEvent.getClosedLoopControlName());
@@ -107,6 +106,8 @@ if (clEvent.getAai().get("attachmentPoint") != null) {
else
{
executor.message = "Received NULL attachment-point";
- returnValue = executor.isFalse;
+ returnValue = false;
}
+returnValue;
+
diff --git a/examples/examples-onap-bbs/src/main/resources/logic/NomadicEventSuccessTask.js b/examples/examples-onap-bbs/src/main/resources/logic/NomadicEventSuccessTask.js
index 36b21b8f4..17234101e 100644
--- a/examples/examples-onap-bbs/src/main/resources/logic/NomadicEventSuccessTask.js
+++ b/examples/examples-onap-bbs/src/main/resources/logic/NomadicEventSuccessTask.js
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Huawei. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,8 +18,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-load("nashorn:mozilla_compat.js");
-importClass(org.apache.avro.Schema);
executor.logger.info("Begin Execution NomadicEventSuccess.js");
executor.logger.info(executor.subject.id);
@@ -32,16 +31,17 @@ executor.logger.info(executor.outFields);
executor.logger.info(executor.inFields);
result = NomadicONTContext.get("result");
+var returnValue = true;
-if (result === "SUCCESS") {
- returnValue = executor.isTrue;
+if (result == "SUCCESS") {
executor.outFields.put("result", "SUCCCESS");
executor.logger.info("BBS policy Execution Done");
} else {
executor.logger.info("BBS policy Execution Failed");
executor.outFields.put("result", "FAILURE");
- returnValue = executor.isFalse;
+ returnValue = false;
}
-var returnValue = executor.isTrue;
-executor.logger.info("End Execution NomadicEventSuccess.js"); \ No newline at end of file
+executor.logger.info("End Execution NomadicEventSuccess.js");
+
+returnValue;
diff --git a/examples/examples-onap-bbs/src/main/resources/logic/RUorInitStateSelect.js b/examples/examples-onap-bbs/src/main/resources/logic/RUorInitStateSelect.js
index 810903a28..04a36cd28 100644
--- a/examples/examples-onap-bbs/src/main/resources/logic/RUorInitStateSelect.js
+++ b/examples/examples-onap-bbs/src/main/resources/logic/RUorInitStateSelect.js
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Huawei. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +22,6 @@ executor.logger.info("Begin Execution RUorInitStateSelect.js");
executor.logger.info(executor.subject.id);
executor.logger.info(executor.inFields);
-var returnValue = executor.isTrue;
var result = null;
var attachmentPoint = executor.inFields.get("attachmentPoint");
@@ -30,7 +30,7 @@ var NomadicONTContext = executor.getContextAlbum("NomadicONTContextAlbum").get(
result = NomadicONTContext.get("result");
-if (result === "SUCCESS") {
+if (result == "SUCCESS") {
executor.subject.getTaskKey("SdncResourceUpdateTask").copyTo(executor.selectedTask);
} else {
executor.subject.getTaskKey("ErrorAAIServiceAssignedLogTask").copyTo(
@@ -39,4 +39,6 @@ if (result === "SUCCESS") {
}
executor.logger.info("State Selected Task:" + executor.selectedTask);
-executor.logger.info("End Execution RUorInitStateSelect.js"); \ No newline at end of file
+executor.logger.info("End Execution RUorInitStateSelect.js");
+
+true;
diff --git a/examples/examples-onap-bbs/src/main/resources/logic/SU2orInitStateSelect.js b/examples/examples-onap-bbs/src/main/resources/logic/SU2orInitStateSelect.js
index 3abd75071..eafbe923c 100644
--- a/examples/examples-onap-bbs/src/main/resources/logic/SU2orInitStateSelect.js
+++ b/examples/examples-onap-bbs/src/main/resources/logic/SU2orInitStateSelect.js
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Huawei. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +22,6 @@ executor.logger.info("Begin Execution SU2orInitStateSelect.js");
executor.logger.info(executor.subject.id);
executor.logger.info(executor.inFields);
-var returnValue = executor.isTrue;
var result = null;
var attachmentPoint = executor.inFields.get("attachmentPoint");
@@ -32,7 +32,7 @@ executor.logger.info(executor.inFields);
result = NomadicONTContext.get("result");
-if (result === "SUCCESS") {
+if (result == "SUCCESS") {
executor.subject.getTaskKey("AAIServiceCreateTask").copyTo(executor.selectedTask);
} else {
executor.subject.getTaskKey("SdncResourceUpdateErrorLogOutput").copyTo(
@@ -41,4 +41,6 @@ if (result === "SUCCESS") {
}
executor.logger.info("State Selected Task:" + executor.selectedTask);
-executor.logger.info("End Execution SU2orInitStateSelect.js"); \ No newline at end of file
+executor.logger.info("End Execution SU2orInitStateSelect.js");
+
+true;
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 02fc05839..d3575a7bb 100644
--- a/examples/examples-onap-bbs/src/main/resources/logic/SdncResourceUpdateTask.js
+++ b/examples/examples-onap-bbs/src/main/resources/logic/SdncResourceUpdateTask.js
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Huawei. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,14 +18,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-load("nashorn:mozilla_compat.js");
-importClass(org.apache.avro.Schema);
-importClass(java.io.BufferedReader);
-importClass(java.io.IOException);
-importClass(java.nio.file.Files);
-importClass(java.nio.file.Paths);
-
-importPackage(org.json.XML);
executor.logger.info("Begin Execution SdncResourceUpdateTask.js");
executor.logger.info(executor.subject.id);
@@ -33,9 +26,9 @@ executor.logger.info(executor.inFields);
var attachmentPoint = executor.inFields.get("attachmentPoint");
var requestID = executor.inFields.get("requestID");
var serviceInstanceId = executor.inFields.get("serviceInstanceId");
-var uuidType = Java.type("java.util.UUID");
+var uuidType = java.util.UUID;
-var wbClient = Java.type("org.onap.policy.apex.examples.bbs.WebClient");
+var wbClient = org.onap.policy.apex.examples.bbs.WebClient;
var client = new wbClient();
var NomadicONTContext = executor.getContextAlbum("NomadicONTContextAlbum").get(attachmentPoint);
@@ -276,7 +269,7 @@ try {
/* If Success then Fill output schema */
-if (sdncUpdateResult === true) {
+if (sdncUpdateResult == true) {
NomadicONTContext.put("result", "SUCCESS");
executor.outFields.put("result", "SUCCESS");
} else {
@@ -288,10 +281,11 @@ executor.outFields.put("requestID", requestID);
executor.outFields.put("attachmentPoint", attachmentPoint);
executor.outFields.put("serviceInstanceId", executor.inFields.get("serviceInstanceId"));
-var returnValue = executor.isTrue;
executor.logger.info(executor.outFields);
executor.logger.info("End Execution SdncResourceUpdateTask.js");
+true;
+
function getMetaValue(metaJson, metaname) {
for (var i = 0; i < metaJson.length; i++) {
if (metaJson[i]['metaname'] == metaname) {
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 871e146a7..73e45fd7f 100644
--- a/examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js
+++ b/examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Huawei. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,17 +18,12 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-load("nashorn:mozilla_compat.js");
-importClass(java.io.BufferedReader);
-importClass(java.io.IOException);
-importClass(java.nio.file.Files);
-importClass(java.nio.file.Paths);
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 = org.onap.policy.controlloop.VirtualControlLoopEvent;
var clEvent = executor.inFields.get("VirtualControlLoopEvent");
var serviceInstanceId = clEvent.getAai().get("service-information.hsia-cfs-service-instance-id");
@@ -36,7 +31,7 @@ var requestID = clEvent.getRequestId();
var jsonObj;
var aaiUpdateResult = true;
-var wbClient = Java.type("org.onap.policy.apex.examples.bbs.WebClient");
+var wbClient = 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");
@@ -132,5 +127,6 @@ if (aaiUpdateResult == true) {
}
executor.logger.info(executor.outFields);
-var returnValue = executor.isTrue;
executor.logger.info("End Execution ServiceUpdateStateCpeAuthTask.js");
+
+true;