Adapt vCPE example for Rhino Javascript 79/103479/3
authorliamfallon <liam.fallon@est.tech>
Tue, 10 Mar 2020 21:09:28 +0000 (21:09 +0000)
committerliamfallon <liam.fallon@est.tech>
Wed, 11 Mar 2020 15:41:13 +0000 (15:41 +0000)
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>
26 files changed:
examples/examples-onap-vcpe/src/main/resources/logic/definitive/AAILookupTask.js
examples/examples-onap-vcpe/src/main/resources/logic/definitive/APPCRestartVNFRequestTask.js
examples/examples-onap-vcpe/src/main/resources/logic/definitive/APPCRestartVNFResponseTask.js
examples/examples-onap-vcpe/src/main/resources/logic/definitive/AbatedTask.js
examples/examples-onap-vcpe/src/main/resources/logic/definitive/ControlLoopLogTask.js
examples/examples-onap-vcpe/src/main/resources/logic/definitive/DeniedTask.js
examples/examples-onap-vcpe/src/main/resources/logic/definitive/GetVCPEStateTask.js
examples/examples-onap-vcpe/src/main/resources/logic/definitive/GuardRequestTask.js
examples/examples-onap-vcpe/src/main/resources/logic/definitive/GuardResponseTask.js
examples/examples-onap-vcpe/src/main/resources/logic/definitive/NoAAILookupTask.js
examples/examples-onap-vcpe/src/main/resources/logic/definitive/OnsetOrAbatedStateTSL.js
examples/examples-onap-vcpe/src/main/resources/logic/definitive/RestartAPPCRequestPolicyPermitOrDenyTSL.js
examples/examples-onap-vcpe/src/main/resources/logic/standalone/CheckServiceIdTask.js
examples/examples-onap-vcpe/src/main/resources/logic/standalone/CheckVNFIdTask.js
examples/examples-onap-vcpe/src/main/resources/logic/standalone/CheckVServerIdTask.js
examples/examples-onap-vcpe/src/main/resources/logic/standalone/ConfigureBlackWhiteListTask.js
examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControlLoopLogTask.js
examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerRequestTask.js
examples/examples-onap-vcpe/src/main/resources/logic/standalone/ControllerResponseTask.js
examples/examples-onap-vcpe/src/main/resources/logic/standalone/DoControllerRequestActionTask.js
examples/examples-onap-vcpe/src/main/resources/logic/standalone/DoLogActionTask.js
examples/examples-onap-vcpe/src/main/resources/logic/standalone/ExecuteActionsPolicyActionStateTSL.js
examples/examples-onap-vcpe/src/main/resources/logic/standalone/GetEntityStateTask.js
examples/examples-onap-vcpe/src/main/resources/logic/standalone/InitiateActionsTask.js
examples/examples-onap-vcpe/src/main/resources/logic/standalone/ReceiveEventPolicyExecuteOrLogStateTSL.js
examples/examples-onap-vcpe/src/main/resources/logic/standalone/StopAndLogTask.js

index fcb3905..7d01782 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. 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.
@@ -28,17 +29,18 @@ executor.logger.info("Executing A&AI Lookup");
 executor.logger.info(vcpeClosedLoopStatus);
 
 var aaiInfo = vcpeClosedLoopStatus.get("AAI");
+var returnValue = true;
 
 if (aaiInfo.get("vserverName") == null) {
     executor.message = "the field vserver.vserver-name must exist in the onset control loop event";
     executor.logger.warn(executor.message);
-    var returnValue = executor.isFalse;
+    returnValue = false;
 }
 else if (aaiInfo.get("genericVnfVnfId") == null && aaiInfo.get("genericVnfVnfName") == null) {
     executor.message = "either the field generic-vnf.vnf-id or generic-vnf.vnf-name must exist"
         + " in the onset control loop event";
     executor.logger.warn(executor.message);
-    var returnValue = executor.isFalse;
+    returnValue = false;
 }
 else {
     var restManager = new org.onap.policy.rest.RestManager;
@@ -46,7 +48,7 @@ else {
 
     // We need to instantiate the type in order to trigger the static JAXB handling
     // in the AaiCqResponse class
-    var aaiCqResponseType = Java.type("org.onap.policy.aai.AaiCqResponse");
+    var aaiCqResponseType = org.onap.policy.aai.AaiCqResponse;
 
     var aaiResponse = aaiManager.getCustomQueryResponse(
             "http://localhost:54321/OnapVCpeSim/sim",
@@ -80,6 +82,6 @@ else {
     executor.outFields.put("vnfID", executor.inFields.get("vnfID"));
 
     executor.logger.info(executor.outFields);
-
-    var returnValue = executor.isTrue;
 }
+
+returnValue;
index dd69dcb..9ee928f 100644 (file)
@@ -1,19 +1,20 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. 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.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -64,4 +65,4 @@ executor.outFields.put("APPCLCMRequestEvent", appcRequest);
 
 executor.logger.info(executor.outFields);
 
-var returnValue = executor.isTrue;
+true;
index 75ab6a3..ac22abb 100644 (file)
@@ -1,26 +1,27 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. 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.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * APPC LCM Response code: 100 ACCEPTED
  *                         200 ERROR UNEXPECTED ERROR means failure
  *                         312 REJECTED DUPLICATE REQUEST
- *                         400 SUCCESS 
+ *                         400 SUCCESS
  *
  * Note: Sometimes the corelationId has a -1 at the tail, need to get rid of it when present.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -38,7 +39,7 @@ executor.logger.info("Size of RequestIDVNFIDAlbum = "
         + executor.getContextAlbum("RequestIDVNFIDAlbum").size());
 executor.logger.info("vnfID = " + vnfID);
 
-var returnValue = executor.isTrue;
+var returnValue = true;
 
 if (vnfID != null) {
     var vcpeClosedLoopStatus = executor.getContextAlbum(
@@ -82,7 +83,9 @@ if (vnfID != null) {
 } 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;
index f37b6f1..e19b8b1 100644 (file)
@@ -1,19 +1,20 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. 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.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -21,7 +22,7 @@
 executor.logger.info(executor.subject.id);
 executor.logger.info(executor.inFields);
 
-var vcpeClosedLoopStatus = null; 
+var vcpeClosedLoopStatus = null;
 if( executor.inFields.get("vnfID") == null) {
    executor.logger.info("AbatedTask: vnfID is null");
    var vnfName = executor.inFields.get("vnfName");
@@ -38,4 +39,4 @@ vcpeClosedLoopStatus.put("message",          "situation has been abated");
 
 executor.logger.info(executor.outFields);
 
-var returnValue = executor.isTrue;
+true;
index a5a692c..3e2771a 100644 (file)
@@ -63,6 +63,7 @@ clNotification.getAai().put("generic-vnf.orchestration-status",    aaiInfo.get("
 clNotification.getAai().put("generic-vnf.vnf-type",                aaiInfo.get("genericVnfVnfType"));
 clNotification.getAai().put("generic-vnf.in-maint",                aaiInfo.get("genericVnfInMaint"));
 clNotification.getAai().put("generic-vnf.service-id",              aaiInfo.get("genericVnfServiceId"));
+
 if(vnfID != null) {
    clNotification.getAai().put("generic-vnf.vnf-id",                  aaiInfo.get("genericVnfVnfId"));
 }
@@ -70,4 +71,4 @@ executor.outFields.put("VirtualControlLoopNotification", clNotification);
 
 executor.logger.info(executor.outFields);
 
-var returnValue = executor.isTrue;
+true;
index 353c21e..73b989f 100644 (file)
@@ -1,19 +1,20 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. 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.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -29,4 +30,4 @@ vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis(
 
 executor.logger.info(executor.outFields);
 
-var returnValue = executor.isTrue;
+true;
index f4f6d90..9882a43 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. 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.
@@ -25,9 +26,9 @@
 executor.logger.info(executor.subject.id);
 executor.logger.info(executor.inFields);
 
-var clEventType = Java.type("org.onap.policy.controlloop.VirtualControlLoopEvent");
-var longType = Java.type("java.lang.Long");
-var uuidType = Java.type("java.util.UUID");
+var clEventType = org.onap.policy.controlloop.VirtualControlLoopEvent;
+var longType = java.lang.Long;
+var uuidType = java.util.UUID;
 
 var clEvent = executor.inFields.get("VirtualControlLoopEvent");
 
@@ -146,4 +147,4 @@ else {
     executor.logger.info(executor.outFields);
 }
 
-returnValue = executor.isTrue;
+true;
index d247f8a..66c6213 100644 (file)
@@ -1,19 +1,20 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. 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.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -41,4 +42,4 @@ executor.getContextAlbum("ControlLoopExecutionIDAlbum").put(executor.executionId
 
 executor.logger.info(executor.outFields);
 
-var returnValue = executor.isTrue;
+true;
index 2a9100b..55fee56 100644 (file)
@@ -1,19 +1,20 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. 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.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -29,17 +30,18 @@ var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum")
 executor.logger.info(vcpeClosedLoopStatus);
 
 var guardResult = executor.inFields.get("decision");
+var returnValue = true;
 
-if (guardResult === "PERMIT") {
+if (guardResult == "PERMIT") {
     vcpeClosedLoopStatus.put("notification", "OPERATION: GUARD_PERMIT");
-} else if (guardResult === "DENY") {
+} else if (guardResult == "DENY") {
     vcpeClosedLoopStatus.put("notification", "OPERATION: GUARD_DENY");
 } else {
     executor.message = "guard result must be either \"PERMIT\" or \"DENY\"";
-    returnValue = executor.FALSE;
+    returnValue = false;
 }
 
-var uuidType = Java.type("java.util.UUID");
+var uuidType = java.util.UUID;
 var requestID = uuidType.fromString(vcpeClosedLoopStatus.get("requestID"));
 
 executor.outFields.put("requestID", requestID);
@@ -47,4 +49,5 @@ executor.outFields.put("vnfID", vnfID);
 
 executor.logger.info(executor.outFields);
 
-var returnValue = executor.isTrue;
+
+returnValue;
index ebc0e63..7b3d5c4 100644 (file)
@@ -1,19 +1,20 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. 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.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -23,4 +24,4 @@ executor.logger.info(executor.inFields);
 
 executor.logger.info(executor.outFields);
 
-var returnValue = executor.isTrue;
+true;
index c8a3bfb..4f6c321 100644 (file)
@@ -1,19 +1,20 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. 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.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -21,7 +22,7 @@
 executor.logger.info(executor.subject.id);
 executor.logger.info(executor.inFields);
 
-var returnValue = executor.isTrue;
+var returnValue = true;
 var status = null;
 
 if( executor.inFields.get("vnfID") == null) {
@@ -36,16 +37,16 @@ if( executor.inFields.get("vnfID") == null) {
    status = vcpeClosedLoopStatus.get("closedLoopEventStatus").toString();
 }
 
-var returnValue = executor.isTrue;
-
-if (status === "ONSET") {
+if (status == "ONSET") {
     executor.subject.getTaskKey("GuardRequestTask").copyTo(executor.selectedTask);
-} else if (status === "ABATED") {
+} else if (status == "ABATED") {
     executor.subject.getTaskKey("AbatedTask").copyTo(executor.selectedTask);
     onsetFlag = executor.isFalse;
 } else {
     executor.message = "closedLoopEventStatus is \"" + status + "\", it must be either \"ONSET\" or \"ABATED\"";
-    returnValue = executor.isFalse;
+    returnValue = false;
 }
 
 executor.logger.info("ReceiveEventPolicyOnsetOrAbatedStateTSL State Selected Task:" + executor.selectedTask);
+
+returnValue;
index a1bac65..7ab346f 100644 (file)
@@ -1,19 +1,20 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. 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.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -26,7 +27,7 @@ var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum")
 
 var guardResult = vcpeClosedLoopStatus.get("notification");
 
-if (guardResult === "OPERATION: GUARD_PERMIT") {
+if (guardResult == "OPERATION: GUARD_PERMIT") {
     executor.subject.getTaskKey("APPCRestartVNFRequestTask").copyTo(executor.selectedTask);
 } else {
     executor.subject.getTaskKey("DeniedTask").copyTo(executor.selectedTask);
@@ -34,4 +35,4 @@ if (guardResult === "OPERATION: GUARD_PERMIT") {
 
 executor.logger.info("RestartAPPCRequestPolicyPermitOrDenyTSL State Selected Task:" + executor.selectedTask);
 
-var returnValue = executor.isTrue;
+true;
index 88bf726..6d5df84 100644 (file)
@@ -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.
@@ -28,8 +29,8 @@ var blackFlag = executor.getContextAlbum("ServiceIdWhiteBlackListAlbum").get(ser
 
 executor.logger.info("vnfId=" + vnfId + ", serviceId=" + serviceId + ", blackFlag=" + blackFlag);
 
-if (blackFlag != null && blackFlag === true) {
-    vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+if (blackFlag != null && blackFlag == true) {
+    vcpeClosedLoopStatus.put("notificationTime",  java.lang.Long.valueOf(Date.now()));
     vcpeClosedLoopStatus.put("notification", "BLACKLIST");
     var message = vcpeClosedLoopStatus.get("message");
 
@@ -43,4 +44,5 @@ if (blackFlag != null && blackFlag === true) {
 
 executor.logger.info(executor.outFields);
 
-var returnValue = executor.isTrue;
+true;
+
index d4e3f30..7bca865 100644 (file)
@@ -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.
@@ -26,9 +27,9 @@ var blackFlag = executor.getContextAlbum("VnfIdWhiteBlackListAlbum").get(vnfId);
 
 executor.logger.info("vnfId=" + vnfId + ", blackFlag=" + blackFlag);
 
-if (blackFlag != null && blackFlag === true) {
+if (blackFlag != null && blackFlag == true) {
     var vcpeClosedLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum").get(vnfId);
-    vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+    vcpeClosedLoopStatus.put("notificationTime",  java.lang.Long.valueOf(Date.now()));
     vcpeClosedLoopStatus.put("notification", "BLACKLIST");
     var message = vcpeClosedLoopStatus.get("message");
 
@@ -42,4 +43,4 @@ if (blackFlag != null && blackFlag === true) {
 
 executor.logger.info(executor.outFields);
 
-var returnValue = executor.isTrue;
+true;
index 785d93f..8430110 100644 (file)
@@ -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.
@@ -28,8 +29,8 @@ var blackFlag = executor.getContextAlbum("VServerIdWhiteBlackListAlbum").get(vSe
 
 executor.logger.info("vnfId=" + vnfId + ", vServerId=" + vServerId + ", blackFlag=" + blackFlag);
 
-if (blackFlag != null && blackFlag === true) {
-    vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+if (blackFlag != null && blackFlag == true) {
+    vcpeClosedLoopStatus.put("notificationTime",  java.lang.Long.valueOf(Date.now()));
     vcpeClosedLoopStatus.put("notification", "BLACKLIST");
     var message = vcpeClosedLoopStatus.get("message");
 
@@ -43,4 +44,5 @@ if (blackFlag != null && blackFlag === true) {
 
 executor.logger.info(executor.outFields);
 
-var returnValue = executor.isTrue;
+true;
+
index 2d41e5f..b164042 100644 (file)
@@ -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.
@@ -29,21 +30,24 @@ var targetType = executor.inFields.get("targetType");
 var target = executor.inFields.get("target");
 var black = executor.inFields.get("black");
 
-var returnValue = executor.isTrue;
+var returnValue = true;
 
-if (targetType === "VNF") {
+if (targetType == "VNF") {
     executor.getContextAlbum("VnfIdWhiteBlackListAlbum").put(target, black);
     executor.logger.info("added VNF ID \"" + target + "\" with black flag \"" + black + "\" to VNF ID list");
 }
-else if (targetType === "Service") {
+else if (targetType == "Service") {
     executor.getContextAlbum("ServiceIdWhiteBlackListAlbum").put(target, black);
     executor.logger.info("added Service ID \"" + target + "\" with black flag \"" + black + "\" to Service ID list");
 }
-else if (targetType === "VServer") {
+else if (targetType == "VServer") {
     executor.getContextAlbum("VServerIdWhiteBlackListAlbum").put(target, black);
     executor.logger.info("added VServer ID \"" + target + "\" with black flag \"" + black + "\" to VServer ID list");
 }
 else {
     executor.logger.warn("unknown target type \"" + targetType + "\" specified");
-    returnValue = executor.isFalse;
+    returnValue = false;
 }
+
+returnValue;
+
index ca2166c..615901c 100644 (file)
@@ -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.
@@ -72,4 +73,4 @@ executor.outFields.put("VirtualControlLoopNotification", clNotification);
 
 executor.logger.info(executor.outFields);
 
-var returnValue = executor.isTrue;
+true;
index b6d4cae..457b801 100644 (file)
@@ -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.
@@ -44,7 +45,7 @@ controllerRequestBodyInput.put("action", "Restart");
 controllerRequestBodyInput.put("action_DasH_identifiers", new java.util.HashMap());
 controllerRequestBodyInput.get("action_DasH_identifiers").put("vnf-id", executor.inFields.get("vnfID").toString());
 
-controllerRequestBodyInputCommonHeader.put("timestamp", java.lang.System.currentTimeMillis());
+controllerRequestBodyInputCommonHeader.put("timestamp",  java.lang.Long.valueOf(Date.now()));
 controllerRequestBodyInputCommonHeader.put("api_DasH_ver", "2.00");
 controllerRequestBodyInputCommonHeader.put("originator_DasH_id", executor.inFields.get("requestID").toString());
 controllerRequestBodyInputCommonHeader.put("request_DasH_id", executor.inFields.get("requestID").toString());
@@ -62,10 +63,11 @@ executor.getContextAlbum("RequestIDVNFIDAlbum").put(executor.inFields.get("reque
         executor.inFields.get("vnfID"));
 
 vcpeClosedLoopStatus.put("notification", "OPERATION");
-vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+vcpeClosedLoopStatus.put("notificationTime",  java.lang.Long.valueOf(Date.now()));
 
 executor.outFields.put("ControllerRequest", controllerRequest);
 
 executor.logger.info(executor.outFields);
 
-var returnValue = executor.isTrue;
+true;
+
index 5a87037..8cb3e4e 100644 (file)
@@ -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;
index c24e765..998f6a2 100644 (file)
@@ -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.
@@ -24,4 +25,4 @@ executor.logger.info(executor.inFields);
 
 executor.logger.info(executor.outFields);
 
-var returnValue = executor.isTrue;
+true;
index 003942e..7715564 100644 (file)
@@ -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.
@@ -25,4 +26,4 @@ executor.logger.info(executor.inFields);
 
 executor.logger.info(executor.outFields);
 
-var returnValue = executor.isTrue;
+true;
index a8bb40c..a74f397 100644 (file)
@@ -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.
 executor.logger.info(executor.subject.id);
 executor.logger.info(executor.inFields);
 
-var returnValue = executor.isTrue;
 var status = null;
 
-if (executor.inFields.get("action") === "ControllerRequestAction") {
+if (executor.inFields.get("action") == "ControllerRequestAction") {
     executor.subject.getTaskKey("DoControllerRequestActionTask").copyTo(executor.selectedTask);
 } else {
     executor.subject.getTaskKey("DoLogActionTask").copyTo(executor.selectedTask);
 }
 
 executor.logger.info("ReceiveEventPolicyOnsetOrAbatedStateTSL State Selected Task:" + executor.selectedTask);
+
+true;
index 1567608..13129f2 100644 (file)
@@ -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.
@@ -25,8 +26,8 @@
 executor.logger.info(executor.subject.id);
 executor.logger.info(executor.inFields);
 
-var utf8Type = Java.type("org.apache.avro.util.Utf8");
-var uuidType = Java.type("java.util.UUID");
+var utf8Type = org.apache.avro.util.Utf8;
+var uuidType = java.util.UUID;
 
 var clEvent = executor.inFields.get("VirtualControlLoopEvent");
 
@@ -61,7 +62,7 @@ if (clEvent.get("AAI").get(new utf8Type("generic_DasH_vnf_DoT_vnf_DasH_id")) !=
         vcpeClosedLoopStatus.put("policyName", "ONAPvCPEPolicyModel");
         vcpeClosedLoopStatus.put("policyVersion", "0.0.1");
         vcpeClosedLoopStatus.put("notification", "ACTIVE");
-        vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+        vcpeClosedLoopStatus.put("notificationTime",  java.lang.Long.valueOf(Date.now()));
         vcpeClosedLoopStatus.put("message", "");
 
         var aaiInfo = executor.getContextAlbum("ControlLoopStatusAlbum").getSchemaHelper().createNewSubInstance(
@@ -130,7 +131,7 @@ if (clEvent.get("AAI").get(new utf8Type("generic_DasH_vnf_DoT_vnf_DasH_id")) !=
         vcpeClosedLoopStatus.put("policyName", "ONAPvCPEPolicyModel");
         vcpeClosedLoopStatus.put("policyVersion", "0.0.1");
         vcpeClosedLoopStatus.put("notification", "ACTIVE");
-        vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+        vcpeClosedLoopStatus.put("notificationTime",  java.lang.Long.valueOf(Date.now()));
         vcpeClosedLoopStatus.put("message", "");
 
         var aaiInfo = executor.getContextAlbum("ControlLoopStatusAlbum").getSchemaHelper().createNewSubInstance(
@@ -154,4 +155,5 @@ if (clEvent.get("AAI").get(new utf8Type("generic_DasH_vnf_DoT_vnf_DasH_id")) !=
     executor.logger.info(executor.outFields);
 }
 
-var returnValue = executor.isTrue;
+true;
+
index 0303bc9..d5c3999 100644 (file)
@@ -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.
@@ -26,7 +27,7 @@ var vcpeClosedLoopStatus = executor.getContextAlbum("ControlLoopStatusAlbum").ge
 
 var eventList = executor.subject.getOutFieldSchemaHelper("ActionEventList").createNewInstance();
 
-var eventType = Java.type("org.onap.policy.apex.service.engine.event.ApexEvent");
+var eventType = org.onap.policy.apex.service.engine.event.ApexEvent;
 
 var controllerRequestActionEvent = new eventType("ActionEvent", "0.0.1", "org.onap.policy.apex.onap.vcpe", "APEX",
         "APEX");
@@ -51,4 +52,5 @@ executor.outFields.put("ActionEventList", eventList);
 
 executor.logger.info(executor.outFields);
 
-var returnValue = executor.isTrue;
+true;
+
index 46a65ad..a291f6a 100644 (file)
@@ -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.
@@ -21,7 +22,7 @@
 executor.logger.info(executor.subject.id);
 executor.logger.info(executor.inFields);
 
-var returnValue = executor.isTrue;
+var returnValue = true;
 
 if( executor.inFields.get("vnfID") == null) {
    executor.logger.info("ControlLoopStatusAlbum: vnfID is null");
@@ -36,20 +37,20 @@ if( executor.inFields.get("vnfID") == null) {
 var status = vcpeClosedLoopStatus.get("closedLoopEventStatus").toString();
 var notification = vcpeClosedLoopStatus.get("notification");
 
-var returnValue = executor.isTrue;
-
-if (notification != null && notification === "BLACKLIST") {
+if (notification != null && notification == "BLACKLIST") {
     executor.subject.getTaskKey("StopAndLogTask").copyTo(executor.selectedTask);
 }
 else {
-    if (status === "ONSET") {
+    if (status == "ONSET") {
         executor.subject.getTaskKey("InitiateActionsTask").copyTo(executor.selectedTask);
-    } else if (status === "ABATED") {
+    } else if (status == "ABATED") {
         executor.subject.getTaskKey("StopAndLogTask").copyTo(executor.selectedTask);
     } else {
         executor.message = "closedLoopEventStatus is \"" + status + "\", it must be either \"ONSET\" or \"ABATED\"";
-        returnValue = executor.isFalse;
+        returnValue = false;
     }
 }
 
 executor.logger.info("ReceiveEventPolicyOnsetOrAbatedStateTSL State Selected Task:" + executor.selectedTask);
+
+returnValue;
index af57bf1..2b062fd 100644 (file)
@@ -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.
@@ -32,10 +33,10 @@ if (executor.inFields.get("vnfID") == null) {
             .get(executor.inFields.get("vnfID").toString());
 }
 
-vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+vcpeClosedLoopStatus.put("notificationTime", java.lang.Long.valueOf(Date.now()));
 
 var message = vcpeClosedLoopStatus.get("message");
-if (message == null || message === "") {
+if (message == null || message == "") {
     vcpeClosedLoopStatus.put("message", "situation has been abated");
 }
 else {
@@ -44,4 +45,4 @@ else {
 
 executor.logger.info(executor.outFields);
 
-var returnValue = executor.isTrue;
+true;