From 938108832179d5ca9b28e5cb981ce5602ca59344 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Tue, 10 Mar 2020 21:09:28 +0000 Subject: 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 --- .../resources/logic/standalone/ControllerResponseTask.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerResponseTask.js') 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; -- cgit 1.2.3-korg