summaryrefslogtreecommitdiffstats
path: root/examples/examples-adaptive/src/main/resources/org
diff options
context:
space:
mode:
authorramverma <ram.krishna.verma@ericsson.com>2018-07-25 17:26:52 +0100
committerramverma <ram.krishna.verma@ericsson.com>2018-07-25 17:32:29 +0100
commitf8959f5c51e6338b62e23ea503eb86d9c65d7c74 (patch)
tree7a8afbbf61f7091c30aadfc1cace70fb6e65bff9 /examples/examples-adaptive/src/main/resources/org
parentdccf9a9e0758be0a926c94bf1599ee625066100d (diff)
Renaming examples in apex-pdp
Renaming the examples as per what the documentation expects them. Otherwise the documents won't work. Change-Id: Ib9e30bf5a4cec0fec981372e1d9f3a0ee5d60f2f Issue-ID: POLICY-861 Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
Diffstat (limited to 'examples/examples-adaptive/src/main/resources/org')
-rw-r--r--examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask0_TaskLogic.mvel40
-rw-r--r--examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask1_TaskLogic.mvel40
-rw-r--r--examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask2_TaskLogic.mvel40
-rw-r--r--examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask3_TaskLogic.mvel40
-rw-r--r--examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask4_TaskLogic.mvel40
-rw-r--r--examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask5_TaskLogic.mvel40
-rw-r--r--examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask6_TaskLogic.mvel40
-rw-r--r--examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAnomalyDetectionTask_Logic.mvel25
-rw-r--r--examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAutoLearnTask_Logic.mvel26
-rw-r--r--examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultState_Logic.mvel23
10 files changed, 354 insertions, 0 deletions
diff --git a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask0_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask0_TaskLogic.mvel
new file mode 100644
index 000000000..758062b8e
--- /dev/null
+++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask0_TaskLogic.mvel
@@ -0,0 +1,40 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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=========================================================
+ */
+logger.debug("AutoLearnDecideTask0: inFields:" + inFields);
+java.util.Random rand = new java.util.Random(System.currentTimeMillis());
+double MIN = -100.0;
+double MAX = 100.0;
+double WANT = 50.0;
+
+double inval = (Double)(inFields["MonitoredValue"]);
+double ret = inval;
+///////////////
+double diff = (1.0/2.0) * (Math.abs(inval - WANT));
+///////////////
+ret = inval + diff;
+if (ret > MAX)
+ ret = MAX;
+if (ret<MIN)
+ ret = MIN;
+
+outFields["MonitoredValue"] = ret;
+outFields["LastMonitoredValue"] = inval;
+logger.debug("AutoLearnDecideTask0: outFields:" + outFields);
+return true;
diff --git a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask1_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask1_TaskLogic.mvel
new file mode 100644
index 000000000..051766045
--- /dev/null
+++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask1_TaskLogic.mvel
@@ -0,0 +1,40 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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=========================================================
+ */
+logger.debug("AutoLearnDecideTask1: inFields:" + inFields);
+java.util.Random rand = new java.util.Random(System.currentTimeMillis());
+double MIN = -100.0;
+double MAX = 100.0;
+double WANT = 50.0;
+
+double inval = (Double)(inFields["MonitoredValue"]);
+double ret = inval;
+///////////////
+double diff = (1.0/5.0) * (Math.abs(inval - WANT));
+///////////////
+ret = inval + diff;
+if (ret > MAX)
+ ret = MAX;
+if (ret<MIN)
+ ret = MIN;
+
+outFields["MonitoredValue"] = ret;
+outFields["LastMonitoredValue"] = inval;
+logger.debug("AutoLearnDecideTask1: outFields:" + outFields);
+return true;
diff --git a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask2_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask2_TaskLogic.mvel
new file mode 100644
index 000000000..b787b2153
--- /dev/null
+++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask2_TaskLogic.mvel
@@ -0,0 +1,40 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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=========================================================
+ */
+logger.debug("AutoLearnDecideTask2: inFields:" + inFields);
+java.util.Random rand = new java.util.Random(System.currentTimeMillis());
+double MIN = -100.0;
+double MAX = 100.0;
+double WANT = 50.0;
+
+double inval = (Double)(inFields["MonitoredValue"]);
+double ret = inval;
+///////////////
+double diff = (1.0/10.0) * (Math.abs(inval - WANT));
+///////////////
+ret = inval + diff;
+if (ret > MAX)
+ ret = MAX;
+if (ret<MIN)
+ ret = MIN;
+
+outFields["MonitoredValue"] = ret;
+outFields["LastMonitoredValue"] = inval;
+logger.debug("AutoLearnDecideTask2: outFields:" + outFields);
+return true;
diff --git a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask3_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask3_TaskLogic.mvel
new file mode 100644
index 000000000..7fbc8c765
--- /dev/null
+++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask3_TaskLogic.mvel
@@ -0,0 +1,40 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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=========================================================
+ */
+logger.debug("AutoLearnDecideTask3: inFields:" + inFields);
+java.util.Random rand = new java.util.Random(System.currentTimeMillis());
+double MIN = -100.0;
+double MAX = 100.0;
+double WANT = 50.0;
+
+double inval = (Double)(inFields["MonitoredValue"]);
+double ret = inval;
+///////////////
+double diff = rand.nextGaussian()*((MAX - WANT) / 50.0);
+///////////////
+ret = inval + diff;
+if (ret > MAX)
+ ret = MAX;
+if (ret<MIN)
+ ret = MIN;
+
+outFields["MonitoredValue"] = ret;
+outFields["LastMonitoredValue"] = inval;
+logger.debug("AutoLearnDecideTask3: outFields:" + outFields);
+return true;
diff --git a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask4_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask4_TaskLogic.mvel
new file mode 100644
index 000000000..a0a12d84f
--- /dev/null
+++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask4_TaskLogic.mvel
@@ -0,0 +1,40 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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=========================================================
+ */
+logger.debug("AutoLearnDecideTask4: inFields:" + inFields);
+java.util.Random rand = new java.util.Random(System.currentTimeMillis());
+double MIN = -100.0;
+double MAX = 100.0;
+double WANT = 50.0;
+
+double inval = (Double)(inFields["MonitoredValue"]);
+double ret = inval;
+///////////////
+double diff = (-1.0/10.0) * (Math.abs(inval - WANT));
+///////////////
+ret = inval + diff;
+if (ret > MAX)
+ ret = MAX;
+if (ret<MIN)
+ ret = MIN;
+
+outFields["MonitoredValue"] = ret;
+outFields["LastMonitoredValue"] = inval;
+logger.debug("AutoLearnDecideTask4: outFields:" + outFields);
+return true;
diff --git a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask5_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask5_TaskLogic.mvel
new file mode 100644
index 000000000..fc2005fdf
--- /dev/null
+++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask5_TaskLogic.mvel
@@ -0,0 +1,40 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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=========================================================
+ */
+logger.debug("AutoLearnDecideTask5: inFields:" + inFields);
+java.util.Random rand = new java.util.Random(System.currentTimeMillis());
+double MIN = -100.0;
+double MAX = 100.0;
+double WANT = 50.0;
+
+double inval = (Double)(inFields["MonitoredValue"]);
+double ret = inval;
+///////////////
+double diff = (-1.0/5.0) * (Math.abs(inval - WANT));
+///////////////
+ret = inval + diff;
+if (ret > MAX)
+ ret = MAX;
+if (ret < MIN)
+ ret = MIN;
+
+outFields["MonitoredValue"] = ret;
+outFields["LastMonitoredValue"] = inval;
+logger.debug("AutoLearnDecideTask5: outFields:" + outFields);
+return true;
diff --git a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask6_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask6_TaskLogic.mvel
new file mode 100644
index 000000000..5eb44839c
--- /dev/null
+++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask6_TaskLogic.mvel
@@ -0,0 +1,40 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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=========================================================
+ */
+logger.debug("AutoLearnDecideTask6: inFields:" + inFields);
+java.util.Random rand = new java.util.Random(System.currentTimeMillis());
+double MIN = -100.0;
+double MAX = 100.0;
+double WANT = 50.0;
+
+double inval = (Double)(inFields["MonitoredValue"]);
+double ret = inval;
+///////////////
+double diff = (-1.0/2.0) * (Math.abs(inval - WANT));
+///////////////
+ret = inval + diff;
+if (ret > MAX)
+ ret = MAX;
+if (ret<MIN)
+ ret = MIN;
+
+outFields["MonitoredValue"] = ret;
+outFields["LastMonitoredValue"] = inval;
+logger.debug("AutoLearnDecideTask6: outFields:" + outFields);
+return true;
diff --git a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAnomalyDetectionTask_Logic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAnomalyDetectionTask_Logic.mvel
new file mode 100644
index 000000000..8f894d297
--- /dev/null
+++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAnomalyDetectionTask_Logic.mvel
@@ -0,0 +1,25 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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=========================================================
+ */
+logger.debug(subject.getTaskName() + " execution logic");
+logger.debug("inFields : " + inFields);
+outFields["MonitoredValue"] = inFields["MonitoredValue"];
+outFields["Iteration"] = inFields["Iteration"];
+logger.debug("outFields : "+outFields);
+return true;
diff --git a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAutoLearnTask_Logic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAutoLearnTask_Logic.mvel
new file mode 100644
index 000000000..636378396
--- /dev/null
+++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultAutoLearnTask_Logic.mvel
@@ -0,0 +1,26 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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=========================================================
+ */
+logger.debug("AutoLearnActTask execution logic");
+logger.debug("inFields : " + inFields);
+outFields["MonitoredValue"] = inFields["MonitoredValue"];
+outFields["LastMonitoredValue"] = inFields["LastMonitoredValue"];
+logger.debug("outFields : " + outFields);
+return true;
+
diff --git a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultState_Logic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultState_Logic.mvel
new file mode 100644
index 000000000..2db0a0031
--- /dev/null
+++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/DefaultState_Logic.mvel
@@ -0,0 +1,23 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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=========================================================
+ */
+logger.debug(subject.id + ":" + subject.stateName);
+subject.defaultTaskKey.copyTo(selectedTask);
+logger.debug(subject.id + ":" + subject.stateName) + ", using default task" + subject.defaultTaskKey.getID();
+return true;