aboutsummaryrefslogtreecommitdiffstats
path: root/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerResponseTask.js
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-03-10 21:09:28 +0000
committerliamfallon <liam.fallon@est.tech>2020-03-11 15:41:13 +0000
commit938108832179d5ca9b28e5cb981ce5602ca59344 (patch)
tree0bdb6b0c3d0b42b42ca8805451c190b707133bfe /examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerResponseTask.js
parent4eb64b73443620c8588ee48b54d225326ff4550e (diff)
Adapt vCPE example for Rhino Javascript
Minor changes to Javascript source for execution under the Rhino script engine. Issue-ID: POLICY-2106 Change-Id: Ib7e30ce0067a11ea1bb3ca8d197c796dba9ea091 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerResponseTask.js')
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerResponseTask.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerResponseTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerResponseTask.js
index 5a8703780..8cb3e4e41 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerResponseTask.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerResponseTask.js
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
+ * 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.
@@ -35,13 +36,13 @@ executor.logger.info("requestIDString =\"" + requestIDString + "\"");
var vnfID = executor.getContextAlbum("RequestIDVNFIDAlbum").get(requestIDString);
executor.logger.info("vnfID = " + vnfID);
-var returnValue = executor.isTrue;
+var returnValue = true
if (vnfID != null) {
var vcpeClosedLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum").get(vnfID.toString());
var requestId = java.util.UUID.fromString(vcpeClosedLoopStatus.get("requestID"));
- vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+ vcpeClosedLoopStatus.put("notificationTime", java.lang.Long.valueOf(Date.now()));
var returnedCode = controllerResponse.get("body").get("output").get("status").get("code");
var responseStatus = null;
@@ -66,11 +67,11 @@ if (vnfID != null) {
executor.logger.info("Got from APPC code: " + responseStatus);
- if (responseStatus === "SUCCESS") {
+ if (responseStatus == "SUCCESS") {
vcpeClosedLoopStatus.put("notification", "OPERATION_SUCCESS");
vcpeClosedLoopStatus.put("message", "vCPE restarted");
executor.getContextAlbum("RequestIDVNFIDAlbum").remove(requestIDString);
- } else if (responseStatus === "ACCEPTED" || responseStatus === "REJECT") {
+ } else if (responseStatus == "ACCEPTED" || responseStatus == "REJECT") {
executor.logger.info("Got ACCEPTED 100 or REJECT 312, keep the context, wait for next response. Code is: "
+ responseStatus);
} else {
@@ -84,7 +85,9 @@ if (vnfID != null) {
executor.outFields.put("vnfID", vnfID);
} else {
executor.message = "VNF ID not found in context album for request ID " + requestIDString;
- returnValue = executor.isFalse;
+ returnValue = false;
}
executor.logger.info(executor.outFields);
+
+returnValue;