Updates in docker-compose for policy framework 99/6499/1
authorRehanRaza <muhammad.rehan.raza@est.tech>
Thu, 15 Jul 2021 12:53:03 +0000 (14:53 +0200)
committerRehanRaza <muhammad.rehan.raza@est.tech>
Thu, 15 Jul 2021 15:56:55 +0000 (17:56 +0200)
The updates are needed for getting it to work with policy participant
and control-loop runtime.

Change-Id: Ia268270250cd6b582ae565f0dd04d82bdb366bd8
Issue-ID: NONRTRIC-553
Signed-off-by: RehanRaza <muhammad.rehan.raza@est.tech>
13 files changed:
docker-compose/docker-compose-policy-framework/config/api/defaultConfig.json [new file with mode: 0644]
docker-compose/docker-compose-policy-framework/config/db/bootstrap-database.sh [new file with mode: 0755]
docker-compose/docker-compose-policy-framework/config/db/create-db.sql [new file with mode: 0644]
docker-compose/docker-compose-policy-framework/config/db/db.conf [deleted file]
docker-compose/docker-compose-policy-framework/config/db/db.sh [deleted file]
docker-compose/docker-compose-policy-framework/config/drools-apps/env/base.conf
docker-compose/docker-compose-policy-framework/config/drools/env/base.conf
docker-compose/docker-compose-policy-framework/config/pap/defaultConfig.json
docker-compose/docker-compose-policy-framework/config/runtime-controlloop/ClRuntimeParameters.json [new file with mode: 0644]
docker-compose/docker-compose-policy-framework/docker-compose.yml
test/usecases/oruclosedlooprecovery/apexpolicyversion/LinkMonitor/controlloop-rest-payloads/commission.yaml [new file with mode: 0644]
test/usecases/oruclosedlooprecovery/apexpolicyversion/LinkMonitor/controlloop-rest-payloads/instantiation-command.json [new file with mode: 0644]
test/usecases/oruclosedlooprecovery/apexpolicyversion/LinkMonitor/controlloop-rest-payloads/instantiation.json [new file with mode: 0644]

diff --git a/docker-compose/docker-compose-policy-framework/config/api/defaultConfig.json b/docker-compose/docker-compose-policy-framework/config/api/defaultConfig.json
new file mode 100644 (file)
index 0000000..b78b753
--- /dev/null
@@ -0,0 +1,53 @@
+{
+    "name": "ApiGroup",
+    "restServerParameters": {
+        "host": "0.0.0.0",
+        "port": 6969,
+        "userName": "healthcheck",
+        "password": "zb!XztG34",
+        "https": false,
+        "aaf": false
+    },
+    "databaseProviderParameters": {
+        "name": "PolicyProviderParameterGroup",
+        "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
+        "databaseDriver": "org.mariadb.jdbc.Driver",
+        "databaseUrl": "jdbc:mariadb://mariadb:3306/policyadmin",
+        "databaseUser": "root",
+        "databasePassword": "strong_pitchou",
+        "persistenceUnit": "PolicyMariaDb"
+    },
+    "preloadPolicyTypes": [
+        "policytypes/onap.policies.monitoring.tcagen2.yaml",
+        "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml",
+        "policytypes/onap.policies.monitoring.dcae-restconfcollector.yaml",
+        "policytypes/onap.policies.Optimization.yaml",
+        "policytypes/onap.policies.optimization.Resource.yaml",
+        "policytypes/onap.policies.optimization.Service.yaml",
+        "policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml",
+        "policytypes/onap.policies.optimization.resource.DistancePolicy.yaml",
+        "policytypes/onap.policies.optimization.resource.HpaPolicy.yaml",
+        "policytypes/onap.policies.optimization.resource.OptimizationPolicy.yaml",
+        "policytypes/onap.policies.optimization.resource.PciPolicy.yaml",
+        "policytypes/onap.policies.optimization.service.QueryPolicy.yaml",
+        "policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml",
+        "policytypes/onap.policies.optimization.resource.Vim_fit.yaml",
+        "policytypes/onap.policies.optimization.resource.VnfPolicy.yaml",
+        "policytypes/onap.policies.controlloop.guard.Common.yaml",
+        "policytypes/onap.policies.controlloop.guard.common.Blacklist.yaml",
+        "policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter.yaml",
+        "policytypes/onap.policies.controlloop.guard.common.MinMax.yaml",
+        "policytypes/onap.policies.controlloop.guard.common.Filter.yaml",
+        "policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml",
+        "policytypes/onap.policies.Naming.yaml",
+        "policytypes/onap.policies.Match.yaml",
+        "policytypes/onap.policies.native.Drools.yaml",
+        "policytypes/onap.policies.native.Xacml.yaml",
+        "policytypes/onap.policies.native.Apex.yaml",
+        "policytypes/onap.policies.controlloop.operational.Common.yaml",
+        "policytypes/onap.policies.controlloop.operational.common.Drools.yaml"
+    ],
+    "preloadPolicies" : [
+        "policies/sdnc.policy.naming.input.tosca.yaml"
+    ]
+}
diff --git a/docker-compose/docker-compose-policy-framework/config/db/bootstrap-database.sh b/docker-compose/docker-compose-policy-framework/config/db/bootstrap-database.sh
new file mode 100755 (executable)
index 0000000..ac2d0a5
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+###
+# ============LICENSE_START=======================================================
+# ONAP CLAMP
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 2021 Nordix Foundation. 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.
+# ============LICENSE_END============================================
+# ===================================================================
+#
+###
+
+mysql -uroot -p$MYSQL_ROOT_PASSWORD -f < /docker-entrypoint-initdb.d/create-db.sql
+mysql -uroot -p$MYSQL_ROOT_PASSWORD --execute "CREATE USER 'policy'@'%' IDENTIFIED BY 'P01icY';"
+mysql -uroot -p$MYSQL_ROOT_PASSWORD --execute "GRANT ALL PRIVILEGES ON controlloop.* TO 'policy'@'%';"
\ No newline at end of file
diff --git a/docker-compose/docker-compose-policy-framework/config/db/create-db.sql b/docker-compose/docker-compose-policy-framework/config/db/create-db.sql
new file mode 100644 (file)
index 0000000..bc64431
--- /dev/null
@@ -0,0 +1,13 @@
+#
+# Create CLDS database objects (tables, etc.)
+#
+#
+CREATE DATABASE IF NOT EXISTS `cldsdb4`;
+CREATE DATABASE IF NOT EXISTS `policyadmin`;
+CREATE DATABASE IF NOT EXISTS `controlloop`;
+USE `cldsdb4`;
+DROP USER 'clds';
+CREATE USER 'clds';
+GRANT ALL on cldsdb4.* to 'clds' identified by 'sidnnd83K' with GRANT OPTION;
+FLUSH PRIVILEGES;
+
diff --git a/docker-compose/docker-compose-policy-framework/config/db/db.conf b/docker-compose/docker-compose-policy-framework/config/db/db.conf
deleted file mode 100644 (file)
index 22b37f8..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright 2019,2021 AT&T Intellectual Property. 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.
-MYSQL_ROOT_PASSWORD=secret
-MYSQL_USER=policy_user
-MYSQL_PASSWORD=policy_user
diff --git a/docker-compose/docker-compose-policy-framework/config/db/db.sh b/docker-compose/docker-compose-policy-framework/config/db/db.sh
deleted file mode 100755 (executable)
index a5c8129..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash -xv
-# Copyright 2019,2021 AT&T Intellectual Property. 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.
-
-for db in support onap_sdk log migration operationshistory10 pooling policyadmin operationshistory
-do
-    mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "CREATE DATABASE IF NOT EXISTS ${db};"
-    mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "GRANT ALL PRIVILEGES ON \`${db}\`.* TO '${MYSQL_USER}'@'%' ;"
-done
-
-mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" --execute "FLUSH PRIVILEGES;"
index a56dbaa..b8ca10e 100644 (file)
@@ -46,8 +46,8 @@ REPOSITORY_OFFLINE=true
 # Relational (SQL) DB access
 
 SQL_HOST=mariadb
-SQL_USER=policy_user
-SQL_PASSWORD=policy_user
+SQL_USER=root
+SQL_PASSWORD=strong_pitchou
 
 # AAF
 
index 8189419..fa1f8f1 100644 (file)
@@ -46,8 +46,8 @@ REPOSITORY_OFFLINE=false
 # Relational (SQL) DB access
 
 SQL_HOST=mariadb
-SQL_USER=policy_user
-SQL_PASSWORD=policy_user
+SQL_USER=root
+SQL_PASSWORD=strong_pitchou
 
 # AAF
 
index 369a37c..8c4ea64 100644 (file)
@@ -24,8 +24,8 @@
         "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
         "databaseDriver": "org.mariadb.jdbc.Driver",
         "databaseUrl": "jdbc:mariadb://mariadb:3306/policyadmin",
-        "databaseUser": "policy_user",
-        "databasePassword": "policy_user",
+        "databaseUser": "root",
+        "databasePassword": "strong_pitchou",
         "persistenceUnit": "PolicyMariaDb"
     },
     "topicParameterGroup": {
@@ -57,7 +57,7 @@
         "port": 6969,
         "userName": "healthcheck",
         "password": "zb!XztG34",
-        "useHttps": true,
+        "useHttps": false,
         "allowSelfSignedCerts" : true,
         "basePath": "policy/api/v1/healthcheck"
     }]
diff --git a/docker-compose/docker-compose-policy-framework/config/runtime-controlloop/ClRuntimeParameters.json b/docker-compose/docker-compose-policy-framework/config/runtime-controlloop/ClRuntimeParameters.json
new file mode 100644 (file)
index 0000000..429e1af
--- /dev/null
@@ -0,0 +1,63 @@
+{
+    "name": "ControlLoopRuntimeGroup",
+    "supervisionScannerIntervalSec": 1000,
+    "participantStateChangeIntervalSec": 1000,
+    "participantClUpdateIntervalSec": 1000,
+    "participantClStateChangeIntervalSec": 1000,
+    "restServerParameters": {
+        "host": "0.0.0.0",
+        "port": 6969,
+        "userName": "healthcheck",
+        "password": "zb!XztG34",
+        "https": true,
+        "aaf": false
+    },
+    "participantParameters": {
+        "heartBeatMs": 120000,
+        "updateParameters": {
+            "maxRetryCount": 1,
+            "maxWaitMs": 30000
+        },
+        "stateChangeParameters": {
+            "maxRetryCount": 1,
+            "maxWaitMs": 30000
+        }
+    },
+    "databaseProviderParameters": {
+        "name": "PolicyProviderParameterGroup",
+        "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
+        "databaseDriver": "org.mariadb.jdbc.Driver",
+        "databaseUrl": "jdbc:mariadb://localhost:3306/controlloop",
+        "databaseUser": "policy",
+        "databasePassword": "P01icY",
+        "persistenceUnit": "CommissioningMariaDb"
+    },
+    "topicParameterGroup": {
+        "topicSources": [
+            {
+                "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+                "servers": [
+                    "localhost"
+                ],
+                "topicCommInfrastructure": "dmaap",
+                "fetchTimeout": 15000
+            }
+        ],
+        "topicSinks": [
+            {
+                "topic": "POLICY-CLRUNTIME-PARTICIPANT",
+                "servers": [
+                    "localhost"
+                ],
+                "topicCommInfrastructure": "dmaap"
+            },
+            {
+                "topic": "POLICY-NOTIFICATION",
+                "servers": [
+                    "localhost"
+                ],
+                "topicCommInfrastructure": "dmaap"
+            }
+        ]
+    }
+}
index 406cbeb..4878357 100644 (file)
@@ -27,10 +27,13 @@ services:
       image: nexus3.onap.org:10001/mariadb:10.5.8
       container_name: mariadb
       hostname: mariadb
-      command: ['--lower-case-table-names=1', '--wait_timeout=28800']
-      env_file: config/db/db.conf
       volumes:
-         - ./config/db:/docker-entrypoint-initdb.d:ro
+       - db-vol:/var/lib/mysql
+       - "./config/db/:/docker-entrypoint-initdb.d:rw"
+      environment:
+       - MYSQL_ROOT_PASSWORD=strong_pitchou
+      ports:
+       - "3306:3306"
       expose:
        - 3306
    api:
@@ -40,10 +43,11 @@ services:
        - mariadb
       hostname: policy-api
       ports:
-       - "6969:6969"
+       - "6869:6969"
       expose:
-       - 6969
+       - 6869
       volumes:
+       - ./config/api/defaultConfig.json:/opt/app/policy/api/etc/defaultConfig.json:ro
        - ./config/ks.jks:/opt/app/policy/api/etc/ssl/policy-keystore.jks:ro
        - ./wait_for_port.sh:/opt/app/policy/api/bin/wait_for_port.sh:ro
       entrypoint: ./wait_for_port.sh
@@ -183,3 +187,5 @@ services:
         'pap', '6969',
         'apex-pdp', '6969'
         ]
+volumes:
+  db-vol:
\ No newline at end of file
diff --git a/test/usecases/oruclosedlooprecovery/apexpolicyversion/LinkMonitor/controlloop-rest-payloads/commission.yaml b/test/usecases/oruclosedlooprecovery/apexpolicyversion/LinkMonitor/controlloop-rest-payloads/commission.yaml
new file mode 100644 (file)
index 0000000..c22a890
--- /dev/null
@@ -0,0 +1,1521 @@
+#  Copyright (C) 2021 Nordix Foundation. 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.
+#  ============LICENSE_END=================================================
+#
+tosca_definitions_version: tosca_simple_yaml_1_1_0
+data_types:
+  onap.datatypes.ToscaConceptIdentifier:
+    derived_from: tosca.datatypes.Root
+    properties:
+      name:
+        type: string
+        required: true
+      version:
+        type: string
+        required: true
+  onap.datatype.controlloop.Target:
+    derived_from: tosca.datatypes.Root
+    description: Definition for a entity in A&AI to perform a control loop operation on
+    properties:
+      targetType:
+        type: string
+        description: Category for the target type
+        required: true
+        constraints:
+        - valid_values:
+          - VNF
+          - VM
+          - VFMODULE
+          - PNF
+      entityIds:
+        type: map
+        description: |
+          Map of values that identify the resource. If none are provided, it is assumed that the
+          entity that generated the ONSET event will be the target.
+        required: false
+        metadata:
+          clamp_possible_values: ClampExecution:CSAR_RESOURCES
+        entry_schema:
+          type: string
+  onap.datatype.controlloop.Actor:
+    derived_from: tosca.datatypes.Root
+    description: An actor/operation/target definition
+    properties:
+      actor:
+        type: string
+        description: The actor performing the operation.
+        required: true
+        metadata:
+          clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor
+      operation:
+        type: string
+        description: The operation the actor is performing.
+        metadata:
+          clamp_possible_values: Dictionary:DefaultOperations,ClampExecution:CDS/operation
+        required: true
+      target:
+        type: onap.datatype.controlloop.Target
+        description: The resource the operation should be performed on.
+        required: true
+      payload:
+        type: map
+        description: Name/value pairs of payload information passed by Policy to the actor
+        required: false
+        metadata:
+          clamp_possible_values: ClampExecution:CDS/payload
+        entry_schema:
+          type: string
+  onap.datatype.controlloop.Operation:
+    derived_from: tosca.datatypes.Root
+    description: An operation supported by an actor
+    properties:
+      id:
+        type: string
+        description: Unique identifier for the operation
+        required: true
+      description:
+        type: string
+        description: A user-friendly description of the intent for the operation
+        required: false
+      operation:
+        type: onap.datatype.controlloop.Actor
+        description: The definition of the operation to be performed.
+        required: true
+      timeout:
+        type: integer
+        description: The amount of time for the actor to perform the operation.
+        required: true
+      retries:
+        type: integer
+        description: The number of retries the actor should attempt to perform the operation.
+        required: true
+        default: 0
+      success:
+        type: string
+        description: Points to the operation to invoke on success. A value of "final_success" indicates and end to the operation.
+        required: false
+        default: final_success
+      failure:
+        type: string
+        description: Points to the operation to invoke on Actor operation failure.
+        required: false
+        default: final_failure
+      failure_timeout:
+        type: string
+        description: Points to the operation to invoke when the time out for the operation occurs.
+        required: false
+        default: final_failure_timeout
+      failure_retries:
+        type: string
+        description: Points to the operation to invoke when the current operation has exceeded its max retries.
+        required: false
+        default: final_failure_retries
+      failure_exception:
+        type: string
+        description: Points to the operation to invoke when the current operation causes an exception.
+        required: false
+        default: final_failure_exception
+      failure_guard:
+        type: string
+        description: Points to the operation to invoke when the current operation is blocked due to guard policy enforcement.
+        required: false
+        default: final_failure_guard
+policy_types:
+  onap.policies.controlloop.operational.Common:
+    derived_from: tosca.policies.Root
+    version: 1.0.0
+    name: onap.policies.controlloop.operational.Common
+    description: |
+      Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant
+      Policy Types. This does NOT support the legacy Policy YAML policy type.
+    properties:
+      id:
+        type: string
+        description: The unique control loop id.
+        required: true
+      timeout:
+        type: integer
+        description: |
+          Overall timeout for executing all the operations. This timeout should equal or exceed the total
+          timeout for each operation listed.
+        required: true
+      abatement:
+        type: boolean
+        description: Whether an abatement event message will be expected for the control loop from DCAE.
+        required: true
+        default: false
+      trigger:
+        type: string
+        description: Initial operation to execute upon receiving an Onset event message for the Control Loop.
+        required: true
+      operations:
+        type: list
+        description: List of operations to be performed when Control Loop is triggered.
+        required: true
+        entry_schema:
+          type: onap.datatype.controlloop.Operation
+  onap.policies.controlloop.operational.common.Apex:
+    derived_from: onap.policies.controlloop.operational.Common
+    type_version: 1.0.0
+    version: 1.0.0
+    name: onap.policies.controlloop.operational.common.Apex
+    description: Operational policies for Apex PDP
+    properties:
+      engineServiceParameters:
+        type: string
+        description: The engine parameters like name, instanceCount, policy implementation, parameters etc.
+        required: true
+      eventInputParameters:
+        type: string
+        description: The event input parameters.
+        required: true
+      eventOutputParameters:
+        type: string
+        description: The event output parameters.
+        required: true
+      javaProperties:
+        type: string
+        description: Name/value pairs of properties to be set for APEX if needed.
+        required: false
+node_types:
+  org.onap.policy.clamp.controlloop.Participant:
+    version: 1.0.1
+    derived_from: tosca.nodetypes.Root
+    properties:
+      provider:
+        type: string
+        requred: false
+  org.onap.policy.clamp.controlloop.ControlLoopElement:
+    version: 1.0.1
+    derived_from: tosca.nodetypes.Root
+    properties:
+      provider:
+        type: string
+        requred: false
+      participant_id:
+        type: onap.datatypes.ToscaConceptIdentifier
+        requred: true
+  org.onap.policy.clamp.controlloop.ControlLoop:
+    version: 1.0.1
+    derived_from: tosca.nodetypes.Root
+    properties:
+      provider:
+        type: string
+        requred: false
+      elements:
+        type: list
+        required: true
+        entry_schema:
+          type: onap.datatypes.ToscaConceptIdentifier
+  org.onap.policy.clamp.controlloop.PolicyControlLoopElement:
+    version: 1.0.1
+    derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+    properties:
+      policy_type_id:
+        type: onap.datatypes.ToscaConceptIdentifier
+        requred: true
+      policy_id:
+        type: onap.datatypes.ToscaConceptIdentifier
+        requred: false
+topology_template:
+  node_templates:
+    org.onap.domain.linkmonitor.LinkMonitorPolicyControlLoopElement:
+      version: 1.2.3
+      type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement
+      type_version: 1.0.1
+      description: Control loop element for the Link Monitor
+      properties:
+        provider: Ericsson
+        participantType: org.onap.policy.controlloop.PolicyControlLoopParticipant:2.3.1
+        startPhase: 0
+        policyType: onap.policies.controlloop.operational.common.Apex:1.0.0
+        policyId: operational.apex.linkmonitor:1.0.0
+    org.onap.domain.linkmonitor.LinkMonitorControlLoopDefinition:
+      version: 1.2.3
+      type: org.onap.policy.clamp.controlloop.ControlLoop
+      type_version: 1.0.0
+      description: Control loop for Link Monitor
+      properties:
+        provider: Ericsson
+        elements:
+        - name: org.onap.domain.linkmonitor.LinkMonitorPolicyControlLoopElement
+          version: 1.2.3
+    org.onap.policy.controlloop.PolicyControlLoopParticipant:
+      version: 2.3.1
+      type: org.onap.policy.clamp.controlloop.Participant
+      type_version: 1.0.1
+      description: Participant for policy framework
+      properties:
+        provider: ONAP
+  policies:
+  - operational.apex.linkmonitor:
+      type: onap.policies.controlloop.operational.common.Apex
+      type_version: 1.0.0
+      version: 1.0.0
+      metadata:
+        policy-id: operational.apex.linkmonitor
+        policy-version: 1.0.0
+      properties:
+        engineServiceParameters:
+          name: LinkMonitorApexEngine
+          version: 0.0.1
+          id: 101
+          instanceCount: 1
+          deploymentPort: 12345
+          engineParameters:
+            executorParameters:
+              JAVASCRIPT:
+                parameterClassName: org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters
+            contextParameters:
+              parameterClassName: org.onap.policy.apex.context.parameters.ContextParameters
+              schemaParameters:
+                Avro:
+                  parameterClassName: org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters
+            taskParameters:
+            - key: ORU-ODU-Map
+              value: |-
+                {"ERICSSON-O-RU-11220": "HCL-O-DU-1122",
+                                               "ERICSSON-O-RU-11221": "HCL-O-DU-1122",
+                                               "ERICSSON-O-RU-11222": "HCL-O-DU-1122",
+                                               "ERICSSON-O-RU-11223": "HCL-O-DU-1122",
+                                               "ERICSSON-O-RU-11224": "HCL-O-DU-1123",
+                                               "ERICSSON-O-RU-11225": "HCL-O-DU-1123",
+                                               "ERICSSON-O-RU-11226": "HCL-O-DU-1123",
+                                               "ERICSSON-O-RU-11227": "HCL-O-DU-1124",
+                                               "ERICSSON-O-RU-11228": "HCL-O-DU-1125",
+                                               "ERICSSON-O-RU-11229": "HCL-O-DU-1125"}
+          policy_type_impl:
+            apexPolicyModel:
+              key:
+                name: LinkMonitorModel
+                version: 0.0.1
+              keyInformation:
+                key:
+                  name: LinkMonitorModel_KeyInfo
+                  version: 0.0.1
+                keyInfoMap:
+                  entry:
+                  - key:
+                      name: ApexMessageOutputEvent
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: ApexMessageOutputEvent
+                        version: 0.0.1
+                      UUID: cca47d74-7754-4a61-b163-ca31f66b157b
+                      description: Generated description for concept referred to by
+                        key "ApexMessageOutputEvent:0.0.1"
+                  - key:
+                      name: CreateLinkClearedOutfieldsEvent
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: CreateLinkClearedOutfieldsEvent
+                        version: 0.0.1
+                      UUID: a295d6a3-1b73-387e-abba-b41e9b608802
+                      description: Generated description for concept referred to by
+                        key "CreateLinkClearedOutfieldsEvent:0.0.1"
+                  - key:
+                      name: CreateLinkClearedOutfieldsTask
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: CreateLinkClearedOutfieldsTask
+                        version: 0.0.1
+                      UUID: fd594e88-411d-4a94-b2be-697b3a0d7adf
+                      description: This task creates the output fields when link failure
+                        is cleared.
+                  - key:
+                      name: CreateLinkFailureOutfieldsEvent
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: CreateLinkFailureOutfieldsEvent
+                        version: 0.0.1
+                      UUID: 02be2b5d-45b7-3c54-ae54-97f2b5c30125
+                      description: Generated description for concept referred to by
+                        key "CreateLinkFailureOutfieldsEvent:0.0.1"
+                  - key:
+                      name: CreateLinkFailureOutfieldsTask
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: CreateLinkFailureOutfieldsTask
+                        version: 0.0.1
+                      UUID: ac3d9842-80af-4a98-951c-bd79a431c613
+                      description: This task the output fields when link failure is
+                        detected.
+                  - key:
+                      name: LinkClearedTask
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkClearedTask
+                        version: 0.0.1
+                      UUID: eecfde90-896c-4343-8f9c-2603ced94e2d
+                      description: This task sends a message to the output when link
+                        failure is cleared.
+                  - key:
+                      name: LinkFailureInputEvent
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkFailureInputEvent
+                        version: 0.0.1
+                      UUID: c4500941-3f98-4080-a9cc-5b9753ed050b
+                      description: Generated description for concept referred to by
+                        key "LinkFailureInputEvent:0.0.1"
+                  - key:
+                      name: LinkFailureInputSchema
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkFailureInputSchema
+                        version: 0.0.1
+                      UUID: 3b3974fc-3012-3b02-9f33-c9d8eefe4dc1
+                      description: Generated description for concept referred to by
+                        key "LinkFailureInputSchema:0.0.1"
+                  - key:
+                      name: LinkFailureOutputEvent
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkFailureOutputEvent
+                        version: 0.0.1
+                      UUID: 4f04aa98-e917-4f4a-882a-c75ba5a99374
+                      description: Generated description for concept referred to by
+                        key "LinkFailureOutputEvent:0.0.1"
+                  - key:
+                      name: LinkFailureOutputSchema
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkFailureOutputSchema
+                        version: 0.0.1
+                      UUID: 2d1a7f6e-eb9a-3984-be1f-283d98111b84
+                      description: Generated description for concept referred to by
+                        key "LinkFailureOutputSchema:0.0.1"
+                  - key:
+                      name: LinkFailureTask
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkFailureTask
+                        version: 0.0.1
+                      UUID: 3351b0f4-cf06-4fa2-8823-edf67bd30223
+                      description: This task updates the config for O-RU when link
+                        failure is detected.
+                  - key:
+                      name: LinkMonitorModel
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkMonitorModel
+                        version: 0.0.1
+                      UUID: 540226fb-55ee-4f0e-a444-983a0494818e
+                      description: This is the Apex Policy Model for link monitoring.
+                  - key:
+                      name: LinkMonitorModel_Events
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkMonitorModel_Events
+                        version: 0.0.1
+                      UUID: 27ad3e7e-fe3b-3bd6-9081-718705c2bcea
+                      description: Generated description for concept referred to by
+                        key "LinkMonitorModel_Events:0.0.1"
+                  - key:
+                      name: LinkMonitorModel_KeyInfo
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkMonitorModel_KeyInfo
+                        version: 0.0.1
+                      UUID: ea0b5f58-eefd-358a-9660-840c640bf981
+                      description: Generated description for concept referred to by
+                        key "LinkMonitorModel_KeyInfo:0.0.1"
+                  - key:
+                      name: LinkMonitorModel_Policies
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkMonitorModel_Policies
+                        version: 0.0.1
+                      UUID: ee9e0b0f-2b7d-3ab7-9a98-c5ec05ed823d
+                      description: Generated description for concept referred to by
+                        key "LinkMonitorModel_Policies:0.0.1"
+                  - key:
+                      name: LinkMonitorModel_Schemas
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkMonitorModel_Schemas
+                        version: 0.0.1
+                      UUID: fa5f9b8f-796c-3c70-84e9-5140c958c4bb
+                      description: Generated description for concept referred to by
+                        key "LinkMonitorModel_Schemas:0.0.1"
+                  - key:
+                      name: LinkMonitorModel_Tasks
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkMonitorModel_Tasks
+                        version: 0.0.1
+                      UUID: eec592f7-69d5-39a9-981a-e552f787ed01
+                      description: Generated description for concept referred to by
+                        key "LinkMonitorModel_Tasks:0.0.1"
+                  - key:
+                      name: LinkMonitorPolicy
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkMonitorPolicy
+                        version: 0.0.1
+                      UUID: 6c5e410f-489a-46ff-964e-982ce6e8b6d0
+                      description: Generated description for concept referred to by
+                        key "LinkMonitorPolicy:0.0.1"
+                  - key:
+                      name: MessageSchema
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: MessageSchema
+                        version: 0.0.1
+                      UUID: ac4b34ac-39d6-3393-a267-8d5b84854018
+                      description: A schema for messages from apex
+                  - key:
+                      name: NoPolicyDefinedTask
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: NoPolicyDefinedTask
+                        version: 0.0.1
+                      UUID: d48b619e-d00d-4008-b884-02d76ea4350b
+                      description: This task sends a message to the output when an
+                        event is received for which no policy has been defined.
+                  - key:
+                      name: OduIdSchema
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: OduIdSchema
+                        version: 0.0.1
+                      UUID: 50662174-a88b-3cbd-91bd-8e91b40b2660
+                      description: A schema for O-DU-ID
+                  - key:
+                      name: OruIdSchema
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: OruIdSchema
+                        version: 0.0.1
+                      UUID: 54daf32b-015f-39cd-8530-a1175c5553e9
+                      description: A schema for O-RU-ID
+              policies:
+                key:
+                  name: LinkMonitorModel_Policies
+                  version: 0.0.1
+                policyMap:
+                  entry:
+                  - key:
+                      name: LinkMonitorPolicy
+                      version: 0.0.1
+                    value:
+                      policyKey:
+                        name: LinkMonitorPolicy
+                        version: 0.0.1
+                      template: Freestyle
+                      state:
+                        entry:
+                        - key: LinkClearedState
+                          value:
+                            stateKey:
+                              parentKeyName: LinkMonitorPolicy
+                              parentKeyVersion: 0.0.1
+                              parentLocalName: 'NULL'
+                              localName: LinkClearedState
+                            trigger:
+                              name: CreateLinkClearedOutfieldsEvent
+                              version: 0.0.1
+                            stateOutputs:
+                              entry:
+                              - key: LinkClearedLogic_Output_Direct
+                                value:
+                                  key:
+                                    parentKeyName: LinkMonitorPolicy
+                                    parentKeyVersion: 0.0.1
+                                    parentLocalName: LinkClearedState
+                                    localName: LinkClearedLogic_Output_Direct
+                                  outgoingEvent:
+                                    name: ApexMessageOutputEvent
+                                    version: 0.0.1
+                                  nextState:
+                                    parentKeyName: 'NULL'
+                                    parentKeyVersion: 0.0.0
+                                    parentLocalName: 'NULL'
+                                    localName: 'NULL'
+                            contextAlbumReference: []
+                            taskSelectionLogic:
+                              key: 'NULL'
+                              logicFlavour: UNDEFINED
+                              logic: ''
+                            stateFinalizerLogicMap:
+                              entry: []
+                            defaultTask:
+                              name: LinkClearedTask
+                              version: 0.0.1
+                            taskReferences:
+                              entry:
+                              - key:
+                                  name: LinkClearedTask
+                                  version: 0.0.1
+                                value:
+                                  key:
+                                    parentKeyName: LinkMonitorPolicy
+                                    parentKeyVersion: 0.0.1
+                                    parentLocalName: LinkClearedState
+                                    localName: LinkClearedTask
+                                  outputType: DIRECT
+                                  output:
+                                    parentKeyName: LinkMonitorPolicy
+                                    parentKeyVersion: 0.0.1
+                                    parentLocalName: LinkClearedState
+                                    localName: LinkClearedLogic_Output_Direct
+                        - key: LinkFailureOrClearedState
+                          value:
+                            stateKey:
+                              parentKeyName: LinkMonitorPolicy
+                              parentKeyVersion: 0.0.1
+                              parentLocalName: 'NULL'
+                              localName: LinkFailureOrClearedState
+                            trigger:
+                              name: LinkFailureInputEvent
+                              version: 0.0.1
+                            stateOutputs:
+                              entry:
+                              - key: CreateLinkClearedOutfieldsLogic_Output_Direct
+                                value:
+                                  key:
+                                    parentKeyName: LinkMonitorPolicy
+                                    parentKeyVersion: 0.0.1
+                                    parentLocalName: LinkFailureOrClearedState
+                                    localName: CreateLinkClearedOutfieldsLogic_Output_Direct
+                                  outgoingEvent:
+                                    name: CreateLinkClearedOutfieldsEvent
+                                    version: 0.0.1
+                                  nextState:
+                                    parentKeyName: LinkMonitorPolicy
+                                    parentKeyVersion: 0.0.1
+                                    parentLocalName: 'NULL'
+                                    localName: LinkClearedState
+                              - key: CreateLinkFailureOutfieldsLogic_Output_Direct
+                                value:
+                                  key:
+                                    parentKeyName: LinkMonitorPolicy
+                                    parentKeyVersion: 0.0.1
+                                    parentLocalName: LinkFailureOrClearedState
+                                    localName: CreateLinkFailureOutfieldsLogic_Output_Direct
+                                  outgoingEvent:
+                                    name: CreateLinkFailureOutfieldsEvent
+                                    version: 0.0.1
+                                  nextState:
+                                    parentKeyName: LinkMonitorPolicy
+                                    parentKeyVersion: 0.0.1
+                                    parentLocalName: 'NULL'
+                                    localName: LinkFailureState
+                              - key: NoPolicyDefinedLogic_Output_Direct
+                                value:
+                                  key:
+                                    parentKeyName: LinkMonitorPolicy
+                                    parentKeyVersion: 0.0.1
+                                    parentLocalName: LinkFailureOrClearedState
+                                    localName: NoPolicyDefinedLogic_Output_Direct
+                                  outgoingEvent:
+                                    name: ApexMessageOutputEvent
+                                    version: 0.0.1
+                                  nextState:
+                                    parentKeyName: 'NULL'
+                                    parentKeyVersion: 0.0.0
+                                    parentLocalName: 'NULL'
+                                    localName: 'NULL'
+                            contextAlbumReference: []
+                            taskSelectionLogic:
+                              key: TaskSelectionLogic
+                              logicFlavour: JAVASCRIPT
+                              logic: |-
+                                /*
+                                 * ============LICENSE_START=======================================================
+                                 * Copyright (C) 2021 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=========================================================
+                                 */
+
+                                executor.logger.info("Task Selection Execution: '"+executor.subject.id+
+                                    "'. InputFields: '"+executor.inFields+"'");
+
+                                var linkFailureInput = executor.inFields.get("LinkFailureInput");
+                                var commonEventHeader = linkFailureInput.get("event").get("commonEventHeader");
+                                var domain = commonEventHeader.get("domain");
+
+                                taskFailure = executor.subject.getTaskKey("CreateLinkFailureOutfieldsTask");
+                                taskCleared = executor.subject.getTaskKey("CreateLinkClearedOutfieldsTask");
+                                taskDefault = executor.subject.getDefaultTaskKey();
+
+                                if (domain == "fault") {
+                                    var faultFields = linkFailureInput.get("event").get("faultFields");
+                                    var alarmCondition = faultFields.get("alarmCondition");
+                                    var eventSeverity = faultFields.get("eventSeverity");
+                                    if (alarmCondition == "28" && eventSeverity != "NORMAL") {
+                                        taskFailure.copyTo(executor.selectedTask);
+                                    } else if (alarmCondition == "28" && eventSeverity == "NORMAL") {
+                                        taskCleared.copyTo(executor.selectedTask);
+                                    } else {
+                                        taskDefault.copyTo(executor.selectedTask);
+                                    }
+                                } else {
+                                    taskDefault.copyTo(executor.selectedTask);
+                                }
+
+                                true;
+                            stateFinalizerLogicMap:
+                              entry: []
+                            defaultTask:
+                              name: NoPolicyDefinedTask
+                              version: 0.0.1
+                            taskReferences:
+                              entry:
+                              - key:
+                                  name: CreateLinkClearedOutfieldsTask
+                                  version: 0.0.1
+                                value:
+                                  key:
+                                    parentKeyName: LinkMonitorPolicy
+                                    parentKeyVersion: 0.0.1
+                                    parentLocalName: LinkFailureOrClearedState
+                                    localName: CreateLinkClearedOutfieldsTask
+                                  outputType: DIRECT
+                                  output:
+                                    parentKeyName: LinkMonitorPolicy
+                                    parentKeyVersion: 0.0.1
+                                    parentLocalName: LinkFailureOrClearedState
+                                    localName: CreateLinkClearedOutfieldsLogic_Output_Direct
+                              - key:
+                                  name: CreateLinkFailureOutfieldsTask
+                                  version: 0.0.1
+                                value:
+                                  key:
+                                    parentKeyName: LinkMonitorPolicy
+                                    parentKeyVersion: 0.0.1
+                                    parentLocalName: LinkFailureOrClearedState
+                                    localName: CreateLinkFailureOutfieldsTask
+                                  outputType: DIRECT
+                                  output:
+                                    parentKeyName: LinkMonitorPolicy
+                                    parentKeyVersion: 0.0.1
+                                    parentLocalName: LinkFailureOrClearedState
+                                    localName: CreateLinkFailureOutfieldsLogic_Output_Direct
+                              - key:
+                                  name: NoPolicyDefinedTask
+                                  version: 0.0.1
+                                value:
+                                  key:
+                                    parentKeyName: LinkMonitorPolicy
+                                    parentKeyVersion: 0.0.1
+                                    parentLocalName: LinkFailureOrClearedState
+                                    localName: NoPolicyDefinedTask
+                                  outputType: DIRECT
+                                  output:
+                                    parentKeyName: LinkMonitorPolicy
+                                    parentKeyVersion: 0.0.1
+                                    parentLocalName: LinkFailureOrClearedState
+                                    localName: NoPolicyDefinedLogic_Output_Direct
+                        - key: LinkFailureState
+                          value:
+                            stateKey:
+                              parentKeyName: LinkMonitorPolicy
+                              parentKeyVersion: 0.0.1
+                              parentLocalName: 'NULL'
+                              localName: LinkFailureState
+                            trigger:
+                              name: CreateLinkFailureOutfieldsEvent
+                              version: 0.0.1
+                            stateOutputs:
+                              entry:
+                              - key: LinkFailureLogic_Output_Direct
+                                value:
+                                  key:
+                                    parentKeyName: LinkMonitorPolicy
+                                    parentKeyVersion: 0.0.1
+                                    parentLocalName: LinkFailureState
+                                    localName: LinkFailureLogic_Output_Direct
+                                  outgoingEvent:
+                                    name: LinkFailureOutputEvent
+                                    version: 0.0.1
+                                  nextState:
+                                    parentKeyName: 'NULL'
+                                    parentKeyVersion: 0.0.0
+                                    parentLocalName: 'NULL'
+                                    localName: 'NULL'
+                            contextAlbumReference: []
+                            taskSelectionLogic:
+                              key: 'NULL'
+                              logicFlavour: UNDEFINED
+                              logic: ''
+                            stateFinalizerLogicMap:
+                              entry: []
+                            defaultTask:
+                              name: LinkFailureTask
+                              version: 0.0.1
+                            taskReferences:
+                              entry:
+                              - key:
+                                  name: LinkFailureTask
+                                  version: 0.0.1
+                                value:
+                                  key:
+                                    parentKeyName: LinkMonitorPolicy
+                                    parentKeyVersion: 0.0.1
+                                    parentLocalName: LinkFailureState
+                                    localName: LinkFailureTask
+                                  outputType: DIRECT
+                                  output:
+                                    parentKeyName: LinkMonitorPolicy
+                                    parentKeyVersion: 0.0.1
+                                    parentLocalName: LinkFailureState
+                                    localName: LinkFailureLogic_Output_Direct
+                      firstState: LinkFailureOrClearedState
+              tasks:
+                key:
+                  name: LinkMonitorModel_Tasks
+                  version: 0.0.1
+                taskMap:
+                  entry:
+                  - key:
+                      name: CreateLinkClearedOutfieldsTask
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: CreateLinkClearedOutfieldsTask
+                        version: 0.0.1
+                      inputFields:
+                        entry:
+                        - key: LinkFailureInput
+                          value:
+                            key: LinkFailureInput
+                            fieldSchemaKey:
+                              name: LinkFailureInputSchema
+                              version: 0.0.1
+                            optional: false
+                      outputFields:
+                        entry:
+                        - key: OruId
+                          value:
+                            key: OruId
+                            fieldSchemaKey:
+                              name: OruIdSchema
+                              version: 0.0.1
+                            optional: false
+                      taskParameters:
+                        entry: []
+                      contextAlbumReference: []
+                      taskLogic:
+                        key: TaskLogic
+                        logicFlavour: JAVASCRIPT
+                        logic: |-
+                          /*
+                           * ============LICENSE_START=======================================================
+                           * Copyright (C) 2021 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=========================================================
+                           */
+
+                          executor.logger.info("Task Execution: '"+executor.subject.id+"'. Input Fields: '"+executor.inFields+"'");
+
+                          var linkFailureInput = executor.inFields.get("LinkFailureInput");
+                          var oruId = linkFailureInput.get("event").get("commonEventHeader").get("sourceName");
+
+                          executor.outFields.put("OruId", oruId);
+
+                          executor.logger.info(executor.outFields);
+
+                          true;
+                  - key:
+                      name: CreateLinkFailureOutfieldsTask
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: CreateLinkFailureOutfieldsTask
+                        version: 0.0.1
+                      inputFields:
+                        entry:
+                        - key: LinkFailureInput
+                          value:
+                            key: LinkFailureInput
+                            fieldSchemaKey:
+                              name: LinkFailureInputSchema
+                              version: 0.0.1
+                            optional: false
+                      outputFields:
+                        entry:
+                        - key: OduId
+                          value:
+                            key: OduId
+                            fieldSchemaKey:
+                              name: OduIdSchema
+                              version: 0.0.1
+                            optional: false
+                        - key: OruId
+                          value:
+                            key: OruId
+                            fieldSchemaKey:
+                              name: OruIdSchema
+                              version: 0.0.1
+                            optional: false
+                      taskParameters:
+                        entry: []
+                      contextAlbumReference: []
+                      taskLogic:
+                        key: TaskLogic
+                        logicFlavour: JAVASCRIPT
+                        logic: |-
+                          /*
+                           * ============LICENSE_START=======================================================
+                           * Copyright (C) 2021 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=========================================================
+                           */
+
+                          executor.logger.info("Task Execution: '"+executor.subject.id+"'. Input Fields: '"+executor.inFields+"'");
+
+                          var returnValue = true;
+                          var linkFailureInput = executor.inFields.get("LinkFailureInput");
+                          var oruId = linkFailureInput.get("event").get("commonEventHeader").get("sourceName");
+                          var oruOduMap = JSON.parse(executor.parameters.get("ORU-ODU-Map"));
+
+                          if (oruId in oruOduMap) {
+                              var oduId = oruOduMap[oruId];
+                              executor.outFields.put("OruId", oruId);
+                              executor.outFields.put("OduId", oduId);
+                              executor.logger.info(executor.outFields);
+                          } else {
+                              executor.message = "No O-RU found in the config with this ID: " + oruId;
+                              returnValue = false;
+                          }
+
+                          returnValue;
+                  - key:
+                      name: LinkClearedTask
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkClearedTask
+                        version: 0.0.1
+                      inputFields:
+                        entry:
+                        - key: OruId
+                          value:
+                            key: OruId
+                            fieldSchemaKey:
+                              name: OruIdSchema
+                              version: 0.0.1
+                            optional: false
+                      outputFields:
+                        entry:
+                        - key: message
+                          value:
+                            key: message
+                            fieldSchemaKey:
+                              name: MessageSchema
+                              version: 0.0.1
+                            optional: false
+                      taskParameters:
+                        entry: []
+                      contextAlbumReference: []
+                      taskLogic:
+                        key: TaskLogic
+                        logicFlavour: JAVASCRIPT
+                        logic: |-
+                          /*
+                           * ============LICENSE_START=======================================================
+                           * Copyright (C) 2021 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=========================================================
+                           */
+
+                          executor.logger.info("Task Execution: '"+executor.subject.id+"'. Input Fields: '"+executor.inFields+"'");
+
+                          var oruId = executor.inFields.get("OruId");
+
+                          executor.outFields.put("message", "CLEARED link failure for O-RU: " + oruId);
+
+                          executor.logger.info(executor.outFields);
+
+                          true;
+                  - key:
+                      name: LinkFailureTask
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkFailureTask
+                        version: 0.0.1
+                      inputFields:
+                        entry:
+                        - key: OduId
+                          value:
+                            key: OduId
+                            fieldSchemaKey:
+                              name: OduIdSchema
+                              version: 0.0.1
+                            optional: false
+                        - key: OruId
+                          value:
+                            key: OruId
+                            fieldSchemaKey:
+                              name: OruIdSchema
+                              version: 0.0.1
+                            optional: false
+                      outputFields:
+                        entry:
+                        - key: LinkFailureOutput
+                          value:
+                            key: LinkFailureOutput
+                            fieldSchemaKey:
+                              name: LinkFailureOutputSchema
+                              version: 0.0.1
+                            optional: false
+                      taskParameters:
+                        entry: []
+                      contextAlbumReference: []
+                      taskLogic:
+                        key: TaskLogic
+                        logicFlavour: JAVASCRIPT
+                        logic: |-
+                          /*
+                           * ============LICENSE_START=======================================================
+                           * Copyright (C) 2021 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=========================================================
+                           */
+
+                          executor.logger.info("Task Execution: '"+executor.subject.id+"'. Input Fields: '"+executor.inFields+"'");
+
+                          var linkFailureOutput = executor.subject.getOutFieldSchemaHelper("LinkFailureOutput").createNewInstance();
+
+                          var oruId = executor.inFields.get("OruId");
+                          var oduId = executor.inFields.get("OduId");
+
+                          var unlockMessageArray = new java.util.ArrayList();
+                          for (var i = 0; i < 1; i++) {
+                              unlockMessageArray.add({
+                                  "name" : oruId,
+                                  "administrative_DasH_state" : "UNLOCKED"
+                              });
+                          }
+
+                          linkFailureOutput.put("o_DasH_ran_DasH_sc_DasH_du_DasH_hello_DasH_world_ColoN_du_DasH_to_DasH_ru_DasH_connection", unlockMessageArray);
+                          executor.outFields.put("LinkFailureOutput", linkFailureOutput.toString());
+
+                          executor.getExecutionProperties().setProperty("OduId", oduId);
+                          executor.getExecutionProperties().setProperty("OruId", oruId);
+
+                          executor.logger.info(executor.outFields);
+
+                          true;
+                  - key:
+                      name: NoPolicyDefinedTask
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: NoPolicyDefinedTask
+                        version: 0.0.1
+                      inputFields:
+                        entry:
+                        - key: LinkFailureInput
+                          value:
+                            key: LinkFailureInput
+                            fieldSchemaKey:
+                              name: LinkFailureInputSchema
+                              version: 0.0.1
+                            optional: false
+                      outputFields:
+                        entry:
+                        - key: message
+                          value:
+                            key: message
+                            fieldSchemaKey:
+                              name: MessageSchema
+                              version: 0.0.1
+                            optional: false
+                      taskParameters:
+                        entry: []
+                      contextAlbumReference: []
+                      taskLogic:
+                        key: TaskLogic
+                        logicFlavour: JAVASCRIPT
+                        logic: |-
+                          /*
+                           * ============LICENSE_START=======================================================
+                           * Copyright (C) 2021 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=========================================================
+                           */
+
+                          executor.logger.info("Task Execution: '"+executor.subject.id+"'. Input Fields: '"+executor.inFields+"'");
+
+                          executor.outFields.put("message", "No policy defined for this event");
+
+                          executor.logger.info(executor.outFields);
+
+                          true;
+              events:
+                key:
+                  name: LinkMonitorModel_Events
+                  version: 0.0.1
+                eventMap:
+                  entry:
+                  - key:
+                      name: ApexMessageOutputEvent
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: ApexMessageOutputEvent
+                        version: 0.0.1
+                      nameSpace: org.onap.policy.apex.auth.clieditor
+                      source: APEX
+                      target: APEX
+                      parameter:
+                        entry:
+                        - key: message
+                          value:
+                            key: message
+                            fieldSchemaKey:
+                              name: MessageSchema
+                              version: 0.0.1
+                            optional: false
+                  - key:
+                      name: CreateLinkClearedOutfieldsEvent
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: CreateLinkClearedOutfieldsEvent
+                        version: 0.0.1
+                      nameSpace: org.onap.policy.apex.auth.clieditor
+                      source: APEX
+                      target: APEX
+                      parameter:
+                        entry:
+                        - key: OruId
+                          value:
+                            key: OruId
+                            fieldSchemaKey:
+                              name: OruIdSchema
+                              version: 0.0.1
+                            optional: false
+                  - key:
+                      name: CreateLinkFailureOutfieldsEvent
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: CreateLinkFailureOutfieldsEvent
+                        version: 0.0.1
+                      nameSpace: org.onap.policy.apex.auth.clieditor
+                      source: APEX
+                      target: APEX
+                      parameter:
+                        entry:
+                        - key: OduId
+                          value:
+                            key: OduId
+                            fieldSchemaKey:
+                              name: OduIdSchema
+                              version: 0.0.1
+                            optional: false
+                        - key: OruId
+                          value:
+                            key: OruId
+                            fieldSchemaKey:
+                              name: OruIdSchema
+                              version: 0.0.1
+                            optional: false
+                  - key:
+                      name: LinkFailureInputEvent
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkFailureInputEvent
+                        version: 0.0.1
+                      nameSpace: org.onap.policy.apex.auth.clieditor
+                      source: DMAAP
+                      target: APEX
+                      parameter:
+                        entry:
+                        - key: LinkFailureInput
+                          value:
+                            key: LinkFailureInput
+                            fieldSchemaKey:
+                              name: LinkFailureInputSchema
+                              version: 0.0.1
+                            optional: false
+                  - key:
+                      name: LinkFailureOutputEvent
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkFailureOutputEvent
+                        version: 0.0.1
+                      nameSpace: org.onap.policy.apex.auth.clieditor
+                      source: APEX
+                      target: OAM
+                      parameter:
+                        entry:
+                        - key: LinkFailureOutput
+                          value:
+                            key: LinkFailureOutput
+                            fieldSchemaKey:
+                              name: LinkFailureOutputSchema
+                              version: 0.0.1
+                            optional: false
+              schemas:
+                key:
+                  name: LinkMonitorModel_Schemas
+                  version: 0.0.1
+                schemas:
+                  entry:
+                  - key:
+                      name: LinkFailureInputSchema
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkFailureInputSchema
+                        version: 0.0.1
+                      schemaFlavour: Avro
+                      schemaDefinition: |-
+                        {
+                            "type": "record",
+                            "name": "Link_Failure_Input",
+                            "fields": [
+                                {
+                                    "name": "event",
+                                    "type": {
+                                        "type": "record",
+                                        "name": "Event_Type",
+                                        "fields": [
+                                            {
+                                                "name": "commonEventHeader",
+                                                "type": {
+                                                    "type": "record",
+                                                    "name": "Common_Event_Header_Type",
+                                                    "fields": [
+                                                        {
+                                                            "name": "domain",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "eventId",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "eventName",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "eventType",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "sequence",
+                                                            "type": "int"
+                                                        },
+                                                        {
+                                                            "name": "priority",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "reportingEntityId",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "reportingEntityName",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "sourceId",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "sourceName",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "startEpochMicrosec",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "lastEpochMicrosec",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "nfNamingCode",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "nfVendorName",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "timeZoneOffset",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "version",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "vesEventListenerVersion",
+                                                            "type": "string"
+                                                        }
+                                                    ]
+                                                }
+                                            },
+                                            {
+                                                "name": "faultFields",
+                                                "type": {
+                                                    "type": "record",
+                                                    "name": "Fault_Fields_Type",
+                                                    "fields": [
+                                                        {
+                                                            "name": "faultFieldsVersion",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "alarmCondition",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "alarmInterfaceA",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "eventSourceType",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "specificProblem",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "eventSeverity",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "vfStatus",
+                                                            "type": "string"
+                                                        },
+                                                        {
+                                                            "name": "alarmAdditionalInformation",
+                                                            "type": {
+                                                                "type": "record",
+                                                                "name": "Alarm_Additional_Information_Type",
+                                                                "fields": [
+                                                                    {
+                                                                        "name": "eventTime",
+                                                                        "type": "string"
+                                                                    },
+                                                                    {
+                                                                        "name": "equipType",
+                                                                        "type": "string"
+                                                                    },
+                                                                    {
+                                                                        "name": "vendor",
+                                                                        "type": "string"
+                                                                    },
+                                                                    {
+                                                                        "name": "model",
+                                                                        "type": "string"
+                                                                    }
+                                                                ]
+                                                            }
+                                                        }
+                                                    ]
+                                                }
+                                            }
+                                        ]
+                                    }
+                                }
+                            ]
+                        }
+                  - key:
+                      name: LinkFailureOutputSchema
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: LinkFailureOutputSchema
+                        version: 0.0.1
+                      schemaFlavour: Avro
+                      schemaDefinition: "{\n    \"type\": \"record\",\n    \"name\":
+                        \"Link_Failure_Output\",\n    \"fields\": [\n        {\n            \"name\":
+                        \"o_DasH_ran_DasH_sc_DasH_du_DasH_hello_DasH_world_ColoN_du_DasH_to_DasH_ru_DasH_connection\",\n
+                        \           \"type\": {\n        \t\"type\": \"array\",\n
+                        \       \t\"items\": {\n\t\t    \"name\": \"Config_Change_Message\",\n
+                        \                   \"type\": \"record\",\n                    \"fields\":
+                        [\n                        {\n                            \"name\":
+                        \"name\",\n                            \"type\": \"string\"\n
+                        \                       },\n\t\t\t{\n                            \"name\":
+                        \"administrative_DasH_state\",\n                            \"type\":
+                        \"string\"\n                        }\n                    ]\n
+                        \               }\n\t    }\n        }\n    ]\n}"
+                  - key:
+                      name: MessageSchema
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: MessageSchema
+                        version: 0.0.1
+                      schemaFlavour: Java
+                      schemaDefinition: java.lang.String
+                  - key:
+                      name: OduIdSchema
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: OduIdSchema
+                        version: 0.0.1
+                      schemaFlavour: Java
+                      schemaDefinition: java.lang.String
+                  - key:
+                      name: OruIdSchema
+                      version: 0.0.1
+                    value:
+                      key:
+                        name: OruIdSchema
+                        version: 0.0.1
+                      schemaFlavour: Java
+                      schemaDefinition: java.lang.String
+        eventOutputParameters:
+          RestProducer:
+            carrierTechnologyParameters:
+              carrierTechnology: RESTCLIENT
+              parameterClassName: org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters
+              parameters:
+                url: http://sdnr-sim:9990/rests/data/network-topology:network-topology/topology=topology-netconf/node={OduId}/yang-ext:mount/o-ran-sc-du-hello-world:network-function/du-to-ru-connection={OruId}
+                httpMethod: PUT
+                httpHeaders:
+                - - Authorization
+                  - Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==
+            eventProtocolParameters:
+              eventProtocol: JSON
+              parameters:
+                pojoField: LinkFailureOutput
+            eventNameFilter: LinkFailureOutputEvent
+          StdOutProducer:
+            carrierTechnologyParameters:
+              carrierTechnology: FILE
+              parameters:
+                standardIo: true
+            eventProtocolParameters:
+              eventProtocol: JSON
+              parameters:
+                pojoField: message
+            eventNameFilter: ApexMessageOutputEvent
+        eventInputParameters:
+          DMaaPConsumer:
+            carrierTechnologyParameters:
+              carrierTechnology: RESTCLIENT
+              parameterClassName: org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters
+              parameters:
+                url: http://onap-dmaap:3904/events/unauthenticated.SEC_FAULT_OUTPUT/users/link-monitor-nonrtric?timeout=15000&limit=100
+            eventProtocolParameters:
+              eventProtocol: JSON
+              parameters:
+                versionAlias: version
+                pojoField: LinkFailureInput
+            eventName: LinkFailureInputEvent
diff --git a/test/usecases/oruclosedlooprecovery/apexpolicyversion/LinkMonitor/controlloop-rest-payloads/instantiation-command.json b/test/usecases/oruclosedlooprecovery/apexpolicyversion/LinkMonitor/controlloop-rest-payloads/instantiation-command.json
new file mode 100644 (file)
index 0000000..a09c112
--- /dev/null
@@ -0,0 +1,9 @@
+{
+    "orderedState": "RUNNING",
+    "controlLoopIdentifierList": [
+        {
+            "name": "LinkMonitorInstance0",
+            "version": "1.0.1"
+        }
+    ]
+}
\ No newline at end of file
diff --git a/test/usecases/oruclosedlooprecovery/apexpolicyversion/LinkMonitor/controlloop-rest-payloads/instantiation.json b/test/usecases/oruclosedlooprecovery/apexpolicyversion/LinkMonitor/controlloop-rest-payloads/instantiation.json
new file mode 100644 (file)
index 0000000..ec01a33
--- /dev/null
@@ -0,0 +1,31 @@
+{
+    "controlLoopList": [
+        {
+            "name": "LinkMonitorInstance0",
+            "version": "1.0.1",
+            "definition": {
+                "name": "org.onap.domain.linkmonitor.LinkMonitorControlLoopDefinition",
+                "version": "1.2.3"
+            },
+            "state": "UNINITIALISED",
+            "orderedState": "UNINITIALISED",
+            "description": "Link Monitor control loop instance 0",
+            "elements": {
+                "709c62b3-8918-41b9-a747-d21eb79c6c22": {
+                    "id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
+                    "definition": {
+                        "name": "org.onap.domain.linkmonitor.LinkMonitorPolicyControlLoopElement",
+                        "version": "1.2.3"
+                    },
+                    "participantType": {
+                        "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
+                        "version": "2.3.1"
+                    },
+                    "state": "UNINITIALISED",
+                    "orderedState": "UNINITIALISED",
+                    "description": "Link Monitor Policy Control Loop Element"
+                }
+            }
+        }
+    ]
+}
\ No newline at end of file