aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Perez Caparros <david.perezcaparros@swisscom.com>2020-03-24 17:19:52 +0000
committerGerrit Code Review <gerrit@onap.org>2020-03-24 17:19:52 +0000
commitfe95ad70a92b12cd3b8864f825fa5d51eb99834d (patch)
treeb232b822e549f85750dc73ab0af33ffbcb1562f5
parent0aa21533e91f400b8a7c80ea5deabef2a857c38f (diff)
parent45343636aeb9c555bbaf9fa66cfe884568647695 (diff)
Merge "Add BBS use case artifacts use case repo"
-rw-r--r--README.md1
-rw-r--r--model/vfc/AccessConnectivityVFC.yaml21
-rw-r--r--model/vfc/CpeVFC.yaml42
-rw-r--r--model/vfc/InternetProfileVFC.yaml26
-rw-r--r--policy/apex/README.md5
-rw-r--r--policy/apex/json/bbs_create_policy.json2517
-rw-r--r--policy/apex/json/bbs_policytypes.json266
-rw-r--r--policy/apex/json/bbs_simple_deploy.json8
8 files changed, 2886 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..c190ccb
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# Broadband Service (BBS) use case
diff --git a/model/vfc/AccessConnectivityVFC.yaml b/model/vfc/AccessConnectivityVFC.yaml
new file mode 100644
index 0000000..3d3df37
--- /dev/null
+++ b/model/vfc/AccessConnectivityVFC.yaml
@@ -0,0 +1,21 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+node_types:
+ org.openecomp.resource.vfc.accessConnectivity:
+ derived_from: tosca.nodes.Root
+ description: olt
+ properties:
+ service_type:
+ type: string
+ required: true
+ upstream_speed:
+ type: string
+ required: true
+ downstream_speed:
+ type: string
+ required: true
+ capabilities:
+ virtual_binding:
+ type: tosca.capabilities.nfv.VirtualBindable
+ occurrences:
+ - 1
+ - UNBOUNDED
diff --git a/model/vfc/CpeVFC.yaml b/model/vfc/CpeVFC.yaml
new file mode 100644
index 0000000..43d4c03
--- /dev/null
+++ b/model/vfc/CpeVFC.yaml
@@ -0,0 +1,42 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+node_types:
+ org.openecomp.resource.vfc.OntPnf:
+ derived_from: org.openecomp.resource.abstract.nodes.PNF
+ properties:
+ cpe_id:
+ type: string
+ required: true
+ pnf_name:
+ type: string
+ required: true
+ mac_addr:
+ type: string
+ required: true
+ manufacturer:
+ type: string
+ required: true
+ serial_num:
+ type: string
+ required: true
+ model:
+ type: string
+ required: true
+ attachment_point:
+ type: string
+ required: true
+ is_pnf:
+ type: boolean
+ required: true
+ default: true
+# ont_type: reuse nf_type in Generic_PNF
+# type: string
+# required: true
+# ont_sw_version: reuse software_versions in Generic_PNF
+# type: string
+# required: true
+ capabilities:
+ virtual_binding:
+ type: tosca.capabilities.nfv.VirtualBindable
+ occurrences:
+ - 1
+ - UNBOUNDED
diff --git a/model/vfc/InternetProfileVFC.yaml b/model/vfc/InternetProfileVFC.yaml
new file mode 100644
index 0000000..d5cdab2
--- /dev/null
+++ b/model/vfc/InternetProfileVFC.yaml
@@ -0,0 +1,26 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+node_types:
+ org.openecomp.resource.vfc.InternetProfile:
+ derived_from: tosca.nodes.Root
+ properties:
+ rg_mac_addr:
+ type: string
+ required: true
+ service_type:
+ type: string
+ required: true
+ upstream_speed:
+ type: string
+ required: true
+ downstream_speed:
+ type: string
+ required: true
+ remote_id:
+ type: string
+ required: true
+ capabilities:
+ virtual_binding:
+ type: tosca.capabilities.nfv.VirtualBindable
+ occurrences:
+ - 1
+ - UNBOUNDED
diff --git a/policy/apex/README.md b/policy/apex/README.md
new file mode 100644
index 0000000..b937d77
--- /dev/null
+++ b/policy/apex/README.md
@@ -0,0 +1,5 @@
+# bbs-apex-policy
+Deploy BBS policy in EL-Alto [README.md](el-alto/README.md)
+
+Deploy BBS policy in Master(2.3) [README.md](master/README.md)
+
diff --git a/policy/apex/json/bbs_create_policy.json b/policy/apex/json/bbs_create_policy.json
new file mode 100644
index 0000000..099ab20
--- /dev/null
+++ b/policy/apex/json/bbs_create_policy.json
@@ -0,0 +1,2517 @@
+{
+ "tosca_definitions_version": "tosca_simple_yaml_1_0_0",
+ "topology_template": {
+ "policies": [
+ {
+ "operational.onapbbs": {
+ "type": "onap.policies.controlloop.operational.Apex",
+ "typeVersion": "1.0.0",
+ "name": "onap.policies.controlloop.operational.apex.onapbbs",
+ "version": "1.0.0",
+ "properties": {
+ "engineServiceParameters": {
+ "name": "NomadicONTPolicyModelEngine",
+ "version": "0.0.1",
+ "id": 101,
+ "instanceCount": 4,
+ "deploymentPort": 12345,
+ "engineParameters": {
+ "executorParameters": {
+ "MVEL": {
+ "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters"
+ },
+ "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"
+ },
+ "Java": {
+ "parameterClassName": "org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters",
+ "jsonAdapters": {
+ "Instant": {
+ "adaptedClass": "java.time.Instant",
+ "adaptorClass": "org.onap.policy.controlloop.util.Serialization$GsonInstantAdapter"
+ }
+ }
+ }
+ }
+ }
+ },
+ "policy_type_impl": {
+ "apexPolicyModel": {
+ "key": {
+ "name": "NomadicONTPolicyModel",
+ "version": "1.0.2"
+ },
+ "keyInformation": {
+ "key": {
+ "name": "NomadicONTPolicyModel_KeyInfo",
+ "version": "1.0.2"
+ },
+ "keyInfoMap": {
+ "entry": [
+ {
+ "key": {
+ "name": "AAIServiceAssignedTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "AAIServiceAssignedTask",
+ "version": "0.0.1"
+ },
+ "UUID": "2af956bf-4c3f-370b-8112-44d7eca870a7",
+ "description": "Generated description for concept referred to by key \"AAIServiceAssignedTask:0.0.1\""
+ }
+ },
+ {
+ "key": {
+ "name": "AAIServiceCreateTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "AAIServiceCreateTask",
+ "version": "0.0.1"
+ },
+ "UUID": "e1fcaf11-adce-3d40-90e2-9b74d523b7ba",
+ "description": "Generated description for concept referred to by key \"AAIServiceCreateTask:0.0.1\""
+ }
+ },
+ {
+ "key": {
+ "name": "AAI_CPE_AUTH_UPDATE",
+ "version": "1.0.0"
+ },
+ "value": {
+ "key": {
+ "name": "AAI_CPE_AUTH_UPDATE",
+ "version": "1.0.0"
+ },
+ "UUID": "11fbba56-9d56-398b-aa9f-8f1242384de5",
+ "description": "Generated description for concept referred to by key \"AAI_CPE_AUTH_UPDATE:1.0.0\""
+ }
+ },
+ {
+ "key": {
+ "name": "AAI_SERVICE_ASSIGNED",
+ "version": "1.0.0"
+ },
+ "value": {
+ "key": {
+ "name": "AAI_SERVICE_ASSIGNED",
+ "version": "1.0.0"
+ },
+ "UUID": "91964d94-023a-3039-bb27-da28d38206e6",
+ "description": "Generated description for concept referred to by key \"AAI_SERVICE_ASSIGNED:1.0.0\""
+ }
+ },
+ {
+ "key": {
+ "name": "AAI_SERVICE_CREATE",
+ "version": "1.0.0"
+ },
+ "value": {
+ "key": {
+ "name": "AAI_SERVICE_CREATE",
+ "version": "1.0.0"
+ },
+ "UUID": "5ee7ee54-2155-3e11-b899-8af74d8044ce",
+ "description": "Generated description for concept referred to by key \"AAI_SERVICE_CREATE:1.0.0\""
+ }
+ },
+ {
+ "key": {
+ "name": "CPEAuthenticationPolicy",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "CPEAuthenticationPolicy",
+ "version": "0.0.1"
+ },
+ "UUID": "f8c31efd-6755-3bd8-8720-b622e7e61a4d",
+ "description": "Generated description for concept referred to by key \"CPEAuthenticationPolicy:0.0.1\""
+ }
+ },
+ {
+ "key": {
+ "name": "CPE_Authentication",
+ "version": "1.0.2"
+ },
+ "value": {
+ "key": {
+ "name": "CPE_Authentication",
+ "version": "1.0.2"
+ },
+ "UUID": "7fe1283a-ff26-3fdc-9856-bcebd2f7b3d2",
+ "description": "Generated description for concept referred to by key \"CPE_Authentication:1.0.2\""
+ }
+ },
+ {
+ "key": {
+ "name": "END_CONTROL_LOOP",
+ "version": "1.0.0"
+ },
+ "value": {
+ "key": {
+ "name": "END_CONTROL_LOOP",
+ "version": "1.0.0"
+ },
+ "UUID": "e5b7f639-1586-3a51-a968-6315e0b79f27",
+ "description": "Generated description for concept referred to by key \"END_CONTROL_LOOP:1.0.0\""
+ }
+ },
+ {
+ "key": {
+ "name": "END_EVENT",
+ "version": "1.0.0"
+ },
+ "value": {
+ "key": {
+ "name": "END_EVENT",
+ "version": "1.0.0"
+ },
+ "UUID": "0378736c-46f7-39fb-9e89-3c34e124ade1",
+ "description": "Generated description for concept referred to by key \"END_EVENT:1.0.0\""
+ }
+ },
+ {
+ "key": {
+ "name": "ERROR_LOG",
+ "version": "1.0.0"
+ },
+ "value": {
+ "key": {
+ "name": "ERROR_LOG",
+ "version": "1.0.0"
+ },
+ "UUID": "a220439e-cc77-3a05-8ac9-773ab68f417e",
+ "description": "Generated description for concept referred to by key \"ERROR_LOG:1.0.0\""
+ }
+ },
+ {
+ "key": {
+ "name": "ErrorAAIServiceAssignedLogTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "ErrorAAIServiceAssignedLogTask",
+ "version": "0.0.1"
+ },
+ "UUID": "4b5311bb-b3e8-31f6-9ea1-0fd026d739d7",
+ "description": "Generated description for concept referred to by key \"ErrorAAIServiceAssignedLogTask:0.0.1\""
+ }
+ },
+ {
+ "key": {
+ "name": "ErrorSdncResourceUpdateTaskLogTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "ErrorSdncResourceUpdateTaskLogTask",
+ "version": "0.0.1"
+ },
+ "UUID": "daa86721-a761-334f-96bf-6f5c781f65ed",
+ "description": "Generated description for concept referred to by key \"ErrorSdncResourceUpdateTaskLogTask:0.0.1\""
+ }
+ },
+ {
+ "key": {
+ "name": "GetBBSCloseLoopEventTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "GetBBSCloseLoopEventTask",
+ "version": "0.0.1"
+ },
+ "UUID": "0791e26f-5d94-3cee-991c-31f226e83c4e",
+ "description": "Generated description for concept referred to by key \"GetBBSCloseLoopEventTask:0.0.1\""
+ }
+ },
+ {
+ "key": {
+ "name": "NomadicEventSuccessTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "NomadicEventSuccessTask",
+ "version": "0.0.1"
+ },
+ "UUID": "6fe3e6f7-a429-3979-9146-db0fa239591b",
+ "description": "Generated description for concept referred to by key \"NomadicEventSuccessTask:0.0.1\""
+ }
+ },
+ {
+ "key": {
+ "name": "NomadicONTContextAlbum",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "NomadicONTContextAlbum",
+ "version": "0.0.1"
+ },
+ "UUID": "3d9cf947-a5ef-3781-8c70-ec0e94f65693",
+ "description": "Generated description for concept referred to by key \"NomadicONTContextAlbum:0.0.1\""
+ }
+ },
+ {
+ "key": {
+ "name": "NomadicONTContextType",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "NomadicONTContextType",
+ "version": "0.0.1"
+ },
+ "UUID": "b9508c97-79b6-35ec-8e45-731eac9d37cc",
+ "description": "Generated description for concept referred to by key \"NomadicONTContextType:0.0.1\""
+ }
+ },
+ {
+ "key": {
+ "name": "NomadicONTPolicyModel",
+ "version": "1.0.2"
+ },
+ "value": {
+ "key": {
+ "name": "NomadicONTPolicyModel",
+ "version": "1.0.2"
+ },
+ "UUID": "457e3fcf-a901-37b2-bfc0-14d56abfc507",
+ "description": "Generated description for concept referred to by key \"NomadicONTPolicyModel:1.0.2\""
+ }
+ },
+ {
+ "key": {
+ "name": "NomadicONTPolicyModel_Albums",
+ "version": "1.0.2"
+ },
+ "value": {
+ "key": {
+ "name": "NomadicONTPolicyModel_Albums",
+ "version": "1.0.2"
+ },
+ "UUID": "9a0edd63-7d9b-3122-8750-d6a17c248f0f",
+ "description": "Generated description for concept referred to by key \"NomadicONTPolicyModel_Albums:1.0.2\""
+ }
+ },
+ {
+ "key": {
+ "name": "NomadicONTPolicyModel_Events",
+ "version": "1.0.2"
+ },
+ "value": {
+ "key": {
+ "name": "NomadicONTPolicyModel_Events",
+ "version": "1.0.2"
+ },
+ "UUID": "82ff2635-a05e-3b3e-ae59-526735db78fc",
+ "description": "Generated description for concept referred to by key \"NomadicONTPolicyModel_Events:1.0.2\""
+ }
+ },
+ {
+ "key": {
+ "name": "NomadicONTPolicyModel_KeyInfo",
+ "version": "1.0.2"
+ },
+ "value": {
+ "key": {
+ "name": "NomadicONTPolicyModel_KeyInfo",
+ "version": "1.0.2"
+ },
+ "UUID": "530bcf35-a3cb-305a-8b41-0499945b510f",
+ "description": "Generated description for concept referred to by key \"NomadicONTPolicyModel_KeyInfo:1.0.2\""
+ }
+ },
+ {
+ "key": {
+ "name": "NomadicONTPolicyModel_Policies",
+ "version": "1.0.2"
+ },
+ "value": {
+ "key": {
+ "name": "NomadicONTPolicyModel_Policies",
+ "version": "1.0.2"
+ },
+ "UUID": "9223db37-fb3b-3b3f-a85b-eb7e7b3a4e10",
+ "description": "Generated description for concept referred to by key \"NomadicONTPolicyModel_Policies:1.0.2\""
+ }
+ },
+ {
+ "key": {
+ "name": "NomadicONTPolicyModel_Schemas",
+ "version": "1.0.2"
+ },
+ "value": {
+ "key": {
+ "name": "NomadicONTPolicyModel_Schemas",
+ "version": "1.0.2"
+ },
+ "UUID": "41ba496f-6bfb-31e7-972e-6b2fab3e7d52",
+ "description": "Generated description for concept referred to by key \"NomadicONTPolicyModel_Schemas:1.0.2\""
+ }
+ },
+ {
+ "key": {
+ "name": "NomadicONTPolicyModel_Tasks",
+ "version": "1.0.2"
+ },
+ "value": {
+ "key": {
+ "name": "NomadicONTPolicyModel_Tasks",
+ "version": "1.0.2"
+ },
+ "UUID": "c337fda0-0a48-3329-af48-ed710214c092",
+ "description": "Generated description for concept referred to by key \"NomadicONTPolicyModel_Tasks:1.0.2\""
+ }
+ },
+ {
+ "key": {
+ "name": "Nomadic_ONT",
+ "version": "1.0.2"
+ },
+ "value": {
+ "key": {
+ "name": "Nomadic_ONT",
+ "version": "1.0.2"
+ },
+ "UUID": "b375c6f5-19ca-390f-ba19-2a0a49f233af",
+ "description": "Generated description for concept referred to by key \"Nomadic_ONT:1.0.2\""
+ }
+ },
+ {
+ "key": {
+ "name": "ONTRegistrationPolicy",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "ONTRegistrationPolicy",
+ "version": "0.0.1"
+ },
+ "UUID": "45773f7e-e1f6-3286-8f82-144836629edb",
+ "description": "Generated description for concept referred to by key \"ONTRegistrationPolicy:0.0.1\""
+ }
+ },
+ {
+ "key": {
+ "name": "SDNC_RESOURCE_UPDATE",
+ "version": "1.0.0"
+ },
+ "value": {
+ "key": {
+ "name": "SDNC_RESOURCE_UPDATE",
+ "version": "1.0.0"
+ },
+ "UUID": "c8fe0156-80c7-3e8d-8aa8-56be04fb1147",
+ "description": "Generated description for concept referred to by key \"SDNC_RESOURCE_UPDATE:1.0.0\""
+ }
+ },
+ {
+ "key": {
+ "name": "SdncResourceUpdateTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "SdncResourceUpdateTask",
+ "version": "0.0.1"
+ },
+ "UUID": "db7d3e67-12a8-35c8-b063-bc2a1fd77662",
+ "description": "Generated description for concept referred to by key \"SdncResourceUpdateTask:0.0.1\""
+ }
+ },
+ {
+ "key": {
+ "name": "ServiceUpdateStateCpeAuthTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "ServiceUpdateStateCpeAuthTask",
+ "version": "0.0.1"
+ },
+ "UUID": "78fa10b8-23e9-3362-893a-0dd7a656c7b6",
+ "description": "Generated description for concept referred to by key \"ServiceUpdateStateCpeAuthTask:0.0.1\""
+ }
+ },
+ {
+ "key": {
+ "name": "SimpleBooleanType",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "SimpleBooleanType",
+ "version": "0.0.1"
+ },
+ "UUID": "7218fb2f-59e3-321d-9ae1-bc97b19eb4ae",
+ "description": "Generated description for concept referred to by key \"SimpleBooleanType:0.0.1\""
+ }
+ },
+ {
+ "key": {
+ "name": "SimpleLongType",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "SimpleLongType",
+ "version": "0.0.1"
+ },
+ "UUID": "2dfcd9ec-a6f9-3f9f-958f-9b36cf4ac574",
+ "description": "Generated description for concept referred to by key \"SimpleLongType:0.0.1\""
+ }
+ },
+ {
+ "key": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "UUID": "8a4957cf-9493-3a76-8c22-a208e23259af",
+ "description": "Generated description for concept referred to by key \"SimpleStringType:0.0.1\""
+ }
+ },
+ {
+ "key": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "UUID": "6a8cc68e-dfc8-3403-9c6d-071c886b319c",
+ "description": "Generated description for concept referred to by key \"UUIDType:0.0.1\""
+ }
+ },
+ {
+ "key": {
+ "name": "VirtualControlLoopEventType",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "VirtualControlLoopEventType",
+ "version": "0.0.1"
+ },
+ "UUID": "15aca887-8f6c-3713-8114-0f49f03adab7",
+ "description": "Generated description for concept referred to by key \"VirtualControlLoopEventType:0.0.1\""
+ }
+ }
+ ]
+ }
+ },
+ "policies": {
+ "key": {
+ "name": "NomadicONTPolicyModel_Policies",
+ "version": "1.0.2"
+ },
+ "policyMap": {
+ "entry": [
+ {
+ "key": {
+ "name": "CPEAuthenticationPolicy",
+ "version": "0.0.1"
+ },
+ "value": {
+ "policyKey": {
+ "name": "CPEAuthenticationPolicy",
+ "version": "0.0.1"
+ },
+ "template": "Freestyle",
+ "state": {
+ "entry": [
+ {
+ "key": "INIT",
+ "value": {
+ "stateKey": {
+ "parentKeyName": "CPEAuthenticationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "NULL",
+ "localName": "INIT"
+ },
+ "trigger": {
+ "name": "CPE_Authentication",
+ "version": "1.0.2"
+ },
+ "stateOutputs": {
+ "entry": [
+ {
+ "key": "ServiceUpdateCpeAuthOutPut",
+ "value": {
+ "key": {
+ "parentKeyName": "CPEAuthenticationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "INIT",
+ "localName": "ServiceUpdateCpeAuthOutPut"
+ },
+ "outgoingEvent": {
+ "name": "AAI_CPE_AUTH_UPDATE",
+ "version": "1.0.0"
+ },
+ "nextState": {
+ "parentKeyName": "NULL",
+ "parentKeyVersion": "0.0.0",
+ "parentLocalName": "NULL",
+ "localName": "NULL"
+ }
+ }
+ }
+ ]
+ },
+ "contextAlbumReference": [],
+ "taskSelectionLogic": {
+ "key": "NULL",
+ "logicFlavour": "UNDEFINED",
+ "logic": ""
+ },
+ "stateFinalizerLogicMap": {
+ "entry": []
+ },
+ "defaultTask": {
+ "name": "ServiceUpdateStateCpeAuthTask",
+ "version": "0.0.1"
+ },
+ "taskReferences": {
+ "entry": [
+ {
+ "key": {
+ "name": "ServiceUpdateStateCpeAuthTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "parentKeyName": "CPEAuthenticationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "INIT",
+ "localName": "CPEAuthenticationPolicy"
+ },
+ "outputType": "DIRECT",
+ "output": {
+ "parentKeyName": "CPEAuthenticationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "INIT",
+ "localName": "ServiceUpdateCpeAuthOutPut"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ },
+ "firstState": "INIT"
+ }
+ },
+ {
+ "key": {
+ "name": "ONTRegistrationPolicy",
+ "version": "0.0.1"
+ },
+ "value": {
+ "policyKey": {
+ "name": "ONTRegistrationPolicy",
+ "version": "0.0.1"
+ },
+ "template": "Freestyle",
+ "state": {
+ "entry": [
+ {
+ "key": "AAI_SERVICE_ASSIGN",
+ "value": {
+ "stateKey": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "NULL",
+ "localName": "AAI_SERVICE_ASSIGN"
+ },
+ "trigger": {
+ "name": "AAI_SERVICE_ASSIGNED",
+ "version": "1.0.0"
+ },
+ "stateOutputs": {
+ "entry": [
+ {
+ "key": "AAIServiceAssignedOutput",
+ "value": {
+ "key": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "AAI_SERVICE_ASSIGN",
+ "localName": "AAIServiceAssignedOutput"
+ },
+ "outgoingEvent": {
+ "name": "SDNC_RESOURCE_UPDATE",
+ "version": "1.0.0"
+ },
+ "nextState": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "NULL",
+ "localName": "SDNC_RES_UPDATE"
+ }
+ }
+ }
+ ]
+ },
+ "contextAlbumReference": [],
+ "taskSelectionLogic": {
+ "key": "NULL",
+ "logicFlavour": "UNDEFINED",
+ "logic": ""
+ },
+ "stateFinalizerLogicMap": {
+ "entry": []
+ },
+ "defaultTask": {
+ "name": "AAIServiceAssignedTask",
+ "version": "0.0.1"
+ },
+ "taskReferences": {
+ "entry": [
+ {
+ "key": {
+ "name": "AAIServiceAssignedTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "AAI_SERVICE_ASSIGN",
+ "localName": "ONTRegistrationPolicy"
+ },
+ "outputType": "DIRECT",
+ "output": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "AAI_SERVICE_ASSIGN",
+ "localName": "AAIServiceAssignedOutput"
+ }
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "key": "AAI_SERVICE_CREATE",
+ "value": {
+ "stateKey": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "NULL",
+ "localName": "AAI_SERVICE_CREATE"
+ },
+ "trigger": {
+ "name": "AAI_SERVICE_CREATE",
+ "version": "1.0.0"
+ },
+ "stateOutputs": {
+ "entry": [
+ {
+ "key": "AAIServiceCreateTaskOutput",
+ "value": {
+ "key": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "AAI_SERVICE_CREATE",
+ "localName": "AAIServiceCreateTaskOutput"
+ },
+ "outgoingEvent": {
+ "name": "END_CONTROL_LOOP",
+ "version": "1.0.0"
+ },
+ "nextState": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "NULL",
+ "localName": "NOMADIC_ONT_REG_SUCCESS"
+ }
+ }
+ },
+ {
+ "key": "SdncResourceUpdateErrorLogOutput",
+ "value": {
+ "key": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "AAI_SERVICE_CREATE",
+ "localName": "SdncResourceUpdateErrorLogOutput"
+ },
+ "outgoingEvent": {
+ "name": "ERROR_LOG",
+ "version": "1.0.0"
+ },
+ "nextState": {
+ "parentKeyName": "NULL",
+ "parentKeyVersion": "0.0.0",
+ "parentLocalName": "NULL",
+ "localName": "NULL"
+ }
+ }
+ }
+ ]
+ },
+ "contextAlbumReference": [
+ {
+ "name": "NomadicONTContextAlbum",
+ "version": "0.0.1"
+ }
+ ],
+ "taskSelectionLogic": {
+ "key": "TaskSelectionLogic",
+ "logicFlavour": "JAVASCRIPT",
+ "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nexecutor.logger.info(\"Begin Execution SU2orInitStateSelect.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar returnValue = executor.isTrue;\nvar result = null;\n\nvar attachmentPoint = executor.inFields.get(\"attachmentPoint\");\nvar NomadicONTContext = executor.getContextAlbum(\"NomadicONTContextAlbum\").get(\n attachmentPoint);\n\nexecutor.logger.info(executor.inFields);\n\nresult = NomadicONTContext.get(\"result\");\n\nif (result === \"SUCCESS\") {\n executor.subject.getTaskKey(\"AAIServiceCreateTask\").copyTo(executor.selectedTask);\n} else {\n executor.subject.getTaskKey(\"SdncResourceUpdateErrorLogOutput\").copyTo(\n executor.selectedTask);\n onsetFlag = executor.isFalse;\n}\n\nexecutor.logger.info(\"State Selected Task:\" + executor.selectedTask);\nexecutor.logger.info(\"End Execution SU2orInitStateSelect.js\");"
+ },
+ "stateFinalizerLogicMap": {
+ "entry": []
+ },
+ "defaultTask": {
+ "name": "AAIServiceCreateTask",
+ "version": "0.0.1"
+ },
+ "taskReferences": {
+ "entry": [
+ {
+ "key": {
+ "name": "AAIServiceCreateTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "AAI_SERVICE_CREATE",
+ "localName": "ONTRegistrationPolicy"
+ },
+ "outputType": "DIRECT",
+ "output": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "AAI_SERVICE_CREATE",
+ "localName": "AAIServiceCreateTaskOutput"
+ }
+ }
+ },
+ {
+ "key": {
+ "name": "ErrorSdncResourceUpdateTaskLogTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "AAI_SERVICE_CREATE",
+ "localName": "ONTRegistrationPolicy"
+ },
+ "outputType": "DIRECT",
+ "output": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "AAI_SERVICE_CREATE",
+ "localName": "SdncResourceUpdateErrorLogOutput"
+ }
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "key": "INIT",
+ "value": {
+ "stateKey": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "NULL",
+ "localName": "INIT"
+ },
+ "trigger": {
+ "name": "Nomadic_ONT",
+ "version": "1.0.2"
+ },
+ "stateOutputs": {
+ "entry": [
+ {
+ "key": "BBSCloseLoopEventOutPut",
+ "value": {
+ "key": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "INIT",
+ "localName": "BBSCloseLoopEventOutPut"
+ },
+ "outgoingEvent": {
+ "name": "AAI_SERVICE_ASSIGNED",
+ "version": "1.0.0"
+ },
+ "nextState": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "NULL",
+ "localName": "AAI_SERVICE_ASSIGN"
+ }
+ }
+ }
+ ]
+ },
+ "contextAlbumReference": [],
+ "taskSelectionLogic": {
+ "key": "NULL",
+ "logicFlavour": "UNDEFINED",
+ "logic": ""
+ },
+ "stateFinalizerLogicMap": {
+ "entry": []
+ },
+ "defaultTask": {
+ "name": "GetBBSCloseLoopEventTask",
+ "version": "0.0.1"
+ },
+ "taskReferences": {
+ "entry": [
+ {
+ "key": {
+ "name": "GetBBSCloseLoopEventTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "INIT",
+ "localName": "ONTRegistrationPolicy"
+ },
+ "outputType": "DIRECT",
+ "output": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "INIT",
+ "localName": "BBSCloseLoopEventOutPut"
+ }
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "key": "NOMADIC_ONT_REG_SUCCESS",
+ "value": {
+ "stateKey": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "NULL",
+ "localName": "NOMADIC_ONT_REG_SUCCESS"
+ },
+ "trigger": {
+ "name": "END_CONTROL_LOOP",
+ "version": "1.0.0"
+ },
+ "stateOutputs": {
+ "entry": [
+ {
+ "key": "NomadicEventSuccessOutPut",
+ "value": {
+ "key": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "NOMADIC_ONT_REG_SUCCESS",
+ "localName": "NomadicEventSuccessOutPut"
+ },
+ "outgoingEvent": {
+ "name": "END_EVENT",
+ "version": "1.0.0"
+ },
+ "nextState": {
+ "parentKeyName": "NULL",
+ "parentKeyVersion": "0.0.0",
+ "parentLocalName": "NULL",
+ "localName": "NULL"
+ }
+ }
+ }
+ ]
+ },
+ "contextAlbumReference": [],
+ "taskSelectionLogic": {
+ "key": "NULL",
+ "logicFlavour": "UNDEFINED",
+ "logic": ""
+ },
+ "stateFinalizerLogicMap": {
+ "entry": []
+ },
+ "defaultTask": {
+ "name": "NomadicEventSuccessTask",
+ "version": "0.0.1"
+ },
+ "taskReferences": {
+ "entry": [
+ {
+ "key": {
+ "name": "NomadicEventSuccessTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "NOMADIC_ONT_REG_SUCCESS",
+ "localName": "ONTRegistrationPolicy"
+ },
+ "outputType": "DIRECT",
+ "output": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "NOMADIC_ONT_REG_SUCCESS",
+ "localName": "NomadicEventSuccessOutPut"
+ }
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "key": "SDNC_RES_UPDATE",
+ "value": {
+ "stateKey": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "NULL",
+ "localName": "SDNC_RES_UPDATE"
+ },
+ "trigger": {
+ "name": "SDNC_RESOURCE_UPDATE",
+ "version": "1.0.0"
+ },
+ "stateOutputs": {
+ "entry": [
+ {
+ "key": "AAIServiceAssignedErrorLogOutput",
+ "value": {
+ "key": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "SDNC_RES_UPDATE",
+ "localName": "AAIServiceAssignedErrorLogOutput"
+ },
+ "outgoingEvent": {
+ "name": "ERROR_LOG",
+ "version": "1.0.0"
+ },
+ "nextState": {
+ "parentKeyName": "NULL",
+ "parentKeyVersion": "0.0.0",
+ "parentLocalName": "NULL",
+ "localName": "NULL"
+ }
+ }
+ },
+ {
+ "key": "SdncResourceUpdateOutput",
+ "value": {
+ "key": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "SDNC_RES_UPDATE",
+ "localName": "SdncResourceUpdateOutput"
+ },
+ "outgoingEvent": {
+ "name": "AAI_SERVICE_CREATE",
+ "version": "1.0.0"
+ },
+ "nextState": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "NULL",
+ "localName": "AAI_SERVICE_CREATE"
+ }
+ }
+ }
+ ]
+ },
+ "contextAlbumReference": [
+ {
+ "name": "NomadicONTContextAlbum",
+ "version": "0.0.1"
+ }
+ ],
+ "taskSelectionLogic": {
+ "key": "TaskSelectionLogic",
+ "logicFlavour": "JAVASCRIPT",
+ "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nexecutor.logger.info(\"Begin Execution RUorInitStateSelect.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar returnValue = executor.isTrue;\nvar result = null;\n\nvar attachmentPoint = executor.inFields.get(\"attachmentPoint\");\nvar NomadicONTContext = executor.getContextAlbum(\"NomadicONTContextAlbum\").get(\n attachmentPoint);\n\nresult = NomadicONTContext.get(\"result\");\n\nif (result === \"SUCCESS\") {\n executor.subject.getTaskKey(\"SdncResourceUpdateTask\").copyTo(executor.selectedTask);\n} else {\n executor.subject.getTaskKey(\"ErrorAAIServiceAssignedLogTask\").copyTo(\n executor.selectedTask);\n onsetFlag = executor.isFalse;\n}\n\nexecutor.logger.info(\"State Selected Task:\" + executor.selectedTask);\nexecutor.logger.info(\"End Execution RUorInitStateSelect.js\");"
+ },
+ "stateFinalizerLogicMap": {
+ "entry": []
+ },
+ "defaultTask": {
+ "name": "SdncResourceUpdateTask",
+ "version": "0.0.1"
+ },
+ "taskReferences": {
+ "entry": [
+ {
+ "key": {
+ "name": "ErrorAAIServiceAssignedLogTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "SDNC_RES_UPDATE",
+ "localName": "ONTRegistrationPolicy"
+ },
+ "outputType": "DIRECT",
+ "output": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "SDNC_RES_UPDATE",
+ "localName": "AAIServiceAssignedErrorLogOutput"
+ }
+ }
+ },
+ {
+ "key": {
+ "name": "SdncResourceUpdateTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "SDNC_RES_UPDATE",
+ "localName": "ONTRegistrationPolicy"
+ },
+ "outputType": "DIRECT",
+ "output": {
+ "parentKeyName": "ONTRegistrationPolicy",
+ "parentKeyVersion": "0.0.1",
+ "parentLocalName": "SDNC_RES_UPDATE",
+ "localName": "SdncResourceUpdateOutput"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ },
+ "firstState": "INIT"
+ }
+ }
+ ]
+ }
+ },
+ "tasks": {
+ "key": {
+ "name": "NomadicONTPolicyModel_Tasks",
+ "version": "1.0.2"
+ },
+ "taskMap": {
+ "entry": [
+ {
+ "key": {
+ "name": "AAIServiceAssignedTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "AAIServiceAssignedTask",
+ "version": "0.0.1"
+ },
+ "inputFields": {
+ "entry": [
+ {
+ "key": "attachmentPoint",
+ "value": {
+ "key": "attachmentPoint",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "requestID",
+ "value": {
+ "key": "requestID",
+ "fieldSchemaKey": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "serviceInstanceId",
+ "value": {
+ "key": "serviceInstanceId",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ },
+ "outputFields": {
+ "entry": [
+ {
+ "key": "attachmentPoint",
+ "value": {
+ "key": "attachmentPoint",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "requestID",
+ "value": {
+ "key": "requestID",
+ "fieldSchemaKey": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "result",
+ "value": {
+ "key": "result",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "serviceInstanceId",
+ "value": {
+ "key": "serviceInstanceId",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ },
+ "taskParameters": {
+ "entry": []
+ },
+ "contextAlbumReference": [
+ {
+ "name": "NomadicONTContextAlbum",
+ "version": "0.0.1"
+ }
+ ],
+ "taskLogic": {
+ "key": "TaskLogic",
+ "logicFlavour": "JAVASCRIPT",
+ "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * Modifications Copyright (C) 2019 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nload(\"nashorn:mozilla_compat.js\");\nimportClass(org.apache.avro.Schema);\nimportClass(java.io.BufferedReader);\nimportClass(java.io.IOException);\nimportClass(java.nio.file.Files);\nimportClass(java.nio.file.Paths);\n\nexecutor.logger.info(\"Begin Execution AAIServiceAssignedTask.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar attachmentPoint = executor.inFields.get(\"attachmentPoint\");\nvar requestID = executor.inFields.get(\"requestID\");\nvar serviceInstanceId = executor.inFields.get(\"serviceInstanceId\");\n\nvar NomadicONTContext = executor.getContextAlbum(\"NomadicONTContextAlbum\").get(attachmentPoint);\nexecutor.logger.info(NomadicONTContext);\n\nvar jsonObj;\nvar aaiUpdateResult = true;\n\nvar wbClient = Java.type(\"org.onap.policy.apex.examples.bbs.WebClient\");\nvar client = new wbClient();\n\n/* Get AAI URL from Configuration file. */\nvar AAI_URL = \"localhost:8080\";\nvar CUSTOMER_ID = requestID;\nvar SERVICE_INSTANCE_ID = serviceInstanceId;\nvar AAI_VERSION = \"v14\";\nvar resource_version;\nvar relationship_list;\nvar HTTP_PROTOCOL = \"https://\";\nvar results;\nvar putUrl;\nvar service_instance;\ntry {\n var br = Files.newBufferedReader(Paths.get(\"/home/apexuser/examples/config/ONAPBBS/config.txt\"));\n var line;\n while ((line = br.readLine()) != null) {\n if (line.startsWith(\"AAI_URL\")) {\n var str = line.split(\"=\");\n AAI_URL = str[str.length - 1];\n } else if (line.startsWith(\"AAI_USERNAME\")) {\n var str = line.split(\"=\");\n AAI_USERNAME = str[str.length - 1];\n } else if (line.startsWith(\"AAI_PASSWORD\")) {\n var str = line.split(\"=\");\n AAI_PASSWORD = str[str.length - 1];\n } else if (line.startsWith(\"AAI_VERSION\")) {\n var str = line.split(\"=\");\n AAI_VERSION = str[str.length - 1];\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n}\n\nexecutor.logger.info(\"AAI_URL \" + AAI_URL);\n\n/* Get service instance Id from AAI */\ntry {\n var urlGet = HTTP_PROTOCOL + AAI_URL + \"/aai/\" + AAI_VERSION + \"/nodes/service-instances/service-instance/\"\n + SERVICE_INSTANCE_ID + \"?format=resource_and_url\";\n\n executor.logger.info(\"Query url\" + urlGet);\n\n result = client.httpRequest(urlGet, \"GET\", null, AAI_USERNAME, AAI_PASSWORD, \"application/json\");\n executor.logger.info(\"Data received From \" + urlGet + \" \" + result);\n jsonObj = JSON.parse(result.toString());\n\n executor.logger.info(JSON.stringify(jsonObj, null, 4));\n /* Retrieve the service instance id */\n results = jsonObj['results'][0];\n putUrl = results['url'];\n service_instance = results['service-instance'];\n service_instance_id = service_instance['service-instance-id'];\n resource_version = service_instance['resource-version'];\n relationship_list = service_instance['relationship-list'];\n executor.logger.info(\"After Parse service_instance \" + JSON.stringify(service_instance, null, 4) + \"\\n url \"\n + putUrl + \"\\n Service instace Id \" + service_instance_id);\n\n if (result == \"\") {\n aaiUpdateResult = false;\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n aaiUpdateResult = false;\n}\n\n/* BBS Policy updates orchestration status of {{bbs-cfs-service-instance-UUID}} [ active --> assigned ] */\nvar putUpddateServInstance;\nputUpddateServInstance = service_instance;\ntry {\n if (aaiUpdateResult == true) {\n putUpddateServInstance[\"orchestration-status\"] = \"active\";\n executor.logger.info(\"ready to putAfter Parse \" + JSON.stringify(putUpddateServInstance, null, 4));\n var urlPut = HTTP_PROTOCOL + AAI_URL + putUrl + \"?resource_version=\" + resource_version;\n result = client.httpRequest(urlPut, \"PUT\", JSON.stringify(putUpddateServInstance), AAI_USERNAME, AAI_PASSWORD,\n \"application/json\");\n executor.logger.info(\"Data received From \" + urlPut + \" \" + result);\n /* If failure to retrieve data proceed to Failure */\n if (result != \"\") {\n aaiUpdateResult = false;\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n aaiUpdateResult = false;\n}\n\nif (!service_instance.hasOwnProperty('input-parameters') || !service_instance.hasOwnProperty('metadata')) {\n aaiUpdateResult = false;\n executor.logger.info(\"Validate data failed. input-parameters or metadata is missing\");\n}\n\n/* update logical link in pnf */\nvar oldLinkName = \"\";\ntry {\n if (aaiUpdateResult == true) {\n var pnfName = \"\";\n var pnfResponse;\n var pnfUpdate;\n var relationShips = relationship_list[\"relationship\"];\n\n for (var i = 0; i < relationShips.length; i++) {\n if (relationShips[i][\"related-to\"] == \"pnf\") {\n var relationship_data = relationShips[i][\"relationship-data\"];\n for (var j = 0; j < relationship_data.length; j++) {\n if (relationship_data[j][\"relationship-key\"] == \"pnf.pnf-name\") {\n pnfName = relationship_data[j]['relationship-value'];\n break;\n }\n }\n }\n }\n executor.logger.info(\"pnf-name found \" + pnfName);\n\n /* 1. Get PNF */\n var urlGetPnf = HTTP_PROTOCOL + AAI_URL + \"/aai/\" + AAI_VERSION + \"/network/pnfs/pnf/\" + pnfName;\n pnfResponse = client.httpRequest(urlGetPnf, \"GET\", null, AAI_USERNAME, AAI_PASSWORD, \"application/json\");\n executor.logger.info(\"Data received From \" + urlGetPnf + \" \" + pnfResponse);\n /* If failure to retrieve data proceed to Failure */\n if (result != \"\") {\n aaiUpdateResult = false;\n }\n pnfUpdate = JSON.parse(pnfResponse.toString());\n executor.logger.info(JSON.stringify(pnfUpdate, null, 4));\n\n /* 2. Create logical link */\n var link_name = attachmentPoint;\n var logicalLink = {\n \"link-name\" : link_name,\n \"in-maint\" : false,\n \"link-type\" : \"attachment-point\"\n };\n var urlNewLogicalLink = HTTP_PROTOCOL + AAI_URL + \"/aai/\" + AAI_VERSION\n + \"/network/logical-links/logical-link/\" + link_name;\n result = client.httpRequest(urlNewLogicalLink, \"PUT\", JSON.stringify(logicalLink), AAI_USERNAME, AAI_PASSWORD,\n \"application/json\");\n executor.logger.info(\"Data received From \" + urlNewLogicalLink + \" \" + result);\n /* If failure to retrieve data proceed to Failure */\n if (result != \"\") {\n aaiUpdateResult = false;\n }\n\n /* 3. Update pnf with new relation */\n for (var i = 0; i < pnfUpdate[\"relationship-list\"][\"relationship\"].length; i++) {\n if (pnfUpdate[\"relationship-list\"][\"relationship\"][i]['related-to'] == 'logical-link') {\n pnfUpdate[\"relationship-list\"][\"relationship\"][i]['related-link'] = \"/aai/\" + AAI_VERSION\n + \"/network/logical-links/logical-link/\" + link_name;\n for (var j = 0; j < pnfUpdate[\"relationship-list\"][\"relationship\"][i]['relationship-data'].length; j++) {\n if (pnfUpdate[\"relationship-list\"][\"relationship\"][i]['relationship-data'][j]['relationship-key'] == \"logical-link.link-name\") {\n oldLinkName = pnfUpdate[\"relationship-list\"][\"relationship\"][i]['relationship-data'][j]['relationship-value'];\n pnfUpdate[\"relationship-list\"][\"relationship\"][i]['relationship-data'][j]['relationship-value'] = link_name;\n break;\n }\n }\n break;\n }\n }\n\n executor.logger.info(\"Put pnf to aai \" + JSON.stringify(pnfUpdate, null, 4));\n var urlPutPnf = HTTP_PROTOCOL + AAI_URL + \"/aai/\" + AAI_VERSION + \"/network/pnfs/pnf/\" + pnfName;\n result = client.httpRequest(urlPutPnf, \"PUT\", JSON.stringify(pnfUpdate), AAI_USERNAME, AAI_PASSWORD,\n \"application/json\");\n executor.logger.info(\"Data received From \" + urlPutPnf + \" \" + result);\n\n /* If failure to retrieve data proceed to Failure */\n if (result != \"\") {\n aaiUpdateResult = false;\n }\n\n /* Get and Delete the Stale logical link */\n var oldLinkResult;\n var linkResult;\n var urlOldLogicalLink = HTTP_PROTOCOL + AAI_URL + \"/aai/\" + AAI_VERSION\n + \"/network/logical-links/logical-link/\" + oldLinkName;\n linkResult = client.httpRequest(urlOldLogicalLink, \"GET\", null, AAI_USERNAME, AAI_PASSWORD, \"application/json\");\n executor.logger.info(\"Data received From \" + urlOldLogicalLink + \" \" + linkResult + \" \"\n + linkResult.hasOwnProperty(\"link-name\"));\n oldLinkResult = JSON.parse(linkResult.toString());\n if (oldLinkResult.hasOwnProperty(\"link-name\") == true) {\n var res_version = oldLinkResult[\"resource-version\"];\n var urlDelOldLogicalLink = urlOldLogicalLink + \"?resource-version=\" + res_version;\n executor.logger.info(\"Delete called for \" + urlDelOldLogicalLink);\n result = client.httpRequest(urlDelOldLogicalLink, \"DELETE\", null, AAI_USERNAME, AAI_PASSWORD,\n \"application/json\");\n executor.logger.info(\"Delete called for \" + urlDelOldLogicalLink + \" result \" + result);\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n aaiUpdateResult = false;\n}\n\n/* If Success then Fill output schema */\nif (aaiUpdateResult === true) {\n executor.outFields.put(\"result\", \"SUCCESS\");\n NomadicONTContext.put(\"result\", \"SUCCESS\");\n NomadicONTContext.put(\"aai_message\", JSON.stringify(service_instance));\n NomadicONTContext.put(\"url\", putUrl);\n} else {\n executor.outFields.put(\"result\", \"FAILURE\");\n NomadicONTContext.put(\"result\", \"FAILURE\");\n}\n\nexecutor.outFields.put(\"requestID\", requestID);\nexecutor.outFields.put(\"attachmentPoint\", attachmentPoint);\nexecutor.outFields.put(\"serviceInstanceId\", executor.inFields.get(\"serviceInstanceId\"));\n\nvar returnValue = executor.isTrue;\nexecutor.logger.info(executor.outFields);\nexecutor.logger.info(\"End Execution AAIServiceAssignedTask.js\");\n\n/* Utility functions Begin */\nfunction IsValidJSONString(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n}\n/* Utility functions End */"
+ }
+ }
+ },
+ {
+ "key": {
+ "name": "AAIServiceCreateTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "AAIServiceCreateTask",
+ "version": "0.0.1"
+ },
+ "inputFields": {
+ "entry": [
+ {
+ "key": "attachmentPoint",
+ "value": {
+ "key": "attachmentPoint",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "requestID",
+ "value": {
+ "key": "requestID",
+ "fieldSchemaKey": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "serviceInstanceId",
+ "value": {
+ "key": "serviceInstanceId",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ },
+ "outputFields": {
+ "entry": [
+ {
+ "key": "attachmentPoint",
+ "value": {
+ "key": "attachmentPoint",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "requestID",
+ "value": {
+ "key": "requestID",
+ "fieldSchemaKey": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "result",
+ "value": {
+ "key": "result",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "serviceInstanceId",
+ "value": {
+ "key": "serviceInstanceId",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ },
+ "taskParameters": {
+ "entry": []
+ },
+ "contextAlbumReference": [
+ {
+ "name": "NomadicONTContextAlbum",
+ "version": "0.0.1"
+ }
+ ],
+ "taskLogic": {
+ "key": "TaskLogic",
+ "logicFlavour": "JAVASCRIPT",
+ "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * Modifications Copyright (C) 2019 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nload(\"nashorn:mozilla_compat.js\");\nimportClass(org.apache.avro.Schema);\nimportClass(java.io.BufferedReader);\nimportClass(java.io.IOException);\nimportClass(java.nio.file.Files);\nimportClass(java.nio.file.Paths);\n\nexecutor.logger.info(\"Begin Execution AAIServiceCreateTask.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar attachmentPoint = executor.inFields.get(\"attachmentPoint\");\nvar requestID = executor.inFields.get(\"requestID\");\nvar serviceInstanceId = executor.inFields.get(\"serviceInstanceId\");\n\nvar NomadicONTContext = executor.getContextAlbum(\"NomadicONTContextAlbum\").get(attachmentPoint);\nexecutor.logger.info(NomadicONTContext);\n\n// Get the AAI URL from configuraiotn file\nvar AAI_URL = \"localhost:8080\";\nvar CUSTOMER_ID = requestID;\nvar BBS_CFS_SERVICE_TYPE = \"BBS-CFS-Access_Test\";\nvar SERVICE_INSTANCE_ID = serviceInstanceId;\nvar AAI_VERSION = \"v14\";\nvar HTTP_PROTOCOL = \"https://\";\nvar wbClient = Java.type(\"org.onap.policy.apex.examples.bbs.WebClient\");\nvar client = new wbClient();\nvar AAI_USERNAME = null;\nvar AAI_PASSWORD = null;\ntry {\n var br = Files.newBufferedReader(Paths.get(\"/home/apexuser/examples/config/ONAPBBS/config.txt\"));\n // read line by line\n var line;\n while ((line = br.readLine()) != null) {\n if (line.startsWith(\"AAI_URL\")) {\n var str = line.split(\"=\");\n AAI_URL = str[str.length - 1];\n } else if (line.startsWith(\"AAI_USERNAME\")) {\n var str = line.split(\"=\");\n AAI_USERNAME = str[str.length - 1];\n } else if (line.startsWith(\"AAI_PASSWORD\")) {\n var str = line.split(\"=\");\n AAI_PASSWORD = str[str.length - 1];\n } else if (line.startsWith(\"AAI_VERSION\")) {\n var str = line.split(\"=\");\n AAI_VERSION = str[str.length - 1];\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n}\nexecutor.logger.info(\"AAI_URL \" + AAI_URL);\nvar aaiUpdateResult = true;\n/* Get service instance Id from AAI */\ntry {\n var urlGet = HTTP_PROTOCOL + AAI_URL + \"/aai/\" + AAI_VERSION + \"/nodes/service-instances/service-instance/\"\n + SERVICE_INSTANCE_ID + \"?format=resource_and_url\";\n\n executor.logger.info(\"Query url\" + urlGet);\n\n result = client.httpRequest(urlGet, \"GET\", null, AAI_USERNAME, AAI_PASSWORD, \"application/json\");\n executor.logger.info(\"Data received From \" + urlGet + \" \" + result);\n jsonObj = JSON.parse(result);\n\n executor.logger.info(JSON.stringify(jsonObj, null, 4));\n /* Retrieve the service instance id */\n results = jsonObj['results'][0];\n putUrl = results['url'];\n service_instance = results['service-instance'];\n executor.logger.info(\"After Parse service_instance \" + JSON.stringify(service_instance, null, 4) + \"\\n url \"\n + putUrl + \"\\n Service instace Id \" + SERVICE_INSTANCE_ID);\n\n if (result == \"\") {\n aaiUpdateResult = false;\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n aaiUpdateResult = false;\n}\n\nvar putUpddateServInstance = service_instance;\nputUpddateServInstance['orchestration-status'] = \"created\";\nexecutor.logger.info(\" string\" + JSON.stringify(putUpddateServInstance, null, 4));\nvar resource_version = putUpddateServInstance['resource-version'];\nvar putUrl = NomadicONTContext.get(\"url\");\n\n/* BBS Policy updates {{bbs-cfs-service-instance-UUID}} orchestration-status [ assigned --> created ] */\ntry {\n if (aaiUpdateResult == true) {\n executor.logger.info(\"ready to putAfter Parse \" + JSON.stringify(putUpddateServInstance, null, 4));\n var urlPut = HTTP_PROTOCOL + AAI_URL + putUrl + \"?resource_version=\" + resource_version;\n result = client.httpRequest(urlPut, \"PUT\", JSON.stringify(putUpddateServInstance), AAI_USERNAME, AAI_PASSWORD,\n \"application/json\");\n executor.logger.info(\"Data received From \" + urlPut + \" \" + result);\n /* If failure to retrieve data proceed to Failure */\n if (result != \"\") {\n aaiUpdateResult = false;\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n aaiUpdateResult = false;\n}\n/* If Success then Fill output schema */\nif (aaiUpdateResult === true) {\n NomadicONTContext.put(\"result\", \"SUCCESS\");\n} else {\n NomadicONTContext.put(\"result\", \"FAILURE\");\n\n}\n\nexecutor.outFields.put(\"requestID\", requestID);\nexecutor.outFields.put(\"attachmentPoint\", attachmentPoint);\nexecutor.outFields.put(\"serviceInstanceId\", executor.inFields.get(\"serviceInstanceId\"));\n\nvar returnValue = executor.isTrue;\nexecutor.logger.info(executor.outFields);\nexecutor.logger.info(\"End Execution AAIServiceCreateTask.js\");"
+ }
+ }
+ },
+ {
+ "key": {
+ "name": "ErrorAAIServiceAssignedLogTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "ErrorAAIServiceAssignedLogTask",
+ "version": "0.0.1"
+ },
+ "inputFields": {
+ "entry": [
+ {
+ "key": "attachmentPoint",
+ "value": {
+ "key": "attachmentPoint",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "requestID",
+ "value": {
+ "key": "requestID",
+ "fieldSchemaKey": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "result",
+ "value": {
+ "key": "result",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "serviceInstanceId",
+ "value": {
+ "key": "serviceInstanceId",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ },
+ "outputFields": {
+ "entry": [
+ {
+ "key": "errorLogParam",
+ "value": {
+ "key": "errorLogParam",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ }
+ ]
+ },
+ "taskParameters": {
+ "entry": []
+ },
+ "contextAlbumReference": [],
+ "taskLogic": {
+ "key": "TaskLogic",
+ "logicFlavour": "JAVASCRIPT",
+ "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nexecutor.logger.info(\"Begin Execution ErrorServiceUpdateOneLogTask.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nexecutor.logger.info(executor.outFields);\n\nvar returnValue = executor.isTrue;\nexecutor.logger.info(\"Begin Execution ErrorServiceUpdateOneLogTask.js\");"
+ }
+ }
+ },
+ {
+ "key": {
+ "name": "ErrorSdncResourceUpdateTaskLogTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "ErrorSdncResourceUpdateTaskLogTask",
+ "version": "0.0.1"
+ },
+ "inputFields": {
+ "entry": [
+ {
+ "key": "attachmentPoint",
+ "value": {
+ "key": "attachmentPoint",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "requestID",
+ "value": {
+ "key": "requestID",
+ "fieldSchemaKey": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "result",
+ "value": {
+ "key": "result",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "serviceInstanceId",
+ "value": {
+ "key": "serviceInstanceId",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ },
+ "outputFields": {
+ "entry": [
+ {
+ "key": "errorLogParam",
+ "value": {
+ "key": "errorLogParam",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ }
+ ]
+ },
+ "taskParameters": {
+ "entry": []
+ },
+ "contextAlbumReference": [],
+ "taskLogic": {
+ "key": "TaskLogic",
+ "logicFlavour": "JAVASCRIPT",
+ "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nexecutor.logger.info(\"Begin Execution ErrorResourceUpdateLogTask.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar returnValue = executor.isTrue;\nexecutor.logger.info(\"End Execution ErrorResourceUpdateLogTask.js\");"
+ }
+ }
+ },
+ {
+ "key": {
+ "name": "GetBBSCloseLoopEventTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "GetBBSCloseLoopEventTask",
+ "version": "0.0.1"
+ },
+ "inputFields": {
+ "entry": [
+ {
+ "key": "VirtualControlLoopEvent",
+ "value": {
+ "key": "VirtualControlLoopEvent",
+ "fieldSchemaKey": {
+ "name": "VirtualControlLoopEventType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ }
+ ]
+ },
+ "outputFields": {
+ "entry": [
+ {
+ "key": "attachmentPoint",
+ "value": {
+ "key": "attachmentPoint",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "requestID",
+ "value": {
+ "key": "requestID",
+ "fieldSchemaKey": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "serviceInstanceId",
+ "value": {
+ "key": "serviceInstanceId",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ },
+ "taskParameters": {
+ "entry": []
+ },
+ "contextAlbumReference": [
+ {
+ "name": "NomadicONTContextAlbum",
+ "version": "0.0.1"
+ }
+ ],
+ "taskLogic": {
+ "key": "TaskLogic",
+ "logicFlavour": "JAVASCRIPT",
+ "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nload(\"nashorn:mozilla_compat.js\");\n\nexecutor.logger.info(\"Begin Execution GetBBSCloseLoopEventTask.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\nvar returnValue = executor.isTrue;\n\nvar clEventType = Java.type(\n \"org.onap.policy.controlloop.VirtualControlLoopEvent\");\nvar clEvent = executor.inFields.get(\"VirtualControlLoopEvent\");\nexecutor.logger.info(clEvent.toString());\nexecutor.logger.info(clEvent.getClosedLoopControlName());\n\nvar requestID = clEvent.getRequestId();\nexecutor.logger.info(\"requestID = \" + requestID);\nvar attachmentPoint = null;\nvar NomadicONTContext = null;\nvar serviceInstanceId = null;\n\nif (clEvent.getAai().get(\"attachmentPoint\") != null) {\n attachmentPoint = clEvent.getAai().get(\"attachmentPoint\");\n executor.logger.info(\"attachmentPoint = \" + attachmentPoint);\n NomadicONTContext = executor.getContextAlbum(\"NomadicONTContextAlbum\").get(\n attachmentPoint);\n serviceInstanceId = clEvent.getAai().get(\n \"service-information.hsia-cfs-service-instance-id\");\n executor.logger.info(\"serviceInstanceId = \" + serviceInstanceId);\n\n if (NomadicONTContext == null) {\n executor.logger.info(\n \"Creating context information for new ONT Device \\\"\" +\n attachmentPoint.toString() + \"\\\"\");\n\n NomadicONTContext = executor.getContextAlbum(\"NomadicONTContextAlbum\").getSchemaHelper()\n .createNewInstance();\n\n NomadicONTContext.put(\"closedLoopControlName\", clEvent.getClosedLoopControlName());\n NomadicONTContext.put(\"closedLoopAlarmStart\", clEvent.getClosedLoopAlarmStart()\n .toEpochMilli());\n NomadicONTContext.put(\"closedLoopEventClient\", clEvent.getClosedLoopEventClient());\n NomadicONTContext.put(\"closedLoopEventStatus\", clEvent.getClosedLoopEventStatus()\n .toString());\n NomadicONTContext.put(\"version\", clEvent.getVersion());\n NomadicONTContext.put(\"requestID\", clEvent.getRequestId().toString());\n NomadicONTContext.put(\"target_type\", clEvent.getTargetType().toString());\n NomadicONTContext.put(\"target\", clEvent.getTarget());\n NomadicONTContext.put(\"from\", clEvent.getFrom());\n NomadicONTContext.put(\"policyScope\", \"Nomadic ONT\");\n NomadicONTContext.put(\"policyName\", clEvent.getPolicyName());\n NomadicONTContext.put(\"policyVersion\", \"1.0.0\");\n NomadicONTContext.put(\"notificationTime\", java.lang.System.currentTimeMillis());\n NomadicONTContext.put(\"message\", \"\");\n NomadicONTContext.put(\"result\", \"SUCCESS\");\n var aaiInfo = executor.getContextAlbum(\"NomadicONTContextAlbum\").getSchemaHelper()\n .createNewSubInstance(\"VCPE_AAI_Type\");\n\n aaiInfo.put(\"attachmentPoint\", clEvent.getAai().get(\"attachmentPoint\"));\n aaiInfo.put(\"cvlan\", clEvent.getAai().get(\"cvlan\"));\n aaiInfo.put(\"service_information_hsia_cfs_service_instance_id\", clEvent\n .getAai().get(\n \"service-information.hsia-cfs-service-instance-id\"));\n aaiInfo.put(\"svlan\", clEvent.getAai().get(\"svlan\"));\n aaiInfo.put(\"remoteId\", clEvent.getAai().get(\"remoteId\"));\n\n\n NomadicONTContext.put(\"AAI\", aaiInfo);\n\n if (clEvent.getClosedLoopAlarmEnd() != null) {\n NomadicONTContext.put(\"closedLoopAlarmEnd\", clEvent.getClosedLoopAlarmEnd()\n .toEpochMilli());\n } else {\n NomadicONTContext.put(\"closedLoopAlarmEnd\", java.lang.Long.valueOf(\n 0));\n }\n\n executor.getContextAlbum(\"NomadicONTContextAlbum\").put(attachmentPoint.toString(),\n NomadicONTContext);\n executor.logger.info(\"Created context information for new vCPE VNF \\\"\" +\n attachmentPoint.toString() + \"\\\"\");\n }\n\n executor.outFields.put(\"requestID\", requestID);\n executor.outFields.put(\"attachmentPoint\", attachmentPoint);\n executor.outFields.put(\"serviceInstanceId\", serviceInstanceId);\n executor.logger.info(executor.outFields);\n executor.logger.info(\"Event Successfully Received and stored in album\");\n}\nelse\n{\n executor.message = \"Received NULL attachment-point\";\n returnValue = executor.isFalse;\n}"
+ }
+ }
+ },
+ {
+ "key": {
+ "name": "NomadicEventSuccessTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "NomadicEventSuccessTask",
+ "version": "0.0.1"
+ },
+ "inputFields": {
+ "entry": [
+ {
+ "key": "attachmentPoint",
+ "value": {
+ "key": "attachmentPoint",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "requestID",
+ "value": {
+ "key": "requestID",
+ "fieldSchemaKey": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "serviceInstanceId",
+ "value": {
+ "key": "serviceInstanceId",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ },
+ "outputFields": {
+ "entry": [
+ {
+ "key": "result",
+ "value": {
+ "key": "result",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ },
+ "taskParameters": {
+ "entry": []
+ },
+ "contextAlbumReference": [
+ {
+ "name": "NomadicONTContextAlbum",
+ "version": "0.0.1"
+ }
+ ],
+ "taskLogic": {
+ "key": "TaskLogic",
+ "logicFlavour": "JAVASCRIPT",
+ "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nload(\"nashorn:mozilla_compat.js\");\nimportClass(org.apache.avro.Schema);\n\nexecutor.logger.info(\"Begin Execution NomadicEventSuccess.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar attachmentPoint = executor.inFields.get(\"attachmentPoint\");\nvar NomadicONTContext = executor.getContextAlbum(\"NomadicONTContextAlbum\").get(\n attachmentPoint);\n\nexecutor.logger.info(executor.outFields);\nexecutor.logger.info(executor.inFields);\n\nresult = NomadicONTContext.get(\"result\");\n\nif (result === \"SUCCESS\") {\n returnValue = executor.isTrue;\n executor.outFields.put(\"result\", \"SUCCCESS\");\n executor.logger.info(\"BBS policy Execution Done\");\n} else {\n executor.logger.info(\"BBS policy Execution Failed\");\n executor.outFields.put(\"result\", \"FAILURE\");\n returnValue = executor.isFalse;\n}\n\nvar returnValue = executor.isTrue;\nexecutor.logger.info(\"End Execution NomadicEventSuccess.js\");"
+ }
+ }
+ },
+ {
+ "key": {
+ "name": "SdncResourceUpdateTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "SdncResourceUpdateTask",
+ "version": "0.0.1"
+ },
+ "inputFields": {
+ "entry": [
+ {
+ "key": "attachmentPoint",
+ "value": {
+ "key": "attachmentPoint",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "requestID",
+ "value": {
+ "key": "requestID",
+ "fieldSchemaKey": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "serviceInstanceId",
+ "value": {
+ "key": "serviceInstanceId",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ },
+ "outputFields": {
+ "entry": [
+ {
+ "key": "attachmentPoint",
+ "value": {
+ "key": "attachmentPoint",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "requestID",
+ "value": {
+ "key": "requestID",
+ "fieldSchemaKey": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "result",
+ "value": {
+ "key": "result",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "serviceInstanceId",
+ "value": {
+ "key": "serviceInstanceId",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ },
+ "taskParameters": {
+ "entry": []
+ },
+ "contextAlbumReference": [
+ {
+ "name": "NomadicONTContextAlbum",
+ "version": "0.0.1"
+ }
+ ],
+ "taskLogic": {
+ "key": "TaskLogic",
+ "logicFlavour": "JAVASCRIPT",
+ "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nload(\"nashorn:mozilla_compat.js\");\nimportClass(org.apache.avro.Schema);\nimportClass(java.io.BufferedReader);\nimportClass(java.io.IOException);\nimportClass(java.nio.file.Files);\nimportClass(java.nio.file.Paths);\n\nimportPackage(org.json.XML);\n\nexecutor.logger.info(\"Begin Execution SdncResourceUpdateTask.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar attachmentPoint = executor.inFields.get(\"attachmentPoint\");\nvar requestID = executor.inFields.get(\"requestID\");\nvar serviceInstanceId = executor.inFields.get(\"serviceInstanceId\");\nvar uuidType = Java.type(\"java.util.UUID\");\n\nvar wbClient = Java.type(\"org.onap.policy.apex.examples.bbs.WebClient\");\nvar client = new wbClient();\n\nvar NomadicONTContext = executor.getContextAlbum(\"NomadicONTContextAlbum\").get(attachmentPoint);\nvar sdncUUID = uuidType.randomUUID();\nexecutor.logger.info(NomadicONTContext);\nvar jsonObj;\nvar aaiUpdateResult = true;\nvar SDNC_URL = \"localhost:8080\";\nvar HTTP_PROTOCOL = \"http://\"\nvar SVC_NOTIFICATION_URL;\nvar putUpddateServInstance = JSON.parse(NomadicONTContext.get(\"aai_message\"));\nvar input_param = JSON.parse(putUpddateServInstance['input-parameters']);\ntry {\n var br = Files.newBufferedReader(Paths.get(\"/home/apexuser/examples/config/ONAPBBS/config.txt\"));\n var line;\n while ((line = br.readLine()) != null) {\n if (line.startsWith(\"SDNC_URL\")) {\n var str = line.split(\"=\");\n SDNC_URL = str[str.length - 1];\n } else if (line.startsWith(\"SVC_NOTIFICATION_URL\")) {\n var str = line.split(\"=\");\n SVC_NOTIFICATION_URL = str[str.length - 1];\n } else if (line.startsWith(\"SDNC_USERNAME\")) {\n var str = line.split(\"=\");\n SDNC_USERNAME = str[str.length - 1];\n } else if (line.startsWith(\"SDNC_PASSWORD\")) {\n var str = line.split(\"=\");\n SDNC_PASSWORD = str[str.length - 1];\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n}\nexecutor.logger.info(\"SDNC_URL \" + SDNC_URL);\n\nvar result;\nvar jsonObj;\nvar sdncUpdateResult = true;\n\n/* BBS Policy calls SDN-C GR-API to delete AccessConnectivity VF ID */\n/* Prepare Data */\nvar xmlDeleteAccess = \"\";\ntry {\n var br = Files.newBufferedReader(Paths\n .get(\"/home/apexuser/examples/config/ONAPBBS/sdnc_DeleteAccessConnectivityInstance.txt\"));\n var line;\n while ((line = br.readLine()) != null) {\n xmlDeleteAccess += line;\n }\n\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n}\n\n/* BBS Policy calls SDN-C GR-API to delete AccessConnectivity */\nxmlDeleteAccess = xmlDeleteAccess.replace(\"svc_request_id_value\", sdncUUID);\nxmlDeleteAccess = xmlDeleteAccess.replace(\"svc_notification_url_value\", SVC_NOTIFICATION_URL);\nxmlDeleteAccess = xmlDeleteAccess.replace(\"request_id_value\", sdncUUID);\nxmlDeleteAccess = xmlDeleteAccess.replace(\"service_id_value\", sdncUUID);\nxmlDeleteAccess = xmlDeleteAccess.replace(\"service_instance_id_value\", putUpddateServInstance['service-instance-id']);\nxmlDeleteAccess = xmlDeleteAccess.replace(\"service_type_value\", input_param['service']['serviceType']);\nxmlDeleteAccess = xmlDeleteAccess.replace(\"customer_id_value\", input_param['service']['globalSubscriberId']);\nxmlDeleteAccess = xmlDeleteAccess.replace(\"customer_name_value\", input_param['service']['globalSubscriberId']);\n\nxmlDeleteAccess = xmlDeleteAccess.replace(\"srv_info_model_inv_uuid_value\", getResourceInvariantUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlDeleteAccess = xmlDeleteAccess.replace(\"srv_info_model_custom_uuid_value\", getResourceCustomizationUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlDeleteAccess = xmlDeleteAccess.replace(\"srv_info_model_uuid_value\", getResourceUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlDeleteAccess = xmlDeleteAccess.replace(\"srv_info_model_name_value\", \"AccessConnectivity\");\nxmlDeleteAccess = xmlDeleteAccess.replace(\"network_info_model_inv_uuid_value\", getResourceInvariantUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlDeleteAccess = xmlDeleteAccess.replace(\"network_info_model_custom_uuid_value\", getResourceCustomizationUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlDeleteAccess = xmlDeleteAccess.replace(\"network_info_model_uuid_value\", getResourceUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlDeleteAccess = xmlDeleteAccess.replace(\"network_info_model_name_value\", \"AccessConnectivity\");\n\nxmlDeleteAccess = xmlDeleteAccess.replace(\"vendor_value\",\n input_param['service']['parameters']['requestInputs']['ont_ont_manufacturer']);\nxmlDeleteAccess = xmlDeleteAccess.replace(\"service_id_value\", getMetaValue(\n putUpddateServInstance['metadata']['metadatum'], 'controller-service-id'));\n\nexecutor.logger.info(xmlDeleteAccess);\n\ntry {\n var urlPost1 = HTTP_PROTOCOL + SDNC_URL + \"/restconf/operations/GENERIC-RESOURCE-API:vnf-topology-operation\";\n result = client.httpRequest(urlPost1, \"POST\", xmlDeleteAccess, SDNC_USERNAME, SDNC_PASSWORD, \"application/xml\");\n executor.logger.info(\"Data received From \" + urlPost1 + \" \" + result);\n if (result == \"\") {\n sdncUpdateResult = false;\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n sdncUpdateResult = false;\n}\n\n/* BBS Policy calls SDN-C GR-API to create new AccessConnectivity VF */\n\n/* Prepare Data */\nvar xmlCreateAccess = \"\";\ntry {\n var br = Files.newBufferedReader(Paths\n .get(\"/home/apexuser/examples/config/ONAPBBS/sdnc_CreateAccessConnectivityInstance.txt\"));\n var line;\n while ((line = br.readLine()) != null) {\n xmlCreateAccess += line;\n }\n\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n}\nxmlCreateAccess = xmlCreateAccess.replace(\"svc_request_id_value\", sdncUUID);\nxmlCreateAccess = xmlCreateAccess.replace(\"svc_notification_url_value\", SVC_NOTIFICATION_URL);\nxmlCreateAccess = xmlCreateAccess.replace(\"request_id_value\", requestID);\nxmlCreateAccess = xmlCreateAccess.replace(\"service_id_value\", sdncUUID);\nxmlCreateAccess = xmlCreateAccess.replace(\"service_instance_id_value\", putUpddateServInstance['service-instance-id']);\nxmlCreateAccess = xmlCreateAccess.replace(\"service_type_value\", input_param['service']['serviceType']);\nxmlCreateAccess = xmlCreateAccess.replace(\"customer_id_value\", input_param['service']['globalSubscriberId']);\nxmlCreateAccess = xmlCreateAccess.replace(\"customer_name_value\", input_param['service']['globalSubscriberId']);\n\nxmlCreateAccess = xmlCreateAccess.replace(\"srv_info_model_inv_uuid_value\", getResourceInvariantUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlCreateAccess = xmlCreateAccess.replace(\"srv_info_model_custom_uuid_value\", getResourceCustomizationUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlCreateAccess = xmlCreateAccess.replace(\"srv_info_model_uuid_value\", getResourceUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlCreateAccess = xmlCreateAccess.replace(\"srv_info_model_name_value\", \"AccessConnectivity\");\nxmlCreateAccess = xmlCreateAccess.replace(\"network_info_model_inv_uuid_value\", getResourceInvariantUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlCreateAccess = xmlCreateAccess.replace(\"network_info_model_custom_uuid_value\", getResourceCustomizationUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlCreateAccess = xmlCreateAccess.replace(\"network_info_model_uuid_value\", getResourceUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlCreateAccess = xmlCreateAccess.replace(\"network_info_model_name_value\", \"AccessConnectivity\");\n\nxmlCreateAccess = xmlCreateAccess.replace(\"vendor_value\",\n input_param['service']['parameters']['requestInputs']['ont_ont_manufacturer']);\nxmlCreateAccess = xmlCreateAccess.replace(\"ont_sn_value\",\n input_param['service']['parameters']['requestInputs']['ont_ont_serial_num']);\nxmlCreateAccess = xmlCreateAccess.replace(\"s_vlan_value\", getMetaValue(putUpddateServInstance['metadata']['metadatum'],\n 'svlan'));\nxmlCreateAccess = xmlCreateAccess.replace(\"c_vlan_value\", getMetaValue(putUpddateServInstance['metadata']['metadatum'],\n 'cvlan'));\nxmlCreateAccess = xmlCreateAccess.replace(\"remote_id_value\", getMetaValue(\n putUpddateServInstance['metadata']['metadatum'], 'remote-id'));\n\nexecutor.logger.info(xmlCreateAccess);\n\ntry {\n if (sdncUpdateResult == true) {\n var urlPost2 = HTTP_PROTOCOL + SDNC_URL\n + \"/restconf/operations/GENERIC-RESOURCE-API:vnf-topology-operation\";\n result = client.httpRequest(urlPost2, \"POST\", xmlCreateAccess, SDNC_USERNAME, SDNC_PASSWORD, \"application/xml\");\n executor.logger.info(\"Data received From \" + urlPost2 + \" \" + result);\n if (result == \"\") {\n sdncUpdateResult = false;\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n sdncUpdateResult = false;\n}\n\n/* BBS Policy calls SDN-C GR-API to create change Internet Profile */\nvar xmlChangeProfile = \"\";\ntry {\n var br = Files.newBufferedReader(Paths\n .get(\"/home/apexuser/examples/config/ONAPBBS/sdnc_ChangeInternetProfileInstance.txt\"));\n var line;\n while ((line = br.readLine()) != null) {\n xmlChangeProfile += line;\n }\n\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n}\n\nxmlChangeProfile = xmlChangeProfile.replace(\"svc_request_id_value\", sdncUUID);\nxmlChangeProfile = xmlChangeProfile.replace(\"svc_notification_url_value\", SVC_NOTIFICATION_URL);\nxmlChangeProfile = xmlChangeProfile.replace(\"request_id_value\", requestID);\nxmlChangeProfile = xmlChangeProfile.replace(\"service_id_value\", sdncUUID);\nxmlChangeProfile = xmlChangeProfile.replace(\"service_instance_id_value\", putUpddateServInstance['service-instance-id']);\nxmlChangeProfile = xmlChangeProfile.replace(\"service_type_value\", input_param['service']['serviceType']);\nxmlChangeProfile = xmlChangeProfile.replace(\"customer_id_value\", input_param['service']['globalSubscriberId']);\nxmlChangeProfile = xmlChangeProfile.replace(\"customer_name_value\", input_param['service']['globalSubscriberId']);\n\nxmlChangeProfile = xmlChangeProfile.replace(\"srv_info_model_inv_uuid_value\", getResourceInvariantUuid(\n input_param['service']['parameters']['resources'], 'InternetProfile'));\nxmlChangeProfile = xmlChangeProfile.replace(\"srv_info_model_custom_uuid_value\", getResourceCustomizationUuid(\n input_param['service']['parameters']['resources'], 'InternetProfile'));\nxmlChangeProfile = xmlChangeProfile.replace(\"srv_info_model_uuid_value\", getResourceUuid(\n input_param['service']['parameters']['resources'], 'InternetProfile'));\nxmlChangeProfile = xmlChangeProfile.replace(\"srv_info_model_name_value\", \"InternetProfile\");\nxmlChangeProfile = xmlChangeProfile.replace(\"network_info_model_inv_uuid_value\", getResourceInvariantUuid(\n input_param['service']['parameters']['resources'], 'InternetProfile'));\nxmlChangeProfile = xmlChangeProfile.replace(\"network_info_model_custom_uuid_value\", getResourceCustomizationUuid(\n input_param['service']['parameters']['resources'], 'InternetProfile'));\nxmlChangeProfile = xmlChangeProfile.replace(\"network_info_model_uuid_value\", getResourceUuid(\n input_param['service']['parameters']['resources'], 'InternetProfile'));\nxmlChangeProfile = xmlChangeProfile.replace(\"network_info_model_name_value\", \"InternetProfile\");\n\nxmlChangeProfile = xmlChangeProfile.replace(\"vendor_value\",\n input_param['service']['parameters']['requestInputs']['ont_ont_manufacturer']);\nxmlChangeProfile = xmlChangeProfile.replace(\"service_id_value\", getMetaValue(\n putUpddateServInstance['metadata']['metadatum'], 'controller-service-id'));\nxmlChangeProfile = xmlChangeProfile.replace(\"remote_id_value\", getMetaValue(\n putUpddateServInstance['metadata']['metadatum'], 'remote-id'));\nxmlChangeProfile = xmlChangeProfile.replace(\"ont_sn_value\",\n input_param['service']['parameters']['requestInputs']['ont_ont_serial_num']);\nxmlChangeProfile = xmlChangeProfile.replace(\"service_type_value\", input_param['service']['serviceType']);\nxmlChangeProfile = xmlChangeProfile.replace(\"mac_value\", getMetaValue(putUpddateServInstance['metadata']['metadatum'],\n 'rgw-mac-address'));\nxmlChangeProfile = xmlChangeProfile.replace(\"up_speed_value\", getMetaValue(\n putUpddateServInstance['metadata']['metadatum'], 'up-speed'));\nxmlChangeProfile = xmlChangeProfile.replace(\"down_speed_value\", getMetaValue(\n putUpddateServInstance['metadata']['metadatum'], 'down-speed'));\nxmlChangeProfile = xmlChangeProfile.replace(\"s_vlan_value\", getMetaValue(\n putUpddateServInstance['metadata']['metadatum'], 'svlan'));\nxmlChangeProfile = xmlChangeProfile.replace(\"c_vlan_value\", getMetaValue(\n putUpddateServInstance['metadata']['metadatum'], 'cvlan'));\n\nexecutor.logger.info(xmlChangeProfile);\n\ntry {\n if (sdncUpdateResult == true) {\n var urlPost3 = HTTP_PROTOCOL + SDNC_URL\n + \"/restconf/operations/GENERIC-RESOURCE-API:vnf-topology-operation\";\n result = client\n .httpRequest(urlPost3, \"POST\", xmlChangeProfile, SDNC_USERNAME, SDNC_PASSWORD, \"application/xml\");\n executor.logger.info(\"Data received From \" + urlPost3 + \" \" + result);\n if (result == \"\") {\n sdncUpdateResult = false;\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n sdncUpdateResult = false;\n}\n\n/* If Success then Fill output schema */\n\nif (sdncUpdateResult === true) {\n NomadicONTContext.put(\"result\", \"SUCCESS\");\n executor.outFields.put(\"result\", \"SUCCESS\");\n} else {\n NomadicONTContext.put(\"result\", \"FAILURE\");\n executor.outFields.put(\"result\", \"FAILURE\");\n}\n\nexecutor.outFields.put(\"requestID\", requestID);\nexecutor.outFields.put(\"attachmentPoint\", attachmentPoint);\nexecutor.outFields.put(\"serviceInstanceId\", executor.inFields.get(\"serviceInstanceId\"));\n\nvar returnValue = executor.isTrue;\nexecutor.logger.info(executor.outFields);\nexecutor.logger.info(\"End Execution SdncResourceUpdateTask.js\");\n\nfunction getMetaValue(metaJson, metaname) {\n for (var i = 0; i < metaJson.length; i++) {\n if (metaJson[i]['metaname'] == metaname) {\n var metaValue = metaJson[i]['metaval'];\n return metaValue;\n }\n }\n\n}\n\nfunction getResourceInvariantUuid(resJson, resourceName) {\n for (var i = 0; i < resJson.length; i++) {\n if (resJson[i]['resourceName'] == resourceName) {\n var resValue = resJson[i]['resourceInvariantUuid'];\n return resValue;\n }\n }\n\n}\n\nfunction getResourceUuid(resJson, resourceName) {\n for (var i = 0; i < resJson.length; i++) {\n if (resJson[i]['resourceName'] == resourceName) {\n var resValue = resJson[i]['resourceUuid'];\n return resValue;\n }\n }\n\n}\n\nfunction getResourceCustomizationUuid(resJson, resourceName) {\n for (var i = 0; i < resJson.length; i++) {\n if (resJson[i]['resourceName'] == resourceName) {\n var resValue = resJson[i]['resourceCustomizationUuid'];\n return resValue;\n }\n }\n\n}\n\n/* Utility functions Begin */\nfunction IsValidJSONString(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n}\n/* Utility functions End */"
+ }
+ }
+ },
+ {
+ "key": {
+ "name": "ServiceUpdateStateCpeAuthTask",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "ServiceUpdateStateCpeAuthTask",
+ "version": "0.0.1"
+ },
+ "inputFields": {
+ "entry": [
+ {
+ "key": "VirtualControlLoopEvent",
+ "value": {
+ "key": "VirtualControlLoopEvent",
+ "fieldSchemaKey": {
+ "name": "VirtualControlLoopEventType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ }
+ ]
+ },
+ "outputFields": {
+ "entry": [
+ {
+ "key": "attachmentPoint",
+ "value": {
+ "key": "attachmentPoint",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "requestID",
+ "value": {
+ "key": "requestID",
+ "fieldSchemaKey": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "result",
+ "value": {
+ "key": "result",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "serviceInstanceId",
+ "value": {
+ "key": "serviceInstanceId",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ },
+ "taskParameters": {
+ "entry": []
+ },
+ "contextAlbumReference": [
+ {
+ "name": "NomadicONTContextAlbum",
+ "version": "0.0.1"
+ }
+ ],
+ "taskLogic": {
+ "key": "TaskLogic",
+ "logicFlavour": "JAVASCRIPT",
+ "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * Modifications Copyright (C) 2019 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nload(\"nashorn:mozilla_compat.js\");\nimportClass(java.io.BufferedReader);\nimportClass(java.io.IOException);\nimportClass(java.nio.file.Files);\nimportClass(java.nio.file.Paths);\n\nexecutor.logger.info(\"Begin Execution ServiceUpdateStateCpeAuthTask.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar clEventType = Java.type(\"org.onap.policy.controlloop.VirtualControlLoopEvent\");\nvar clEvent = executor.inFields.get(\"VirtualControlLoopEvent\");\n\nvar serviceInstanceId = clEvent.getAai().get(\"service-information.hsia-cfs-service-instance-id\");\nvar requestID = clEvent.getRequestId();\n\nvar jsonObj;\nvar aaiUpdateResult = true;\nvar wbClient = Java.type(\"org.onap.policy.apex.examples.bbs.WebClient\");\nvar client = new wbClient();\nvar oldState = clEvent.getAai().get(\"cpe.old-authentication-state\");\nvar newState = clEvent.getAai().get(\"cpe.new-authentication-state\");\n/* Get AAI URL from Configuration file. */\nvar AAI_URL = \"localhost:8080\";\nvar CUSTOMER_ID = requestID;\nvar SERVICE_INSTANCE_ID = serviceInstanceId;\nvar resource_version;\nvar HTTP_PROTOCOL = \"https://\";\nvar results;\nvar putUrl;\nvar service_instance;\nvar AAI_VERSION = \"v14\";\ntry {\n var br = Files.newBufferedReader(Paths.get(\"/home/apexuser/examples/config/ONAPBBS/config.txt\"));\n var line;\n while ((line = br.readLine()) != null) {\n if (line.startsWith(\"AAI_URL\")) {\n var str = line.split(\"=\");\n AAI_URL = str[str.length - 1];\n } else if (line.startsWith(\"AAI_USERNAME\")) {\n var str = line.split(\"=\");\n AAI_USERNAME = str[str.length - 1];\n } else if (line.startsWith(\"AAI_PASSWORD\")) {\n var str = line.split(\"=\");\n AAI_PASSWORD = str[str.length - 1];\n } else if (line.startsWith(\"AAI_VERSION\")) {\n var str = line.split(\"=\");\n AAI_VERSION = str[str.length - 1];\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n}\n\nexecutor.logger.info(\"AAI_URL=>\" + AAI_URL);\n\n/* Get service instance Id from AAI */\ntry {\n var urlGet = HTTP_PROTOCOL + AAI_URL + \"/aai/\" + AAI_VERSION + \"/nodes/service-instances/service-instance/\"\n + SERVICE_INSTANCE_ID + \"?format=resource_and_url\"\n executor.logger.info(\"Query url\" + urlGet);\n\n result = client.httpRequest(urlGet, \"GET\", null, AAI_USERNAME, AAI_PASSWORD, \"application/json\");\n executor.logger.info(\"Data received From \" + urlGet + \" \" + result);\n jsonObj = JSON.parse(result);\n\n /* Retrieve the service instance id */\n results = jsonObj['results'][0];\n putUrl = results[\"url\"];\n service_instance = results['service-instance'];\n resource_version = service_instance['resource-version'];\n executor.logger.info(\"After Parse service_instance \" + JSON.stringify(service_instance, null, 4) + \"\\n url \"\n + putUrl + \"\\n Service instace Id \" + SERVICE_INSTANCE_ID);\n\n if (result == \"\") {\n aaiUpdateResult = false;\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n aaiUpdateResult = false;\n}\n\n/* BBS Policy updates orchestration status of {{bbs-cfs-service-instance-UUID}} [ active --> assigned ] */\nvar putUpddateServInstance;\nputUpddateServInstance = service_instance;\nif (newState == 'inService') {\n putUpddateServInstance['orchestration-status'] = \"active\";\n} else {\n putUpddateServInstance['orchestration-status'] = \"inActive\";\n}\ntry {\n if (aaiUpdateResult == true) {\n executor.logger.info(\"ready to put After Parse \" + JSON.stringify(putUpddateServInstance, null, 4));\n var urlPut = HTTP_PROTOCOL + AAI_URL + putUrl + \"?resource_version=\" + resource_version;\n result = client.httpRequest(urlPut, \"PUT\", JSON.stringify(putUpddateServInstance), AAI_USERNAME, AAI_PASSWORD,\n \"application/json\");\n executor.logger.info(\"Data received From \" + urlPut + \" \" + result);\n /* If failure to retrieve data proceed to Failure */\n if (result != \"\") {\n aaiUpdateResult = false;\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n aaiUpdateResult = false;\n}\n\nif (aaiUpdateResult == true) {\n executor.outFields.put(\"result\", \"SUCCCESS\");\n} else {\n executor.outFields.put(\"result\", \"FAILURE\");\n}\n\nexecutor.logger.info(executor.outFields);\nvar returnValue = executor.isTrue;\nexecutor.logger.info(\"End Execution ServiceUpdateStateCpeAuthTask.js\");"
+ }
+ }
+ }
+ ]
+ }
+ },
+ "events": {
+ "key": {
+ "name": "NomadicONTPolicyModel_Events",
+ "version": "1.0.2"
+ },
+ "eventMap": {
+ "entry": [
+ {
+ "key": {
+ "name": "AAI_CPE_AUTH_UPDATE",
+ "version": "1.0.0"
+ },
+ "value": {
+ "key": {
+ "name": "AAI_CPE_AUTH_UPDATE",
+ "version": "1.0.0"
+ },
+ "nameSpace": "org.onap.policy.apex.onap.bbs",
+ "source": "APEX",
+ "target": "DCAE",
+ "parameter": {
+ "entry": [
+ {
+ "key": "attachmentPoint",
+ "value": {
+ "key": "attachmentPoint",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "requestID",
+ "value": {
+ "key": "requestID",
+ "fieldSchemaKey": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "result",
+ "value": {
+ "key": "result",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "serviceInstanceId",
+ "value": {
+ "key": "serviceInstanceId",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "key": {
+ "name": "AAI_SERVICE_ASSIGNED",
+ "version": "1.0.0"
+ },
+ "value": {
+ "key": {
+ "name": "AAI_SERVICE_ASSIGNED",
+ "version": "1.0.0"
+ },
+ "nameSpace": "org.onap.policy.apex.onap.bbs",
+ "source": "APEX",
+ "target": "APEX",
+ "parameter": {
+ "entry": [
+ {
+ "key": "attachmentPoint",
+ "value": {
+ "key": "attachmentPoint",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "requestID",
+ "value": {
+ "key": "requestID",
+ "fieldSchemaKey": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "serviceInstanceId",
+ "value": {
+ "key": "serviceInstanceId",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "key": {
+ "name": "AAI_SERVICE_CREATE",
+ "version": "1.0.0"
+ },
+ "value": {
+ "key": {
+ "name": "AAI_SERVICE_CREATE",
+ "version": "1.0.0"
+ },
+ "nameSpace": "org.onap.policy.apex.onap.bbs",
+ "source": "APEX",
+ "target": "APEX",
+ "parameter": {
+ "entry": [
+ {
+ "key": "attachmentPoint",
+ "value": {
+ "key": "attachmentPoint",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "requestID",
+ "value": {
+ "key": "requestID",
+ "fieldSchemaKey": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "result",
+ "value": {
+ "key": "result",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "serviceInstanceId",
+ "value": {
+ "key": "serviceInstanceId",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "key": {
+ "name": "CPE_Authentication",
+ "version": "1.0.2"
+ },
+ "value": {
+ "key": {
+ "name": "CPE_Authentication",
+ "version": "1.0.2"
+ },
+ "nameSpace": "org.onap.policy.apex.onap.bbs",
+ "source": "DCAE",
+ "target": "APEX",
+ "parameter": {
+ "entry": [
+ {
+ "key": "VirtualControlLoopEvent",
+ "value": {
+ "key": "VirtualControlLoopEvent",
+ "fieldSchemaKey": {
+ "name": "VirtualControlLoopEventType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "key": {
+ "name": "END_CONTROL_LOOP",
+ "version": "1.0.0"
+ },
+ "value": {
+ "key": {
+ "name": "END_CONTROL_LOOP",
+ "version": "1.0.0"
+ },
+ "nameSpace": "org.onap.policy.apex.onap.bbs",
+ "source": "APEX",
+ "target": "APEX",
+ "parameter": {
+ "entry": [
+ {
+ "key": "attachmentPoint",
+ "value": {
+ "key": "attachmentPoint",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "requestID",
+ "value": {
+ "key": "requestID",
+ "fieldSchemaKey": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "result",
+ "value": {
+ "key": "result",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "serviceInstanceId",
+ "value": {
+ "key": "serviceInstanceId",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "key": {
+ "name": "END_EVENT",
+ "version": "1.0.0"
+ },
+ "value": {
+ "key": {
+ "name": "END_EVENT",
+ "version": "1.0.0"
+ },
+ "nameSpace": "org.onap.policy.apex.onap.bbs",
+ "source": "APEX",
+ "target": "DCAE",
+ "parameter": {
+ "entry": [
+ {
+ "key": "attachmentPoint",
+ "value": {
+ "key": "attachmentPoint",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "requestID",
+ "value": {
+ "key": "requestID",
+ "fieldSchemaKey": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "result",
+ "value": {
+ "key": "result",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ },
+ {
+ "key": "serviceInstanceId",
+ "value": {
+ "key": "serviceInstanceId",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "key": {
+ "name": "ERROR_LOG",
+ "version": "1.0.0"
+ },
+ "value": {
+ "key": {
+ "name": "ERROR_LOG",
+ "version": "1.0.0"
+ },
+ "nameSpace": "org.onap.policy.apex.onap.bbs",
+ "source": "APEX",
+ "target": "APEX",
+ "parameter": {
+ "entry": [
+ {
+ "key": "errorLogParam",
+ "value": {
+ "key": "errorLogParam",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "key": {
+ "name": "Nomadic_ONT",
+ "version": "1.0.2"
+ },
+ "value": {
+ "key": {
+ "name": "Nomadic_ONT",
+ "version": "1.0.2"
+ },
+ "nameSpace": "org.onap.policy.apex.onap.bbs",
+ "source": "DCAE",
+ "target": "APEX",
+ "parameter": {
+ "entry": [
+ {
+ "key": "VirtualControlLoopEvent",
+ "value": {
+ "key": "VirtualControlLoopEvent",
+ "fieldSchemaKey": {
+ "name": "VirtualControlLoopEventType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "key": {
+ "name": "SDNC_RESOURCE_UPDATE",
+ "version": "1.0.0"
+ },
+ "value": {
+ "key": {
+ "name": "SDNC_RESOURCE_UPDATE",
+ "version": "1.0.0"
+ },
+ "nameSpace": "org.onap.policy.apex.onap.bbs",
+ "source": "APEX",
+ "target": "APEX",
+ "parameter": {
+ "entry": [
+ {
+ "key": "attachmentPoint",
+ "value": {
+ "key": "attachmentPoint",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "requestID",
+ "value": {
+ "key": "requestID",
+ "fieldSchemaKey": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "result",
+ "value": {
+ "key": "result",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": false
+ }
+ },
+ {
+ "key": "serviceInstanceId",
+ "value": {
+ "key": "serviceInstanceId",
+ "fieldSchemaKey": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "optional": true
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ },
+ "albums": {
+ "key": {
+ "name": "NomadicONTPolicyModel_Albums",
+ "version": "1.0.2"
+ },
+ "albums": {
+ "entry": [
+ {
+ "key": {
+ "name": "NomadicONTContextAlbum",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "NomadicONTContextAlbum",
+ "version": "0.0.1"
+ },
+ "scope": "policy",
+ "isWritable": true,
+ "itemSchema": {
+ "name": "NomadicONTContextType",
+ "version": "0.0.1"
+ }
+ }
+ }
+ ]
+ }
+ },
+ "schemas": {
+ "key": {
+ "name": "NomadicONTPolicyModel_Schemas",
+ "version": "1.0.2"
+ },
+ "schemas": {
+ "entry": [
+ {
+ "key": {
+ "name": "NomadicONTContextType",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "NomadicONTContextType",
+ "version": "0.0.1"
+ },
+ "schemaFlavour": "Avro",
+ "schemaDefinition": "{\n \"type\": \"record\",\n \"name\": \"NomadicONTContext\",\n \"fields\": [\n {\n \"name\": \"AAI\",\n \"type\": {\n \"type\": \"record\",\n \"name\": \"VCPE_AAI_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.vcpe\",\n \"fields\": [\n {\n \"name\": \"attachmentPoint\",\n \"type\": \"string\"\n },\n {\n \"name\": \"service_information_hsia_cfs_service_instance_id\",\n \"type\": \"string\"\n },\n {\n \"name\": \"cvlan\",\n \"type\": \"string\"\n },\n {\n \"name\": \"svlan\",\n \"type\": \"string\"\n },\n {\n \"name\": \"remoteId\",\n \"type\": \"string\"\n }\n ]\n }\n },\n {\n \"name\": \"closedLoopAlarmStart\",\n \"type\": \"long\"\n },\n {\n \"name\": \"closedLoopAlarmEnd\",\n \"type\": \"long\"\n },\n {\n \"name\": \"closedLoopControlName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"version\",\n \"type\": \"string\"\n },\n {\n \"name\": \"requestID\",\n \"type\": \"string\"\n },\n {\n \"name\": \"closedLoopEventClient\",\n \"type\": \"string\"\n },\n {\n \"name\": \"closedLoopEventStatus\",\n \"type\": \"string\"\n },\n {\n \"name\": \"target_type\",\n \"type\": \"string\"\n },\n {\n \"name\": \"target\",\n \"type\": \"string\"\n },\n {\n \"name\": \"from\",\n \"type\": \"string\"\n },\n {\n \"name\": \"policyScope\",\n \"type\": \"string\"\n },\n {\n \"name\": \"policyName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"policyVersion\",\n \"type\": \"string\"\n },\n {\n \"name\": \"notification\",\n \"type\": \"string\"\n },\n {\n \"name\": \"notificationTime\",\n \"type\": \"long\"\n },\n {\n \"name\": \"result\",\n \"type\": \"string\"\n },\n {\n \"name\": \"message\",\n \"type\": \"string\"\n },\n {\n \"name\": \"url\",\n \"type\": \"string\"\n },\n {\n \"name\": \"aai_message\",\n \"type\": \"string\"\n }\n ]\n}"
+ }
+ },
+ {
+ "key": {
+ "name": "SimpleBooleanType",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "SimpleBooleanType",
+ "version": "0.0.1"
+ },
+ "schemaFlavour": "Java",
+ "schemaDefinition": "java.lang.Boolean"
+ }
+ },
+ {
+ "key": {
+ "name": "SimpleLongType",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "SimpleLongType",
+ "version": "0.0.1"
+ },
+ "schemaFlavour": "Java",
+ "schemaDefinition": "java.lang.Long"
+ }
+ },
+ {
+ "key": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "SimpleStringType",
+ "version": "0.0.1"
+ },
+ "schemaFlavour": "Java",
+ "schemaDefinition": "java.lang.String"
+ }
+ },
+ {
+ "key": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "UUIDType",
+ "version": "0.0.1"
+ },
+ "schemaFlavour": "Java",
+ "schemaDefinition": "java.util.UUID"
+ }
+ },
+ {
+ "key": {
+ "name": "VirtualControlLoopEventType",
+ "version": "0.0.1"
+ },
+ "value": {
+ "key": {
+ "name": "VirtualControlLoopEventType",
+ "version": "0.0.1"
+ },
+ "schemaFlavour": "Java",
+ "schemaDefinition": "org.onap.policy.controlloop.VirtualControlLoopEvent"
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "eventOutputParameters": {
+ "FirstProducer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "FILE",
+ "parameters": {
+ "standardIo": true
+ }
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ }
+ }
+ },
+ "eventInputParameters": {
+ "DCAEConsumer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTCLIENT",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",
+ "parameters": {
+ "url": "http://message-router:3904/events/unauthenticated.DCAE_CL_OUTPUT/g1/c1?timeout=60000"
+ }
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON",
+ "parameters": {
+ "nameAlias": "policyName",
+ "versionAlias": "version",
+ "sourceAlias": "from",
+ "pojoField": "VirtualControlLoopEvent"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+}
diff --git a/policy/apex/json/bbs_policytypes.json b/policy/apex/json/bbs_policytypes.json
new file mode 100644
index 0000000..69096b6
--- /dev/null
+++ b/policy/apex/json/bbs_policytypes.json
@@ -0,0 +1,266 @@
+{
+ "tosca_definitions_version": "tosca_simple_yaml_1_0_0",
+ "policy_types": {
+ "onap.policies.controlloop.operational.Apex": {
+ "version": "1.0.0",
+ "description": "Operational Policy for Control Loops using the APEX PDP",
+ "properties": {
+ "engine_service": {
+ "type": "onap.datatypes.policies.controlloop.operational.apex.EngineService",
+ "description": "APEX Engine Service Parameters"
+ },
+ "inputs": {
+ "type": "map",
+ "description": "Inputs for handling events coming into the APEX engine",
+ "entry_schema": {
+ "type": "onap.datatypes.policies.controlloop.operational.apex.EventHandler"
+ }
+ },
+ "outputs": {
+ "type": "map",
+ "description": "Outputs for handling events going out of the APEX engine",
+ "entry_schema": {
+ "type": "onap.datatypes.policies.controlloop.operational.apex.EventHandler"
+ }
+ },
+ "environment": {
+ "type": "list",
+ "description": "Envioronmental parameters for the APEX engine",
+ "entry_schema": {
+ "type": "onap.datatypes.policies.controlloop.operational.apex.Environment"
+ }
+ }
+ }
+ }
+ },
+ "data_types": {
+ "onap.datatypes.policies.controlloop.operational.apex.EngineService": {
+ "derived_from": "tosca.datatypes.Root",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "Specifies the engine name",
+ "required": false,
+ "default": "ApexEngineService"
+ },
+ "version": {
+ "type": "string",
+ "description": "Specifies the engine version in double dotted format",
+ "required": false,
+ "default": "1.0.0"
+ },
+ "id": {
+ "type": "int",
+ "description": "Specifies the engine id",
+ "required": true
+ },
+ "instance_count": {
+ "type": "int",
+ "description": "Specifies the number of engine threads that should be run",
+ "required": true
+ },
+ "deployment_port": {
+ "type": "int",
+ "description": "Specifies the port to connect to for engine administration",
+ "required": false,
+ "default": 1
+ },
+ "policy_model_file_name": {
+ "type": "string",
+ "description": "The name of the file from which to read the APEX policy model",
+ "required": false,
+ "default": ""
+ },
+ "policy_type_impl": {
+ "type": "string",
+ "description": "The policy type implementation from which to read the APEX policy model",
+ "required": false,
+ "default": ""
+ },
+ "periodic_event_period": {
+ "type": "string",
+ "description": "The time interval in milliseconds for the periodic scanning event, 0 means \"don't scan\"",
+ "required": false,
+ "default": 0
+ },
+ "engine": {
+ "type": "onap.datatypes.policies.controlloop.operational.apex.engineservice.Engine",
+ "description": "The parameters for all engines in the APEX engine service",
+ "required": true
+ }
+ }
+ },
+ "onap.datatypes.policies.controlloop.operational.apex.EventHandler": {
+ "derived_from": "tosca.datatypes.Root",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "Specifies the event handler name, if not specified this is set to the key name",
+ "required": false
+ },
+ "carrier_technology": {
+ "type": "onap.datatypes.policies.controlloop.operational.apex.CarrierTechnology",
+ "description": "Specifies the carrier technology of the event handler (such as REST/Web Socket/Kafka)",
+ "required": true
+ },
+ "event_protocol": {
+ "type": "onap.datatypes.policies.controlloop.operational.apex.EventProtocol",
+ "description": "Specifies the event protocol of events for the event handler (such as Yaml/JSON/XML/POJO)",
+ "required": true
+ },
+ "event_name": {
+ "type": "string",
+ "description": "Specifies the event name for events on this event handler, if not specified, the event name is read from or written to the event being received or sent",
+ "required": false
+ },
+ "event_name_filter": {
+ "type": "string",
+ "description": "Specifies a filter as a regular expression, events that do not match the filter are dropped, the default is to let all events through",
+ "required": false
+ },
+ "synchronous_mode": {
+ "type": "bool",
+ "description": "Specifies the event handler is syncronous (receive event and send response)",
+ "required": false,
+ "default": false
+ },
+ "synchronous_peer": {
+ "type": "string",
+ "description": "The peer event handler (output for input or input for output) of this event handler in synchronous mode, this parameter is mandatory if the event handler is in synchronous mode",
+ "required": false,
+ "default": ""
+ },
+ "synchronous_timeout": {
+ "type": "int",
+ "description": "The timeout in milliseconds for responses to be issued by APEX torequests, this parameter is mandatory if the event handler is in synchronous mode",
+ "required": false,
+ "default": ""
+ },
+ "requestor_mode": {
+ "type": "bool",
+ "description": "Specifies the event handler is in requestor mode (send event and wait for response mode)",
+ "required": false,
+ "default": false
+ },
+ "requestor_peer": {
+ "type": "string",
+ "description": "The peer event handler (output for input or input for output) of this event handler in requestor mode, this parameter is mandatory if the event handler is in requestor mode",
+ "required": false,
+ "default": ""
+ },
+ "requestor_timeout": {
+ "type": "int",
+ "description": "The timeout in milliseconds for wait for responses to requests, this parameter is mandatory if the event handler is in requestor mode",
+ "required": false,
+ "default": ""
+ }
+ }
+ },
+ "onap.datatypes.policies.controlloop.operational.apex.CarrierTechnology": {
+ "derived_from": "tosca.datatypes.Root",
+ "properties": {
+ "label": {
+ "type": "string",
+ "description": "The label (name) of the carrier technology (such as REST, Kafka, WebSocket)",
+ "required": true
+ },
+ "plugin_parameter_class_name": {
+ "type": "string",
+ "description": "The class name of the class that overrides default handling of event input or output for this carrier technology, defaults to the supplied input or output class",
+ "required": false
+ }
+ }
+ },
+ "onap.datatypes.policies.controlloop.operational.apex.EventProtocol": {
+ "derived_from": "tosca.datatypes.Root",
+ "properties": {
+ "label": {
+ "type": "string",
+ "description": "The label (name) of the event protocol (such as Yaml, JSON, XML, or POJO)",
+ "required": true
+ },
+ "event_protocol_plugin_class": {
+ "type": "string",
+ "description": "The class name of the class that overrides default handling of the event protocol for this carrier technology, defaults to the supplied event protocol class",
+ "required": false
+ }
+ }
+ },
+ "onap.datatypes.policies.controlloop.operational.apex.Environmental": {
+ "derived_from": "tosca.datatypes.Root",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "The name of the environment variable",
+ "required": true
+ },
+ "value": {
+ "type": "string",
+ "description": "The value of the environment variable",
+ "required": true
+ }
+ }
+ },
+ "onap.datatypes.policies.controlloop.operational.apex.engineservice.Engine": {
+ "derived_from": "tosca.datatypes.Root",
+ "properties": {
+ "context": {
+ "type": "onap.datatypes.policies.controlloop.operational.apex.engineservice.engine.Context",
+ "description": "The properties for handling context in APEX engines, defaults to using Java maps for context",
+ "required": false
+ },
+ "executors": {
+ "type": "map",
+ "description": "The plugins for policy executors used in engines such as javascript, MVEL, Jython",
+ "required": true,
+ "entry_schema": {
+ "description": "The plugin class path for this policy executor",
+ "type": "string"
+ }
+ }
+ }
+ },
+ "onap.datatypes.policies.controlloop.operational.apex.engineservice.engine.Context": {
+ "derived_from": "tosca.datatypes.Root",
+ "properties": {
+ "distributor": {
+ "type": "onap.datatypes.policies.controlloop.operational.apex.Plugin",
+ "description": "The plugin to be used for distributing context between APEX PDPs at runtime",
+ "required": false
+ },
+ "schemas": {
+ "type": "map",
+ "description": "The plugins for context schemas available in APEX PDPs such as Java and Avro",
+ "required": false,
+ "entry_schema": {
+ "type": "onap.datatypes.policies.controlloop.operational.apex.Plugin"
+ }
+ },
+ "locking": {
+ "type": "onap.datatypes.policies.controlloop.operational.apex.plugin",
+ "description": "The plugin to be used for locking context in and between APEX PDPs at runtime",
+ "required": false
+ },
+ "persistence": {
+ "type": "onap.datatypes.policies.controlloop.operational.apex.Plugin",
+ "description": "The plugin to be used for persisting context for APEX PDPs at runtime",
+ "required": false
+ }
+ }
+ },
+ "onap.datatypes.policies.controlloop.operational.apex.Plugin": {
+ "derived_from": "tosca.datatypes.Root",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "The name of the executor such as Javascript, Jython or MVEL",
+ "required": true
+ },
+ "plugin_class_name": {
+ "type": "string",
+ "description": "The class path of the plugin class for this executor"
+ }
+ }
+ }
+ }
+}
diff --git a/policy/apex/json/bbs_simple_deploy.json b/policy/apex/json/bbs_simple_deploy.json
new file mode 100644
index 0000000..f6212c4
--- /dev/null
+++ b/policy/apex/json/bbs_simple_deploy.json
@@ -0,0 +1,8 @@
+{
+ "policies" : [
+ {
+ "policy-id": "onap.policies.controlloop.operational.apex.onapbbs",
+ "policy-version": "1.0.0"
+ }
+ ]
+}