aboutsummaryrefslogtreecommitdiffstats
path: root/examples/examples-pcvs
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-03-11 17:17:14 +0000
committerliamfallon <liam.fallon@est.tech>2020-03-11 18:34:55 +0000
commitb87ab1696010ca0bbed5db99c140cf908722df57 (patch)
tree160ed6eafc600d126465e846f18b70bd199edbed /examples/examples-pcvs
parent7c28f233037e768cde426f78d61cf959d2053fdb (diff)
Convert examples to Rhino Javascript format
All examples are converted to Rhino Javascript from Nashorn Javascript. Issue-ID: POLICY-2106 Change-Id: Ia6fec5b57b1e6131799b4b069968e4766ce54c96 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'examples/examples-pcvs')
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js13
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js13
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js13
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.js14
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js15
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.js15
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js15
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js15
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js12
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js13
-rw-r--r--examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js18
11 files changed, 76 insertions, 80 deletions
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js
index cefb7a97c..d62bed609 100644
--- a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-customer.js
@@ -1,25 +1,24 @@
/*
* ============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=========================================================
*/
-load("nashorn:mozilla_compat.js");
-
var logger = executor.logger;
logger.trace("start: " + executor.subject.id);
logger.trace("-- infields: " + executor.inFields);
@@ -74,7 +73,7 @@ executor.outFields["report"] = "customer ctxt :: added customer: " + ifCustomerN
logger.info("vpnsla: ctxt added customer " + ifCustomerName);
-var returnValueType = Java.type("java.lang.Boolean");
-var returnValue = new returnValueType(true);
logger.trace("finished: " + executor.subject.id);
logger.debug(".");
+
+true;
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js
index dd667a87d..1e9d6be71 100644
--- a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-edges.js
@@ -1,25 +1,24 @@
/*
* ============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=========================================================
*/
-load("nashorn:mozilla_compat.js");
-
var logger = executor.logger;
logger.trace("start: " + executor.subject.id);
logger.trace("-- infields: " + executor.inFields);
@@ -59,7 +58,7 @@ executor.outFields["report"] = "edge ctxt :: added edge " + ifEdgeName;
logger.info("vpnsla: ctxt added edge " + ifEdgeName);
-var returnValueType = Java.type("java.lang.Boolean");
-var returnValue = new returnValueType(true);
logger.trace("finished: " + executor.subject.id);
logger.debug(".");
+
+true;
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js
index 532820f15..bc360f280 100644
--- a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/ctxt-nodes.js
@@ -1,25 +1,24 @@
/*
* ============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=========================================================
*/
-load("nashorn:mozilla_compat.js");
-
var logger = executor.logger;
logger.trace("start: " + executor.subject.id);
logger.trace("-- infields: " + executor.inFields);
@@ -57,7 +56,7 @@ executor.outFields["report"] = "node ctxt :: added node " + ifNodeName;
logger.info("vpnsla: ctxt added node " + ifNodeName);
-var returnValueType = Java.type("java.lang.Boolean");
-var returnValue = new returnValueType(true);
logger.trace("finished: " + executor.subject.id);
logger.debug(".");
+
+true;
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.js
index df96235d3..6ab792693 100644
--- a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.js
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-act.js
@@ -1,25 +1,24 @@
/*
* ============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=========================================================
*/
-load("nashorn:mozilla_compat.js");
-
var logger = executor.logger;
logger.trace("start: " + executor.subject.id);
logger.trace("-- infields: " + executor.inFields);
@@ -52,9 +51,6 @@ default:
}
-var returnValueType = Java.type("java.lang.Boolean");
-var returnValue = new returnValueType(true);
-
if (executor.outFields["action"] != "") {
logger.info("vpnsla: action is to " + executor.outFields["action"] + " " + executor.outFields["edgeName"]);
} else {
@@ -67,3 +63,5 @@ logger.debug(".a");
var now = new Date().getTime();
logger.info("VPN SLA finished in " + (now - ifMatchStart) + " ms");
+
+true;
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js
index ad6a51027..9471b02d0 100644
--- a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-none.js
@@ -1,24 +1,24 @@
/*
* ============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=========================================================
*/
-load("nashorn:mozilla_compat.js");
importClass(org.slf4j.LoggerFactory);
importClass(java.util.ArrayList);
@@ -41,18 +41,19 @@ decision.put("description", "None, everything is ok");
decision.put("decision", "NONE");
decision.put("customers", new ArrayList());
-var returnValueType = Java.type("java.lang.Boolean");
+var returnValue = true;
if (ifSituation.get("problemID") == "NONE") {
logger.trace("-- no problem, everything ok");
- var returnValue = new returnValueType(true);
} else {
logger.trace("-- wrong problemID <" + problemID + "> for NONE task, we should not be here");
rootLogger.error(executor.subject.id + " " + "-- wrong problemID <" + problemID
+ "> for NONE task, we should not be here");
- var returnValue = new returnValueType(false);
+ returnValue = false;
}
executor.outFields["decision"] = decision;
logger.trace("finished: " + executor.subject.id);
logger.debug(".d-non");
+
+returnValue;
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.js
index 5f2e3be92..2afedfd0c 100644
--- a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.js
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-priority.js
@@ -1,24 +1,24 @@
/*
* ============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=========================================================
*/
-load("nashorn:mozilla_compat.js");
importClass(org.slf4j.LoggerFactory);
importClass(java.util.ArrayList);
@@ -46,7 +46,7 @@ decision.put("problemID", ifSituation.get("problemID"));
decision.put("customers", new ArrayList());
var problem = albumProblemMap.get(ifSituation.get("problemID"));
-var returnValueType = Java.type("java.lang.Boolean");
+var returnValue = true;
if (problem != null && ifSituation.get("violatedSLAs").size() > 0) {
logger.trace("-- impede by priority");
for (var i = 0; i < problem.get("edgeUsedBy").size(); i++) {
@@ -55,12 +55,11 @@ if (problem != null && ifSituation.get("violatedSLAs").size() > 0) {
decision.get("customers").add(customerCtxt.get("customerName"));
}
}
- var returnValue = new returnValueType(true);
} else {
logger.trace("-- wrong problemID <" + ifSituation.get("problemID") + "> for PRIORITY task, we should not be here");
rootLogger.error(executor.subject.id + " " + "-- wrong problemID <" + ifSituation.get("problemID")
+ "> for PRIORITY task, we should not be here");
- var returnValue = new returnValueType(false);
+ returnValue = false;
}
// set impededLast to decision[customers]
@@ -74,3 +73,5 @@ logger.info("vpnsla: priority, impeding customers " + decision.get("customers"))
logger.trace("finished: " + executor.subject.id);
logger.debug(".d-pri");
+
+returnValue;
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js
index bd09a747b..a65814fbd 100644
--- a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-sla.js
@@ -1,24 +1,24 @@
/*
* ============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=========================================================
*/
-load("nashorn:mozilla_compat.js");
importClass(org.slf4j.LoggerFactory);
importClass(java.util.ArrayList);
@@ -46,7 +46,7 @@ decision.put("problemID", ifSituation.get("problemID"));
decision.put("customers", new ArrayList());
var problem = albumProblemMap.get(ifSituation.get("problemID"));
-var returnValueType = Java.type("java.lang.Boolean");
+var returnValue = true;
if (problem != null && ifSituation.get("violatedSLAs").size() == 0) {
logger.trace("-- impede by maximum SLA");
var customer = "";
@@ -62,12 +62,11 @@ if (problem != null && ifSituation.get("violatedSLAs").size() == 0) {
}
}
decision.get("customers").add(customer);
- var returnValue = new returnValueType(true);
} else {
logger.trace("-- wrong problemID <" + ifSituation.get("problemID") + "> for SLA task, we should not be here");
rootLogger.error(executor.subject.id + " " + "-- wrong problemID <" + ifSituation.get("problemID")
+ "> for SLA task, we should not be here");
- var returnValue = new returnValueType(false);
+ returnValue = false;
}
// set impededLast to decision[customers]
@@ -81,3 +80,5 @@ logger.info("vpnsla: sla balance, impeding customers " + decision.get("customers
logger.trace("finished: " + executor.subject.id);
logger.debug(".d-sla");
+
+returnValue;
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js
index 78bc94f00..6306ee06b 100644
--- a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-decide-solved.js
@@ -1,24 +1,24 @@
/*
* ============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=========================================================
*/
-load("nashorn:mozilla_compat.js");
importClass(org.slf4j.LoggerFactory);
importClass(java.util.ArrayList);
@@ -44,15 +44,14 @@ decision.put("decision", "REBUILD");
decision.put("customers", new ArrayList());
decision.put("problemID", ifSituation.get("problemID"));
-var returnValueType = Java.type("java.lang.Boolean");
+var returnValue = true;
if (albumProblemMap.get(ifSituation.get("problemID")).get("status") == "SOLVED") {
logger.trace("-- problem solved");
- var returnValue = new returnValueType(true);
} else {
logger.trace("-- wrong problemID <" + problemID + "> for SOLVED task, we should not be here");
rootLogger.error(executor.subject.id + " " + "-- wrong problemID <" + problemID
+ "> for SOLVED task, we should not be here");
- var returnValue = new returnValueType(false);
+ returnValue = false;
}
executor.outFields["decision"] = decision;
@@ -61,3 +60,5 @@ logger.info("vpnsla: sla solved, problem solved");
logger.trace("finished: " + executor.subject.id);
logger.debug(".d-non");
+
+returnValue;
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js
index 48d69e8eb..95a922052 100644
--- a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-establish.js
@@ -1,24 +1,24 @@
/*
* ============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=========================================================
*/
-load("nashorn:mozilla_compat.js");
importClass(org.slf4j.LoggerFactory);
importClass(java.util.ArrayList);
@@ -164,7 +164,7 @@ executor.outFields["situation"] = situation;
logger.trace("-- out fields <" + executor.outFields + ">");
-var returnValueType = Java.type("java.lang.Boolean");
-var returnValue = new returnValueType(true);
logger.trace("finished: " + executor.subject.id);
logger.debug(".e");
+
+true;
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js
index c50dd9794..87e5bc377 100644
--- a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/task-match.js
@@ -1,25 +1,24 @@
/*
* ============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=========================================================
*/
-load("nashorn:mozilla_compat.js");
-
var now = new Date().getTime();
executor.outFields["matchStart"] = now;
@@ -74,7 +73,7 @@ executor.outFields["status"] = ifLinkStatus;
logger.info("vpnsla: detected " + ifEdgeName + " as " + ifLinkStatus);
-var returnValueType = Java.type("java.lang.Boolean");
-var returnValue = new returnValueType(true);
logger.trace("finished: " + executor.subject.id);
logger.debug(".m");
+
+true;
diff --git a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js
index 44767467d..9d4399f27 100644
--- a/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js
+++ b/examples/examples-pcvs/src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/logic/tsl-decide.js
@@ -1,24 +1,24 @@
/*
* ============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=========================================================
*/
-load("nashorn:mozilla_compat.js");
importClass(org.slf4j.LoggerFactory);
var logger = executor.logger;
@@ -30,29 +30,27 @@ var ifSituation = executor.inFields["situation"];
var albumProblemMap = executor.getContextAlbum("albumProblemMap");
-var returnValueType = Java.type("java.lang.Boolean");
+var returnValue = true;
if (ifSituation.get("problemID") == "NONE") {
logger.trace("-- situation has no problem, selecting <VpnSlaPolicyDecideNoneTask>");
executor.subject.getTaskKey("VpnSlaPolicyDecideNoneTask").copyTo(executor.selectedTask);
- var returnValue = new returnValueType(true);
} else if (albumProblemMap.get(ifSituation.get("problemID")).get("status") == "SOLVED") {
logger.trace("-- situation is solved, selecting <VpnSlaPolicyDecideSolvedTask>");
executor.subject.getTaskKey("VpnSlaPolicyDecideSolvedTask").copyTo(executor.selectedTask);
- var returnValue = new returnValueType(true);
} else if (ifSituation.get("violatedSLAs") != null && ifSituation.get("violatedSLAs").size() > 0) {
logger.trace("-- situation is problem with violations, selecting <VpnSlaPolicyDecidePriorityTask>");
executor.subject.getTaskKey("VpnSlaPolicyDecidePriorityTask").copyTo(executor.selectedTask);
- var returnValue = new returnValueType(true);
} else if (ifSituation.get("violatedSLAs") != null && ifSituation.get("violatedSLAs").size() == 0) {
logger.trace("-- situation is problem without violations, selecting <VpnSlaPolicyDecideSlaTask>");
executor.subject.getTaskKey("VpnSlaPolicyDecideSlaTask").copyTo(executor.selectedTask);
- var returnValue = new returnValueType(true);
} else {
logger.error("-- detected unknown decision for situation <" + ifSituation.get("problemID") + ">");
rootLogger.error(executor.subject.id + " " + "-- detected unknown decision for situation <"
+ ifSituation.get("problemID") + ">");
- var returnValue = new returnValueType(false);
+ returnValue = false;
}
logger.trace("finished: " + executor.subject.id);
logger.debug(".d-tsl");
+
+returnValue;