{
"tosca_definitions_version": "tosca_simple_yaml_1_1_0",
"topology_template": {
"policies": [
{
"operational.onapbbs": {
"type": "onap.policies.controlloop.operational.Apex",
"type_version": "1.0.0",
"name": "operational.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"
}
},
"taskParameters": [
{
"key": "AAI_URL",
"value": "aai:8443"
},
{
"key": "AAI_USERNAME",
"value": "AAI"
},
{
"key": "AAI_PASSWORD",
"value": "AAI"
},
{
"key": "AAI_VERSION",
"value": "v16"
},
{
"key": "SDNC_URL",
"value": "sdnc:8443"
},
{
"key": "SDNC_USERNAME",
"value": "admin"
},
{
"key": "SDNC_PASSWORD",
"value": "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"
},
{
"key": "SVC_NOTIFICATION_URL",
"value": "http://c1.vm1.mso.simpledemo.openecomp.org:8080"
}
],
"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.2"
},
"value": {
"key": {
"name": "AAI_CPE_AUTH_UPDATE",
"version": "1.0.2"
},
"UUID": "d9543444-f74f-31e8-a782-0d93dea34f26",
"description": "Generated description for concept referred to by key \"AAI_CPE_AUTH_UPDATE:1.0.2\""
}
},
{
"key": {
"name": "AAI_SERVICE_ASSIGNED",
"version": "1.0.2"
},
"value": {
"key": {
"name": "AAI_SERVICE_ASSIGNED",
"version": "1.0.2"
},
"UUID": "4720575a-89a3-39d0-9554-24bdb8b21f56",
"description": "Generated description for concept referred to by key \"AAI_SERVICE_ASSIGNED:1.0.2\""
}
},
{
"key": {
"name": "AAI_SERVICE_CREATE",
"version": "1.0.2"
},
"value": {
"key": {
"name": "AAI_SERVICE_CREATE",
"version": "1.0.2"
},
"UUID": "1f18fd72-307e-3c25-940c-69fed411649b",
"description": "Generated description for concept referred to by key \"AAI_SERVICE_CREATE:1.0.2\""
}
},
{
"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.2"
},
"value": {
"key": {
"name": "END_CONTROL_LOOP",
"version": "1.0.2"
},
"UUID": "a666ac83-2ae2-3769-8a25-ce1630b04efa",
"description": "Generated description for concept referred to by key \"END_CONTROL_LOOP:1.0.2\""
}
},
{
"key": {
"name": "END_EVENT",
"version": "1.0.2"
},
"value": {
"key": {
"name": "END_EVENT",
"version": "1.0.2"
},
"UUID": "c50ae42d-d12f-3fde-8714-fe751b2f2a4e",
"description": "Generated description for concept referred to by key \"END_EVENT:1.0.2\""
}
},
{
"key": {
"name": "ERROR_LOG",
"version": "1.0.2"
},
"value": {
"key": {
"name": "ERROR_LOG",
"version": "1.0.2"
},
"UUID": "cee4b299-3851-3779-aa1a-60b90dd95ee4",
"description": "Generated description for concept referred to by key \"ERROR_LOG:1.0.2\""
}
},
{
"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.2"
},
"value": {
"key": {
"name": "SDNC_RESOURCE_UPDATE",
"version": "1.0.2"
},
"UUID": "445af002-8069-37ce-b8c1-49cc1422e279",
"description": "Generated description for concept referred to by key \"SDNC_RESOURCE_UPDATE:1.0.2\""
}
},
{
"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.2"
},
"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.2"
},
"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.2"
},
"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.2"
},
"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.2"
},
"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.2"
},
"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 * Modifications Copyright (C) 2020 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 */\nexecutor.logger.info(\"Begin Execution SU2orInitStateSelect.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\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\");\n\ntrue;"
},
"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.2"
},
"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.2"
},
"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.2"
},
"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.2"
},
"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.2"
},
"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.2"
},
"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 * Modifications Copyright (C) 2020 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 */\nexecutor.logger.info(\"Begin Execution RUorInitStateSelect.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\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\");\n\ntrue;"
},
"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-2020 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 */\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 = 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;\n\nAAI_URL = executor.parameters.get(\"AAI_URL\");\nAAI_USERNAME = executor.parameters.get(\"AAI_USERNAME\");\nAAI_PASSWORD = executor.parameters.get(\"AAI_PASSWORD\");\nAAI_VERSION = executor.parameters.get(\"AAI_VERSION\");\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 /* 1. Get PNF */\n var urlGetPnf = HTTP_PROTOCOL + AAI_URL + \"/aai/\" + AAI_VERSION + \"/network/pnfs/pnf/\" + pnfName;\n executor.logger.info(\"*********************** Executing call to fetch PNF\");\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 (!pnfResponse) {\n executor.logger.info(\"*********************** Fetch PNF with relation marked it ERROR\");\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 logicalLink[\"link-name\"] = String(link_name);\n logicalLink[\"in-maint\"] = String(false);\n logicalLink[\"link-type\"] = \"attachment-point\";\n // var logicalLink = \"{\\\"link-name\\\":\\\"\" + link_name + \"\\\",\\\"in-maint\\\": false, \\\"link-type\\\":\\\"attachment-point\\\"}\";\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 executor.logger.info(\"URL to be used >>\" + urlNewLogicalLink + \"<<\");\n var logicalLinkStr = JSON.stringify(logicalLink);\n executor.logger.info(\"Body to be used >>\" + logicalLinkStr + \"<<\");\n executor.logger.info(\"*********************** Executing call to create new Logical Link\");\n result = client.httpRequest(urlNewLogicalLink, \"PUT\", logicalLinkStr, 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 executor.logger.info(\"*********************** CREATE NEW LOGICAL LINK marked it ERROR\");\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'] = String(\"/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'] = String(link_name);\n break;\n }\n }\n break;\n }\n }\n executor.logger.info(\"*********************** Just before calling stringify\");\n var pnfUpdateStr = JSON.stringify(pnfUpdate);\n executor.logger.info(\"Put pnf to aai \" + pnfUpdateStr);\n var urlPutPnf = HTTP_PROTOCOL + AAI_URL + \"/aai/\" + AAI_VERSION + \"/network/pnfs/pnf/\" + pnfName;\n executor.logger.info(\"*********************** Executing call to update PNF with new relation\");\n result = client.httpRequest(urlPutPnf, \"PUT\", pnfUpdateStr, 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 executor.logger.info(\"*********************** UPDATE PNF with relation marked it ERROR\");\n aaiUpdateResult = false;\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 executor.logger.info(\"*********************** Executing call to fetch old logical link\");\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 executor.logger.info(\"*********************** Executing call to delete old logical link\");\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 executor.logger.info(\"*********************** Just before calling stringify when output to context (service-instance)\");\n NomadicONTContext.put(\"aai_message\", JSON.stringify(service_instance));\n executor.logger.info(\"*********************** Just after calling stringify when output to context (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\nexecutor.logger.info(executor.outFields);\nexecutor.logger.info(\"End Execution AAIServiceAssignedTask.js\");\n\ntrue;\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-2020 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 */\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 = org.onap.policy.apex.examples.bbs.WebClient;\nvar client = new wbClient();\nvar AAI_USERNAME = null;\nvar AAI_PASSWORD = null;\nAAI_URL = executor.parameters.get(\"AAI_URL\");\nAAI_USERNAME = executor.parameters.get(\"AAI_USERNAME\");\nAAI_PASSWORD = executor.parameters.get(\"AAI_PASSWORD\");\nAAI_VERSION = executor.parameters.get(\"AAI_VERSION\");\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\nexecutor.logger.info(executor.outFields);\nexecutor.logger.info(\"End Execution AAIServiceCreateTask.js\");\n\ntrue;"
}
}
},
{
"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 * Modifications Copyright (C) 2020 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 */\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\nexecutor.logger.info(\"Begin Execution ErrorServiceUpdateOneLogTask.js\");\n\ntrue;"
}
}
},
{
"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 * Modifications Copyright (C) 2020 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 */\nexecutor.logger.info(\"Begin Execution ErrorResourceUpdateLogTask.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nexecutor.logger.info(\"End Execution ErrorResourceUpdateLogTask.js\");\n\ntrue;"
}
}
},
{
"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 * Modifications Copyright (C) 2020 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 */\n\nexecutor.logger.info(\"Begin Execution GetBBSCloseLoopEventTask.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\nvar returnValue = true;\n\nvar clEventType = 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.2\");\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 = false;\n}\n\nreturnValue;"
}
}
},
{
"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 * Modifications Copyright (C) 2020 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 */\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\");\nvar returnValue = true;\n\nif (result == \"SUCCESS\") {\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 = false;\n}\n\nexecutor.logger.info(\"End Execution NomadicEventSuccess.js\");\n\nreturnValue;"
}
}
},
{
"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 * Modifications Copyright (C) 2020 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 */\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.util.UUID;\n\nvar wbClient = 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 = \"https://\"\nvar SVC_NOTIFICATION_URL;\nvar putUpddateServInstance = JSON.parse(NomadicONTContext.get(\"aai_message\"));\nvar aaiData = JSON.parse(NomadicONTContext.get(\"AAI\"));\nvar input_param = JSON.parse(putUpddateServInstance['input-parameters']);\nSDNC_URL = executor.parameters.get(\"SDNC_URL\");\nSVC_NOTIFICATION_URL = executor.parameters.get(\"SVC_NOTIFICATION_URL\");\nSDNC_USERNAME = executor.parameters.get(\"SDNC_USERNAME\");\nSDNC_PASSWORD = executor.parameters.get(\"SDNC_PASSWORD\");\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 =\n \"\\n\" +\n \"\\n\" +\n \"svc_request_id_value\\n\" +\n \"delete\\n\" +\n \"svc_notification_url_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"request_id_value\\n\" +\n \"DeleteAccessConnectivityInstance\\n\" +\n \"null\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"service_id_value\\n\" +\n \"service_instance_id_value\\n\" +\n \"service_type_value\\n\" +\n \"customer_id_value\\n\" +\n \"customer_name_value\\n\" +\n \"\\n\" +\n \"srv_info_model_inv_uuid_value\\n\" +\n \"srv_info_model_custom_uuid_value\\n\" +\n \"srv_info_model_uuid_value\\n\" +\n \"srv_info_model_name_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"network_info_model_inv_uuid_value\\n\" +\n \"network_info_model_custom_uuid_value\\n\" +\n \"network_info_model_uuid_value\\n\" +\n \"network_info_model_name_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"manufacturer\\n\" +\n \"vendor_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"serviceID\\n\" +\n \"service_id_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\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'));\nexecutor.logger.info(client.toPrettyString(xmlDeleteAccess, 4));\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 =\n \"\\n\" +\n \"\\n\" +\n \"svc_request_id_value\\n\" +\n \"create\\n\" +\n \"svc_notification_url_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"request_id_value\\n\" +\n \"CreateAccessConnectivityInstance\\n\" +\n \"null\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"service_id_value\\n\" +\n \"service_instance_id_value\\n\" +\n \"service_type_value\\n\" +\n \"customer_id_value\\n\" +\n \"customer_name_value\\n\" +\n \"\\n\" +\n \"srv_info_model_inv_uuid_value\\n\" +\n \"srv_info_model_custom_uuid_value\\n\" +\n \"srv_info_model_uuid_value\\n\" +\n \"srv_info_model_name_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"network_info_model_inv_uuid_value\\n\" +\n \"network_info_model_custom_uuid_value\\n\" +\n \"network_info_model_uuid_value\\n\" +\n \"network_info_model_name_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"manufacturer\\n\" +\n \"vendor_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"ONTSN\\n\" +\n \"ont_sn_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"CVLAN\\n\" +\n \"c_vlan_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"SVLAN\\n\" +\n \"s_vlan_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"remote_id\\n\" +\n \"remote_id_value\\n\" +\n \"\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\";\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\", aaiData[\"svlan\"]);\nxmlCreateAccess = xmlCreateAccess.replace(\"c_vlan_value\", aaiData[\"cvlan\"]);\nxmlCreateAccess = xmlCreateAccess.replace(\"remote_id_value\", aaiData[\"remoteId\"]);\n\n\nexecutor.logger.info(client.toPrettyString(xmlCreateAccess, 4));\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 =\n \"\\n\" +\n \"\\n\" +\n \"svc_request_id_value\\n\" +\n \"update\\n\" +\n \"svc_notification_url_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"request_id_value\\n\" +\n \"ChangeInternetProfileInstance\\n\" +\n \"null\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"service_id_value\\n\" +\n \"service_instance_id_value\\n\" +\n \"service_type_value\\n\" +\n \"customer_id_value\\n\" +\n \"customer_name_value\\n\" +\n \"\\n\" +\n \"srv_info_model_inv_uuid_value\\n\" +\n \"srv_info_model_custom_uuid_value\\n\" +\n \"srv_info_model_uuid_value\\n\" +\n \"srv_info_model_name_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"network_info_model_inv_uuid_value\\n\" +\n \"network_info_model_custom_uuid_value\\n\" +\n \"network_info_model_uuid_value\\n\" +\n \"network_info_model_name_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"manufacturer\\n\" +\n \"vendor_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"service_id\\n\" +\n \"service_id_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"ip_remote_id\\n\" +\n \"remote_id_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"ont_sn\\n\" +\n \"ont_sn_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"ip_service_type\\n\" +\n \"service_type_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"ip_rg_mac_addr\\n\" +\n \"mac_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"ip_upstream_speed\\n\" +\n \"up_speed_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"ip_downstream_speed\\n\" +\n \"down_speed_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"s_vlan\\n\" +\n \"s_vlan_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"c_vlan\\n\" +\n \"c_vlan_value\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\n\" +\n \"\\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(\"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\", aaiData[\"svlan\"]);\nxmlChangeProfile = xmlChangeProfile.replace(\"c_vlan_value\", aaiData[\"cvlan\"]);\nxmlChangeProfile = xmlChangeProfile.replace(\"remote_id_value\", aaiData[\"remoteId\"]);\n\nexecutor.logger.info(client.toPrettyString(xmlChangeProfile, 4));\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\nexecutor.logger.info(executor.outFields);\nexecutor.logger.info(\"End Execution SdncResourceUpdateTask.js\");\n\ntrue;\n\nfunction getMetaValue(metaJson, metaname) {\n for (var i = 0; i < metaJson.length; i++) {\n if (metaJson[i]['metaname'] == metaname) {\n return metaJson[i]['metaval'];\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 return resJson[i]['resourceInvariantUuid'];\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 return resJson[i]['resourceUuid'];\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 return resJson[i]['resourceCustomizationUuid'];\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-2020 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 */\n\nexecutor.logger.info(\"Begin Execution ServiceUpdateStateCpeAuthTask.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar clEventType = 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 = 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\");\nexecutor.logger.info(\"New CPE Authentication State: \" + newState);\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\";\n\nAAI_URL = executor.parameters.get(\"AAI_URL\");\nAAI_USERNAME = executor.parameters.get(\"AAI_USERNAME\");\nAAI_PASSWORD = executor.parameters.get(\"AAI_PASSWORD\");\nAAI_VERSION = executor.parameters.get(\"AAI_VERSION\");\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;\n\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);\nexecutor.logger.info(\"End Execution ServiceUpdateStateCpeAuthTask.js\");\n\ntrue;"
}
}
}
]
}
},
"events": {
"key": {
"name": "NomadicONTPolicyModel_Events",
"version": "1.0.2"
},
"eventMap": {
"entry": [
{
"key": {
"name": "AAI_CPE_AUTH_UPDATE",
"version": "1.0.2"
},
"value": {
"key": {
"name": "AAI_CPE_AUTH_UPDATE",
"version": "1.0.2"
},
"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.2"
},
"value": {
"key": {
"name": "AAI_SERVICE_ASSIGNED",
"version": "1.0.2"
},
"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.2"
},
"value": {
"key": {
"name": "AAI_SERVICE_CREATE",
"version": "1.0.2"
},
"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.2"
},
"value": {
"key": {
"name": "END_CONTROL_LOOP",
"version": "1.0.2"
},
"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.2"
},
"value": {
"key": {
"name": "END_EVENT",
"version": "1.0.2"
},
"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.2"
},
"value": {
"key": {
"name": "ERROR_LOG",
"version": "1.0.2"
},
"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.2"
},
"value": {
"key": {
"name": "SDNC_RESOURCE_UPDATE",
"version": "1.0.2"
},
"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"
}
}
}
}
}
}
}
]
}
}