- Created by David Perez Caparros, last modified on Feb 23, 2020
You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 22 Next »
System View
System Set up
SO
Custom Workflow Configuration
~/oom/kubernetes# kubectl edit cm dev-so-so-bpmn-infra-app-configmap mso: ... oof: auth: test:testpwd callbackEndpoint: http://so-bpmn-infra.onap:8081/mso/WorkflowMessage endpoint: https://oof-osdf.onap:8698/api/oof/v1/placement timeout: PT30M workflow: + custom: + BBS_E2E_Service: + sdnc: + need: true + resource: + sequence: VnfVirtualLink,CPE,AccessConnectivity,InternetProfile,PonUni,OltNni,OntNni CreateGenericVNFV1: aai: volume-group: uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group default: aai: ... ## Restart the pod ~/oom/kubernetes# kubectl delete po dev-so-so-bpmn-infra-7556d7f6bc-8fthk
Mapping between resource model and BPMN template: SO : How it works between API and BPMN
As shown below, new entries need to be inserted manually in SO database (mariadb-galera) in order to map a given resource model to a specific BPMN recipe. For instance, the CPE is modeled in SDC as a VF but it is treated as PNF resource by SO by using the handlePNF BPMN recipe. Those entries need to be inserted in catalogdb database > vnf_recipe table.
IMPORTANT: make sure vnf_recipe.NF_ROLE matches vnf_resource.MODEL_NAME, and vnf_recipe.VERSION_STR matches vnf_resource.MODEL_VERSION.
root@onap-rancher-daily:/home/ubuntu# kubectl exec -ti dev-mariadb-galera-mariadb-galera-0 sh sh-4.2$ mysql -u root -p MariaDB [(none)]> use catalogdb; MariaDB [catalogdb]> INSERT INTO vnf_recipe (NF_ROLE, ACTION, SERVICE_TYPE, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, VNF_PARAM_XSD, RECIPE_TIMEOUT) VALUES ("InternetProfile", "createInstance", "NF", "1.0", "create InternetProfile", "/mso/async/services/CreateSDNCNetworkResource", '{"operationType":"AccessConnectivity"}', 180000), ("AccessConnectivity", "createInstance", "NF", "1.0", "create AccessConnectivity", "/mso/async/services/CreateSDNCNetworkResource", '{"operationType":"InternetProfile"}', 180000), ("CPE", "createInstance", "NF", "1.0", "create CPE", "/mso/async/services/HandlePNF", NULL, 180000); MariaDB [catalogdb]> select * from vnf_recipe where NF_ROLE IN ('AccessConnectivity','InternetProfile', 'CPE'); +-------+--------------------+----------------+--------------+-------------+---------------------------+-----------------------------------------------+----------------------------------------+----------------+---------------------+--------------+ | id | NF_ROLE | ACTION | SERVICE_TYPE | VERSION_STR | DESCRIPTION | ORCHESTRATION_URI | VNF_PARAM_XSD | RECIPE_TIMEOUT | CREATION_TIMESTAMP | VF_MODULE_ID | +-------+--------------------+----------------+--------------+-------------+---------------------------+-----------------------------------------------+----------------------------------------+----------------+---------------------+--------------+ | 10048 | InternetProfile | createInstance | NF | 1.0 | create InternetProfile | /mso/async/services/CreateSDNCNetworkResource | {"operationType":"InternetProfile"} | 1800000 | 2020-01-20 17:43:07 | NULL | | 10051 | AccessConnectivity | createInstance | NF | 1.0 | create AccessConnectivity | /mso/async/services/CreateSDNCNetworkResource | {"operationType":"AccessConnectivity"} | 1800000 | 2020-01-20 17:43:07 | NULL | | 10054 | CPE | createInstance | NF | 1.0 | create CPE | /mso/async/services/HandlePNF | NULL | 1800000 | 2020-01-20 17:43:07 | NULL | +-------+--------------------+----------------+--------------+-------------+---------------------------+-----------------------------------------------+----------------------------------------+----------------+---------------------+--------------+ 3 rows in set (0.00 sec)
DMaaP Message Router
Create required topics
curl -X POST \ http://mr.api.simpledemo.openecomp.org:30227/topics/create \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H 'cache-control: no-cache' \ -d '{ "topicName": "unauthenticated.DCAE_CL_OUTPUT", "topicDescription": "", "partitionCount": "", "replicationCount": "3" }'
curl -X POST \ http://mr.api.simpledemo.openecomp.org:30227/topics/create \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H 'cache-control: no-cache' \ -d '{ "topicName": "unauthenticated.CPE_AUTHENTICATION", "topicDescription": "", "partitionCount": "", "replicationCount": "3" }'
curl -X POST \ http://mr.api.simpledemo.openecomp.org:30227/topics/create \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H 'cache-control: no-cache' \ -d '{ "topicName": "unauthenticated.PNF_READY", "topicDescription": "", "partitionCount": "", "replicationCount": "3" }'
curl -X POST \ http://mr.api.simpledemo.openecomp.org:30227/topics/create \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H 'cache-control: no-cache' \ -d '{ "topicName": "unauthenticated.PNF_UPDATE", "topicDescription": "", "partitionCount": "", "replicationCount": "3" }'
DCAE
BBS Event Processor (BBS-ep)
Description: BBS-EventProcessor Service (BBS Usecase)
BBS event processor blueprints (ElAlto):
- https://git.onap.org/dcaegen2/services/plain/components/bbs-event-processor/dpo/blueprints/k8s-bbs-event-processor.yaml-template?h=elalto
- https://git.onap.org/dcaegen2/services/plain/components/bbs-event-processor/dpo/blueprints/bbs-event-processor-input.yaml?h=elalto
BBS event processor deployment procedure:
~/oom/kubernetes# kubectl exec -ti dev-dcaegen2-dcae-bootstrap-85f664d489-54pmt bash [root@dev-dcaegen2-dcae-bootstrap-85f664d489-54pmt /]# cfy blueprints validate /blueprints/k8s-bbs-event-processor.yaml Validating blueprint: /blueprints/k8s-bbs-event-processor.yaml-template Blueprint validated successfully [root@dev-dcaegen2-dcae-bootstrap-85f664d489-54pmt /]# cfy blueprints upload -b bbs-ep /blueprints/k8s-bbs-event-processor.yaml Uploading blueprint /blueprints/k8s-bbs-event-processor.yaml... k8s-bbs-event-pro... |################################################| 100.0% Blueprint uploaded. The blueprint's id is bbs-ep [root@dev-dcaegen2-dcae-bootstrap-85f664d489-54pmt /]# cfy deployments create -b bbs-ep -i /bbs-event-processor-input.yaml bbs-ep Creating new deployment from blueprint bbs-ep... Deployment created. The deployment's id is bbs-ep [root@dev-dcaegen2-dcae-bootstrap-85f664d489-54pmt /]# cfy executions start -d bbs-ep install Executing workflow install on deployment bbs-ep [timeout=900 seconds] 2019-05-01 11:35:32.007 CFY <bbs-ep> Starting 'install' workflow execution 2019-05-01 11:35:32.587 CFY <bbs-ep> [bbs-event-processor_yd5ucp] Creating node instance 2019-05-01 11:35:32.587 CFY <bbs-ep> [bbs-event-processor_yd5ucp.create] Sending task 'k8splugin.create_for_components' 2019-05-01 11:35:33.953 LOG <bbs-ep> [bbs-event-processor_yd5ucp.create] INFO: Added config for s4d51b24f52264857b7ef520be9efc46b-bbs-event-processor 2019-05-01 11:35:33.953 LOG <bbs-ep> [bbs-event-processor_yd5ucp.create] INFO: Added config for s4d51b24f52264857b7ef520be9efc46b-bbs-event-processor 2019-05-01 11:35:34.596 CFY <bbs-ep> [bbs-event-processor_yd5ucp.create] Task succeeded 'k8splugin.create_for_components' 2019-05-01 11:35:34.596 CFY <bbs-ep> [bbs-event-processor_yd5ucp] Node instance created 2019-05-01 11:35:34.596 CFY <bbs-ep> [bbs-event-processor_yd5ucp] Configuring node instance: nothing to do 2019-05-01 11:35:35.227 CFY <bbs-ep> [bbs-event-processor_yd5ucp] Starting node instance 2019-05-01 11:35:35.227 CFY <bbs-ep> [bbs-event-processor_yd5ucp.start] Sending task 'k8splugin.create_and_start_container_for_components' 2019-05-01 11:35:36.193 LOG <bbs-ep> [bbs-event-processor_yd5ucp.start] INFO: Starting k8s deployment for s4d51b24f52264857b7ef520be9efc46b-bbs-event-processor, image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.components.bbs-event-processor:1.0.0, env: {'CONSUL_HOST': u'consul-server.onap', 'SERVICE_TAGS': 'bbs-ep', 'CONFIG_BINDING_SERVICE': 'config-binding-service'}, kwargs: {'readiness': {u'endpoint': u'/heartbeat', u'type': u'http', u'timeout': u'5s', u'interval': u'180s'}, 'labels': {'cfydeployment': u'bbs-ep', 'cfynodeinstance': u'bbs-event-processor_yd5ucp', 'cfynode': u'bbs-event-processor'}, 'tls_info': {u'use_tls': True, u'cert_directory': u'/opt/app/bbs-event-processor/etc/cert'}, 'envs': {'SERVICE_TAGS': 'bbs-ep'}, 'liveness': {}, 'resource_config': {}, 'volumes': [], 'log_info': {u'log_directory': u'/opt/app/bbs-event-processor/logs'}, 'ports': [u'8100:30810'], 'k8s_location': u'central'} 2019-05-01 11:35:36.818 LOG <bbs-ep> [bbs-event-processor_yd5ucp.start] INFO: Passing k8sconfig: {'tls': {u'cert_path': u'/opt/tls/shared', u'image': u'nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tls-init-container:1.0.3-STAGING-latest'}, 'filebeat': {u'config_map': u'dcae-filebeat-configmap', u'config_path': u'/usr/share/filebeat/filebeat.yml', u'log_path': u'/var/log/onap', u'image': u'docker.elastic.co/beats/filebeat:5.5.0', u'data_path': u'/usr/share/filebeat/data', u'config_subpath': u'filebeat.yml'}, 'consul_dns_name': u'consul-server.onap', 'image_pull_secrets': [u'onap-docker-registry-key'], 'namespace': u'onap', 'consul_host': 'consul-server:8500', 'default_k8s_location': u'central'} 2019-05-01 11:35:36.818 LOG <bbs-ep> [bbs-event-processor_yd5ucp.start] INFO: k8s deployment initiated successfully for s4d51b24f52264857b7ef520be9efc46b-bbs-event-processor: {'services': ['s4d51b24f52264857b7ef520be9efc46b-bbs-event-processor', 'xs4d51b24f52264857b7ef520be9efc46b-bbs-event-processor'], 'namespace': u'onap', 'location': u'central', 'deployment': 'dep-s4d51b24f52264857b7ef520be9efc46b-bbs-event-processor'} 2019-05-01 11:35:36.818 LOG <bbs-ep> [bbs-event-processor_yd5ucp.start] INFO: Waiting up to 1800 secs for s4d51b24f52264857b7ef520be9efc46b-bbs-event-processor to become ready 2019-05-01 11:36:58.376 LOG <bbs-ep> [bbs-event-processor_yd5ucp.start] INFO: Done starting: s4d51b24f52264857b7ef520be9efc46b-bbs-event-processor 2019-05-01 11:36:57.873 LOG <bbs-ep> [bbs-event-processor_yd5ucp.start] INFO: k8s deployment is ready for: s4d51b24f52264857b7ef520be9efc46b-bbs-event-processor 2019-05-01 11:36:59.119 CFY <bbs-ep> [bbs-event-processor_yd5ucp.start] Task succeeded 'k8splugin.create_and_start_container_for_components' 2019-05-01 11:36:59.119 CFY <bbs-ep> [bbs-event-processor_yd5ucp] Node instance started 2019-05-01 11:36:59.119 CFY <bbs-ep> 'install' workflow execution succeeded Finished executing workflow install on deployment bbs-ep * Run 'cfy events list -e 7f285182-4f85-478c-95f3-b8b6970f7c8d' to retrieve the execution's events/logs
RESTCONF Collector
Description: RESTConf Collector (BBS Usecase)
RESTCONF Collector blueprint (ElAlto):
RESTCONF Collector deployment procedure:
[root@dev-dcaegen2-dcae-bootstrap-779767c49c-7cvdw /]# cfy blueprints validate blueprints/k8s-rcc-policy.yaml Validating blueprint: blueprints/k8s-rcc-policy.yaml Blueprint validated successfully [root@dev-dcaegen2-dcae-bootstrap-779767c49c-7cvdw /]# cfy blueprints upload -b restconfcollector /blueprints/k8s-rcc-policy.yaml Uploading blueprint /blueprints/k8s-rcc-policy.yaml... k8s-rcc-policy.yaml |#################################################| 100.0% Blueprint uploaded. The blueprint's id is restconfcollector [root@dev-dcaegen2-dcae-bootstrap-779767c49c-7cvdw /]# cfy deployments create -b restconfcollector Creating new deployment from blueprint restconfcollector... Deployment created. The deployment's id is restconfcollector [root@dev-dcaegen2-dcae-bootstrap-779767c49c-7cvdw /]# cfy executions start -d restconfcollector install Executing workflow install on deployment restconfcollector [timeout=900 seconds] 2020-01-13 15:12:52.119 CFY <restconfcollector> Starting 'install' workflow execution 2020-01-13 15:12:52.701 CFY <restconfcollector> [rcc_k8s_8qm5me] Creating node instance 2020-01-13 15:12:52.701 CFY <restconfcollector> [rcc_k8s_8qm5me.create] Sending task 'k8splugin.create_for_platforms' 2020-01-13 15:12:55.168 LOG <restconfcollector> [rcc_k8s_8qm5me.create] INFO: Added config for dcaegen2-collectors-rcc 2020-01-13 15:12:55.747 LOG <restconfcollector> [rcc_k8s_8qm5me.create] INFO: Done setting up: dcaegen2-collectors-rcc 2020-01-13 15:12:55.747 CFY <restconfcollector> [rcc_k8s_8qm5me.create] Task succeeded 'k8splugin.create_for_platforms' 2020-01-13 15:12:55.747 CFY <restconfcollector> [rcc_k8s_8qm5me] Node instance created 2020-01-13 15:12:56.341 CFY <restconfcollector> [rcc_k8s_8qm5me] Configuring node instance: nothing to do 2020-01-13 15:12:56.341 CFY <restconfcollector> [rcc_k8s_8qm5me] Starting node instance 2020-01-13 15:12:56.341 CFY <restconfcollector> [rcc_k8s_8qm5me.start] Sending task 'k8splugin.create_and_start_container_for_platforms' 2020-01-13 15:12:57.559 LOG <restconfcollector> [rcc_k8s_8qm5me.start] INFO: Starting k8s deployment for dcaegen2-collectors-rcc, image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.restconfcollector:1.1.1, env: {'CONSUL_HOST': u'consul-server.onap.svc.cluster.local', u'DMAAPHOST': u'message-router.onap.svc.cluster.local', 'CONFIG_BINDING_SERVICE': u'config_binding_service', u'CBS_HOST': u'config-binding-service.dcae.svc.cluster.local', u'DMAAPPORT': u'3904', u'CBS_PORT': u'10000', u'CONSUL_PORT': u'8500', u'DMAAPPUBTOPIC': u'unauthenticated.DCAE_RCC_OUTPUT'}, kwargs: {'readiness': {u'endpoint': u'/healthcheck', u'type': u'http', u'timeout': u'1s', u'interval': u'15s'}, 'tls_info': {}, 'replicas': 1, u'envs': {u'CONSUL_HOST': u'consul-server.onap.svc.cluster.local', u'DMAAPHOST': u'message-router.onap.svc.cluster.local', u'CONFIG_BINDING_SERVICE': u'config_binding_service', u'CBS_HOST': u'config-binding-service.dcae.svc.cluster.local', u'DMAAPPORT': u'3904', u'CBS_PORT': u'10000', u'CONSUL_PORT': u'8500', u'DMAAPPUBTOPIC': u'unauthenticated.DCAE_RCC_OUTPUT'}, 'labels': {'cfydeployment': u'restconfcollector', 'cfynodeinstance': u'rcc_k8s_8qm5me', 'cfynode': u'rcc_k8s'}, 'ctx': <cloudify.context.CloudifyContext object at 0x7fb63e5872d0>, 'always_pull_image': False, 'resource_config': {}, 'log_info': {u'log_directory': u'/opt/app/RCCollector/logs'}, u'ports': [u'8080:30416'], 'k8s_location': u'central'} 2020-01-13 15:12:58.275 LOG <restconfcollector> [rcc_k8s_8qm5me.start] INFO: Passing k8sconfig: {'tls': {u'cert_path': u'/opt/tls/shared', u'image': u'nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tls-init-container:1.0.3', u'ca_cert_configmap': u'dev-dcaegen2-dcae-bootstrap-dcae-cacert', u'component_ca_cert_path': u'/opt/dcae/cacert/cacert.pem'}, 'filebeat': {u'config_map': u'dcae-filebeat-configmap', u'config_path': u'/usr/share/filebeat/filebeat.yml', u'log_path': u'/var/log/onap', u'image': u'docker.elastic.co/beats/filebeat:5.5.0', u'data_path': u'/usr/share/filebeat/data', u'config_subpath': u'filebeat.yml'}, 'consul_dns_name': u'consul-server.onap', 'image_pull_secrets': [u'onap-docker-registry-key'], 'namespace': u'onap', 'consul_host': 'consul-server:8500', 'default_k8s_location': u'central'} 2020-01-13 15:12:58.275 LOG <restconfcollector> [rcc_k8s_8qm5me.start] INFO: k8s deployment initiated successfully for dcaegen2-collectors-rcc: {'services': ['dcaegen2-collectors-rcc', 'xdcaegen2-collectors-rcc'], 'namespace': u'onap', 'location': u'central', 'deployment': 'dep-dcaegen2-collectors-rcc'} 2020-01-13 15:12:58.275 LOG <restconfcollector> [rcc_k8s_8qm5me.start] INFO: Waiting up to 1800 secs for dcaegen2-collectors-rcc to become ready ^A2020-01-13 15:13:29.970 LOG <restconfcollector> [rcc_k8s_8qm5me.start] INFO: k8s deployment is ready for: dcaegen2-collectors-rcc 2020-01-13 15:13:30.550 CFY <restconfcollector> [rcc_k8s_8qm5me.start] Task succeeded 'k8splugin.create_and_start_container_for_platforms' 2020-01-13 15:13:30.550 CFY <restconfcollector> [rcc_k8s_8qm5me] Node instance started 2020-01-13 15:13:31.265 CFY <restconfcollector> 'install' workflow execution succeeded Finished executing workflow install on deployment restconfcollector * Run 'cfy events list -e 2ea4f906-536b-48b1-aa34-dd6b4baed255' to retrieve the execution's events/logs
VES mapper
Description: VESMapper (BBS Usecase)
VES Mapper blueprint:
NOTE: Set the image to nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.mapper.vesadapter.universalvesadaptor:1.0.0 in the blueprint
VES Collector
Configure mapping VES event domain to DMaaP topic: ves-statechange --> unauthenticated.CPE_AUTHENTICATION
1) Access Consul UI: http://<consul_server_ui>:30270/ui/#/dc1/services
2) Modify dcae-ves-collector configuration by adding a new VES domain to DMaaP topic mapping
"ves-statechange": {"type": "message_router", "dmaap_info": {"topic_url": "http://message-router:3904/events/unauthenticated.CPE_AUTHENTICATION"}}
3) Click on UPDATE to apply the new configuration
SDNC
Make sure that BBS DGs in SDNC DGBuilder are in Active state
bbs-access-connectivity-vnf-topology-operation-create-huawei
bbs-access-connectivity-vnf-topology-operation-delete-huawei
bbs-internet-profile-vnf-topology-operation-change-huawei
bbs-internet-profile-vnf-topology-operation-common-huawei
bbs-internet-profile-vnf-topology-operation-create-huawei
bbs-internet-profile-vnf-topology-operation-delete-huawei
validate-bbs-vnf-input-parameters
DGBuilder URL: https://dguser:test123@sdnc.api.simpledemo.onap.org:30203
Access SDN M&C DG
Configure Access SDN M&C IP address in SDNC DG using dgbuilder. For instance:
> GENERIC-RESOURCE-API: bbs-access-connectivity-vnf-topology-operation-create-huawei.json
> GENERIC-RESOURCE-API: bbs-access-connectivity-vnf-topology-operation-delete-huawei.json
1) Export the relevant DG
2) Modify the IP address
3) Import back the DG and Activate it
DGBuilder URL: https://dguser:test123@sdnc.api.simpledemo.onap.org:30203
Edge SDN M&C DG
Configure Edge SDN M&C IP address in SDNC DG using dgbuilder. For instance:
> GENERIC-RESOURCE-API: bbs-access-connectivity-vnf-topology-operation-common-huawei.json
1) Export the relevant DG
2) Modify the IP address
3) Import back the DG and Activate it
DGBuilder URL: https://dguser:test123@sdnc.api.simpledemo.onap.org:30203
Ref: Swisscom Edge SDN M&C and virtual BNG
Add SSL certificate of the 3rd party controller into the SDNC trust store
kubectl exec -ti dev-sdnc-sdnc-0 -n onap -- bash openssl s_client -connect <IP_ADDRESS_EXT_CTRL>:<PORT> # copy server certificate and paste in /tmp/<CA_CERT_NAME>.crt sudo keytool -importcert -file /tmp/<CA_CERT_NAME>.crt -alias <CA_CERT_NAME>_key -keystore truststore.onap.client.jks -storepass adminadmin keytool -list -keystore truststore.onap.client.jks -storepass adminadmin | grep <CA_CERT_NAME>
See SDNC-179 - Getting issue details... STATUS
Policy
Deploy BBS APEX Policy (master, apex-pdp image v2.3+)
1) Make Sure APEX PDP is running and in Active state
API: GET URL: {{POLICY-PAP-URL}}/policy/pap/v1/pdps
2) Create the operational control loop APEX policy type
API: POST URL: {{POLICY-API-URL}}/policy/api/v1/policytypes
{ "tosca_definitions_version": "tosca_simple_yaml_1_0_0", "policy_types": { "onap.policies.controlloop.operational.Apex": { "version": "1.0.0", "description": "Operational Policy for Control Loops using the APEX PDP", "properties": { "engine_service": { "type": "onap.datatypes.policies.controlloop.operational.apex.EngineService", "description": "APEX Engine Service Parameters" }, "inputs": { "type": "map", "description": "Inputs for handling events coming into the APEX engine", "entry_schema": { "type": "onap.datatypes.policies.controlloop.operational.apex.EventHandler" } }, "outputs": { "type": "map", "description": "Outputs for handling events going out of the APEX engine", "entry_schema": { "type": "onap.datatypes.policies.controlloop.operational.apex.EventHandler" } }, "environment": { "type": "list", "description": "Envioronmental parameters for the APEX engine", "entry_schema": { "type": "onap.datatypes.policies.controlloop.operational.apex.Environment" } } } } }, "data_types": { "onap.datatypes.policies.controlloop.operational.apex.EngineService": { "derived_from": "tosca.datatypes.Root", "properties": { "name": { "type": "string", "description": "Specifies the engine name", "required": false, "default": "ApexEngineService" }, "version": { "type": "string", "description": "Specifies the engine version in double dotted format", "required": false, "default": "1.0.0" }, "id": { "type": "int", "description": "Specifies the engine id", "required": true }, "instance_count": { "type": "int", "description": "Specifies the number of engine threads that should be run", "required": true }, "deployment_port": { "type": "int", "description": "Specifies the port to connect to for engine administration", "required": false, "default": 1 }, "policy_model_file_name": { "type": "string", "description": "The name of the file from which to read the APEX policy model", "required": false, "default": "" }, "policy_type_impl": { "type": "string", "description": "The policy type implementation from which to read the APEX policy model", "required": false, "default": "" }, "periodic_event_period": { "type": "string", "description": "The time interval in milliseconds for the periodic scanning event, 0 means \"don't scan\"", "required": false, "default": 0 }, "engine": { "type": "onap.datatypes.policies.controlloop.operational.apex.engineservice.Engine", "description": "The parameters for all engines in the APEX engine service", "required": true } } }, "onap.datatypes.policies.controlloop.operational.apex.EventHandler": { "derived_from": "tosca.datatypes.Root", "properties": { "name": { "type": "string", "description": "Specifies the event handler name, if not specified this is set to the key name", "required": false }, "carrier_technology": { "type": "onap.datatypes.policies.controlloop.operational.apex.CarrierTechnology", "description": "Specifies the carrier technology of the event handler (such as REST/Web Socket/Kafka)", "required": true }, "event_protocol": { "type": "onap.datatypes.policies.controlloop.operational.apex.EventProtocol", "description": "Specifies the event protocol of events for the event handler (such as Yaml/JSON/XML/POJO)", "required": true }, "event_name": { "type": "string", "description": "Specifies the event name for events on this event handler, if not specified, the event name is read from or written to the event being received or sent", "required": false }, "event_name_filter": { "type": "string", "description": "Specifies a filter as a regular expression, events that do not match the filter are dropped, the default is to let all events through", "required": false }, "synchronous_mode": { "type": "bool", "description": "Specifies the event handler is syncronous (receive event and send response)", "required": false, "default": false }, "synchronous_peer": { "type": "string", "description": "The peer event handler (output for input or input for output) of this event handler in synchronous mode, this parameter is mandatory if the event handler is in synchronous mode", "required": false, "default": "" }, "synchronous_timeout": { "type": "int", "description": "The timeout in milliseconds for responses to be issued by APEX torequests, this parameter is mandatory if the event handler is in synchronous mode", "required": false, "default": "" }, "requestor_mode": { "type": "bool", "description": "Specifies the event handler is in requestor mode (send event and wait for response mode)", "required": false, "default": false }, "requestor_peer": { "type": "string", "description": "The peer event handler (output for input or input for output) of this event handler in requestor mode, this parameter is mandatory if the event handler is in requestor mode", "required": false, "default": "" }, "requestor_timeout": { "type": "int", "description": "The timeout in milliseconds for wait for responses to requests, this parameter is mandatory if the event handler is in requestor mode", "required": false, "default": "" } } }, "onap.datatypes.policies.controlloop.operational.apex.CarrierTechnology": { "derived_from": "tosca.datatypes.Root", "properties": { "label": { "type": "string", "description": "The label (name) of the carrier technology (such as REST, Kafka, WebSocket)", "required": true }, "plugin_parameter_class_name": { "type": "string", "description": "The class name of the class that overrides default handling of event input or output for this carrier technology, defaults to the supplied input or output class", "required": false } } }, "onap.datatypes.policies.controlloop.operational.apex.EventProtocol": { "derived_from": "tosca.datatypes.Root", "properties": { "label": { "type": "string", "description": "The label (name) of the event protocol (such as Yaml, JSON, XML, or POJO)", "required": true }, "event_protocol_plugin_class": { "type": "string", "description": "The class name of the class that overrides default handling of the event protocol for this carrier technology, defaults to the supplied event protocol class", "required": false } } }, "onap.datatypes.policies.controlloop.operational.apex.Environmental": { "derived_from": "tosca.datatypes.Root", "properties": { "name": { "type": "string", "description": "The name of the environment variable", "required": true }, "value": { "type": "string", "description": "The value of the environment variable", "required": true } } }, "onap.datatypes.policies.controlloop.operational.apex.engineservice.Engine": { "derived_from": "tosca.datatypes.Root", "properties": { "context": { "type": "onap.datatypes.policies.controlloop.operational.apex.engineservice.engine.Context", "description": "The properties for handling context in APEX engines, defaults to using Java maps for context", "required": false }, "executors": { "type": "map", "description": "The plugins for policy executors used in engines such as javascript, MVEL, Jython", "required": true, "entry_schema": { "description": "The plugin class path for this policy executor", "type": "string" } } } }, "onap.datatypes.policies.controlloop.operational.apex.engineservice.engine.Context": { "derived_from": "tosca.datatypes.Root", "properties": { "distributor": { "type": "onap.datatypes.policies.controlloop.operational.apex.Plugin", "description": "The plugin to be used for distributing context between APEX PDPs at runtime", "required": false }, "schemas": { "type": "map", "description": "The plugins for context schemas available in APEX PDPs such as Java and Avro", "required": false, "entry_schema": { "type": "onap.datatypes.policies.controlloop.operational.apex.Plugin" } }, "locking": { "type": "onap.datatypes.policies.controlloop.operational.apex.plugin", "description": "The plugin to be used for locking context in and between APEX PDPs at runtime", "required": false }, "persistence": { "type": "onap.datatypes.policies.controlloop.operational.apex.Plugin", "description": "The plugin to be used for persisting context for APEX PDPs at runtime", "required": false } } }, "onap.datatypes.policies.controlloop.operational.apex.Plugin": { "derived_from": "tosca.datatypes.Root", "properties": { "name": { "type": "string", "description": "The name of the executor such as Javascript, Jython or MVEL", "required": true }, "plugin_class_name": { "type": "string", "description": "The class path of the plugin class for this executor" } } } } }
3) Create BBS APEX policy
API: POST URL: {{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.Apex/versions/1.0.0/policies
{ "tosca_definitions_version": "tosca_simple_yaml_1_0_0", "topology_template": { "policies": [ { "operational.onapbbs": { "type": "onap.policies.controlloop.operational.Apex", "typeVersion": "1.0.0", "name": "onap.policies.controlloop.operational.apex.onapbbs", "version": "1.0.0", "properties": { "engineServiceParameters": { "name": "NomadicONTPolicyModelEngine", "version": "0.0.1", "id": 101, "instanceCount": 4, "deploymentPort": 12345, "engineParameters": { "executorParameters": { "MVEL": { "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters" }, "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" } }, "contextParameters": { "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", "schemaParameters": { "Avro": { "parameterClassName": "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters" }, "Java": { "parameterClassName": "org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters", "jsonAdapters": { "Instant": { "adaptedClass": "java.time.Instant", "adaptorClass": "org.onap.policy.controlloop.util.Serialization$GsonInstantAdapter" } } } } } }, "policy_type_impl": { "apexPolicyModel": { "key": { "name": "NomadicONTPolicyModel", "version": "1.0.2" }, "keyInformation": { "key": { "name": "NomadicONTPolicyModel_KeyInfo", "version": "1.0.2" }, "keyInfoMap": { "entry": [ { "key": { "name": "AAIServiceAssignedTask", "version": "0.0.1" }, "value": { "key": { "name": "AAIServiceAssignedTask", "version": "0.0.1" }, "UUID": "2af956bf-4c3f-370b-8112-44d7eca870a7", "description": "Generated description for concept referred to by key \"AAIServiceAssignedTask:0.0.1\"" } }, { "key": { "name": "AAIServiceCreateTask", "version": "0.0.1" }, "value": { "key": { "name": "AAIServiceCreateTask", "version": "0.0.1" }, "UUID": "e1fcaf11-adce-3d40-90e2-9b74d523b7ba", "description": "Generated description for concept referred to by key \"AAIServiceCreateTask:0.0.1\"" } }, { "key": { "name": "AAI_CPE_AUTH_UPDATE", "version": "1.0.0" }, "value": { "key": { "name": "AAI_CPE_AUTH_UPDATE", "version": "1.0.0" }, "UUID": "11fbba56-9d56-398b-aa9f-8f1242384de5", "description": "Generated description for concept referred to by key \"AAI_CPE_AUTH_UPDATE:1.0.0\"" } }, { "key": { "name": "AAI_SERVICE_ASSIGNED", "version": "1.0.0" }, "value": { "key": { "name": "AAI_SERVICE_ASSIGNED", "version": "1.0.0" }, "UUID": "91964d94-023a-3039-bb27-da28d38206e6", "description": "Generated description for concept referred to by key \"AAI_SERVICE_ASSIGNED:1.0.0\"" } }, { "key": { "name": "AAI_SERVICE_CREATE", "version": "1.0.0" }, "value": { "key": { "name": "AAI_SERVICE_CREATE", "version": "1.0.0" }, "UUID": "5ee7ee54-2155-3e11-b899-8af74d8044ce", "description": "Generated description for concept referred to by key \"AAI_SERVICE_CREATE:1.0.0\"" } }, { "key": { "name": "CPEAuthenticationPolicy", "version": "0.0.1" }, "value": { "key": { "name": "CPEAuthenticationPolicy", "version": "0.0.1" }, "UUID": "f8c31efd-6755-3bd8-8720-b622e7e61a4d", "description": "Generated description for concept referred to by key \"CPEAuthenticationPolicy:0.0.1\"" } }, { "key": { "name": "CPE_Authentication", "version": "1.0.2" }, "value": { "key": { "name": "CPE_Authentication", "version": "1.0.2" }, "UUID": "7fe1283a-ff26-3fdc-9856-bcebd2f7b3d2", "description": "Generated description for concept referred to by key \"CPE_Authentication:1.0.2\"" } }, { "key": { "name": "END_CONTROL_LOOP", "version": "1.0.0" }, "value": { "key": { "name": "END_CONTROL_LOOP", "version": "1.0.0" }, "UUID": "e5b7f639-1586-3a51-a968-6315e0b79f27", "description": "Generated description for concept referred to by key \"END_CONTROL_LOOP:1.0.0\"" } }, { "key": { "name": "END_EVENT", "version": "1.0.0" }, "value": { "key": { "name": "END_EVENT", "version": "1.0.0" }, "UUID": "0378736c-46f7-39fb-9e89-3c34e124ade1", "description": "Generated description for concept referred to by key \"END_EVENT:1.0.0\"" } }, { "key": { "name": "ERROR_LOG", "version": "1.0.0" }, "value": { "key": { "name": "ERROR_LOG", "version": "1.0.0" }, "UUID": "a220439e-cc77-3a05-8ac9-773ab68f417e", "description": "Generated description for concept referred to by key \"ERROR_LOG:1.0.0\"" } }, { "key": { "name": "ErrorAAIServiceAssignedLogTask", "version": "0.0.1" }, "value": { "key": { "name": "ErrorAAIServiceAssignedLogTask", "version": "0.0.1" }, "UUID": "4b5311bb-b3e8-31f6-9ea1-0fd026d739d7", "description": "Generated description for concept referred to by key \"ErrorAAIServiceAssignedLogTask:0.0.1\"" } }, { "key": { "name": "ErrorSdncResourceUpdateTaskLogTask", "version": "0.0.1" }, "value": { "key": { "name": "ErrorSdncResourceUpdateTaskLogTask", "version": "0.0.1" }, "UUID": "daa86721-a761-334f-96bf-6f5c781f65ed", "description": "Generated description for concept referred to by key \"ErrorSdncResourceUpdateTaskLogTask:0.0.1\"" } }, { "key": { "name": "GetBBSCloseLoopEventTask", "version": "0.0.1" }, "value": { "key": { "name": "GetBBSCloseLoopEventTask", "version": "0.0.1" }, "UUID": "0791e26f-5d94-3cee-991c-31f226e83c4e", "description": "Generated description for concept referred to by key \"GetBBSCloseLoopEventTask:0.0.1\"" } }, { "key": { "name": "NomadicEventSuccessTask", "version": "0.0.1" }, "value": { "key": { "name": "NomadicEventSuccessTask", "version": "0.0.1" }, "UUID": "6fe3e6f7-a429-3979-9146-db0fa239591b", "description": "Generated description for concept referred to by key \"NomadicEventSuccessTask:0.0.1\"" } }, { "key": { "name": "NomadicONTContextAlbum", "version": "0.0.1" }, "value": { "key": { "name": "NomadicONTContextAlbum", "version": "0.0.1" }, "UUID": "3d9cf947-a5ef-3781-8c70-ec0e94f65693", "description": "Generated description for concept referred to by key \"NomadicONTContextAlbum:0.0.1\"" } }, { "key": { "name": "NomadicONTContextType", "version": "0.0.1" }, "value": { "key": { "name": "NomadicONTContextType", "version": "0.0.1" }, "UUID": "b9508c97-79b6-35ec-8e45-731eac9d37cc", "description": "Generated description for concept referred to by key \"NomadicONTContextType:0.0.1\"" } }, { "key": { "name": "NomadicONTPolicyModel", "version": "1.0.2" }, "value": { "key": { "name": "NomadicONTPolicyModel", "version": "1.0.2" }, "UUID": "457e3fcf-a901-37b2-bfc0-14d56abfc507", "description": "Generated description for concept referred to by key \"NomadicONTPolicyModel:1.0.2\"" } }, { "key": { "name": "NomadicONTPolicyModel_Albums", "version": "1.0.2" }, "value": { "key": { "name": "NomadicONTPolicyModel_Albums", "version": "1.0.2" }, "UUID": "9a0edd63-7d9b-3122-8750-d6a17c248f0f", "description": "Generated description for concept referred to by key \"NomadicONTPolicyModel_Albums:1.0.2\"" } }, { "key": { "name": "NomadicONTPolicyModel_Events", "version": "1.0.2" }, "value": { "key": { "name": "NomadicONTPolicyModel_Events", "version": "1.0.2" }, "UUID": "82ff2635-a05e-3b3e-ae59-526735db78fc", "description": "Generated description for concept referred to by key \"NomadicONTPolicyModel_Events:1.0.2\"" } }, { "key": { "name": "NomadicONTPolicyModel_KeyInfo", "version": "1.0.2" }, "value": { "key": { "name": "NomadicONTPolicyModel_KeyInfo", "version": "1.0.2" }, "UUID": "530bcf35-a3cb-305a-8b41-0499945b510f", "description": "Generated description for concept referred to by key \"NomadicONTPolicyModel_KeyInfo:1.0.2\"" } }, { "key": { "name": "NomadicONTPolicyModel_Policies", "version": "1.0.2" }, "value": { "key": { "name": "NomadicONTPolicyModel_Policies", "version": "1.0.2" }, "UUID": "9223db37-fb3b-3b3f-a85b-eb7e7b3a4e10", "description": "Generated description for concept referred to by key \"NomadicONTPolicyModel_Policies:1.0.2\"" } }, { "key": { "name": "NomadicONTPolicyModel_Schemas", "version": "1.0.2" }, "value": { "key": { "name": "NomadicONTPolicyModel_Schemas", "version": "1.0.2" }, "UUID": "41ba496f-6bfb-31e7-972e-6b2fab3e7d52", "description": "Generated description for concept referred to by key \"NomadicONTPolicyModel_Schemas:1.0.2\"" } }, { "key": { "name": "NomadicONTPolicyModel_Tasks", "version": "1.0.2" }, "value": { "key": { "name": "NomadicONTPolicyModel_Tasks", "version": "1.0.2" }, "UUID": "c337fda0-0a48-3329-af48-ed710214c092", "description": "Generated description for concept referred to by key \"NomadicONTPolicyModel_Tasks:1.0.2\"" } }, { "key": { "name": "Nomadic_ONT", "version": "1.0.2" }, "value": { "key": { "name": "Nomadic_ONT", "version": "1.0.2" }, "UUID": "b375c6f5-19ca-390f-ba19-2a0a49f233af", "description": "Generated description for concept referred to by key \"Nomadic_ONT:1.0.2\"" } }, { "key": { "name": "ONTRegistrationPolicy", "version": "0.0.1" }, "value": { "key": { "name": "ONTRegistrationPolicy", "version": "0.0.1" }, "UUID": "45773f7e-e1f6-3286-8f82-144836629edb", "description": "Generated description for concept referred to by key \"ONTRegistrationPolicy:0.0.1\"" } }, { "key": { "name": "SDNC_RESOURCE_UPDATE", "version": "1.0.0" }, "value": { "key": { "name": "SDNC_RESOURCE_UPDATE", "version": "1.0.0" }, "UUID": "c8fe0156-80c7-3e8d-8aa8-56be04fb1147", "description": "Generated description for concept referred to by key \"SDNC_RESOURCE_UPDATE:1.0.0\"" } }, { "key": { "name": "SdncResourceUpdateTask", "version": "0.0.1" }, "value": { "key": { "name": "SdncResourceUpdateTask", "version": "0.0.1" }, "UUID": "db7d3e67-12a8-35c8-b063-bc2a1fd77662", "description": "Generated description for concept referred to by key \"SdncResourceUpdateTask:0.0.1\"" } }, { "key": { "name": "ServiceUpdateStateCpeAuthTask", "version": "0.0.1" }, "value": { "key": { "name": "ServiceUpdateStateCpeAuthTask", "version": "0.0.1" }, "UUID": "78fa10b8-23e9-3362-893a-0dd7a656c7b6", "description": "Generated description for concept referred to by key \"ServiceUpdateStateCpeAuthTask:0.0.1\"" } }, { "key": { "name": "SimpleBooleanType", "version": "0.0.1" }, "value": { "key": { "name": "SimpleBooleanType", "version": "0.0.1" }, "UUID": "7218fb2f-59e3-321d-9ae1-bc97b19eb4ae", "description": "Generated description for concept referred to by key \"SimpleBooleanType:0.0.1\"" } }, { "key": { "name": "SimpleLongType", "version": "0.0.1" }, "value": { "key": { "name": "SimpleLongType", "version": "0.0.1" }, "UUID": "2dfcd9ec-a6f9-3f9f-958f-9b36cf4ac574", "description": "Generated description for concept referred to by key \"SimpleLongType:0.0.1\"" } }, { "key": { "name": "SimpleStringType", "version": "0.0.1" }, "value": { "key": { "name": "SimpleStringType", "version": "0.0.1" }, "UUID": "8a4957cf-9493-3a76-8c22-a208e23259af", "description": "Generated description for concept referred to by key \"SimpleStringType:0.0.1\"" } }, { "key": { "name": "UUIDType", "version": "0.0.1" }, "value": { "key": { "name": "UUIDType", "version": "0.0.1" }, "UUID": "6a8cc68e-dfc8-3403-9c6d-071c886b319c", "description": "Generated description for concept referred to by key \"UUIDType:0.0.1\"" } }, { "key": { "name": "VirtualControlLoopEventType", "version": "0.0.1" }, "value": { "key": { "name": "VirtualControlLoopEventType", "version": "0.0.1" }, "UUID": "15aca887-8f6c-3713-8114-0f49f03adab7", "description": "Generated description for concept referred to by key \"VirtualControlLoopEventType:0.0.1\"" } } ] } }, "policies": { "key": { "name": "NomadicONTPolicyModel_Policies", "version": "1.0.2" }, "policyMap": { "entry": [ { "key": { "name": "CPEAuthenticationPolicy", "version": "0.0.1" }, "value": { "policyKey": { "name": "CPEAuthenticationPolicy", "version": "0.0.1" }, "template": "Freestyle", "state": { "entry": [ { "key": "INIT", "value": { "stateKey": { "parentKeyName": "CPEAuthenticationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "NULL", "localName": "INIT" }, "trigger": { "name": "CPE_Authentication", "version": "1.0.2" }, "stateOutputs": { "entry": [ { "key": "ServiceUpdateCpeAuthOutPut", "value": { "key": { "parentKeyName": "CPEAuthenticationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "INIT", "localName": "ServiceUpdateCpeAuthOutPut" }, "outgoingEvent": { "name": "AAI_CPE_AUTH_UPDATE", "version": "1.0.0" }, "nextState": { "parentKeyName": "NULL", "parentKeyVersion": "0.0.0", "parentLocalName": "NULL", "localName": "NULL" } } } ] }, "contextAlbumReference": [], "taskSelectionLogic": { "key": "NULL", "logicFlavour": "UNDEFINED", "logic": "" }, "stateFinalizerLogicMap": { "entry": [] }, "defaultTask": { "name": "ServiceUpdateStateCpeAuthTask", "version": "0.0.1" }, "taskReferences": { "entry": [ { "key": { "name": "ServiceUpdateStateCpeAuthTask", "version": "0.0.1" }, "value": { "key": { "parentKeyName": "CPEAuthenticationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "INIT", "localName": "CPEAuthenticationPolicy" }, "outputType": "DIRECT", "output": { "parentKeyName": "CPEAuthenticationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "INIT", "localName": "ServiceUpdateCpeAuthOutPut" } } } ] } } } ] }, "firstState": "INIT" } }, { "key": { "name": "ONTRegistrationPolicy", "version": "0.0.1" }, "value": { "policyKey": { "name": "ONTRegistrationPolicy", "version": "0.0.1" }, "template": "Freestyle", "state": { "entry": [ { "key": "AAI_SERVICE_ASSIGN", "value": { "stateKey": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "NULL", "localName": "AAI_SERVICE_ASSIGN" }, "trigger": { "name": "AAI_SERVICE_ASSIGNED", "version": "1.0.0" }, "stateOutputs": { "entry": [ { "key": "AAIServiceAssignedOutput", "value": { "key": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "AAI_SERVICE_ASSIGN", "localName": "AAIServiceAssignedOutput" }, "outgoingEvent": { "name": "SDNC_RESOURCE_UPDATE", "version": "1.0.0" }, "nextState": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "NULL", "localName": "SDNC_RES_UPDATE" } } } ] }, "contextAlbumReference": [], "taskSelectionLogic": { "key": "NULL", "logicFlavour": "UNDEFINED", "logic": "" }, "stateFinalizerLogicMap": { "entry": [] }, "defaultTask": { "name": "AAIServiceAssignedTask", "version": "0.0.1" }, "taskReferences": { "entry": [ { "key": { "name": "AAIServiceAssignedTask", "version": "0.0.1" }, "value": { "key": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "AAI_SERVICE_ASSIGN", "localName": "ONTRegistrationPolicy" }, "outputType": "DIRECT", "output": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "AAI_SERVICE_ASSIGN", "localName": "AAIServiceAssignedOutput" } } } ] } } }, { "key": "AAI_SERVICE_CREATE", "value": { "stateKey": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "NULL", "localName": "AAI_SERVICE_CREATE" }, "trigger": { "name": "AAI_SERVICE_CREATE", "version": "1.0.0" }, "stateOutputs": { "entry": [ { "key": "AAIServiceCreateTaskOutput", "value": { "key": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "AAI_SERVICE_CREATE", "localName": "AAIServiceCreateTaskOutput" }, "outgoingEvent": { "name": "END_CONTROL_LOOP", "version": "1.0.0" }, "nextState": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "NULL", "localName": "NOMADIC_ONT_REG_SUCCESS" } } }, { "key": "SdncResourceUpdateErrorLogOutput", "value": { "key": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "AAI_SERVICE_CREATE", "localName": "SdncResourceUpdateErrorLogOutput" }, "outgoingEvent": { "name": "ERROR_LOG", "version": "1.0.0" }, "nextState": { "parentKeyName": "NULL", "parentKeyVersion": "0.0.0", "parentLocalName": "NULL", "localName": "NULL" } } } ] }, "contextAlbumReference": [ { "name": "NomadicONTContextAlbum", "version": "0.0.1" } ], "taskSelectionLogic": { "key": "TaskSelectionLogic", "logicFlavour": "JAVASCRIPT", "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nexecutor.logger.info(\"Begin Execution SU2orInitStateSelect.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar returnValue = executor.isTrue;\nvar result = null;\n\nvar attachmentPoint = executor.inFields.get(\"attachmentPoint\");\nvar NomadicONTContext = executor.getContextAlbum(\"NomadicONTContextAlbum\").get(\n attachmentPoint);\n\nexecutor.logger.info(executor.inFields);\n\nresult = NomadicONTContext.get(\"result\");\n\nif (result === \"SUCCESS\") {\n executor.subject.getTaskKey(\"AAIServiceCreateTask\").copyTo(executor.selectedTask);\n} else {\n executor.subject.getTaskKey(\"SdncResourceUpdateErrorLogOutput\").copyTo(\n executor.selectedTask);\n onsetFlag = executor.isFalse;\n}\n\nexecutor.logger.info(\"State Selected Task:\" + executor.selectedTask);\nexecutor.logger.info(\"End Execution SU2orInitStateSelect.js\");" }, "stateFinalizerLogicMap": { "entry": [] }, "defaultTask": { "name": "AAIServiceCreateTask", "version": "0.0.1" }, "taskReferences": { "entry": [ { "key": { "name": "AAIServiceCreateTask", "version": "0.0.1" }, "value": { "key": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "AAI_SERVICE_CREATE", "localName": "ONTRegistrationPolicy" }, "outputType": "DIRECT", "output": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "AAI_SERVICE_CREATE", "localName": "AAIServiceCreateTaskOutput" } } }, { "key": { "name": "ErrorSdncResourceUpdateTaskLogTask", "version": "0.0.1" }, "value": { "key": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "AAI_SERVICE_CREATE", "localName": "ONTRegistrationPolicy" }, "outputType": "DIRECT", "output": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "AAI_SERVICE_CREATE", "localName": "SdncResourceUpdateErrorLogOutput" } } } ] } } }, { "key": "INIT", "value": { "stateKey": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "NULL", "localName": "INIT" }, "trigger": { "name": "Nomadic_ONT", "version": "1.0.2" }, "stateOutputs": { "entry": [ { "key": "BBSCloseLoopEventOutPut", "value": { "key": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "INIT", "localName": "BBSCloseLoopEventOutPut" }, "outgoingEvent": { "name": "AAI_SERVICE_ASSIGNED", "version": "1.0.0" }, "nextState": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "NULL", "localName": "AAI_SERVICE_ASSIGN" } } } ] }, "contextAlbumReference": [], "taskSelectionLogic": { "key": "NULL", "logicFlavour": "UNDEFINED", "logic": "" }, "stateFinalizerLogicMap": { "entry": [] }, "defaultTask": { "name": "GetBBSCloseLoopEventTask", "version": "0.0.1" }, "taskReferences": { "entry": [ { "key": { "name": "GetBBSCloseLoopEventTask", "version": "0.0.1" }, "value": { "key": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "INIT", "localName": "ONTRegistrationPolicy" }, "outputType": "DIRECT", "output": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "INIT", "localName": "BBSCloseLoopEventOutPut" } } } ] } } }, { "key": "NOMADIC_ONT_REG_SUCCESS", "value": { "stateKey": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "NULL", "localName": "NOMADIC_ONT_REG_SUCCESS" }, "trigger": { "name": "END_CONTROL_LOOP", "version": "1.0.0" }, "stateOutputs": { "entry": [ { "key": "NomadicEventSuccessOutPut", "value": { "key": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "NOMADIC_ONT_REG_SUCCESS", "localName": "NomadicEventSuccessOutPut" }, "outgoingEvent": { "name": "END_EVENT", "version": "1.0.0" }, "nextState": { "parentKeyName": "NULL", "parentKeyVersion": "0.0.0", "parentLocalName": "NULL", "localName": "NULL" } } } ] }, "contextAlbumReference": [], "taskSelectionLogic": { "key": "NULL", "logicFlavour": "UNDEFINED", "logic": "" }, "stateFinalizerLogicMap": { "entry": [] }, "defaultTask": { "name": "NomadicEventSuccessTask", "version": "0.0.1" }, "taskReferences": { "entry": [ { "key": { "name": "NomadicEventSuccessTask", "version": "0.0.1" }, "value": { "key": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "NOMADIC_ONT_REG_SUCCESS", "localName": "ONTRegistrationPolicy" }, "outputType": "DIRECT", "output": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "NOMADIC_ONT_REG_SUCCESS", "localName": "NomadicEventSuccessOutPut" } } } ] } } }, { "key": "SDNC_RES_UPDATE", "value": { "stateKey": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "NULL", "localName": "SDNC_RES_UPDATE" }, "trigger": { "name": "SDNC_RESOURCE_UPDATE", "version": "1.0.0" }, "stateOutputs": { "entry": [ { "key": "AAIServiceAssignedErrorLogOutput", "value": { "key": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "SDNC_RES_UPDATE", "localName": "AAIServiceAssignedErrorLogOutput" }, "outgoingEvent": { "name": "ERROR_LOG", "version": "1.0.0" }, "nextState": { "parentKeyName": "NULL", "parentKeyVersion": "0.0.0", "parentLocalName": "NULL", "localName": "NULL" } } }, { "key": "SdncResourceUpdateOutput", "value": { "key": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "SDNC_RES_UPDATE", "localName": "SdncResourceUpdateOutput" }, "outgoingEvent": { "name": "AAI_SERVICE_CREATE", "version": "1.0.0" }, "nextState": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "NULL", "localName": "AAI_SERVICE_CREATE" } } } ] }, "contextAlbumReference": [ { "name": "NomadicONTContextAlbum", "version": "0.0.1" } ], "taskSelectionLogic": { "key": "TaskSelectionLogic", "logicFlavour": "JAVASCRIPT", "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nexecutor.logger.info(\"Begin Execution RUorInitStateSelect.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar returnValue = executor.isTrue;\nvar result = null;\n\nvar attachmentPoint = executor.inFields.get(\"attachmentPoint\");\nvar NomadicONTContext = executor.getContextAlbum(\"NomadicONTContextAlbum\").get(\n attachmentPoint);\n\nresult = NomadicONTContext.get(\"result\");\n\nif (result === \"SUCCESS\") {\n executor.subject.getTaskKey(\"SdncResourceUpdateTask\").copyTo(executor.selectedTask);\n} else {\n executor.subject.getTaskKey(\"ErrorAAIServiceAssignedLogTask\").copyTo(\n executor.selectedTask);\n onsetFlag = executor.isFalse;\n}\n\nexecutor.logger.info(\"State Selected Task:\" + executor.selectedTask);\nexecutor.logger.info(\"End Execution RUorInitStateSelect.js\");" }, "stateFinalizerLogicMap": { "entry": [] }, "defaultTask": { "name": "SdncResourceUpdateTask", "version": "0.0.1" }, "taskReferences": { "entry": [ { "key": { "name": "ErrorAAIServiceAssignedLogTask", "version": "0.0.1" }, "value": { "key": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "SDNC_RES_UPDATE", "localName": "ONTRegistrationPolicy" }, "outputType": "DIRECT", "output": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "SDNC_RES_UPDATE", "localName": "AAIServiceAssignedErrorLogOutput" } } }, { "key": { "name": "SdncResourceUpdateTask", "version": "0.0.1" }, "value": { "key": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "SDNC_RES_UPDATE", "localName": "ONTRegistrationPolicy" }, "outputType": "DIRECT", "output": { "parentKeyName": "ONTRegistrationPolicy", "parentKeyVersion": "0.0.1", "parentLocalName": "SDNC_RES_UPDATE", "localName": "SdncResourceUpdateOutput" } } } ] } } } ] }, "firstState": "INIT" } } ] } }, "tasks": { "key": { "name": "NomadicONTPolicyModel_Tasks", "version": "1.0.2" }, "taskMap": { "entry": [ { "key": { "name": "AAIServiceAssignedTask", "version": "0.0.1" }, "value": { "key": { "name": "AAIServiceAssignedTask", "version": "0.0.1" }, "inputFields": { "entry": [ { "key": "attachmentPoint", "value": { "key": "attachmentPoint", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "requestID", "value": { "key": "requestID", "fieldSchemaKey": { "name": "UUIDType", "version": "0.0.1" }, "optional": false } }, { "key": "serviceInstanceId", "value": { "key": "serviceInstanceId", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] }, "outputFields": { "entry": [ { "key": "attachmentPoint", "value": { "key": "attachmentPoint", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "requestID", "value": { "key": "requestID", "fieldSchemaKey": { "name": "UUIDType", "version": "0.0.1" }, "optional": false } }, { "key": "result", "value": { "key": "result", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "serviceInstanceId", "value": { "key": "serviceInstanceId", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] }, "taskParameters": { "entry": [] }, "contextAlbumReference": [ { "name": "NomadicONTContextAlbum", "version": "0.0.1" } ], "taskLogic": { "key": "TaskLogic", "logicFlavour": "JAVASCRIPT", "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * Modifications Copyright (C) 2019 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nload(\"nashorn:mozilla_compat.js\");\nimportClass(org.apache.avro.Schema);\nimportClass(java.io.BufferedReader);\nimportClass(java.io.IOException);\nimportClass(java.nio.file.Files);\nimportClass(java.nio.file.Paths);\n\nexecutor.logger.info(\"Begin Execution AAIServiceAssignedTask.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar attachmentPoint = executor.inFields.get(\"attachmentPoint\");\nvar requestID = executor.inFields.get(\"requestID\");\nvar serviceInstanceId = executor.inFields.get(\"serviceInstanceId\");\n\nvar NomadicONTContext = executor.getContextAlbum(\"NomadicONTContextAlbum\").get(attachmentPoint);\nexecutor.logger.info(NomadicONTContext);\n\nvar jsonObj;\nvar aaiUpdateResult = true;\n\nvar wbClient = Java.type(\"org.onap.policy.apex.examples.bbs.WebClient\");\nvar client = new wbClient();\n\n/* Get AAI URL from Configuration file. */\nvar AAI_URL = \"localhost:8080\";\nvar CUSTOMER_ID = requestID;\nvar SERVICE_INSTANCE_ID = serviceInstanceId;\nvar AAI_VERSION = \"v14\";\nvar resource_version;\nvar relationship_list;\nvar HTTP_PROTOCOL = \"https://\";\nvar results;\nvar putUrl;\nvar service_instance;\ntry {\n var br = Files.newBufferedReader(Paths.get(\"/home/apexuser/examples/config/ONAPBBS/config.txt\"));\n var line;\n while ((line = br.readLine()) != null) {\n if (line.startsWith(\"AAI_URL\")) {\n var str = line.split(\"=\");\n AAI_URL = str[str.length - 1];\n } else if (line.startsWith(\"AAI_USERNAME\")) {\n var str = line.split(\"=\");\n AAI_USERNAME = str[str.length - 1];\n } else if (line.startsWith(\"AAI_PASSWORD\")) {\n var str = line.split(\"=\");\n AAI_PASSWORD = str[str.length - 1];\n } else if (line.startsWith(\"AAI_VERSION\")) {\n var str = line.split(\"=\");\n AAI_VERSION = str[str.length - 1];\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n}\n\nexecutor.logger.info(\"AAI_URL \" + AAI_URL);\n\n/* Get service instance Id from AAI */\ntry {\n var urlGet = HTTP_PROTOCOL + AAI_URL + \"/aai/\" + AAI_VERSION + \"/nodes/service-instances/service-instance/\"\n + SERVICE_INSTANCE_ID + \"?format=resource_and_url\";\n\n executor.logger.info(\"Query url\" + urlGet);\n\n result = client.httpRequest(urlGet, \"GET\", null, AAI_USERNAME, AAI_PASSWORD, \"application/json\");\n executor.logger.info(\"Data received From \" + urlGet + \" \" + result);\n jsonObj = JSON.parse(result.toString());\n\n executor.logger.info(JSON.stringify(jsonObj, null, 4));\n /* Retrieve the service instance id */\n results = jsonObj['results'][0];\n putUrl = results['url'];\n service_instance = results['service-instance'];\n service_instance_id = service_instance['service-instance-id'];\n resource_version = service_instance['resource-version'];\n relationship_list = service_instance['relationship-list'];\n executor.logger.info(\"After Parse service_instance \" + JSON.stringify(service_instance, null, 4) + \"\\n url \"\n + putUrl + \"\\n Service instace Id \" + service_instance_id);\n\n if (result == \"\") {\n aaiUpdateResult = false;\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n aaiUpdateResult = false;\n}\n\n/* BBS Policy updates orchestration status of {{bbs-cfs-service-instance-UUID}} [ active --> assigned ] */\nvar putUpddateServInstance;\nputUpddateServInstance = service_instance;\ntry {\n if (aaiUpdateResult == true) {\n putUpddateServInstance[\"orchestration-status\"] = \"active\";\n executor.logger.info(\"ready to putAfter Parse \" + JSON.stringify(putUpddateServInstance, null, 4));\n var urlPut = HTTP_PROTOCOL + AAI_URL + putUrl + \"?resource_version=\" + resource_version;\n result = client.httpRequest(urlPut, \"PUT\", JSON.stringify(putUpddateServInstance), AAI_USERNAME, AAI_PASSWORD,\n \"application/json\");\n executor.logger.info(\"Data received From \" + urlPut + \" \" + result);\n /* If failure to retrieve data proceed to Failure */\n if (result != \"\") {\n aaiUpdateResult = false;\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n aaiUpdateResult = false;\n}\n\nif (!service_instance.hasOwnProperty('input-parameters') || !service_instance.hasOwnProperty('metadata')) {\n aaiUpdateResult = false;\n executor.logger.info(\"Validate data failed. input-parameters or metadata is missing\");\n}\n\n/* update logical link in pnf */\nvar oldLinkName = \"\";\ntry {\n if (aaiUpdateResult == true) {\n var pnfName = \"\";\n var pnfResponse;\n var pnfUpdate;\n var relationShips = relationship_list[\"relationship\"];\n\n for (var i = 0; i < relationShips.length; i++) {\n if (relationShips[i][\"related-to\"] == \"pnf\") {\n var relationship_data = relationShips[i][\"relationship-data\"];\n for (var j = 0; j < relationship_data.length; j++) {\n if (relationship_data[j][\"relationship-key\"] == \"pnf.pnf-name\") {\n pnfName = relationship_data[j]['relationship-value'];\n break;\n }\n }\n }\n }\n executor.logger.info(\"pnf-name found \" + pnfName);\n\n /* 1. Get PNF */\n var urlGetPnf = HTTP_PROTOCOL + AAI_URL + \"/aai/\" + AAI_VERSION + \"/network/pnfs/pnf/\" + pnfName;\n pnfResponse = client.httpRequest(urlGetPnf, \"GET\", null, AAI_USERNAME, AAI_PASSWORD, \"application/json\");\n executor.logger.info(\"Data received From \" + urlGetPnf + \" \" + pnfResponse);\n /* If failure to retrieve data proceed to Failure */\n if (result != \"\") {\n aaiUpdateResult = false;\n }\n pnfUpdate = JSON.parse(pnfResponse.toString());\n executor.logger.info(JSON.stringify(pnfUpdate, null, 4));\n\n /* 2. Create logical link */\n var link_name = attachmentPoint;\n var logicalLink = {\n \"link-name\" : link_name,\n \"in-maint\" : false,\n \"link-type\" : \"attachment-point\"\n };\n var urlNewLogicalLink = HTTP_PROTOCOL + AAI_URL + \"/aai/\" + AAI_VERSION\n + \"/network/logical-links/logical-link/\" + link_name;\n result = client.httpRequest(urlNewLogicalLink, \"PUT\", JSON.stringify(logicalLink), AAI_USERNAME, AAI_PASSWORD,\n \"application/json\");\n executor.logger.info(\"Data received From \" + urlNewLogicalLink + \" \" + result);\n /* If failure to retrieve data proceed to Failure */\n if (result != \"\") {\n aaiUpdateResult = false;\n }\n\n /* 3. Update pnf with new relation */\n for (var i = 0; i < pnfUpdate[\"relationship-list\"][\"relationship\"].length; i++) {\n if (pnfUpdate[\"relationship-list\"][\"relationship\"][i]['related-to'] == 'logical-link') {\n pnfUpdate[\"relationship-list\"][\"relationship\"][i]['related-link'] = \"/aai/\" + AAI_VERSION\n + \"/network/logical-links/logical-link/\" + link_name;\n for (var j = 0; j < pnfUpdate[\"relationship-list\"][\"relationship\"][i]['relationship-data'].length; j++) {\n if (pnfUpdate[\"relationship-list\"][\"relationship\"][i]['relationship-data'][j]['relationship-key'] == \"logical-link.link-name\") {\n oldLinkName = pnfUpdate[\"relationship-list\"][\"relationship\"][i]['relationship-data'][j]['relationship-value'];\n pnfUpdate[\"relationship-list\"][\"relationship\"][i]['relationship-data'][j]['relationship-value'] = link_name;\n break;\n }\n }\n break;\n }\n }\n\n executor.logger.info(\"Put pnf to aai \" + JSON.stringify(pnfUpdate, null, 4));\n var urlPutPnf = HTTP_PROTOCOL + AAI_URL + \"/aai/\" + AAI_VERSION + \"/network/pnfs/pnf/\" + pnfName;\n result = client.httpRequest(urlPutPnf, \"PUT\", JSON.stringify(pnfUpdate), AAI_USERNAME, AAI_PASSWORD,\n \"application/json\");\n executor.logger.info(\"Data received From \" + urlPutPnf + \" \" + result);\n\n /* If failure to retrieve data proceed to Failure */\n if (result != \"\") {\n aaiUpdateResult = false;\n }\n\n /* Get and Delete the Stale logical link */\n var oldLinkResult;\n var linkResult;\n var urlOldLogicalLink = HTTP_PROTOCOL + AAI_URL + \"/aai/\" + AAI_VERSION\n + \"/network/logical-links/logical-link/\" + oldLinkName;\n linkResult = client.httpRequest(urlOldLogicalLink, \"GET\", null, AAI_USERNAME, AAI_PASSWORD, \"application/json\");\n executor.logger.info(\"Data received From \" + urlOldLogicalLink + \" \" + linkResult + \" \"\n + linkResult.hasOwnProperty(\"link-name\"));\n oldLinkResult = JSON.parse(linkResult.toString());\n if (oldLinkResult.hasOwnProperty(\"link-name\") == true) {\n var res_version = oldLinkResult[\"resource-version\"];\n var urlDelOldLogicalLink = urlOldLogicalLink + \"?resource-version=\" + res_version;\n executor.logger.info(\"Delete called for \" + urlDelOldLogicalLink);\n result = client.httpRequest(urlDelOldLogicalLink, \"DELETE\", null, AAI_USERNAME, AAI_PASSWORD,\n \"application/json\");\n executor.logger.info(\"Delete called for \" + urlDelOldLogicalLink + \" result \" + result);\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n aaiUpdateResult = false;\n}\n\n/* If Success then Fill output schema */\nif (aaiUpdateResult === true) {\n executor.outFields.put(\"result\", \"SUCCESS\");\n NomadicONTContext.put(\"result\", \"SUCCESS\");\n NomadicONTContext.put(\"aai_message\", JSON.stringify(service_instance));\n NomadicONTContext.put(\"url\", putUrl);\n} else {\n executor.outFields.put(\"result\", \"FAILURE\");\n NomadicONTContext.put(\"result\", \"FAILURE\");\n}\n\nexecutor.outFields.put(\"requestID\", requestID);\nexecutor.outFields.put(\"attachmentPoint\", attachmentPoint);\nexecutor.outFields.put(\"serviceInstanceId\", executor.inFields.get(\"serviceInstanceId\"));\n\nvar returnValue = executor.isTrue;\nexecutor.logger.info(executor.outFields);\nexecutor.logger.info(\"End Execution AAIServiceAssignedTask.js\");\n\n/* Utility functions Begin */\nfunction IsValidJSONString(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n}\n/* Utility functions End */" } } }, { "key": { "name": "AAIServiceCreateTask", "version": "0.0.1" }, "value": { "key": { "name": "AAIServiceCreateTask", "version": "0.0.1" }, "inputFields": { "entry": [ { "key": "attachmentPoint", "value": { "key": "attachmentPoint", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "requestID", "value": { "key": "requestID", "fieldSchemaKey": { "name": "UUIDType", "version": "0.0.1" }, "optional": false } }, { "key": "serviceInstanceId", "value": { "key": "serviceInstanceId", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] }, "outputFields": { "entry": [ { "key": "attachmentPoint", "value": { "key": "attachmentPoint", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "requestID", "value": { "key": "requestID", "fieldSchemaKey": { "name": "UUIDType", "version": "0.0.1" }, "optional": false } }, { "key": "result", "value": { "key": "result", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "serviceInstanceId", "value": { "key": "serviceInstanceId", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] }, "taskParameters": { "entry": [] }, "contextAlbumReference": [ { "name": "NomadicONTContextAlbum", "version": "0.0.1" } ], "taskLogic": { "key": "TaskLogic", "logicFlavour": "JAVASCRIPT", "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * Modifications Copyright (C) 2019 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nload(\"nashorn:mozilla_compat.js\");\nimportClass(org.apache.avro.Schema);\nimportClass(java.io.BufferedReader);\nimportClass(java.io.IOException);\nimportClass(java.nio.file.Files);\nimportClass(java.nio.file.Paths);\n\nexecutor.logger.info(\"Begin Execution AAIServiceCreateTask.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar attachmentPoint = executor.inFields.get(\"attachmentPoint\");\nvar requestID = executor.inFields.get(\"requestID\");\nvar serviceInstanceId = executor.inFields.get(\"serviceInstanceId\");\n\nvar NomadicONTContext = executor.getContextAlbum(\"NomadicONTContextAlbum\").get(attachmentPoint);\nexecutor.logger.info(NomadicONTContext);\n\n// Get the AAI URL from configuraiotn file\nvar AAI_URL = \"localhost:8080\";\nvar CUSTOMER_ID = requestID;\nvar BBS_CFS_SERVICE_TYPE = \"BBS-CFS-Access_Test\";\nvar SERVICE_INSTANCE_ID = serviceInstanceId;\nvar AAI_VERSION = \"v14\";\nvar HTTP_PROTOCOL = \"https://\";\nvar wbClient = Java.type(\"org.onap.policy.apex.examples.bbs.WebClient\");\nvar client = new wbClient();\nvar AAI_USERNAME = null;\nvar AAI_PASSWORD = null;\ntry {\n var br = Files.newBufferedReader(Paths.get(\"/home/apexuser/examples/config/ONAPBBS/config.txt\"));\n // read line by line\n var line;\n while ((line = br.readLine()) != null) {\n if (line.startsWith(\"AAI_URL\")) {\n var str = line.split(\"=\");\n AAI_URL = str[str.length - 1];\n } else if (line.startsWith(\"AAI_USERNAME\")) {\n var str = line.split(\"=\");\n AAI_USERNAME = str[str.length - 1];\n } else if (line.startsWith(\"AAI_PASSWORD\")) {\n var str = line.split(\"=\");\n AAI_PASSWORD = str[str.length - 1];\n } else if (line.startsWith(\"AAI_VERSION\")) {\n var str = line.split(\"=\");\n AAI_VERSION = str[str.length - 1];\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n}\nexecutor.logger.info(\"AAI_URL \" + AAI_URL);\nvar aaiUpdateResult = true;\n/* Get service instance Id from AAI */\ntry {\n var urlGet = HTTP_PROTOCOL + AAI_URL + \"/aai/\" + AAI_VERSION + \"/nodes/service-instances/service-instance/\"\n + SERVICE_INSTANCE_ID + \"?format=resource_and_url\";\n\n executor.logger.info(\"Query url\" + urlGet);\n\n result = client.httpRequest(urlGet, \"GET\", null, AAI_USERNAME, AAI_PASSWORD, \"application/json\");\n executor.logger.info(\"Data received From \" + urlGet + \" \" + result);\n jsonObj = JSON.parse(result);\n\n executor.logger.info(JSON.stringify(jsonObj, null, 4));\n /* Retrieve the service instance id */\n results = jsonObj['results'][0];\n putUrl = results['url'];\n service_instance = results['service-instance'];\n executor.logger.info(\"After Parse service_instance \" + JSON.stringify(service_instance, null, 4) + \"\\n url \"\n + putUrl + \"\\n Service instace Id \" + SERVICE_INSTANCE_ID);\n\n if (result == \"\") {\n aaiUpdateResult = false;\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n aaiUpdateResult = false;\n}\n\nvar putUpddateServInstance = service_instance;\nputUpddateServInstance['orchestration-status'] = \"created\";\nexecutor.logger.info(\" string\" + JSON.stringify(putUpddateServInstance, null, 4));\nvar resource_version = putUpddateServInstance['resource-version'];\nvar putUrl = NomadicONTContext.get(\"url\");\n\n/* BBS Policy updates {{bbs-cfs-service-instance-UUID}} orchestration-status [ assigned --> created ] */\ntry {\n if (aaiUpdateResult == true) {\n executor.logger.info(\"ready to putAfter Parse \" + JSON.stringify(putUpddateServInstance, null, 4));\n var urlPut = HTTP_PROTOCOL + AAI_URL + putUrl + \"?resource_version=\" + resource_version;\n result = client.httpRequest(urlPut, \"PUT\", JSON.stringify(putUpddateServInstance), AAI_USERNAME, AAI_PASSWORD,\n \"application/json\");\n executor.logger.info(\"Data received From \" + urlPut + \" \" + result);\n /* If failure to retrieve data proceed to Failure */\n if (result != \"\") {\n aaiUpdateResult = false;\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n aaiUpdateResult = false;\n}\n/* If Success then Fill output schema */\nif (aaiUpdateResult === true) {\n NomadicONTContext.put(\"result\", \"SUCCESS\");\n} else {\n NomadicONTContext.put(\"result\", \"FAILURE\");\n\n}\n\nexecutor.outFields.put(\"requestID\", requestID);\nexecutor.outFields.put(\"attachmentPoint\", attachmentPoint);\nexecutor.outFields.put(\"serviceInstanceId\", executor.inFields.get(\"serviceInstanceId\"));\n\nvar returnValue = executor.isTrue;\nexecutor.logger.info(executor.outFields);\nexecutor.logger.info(\"End Execution AAIServiceCreateTask.js\");" } } }, { "key": { "name": "ErrorAAIServiceAssignedLogTask", "version": "0.0.1" }, "value": { "key": { "name": "ErrorAAIServiceAssignedLogTask", "version": "0.0.1" }, "inputFields": { "entry": [ { "key": "attachmentPoint", "value": { "key": "attachmentPoint", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "requestID", "value": { "key": "requestID", "fieldSchemaKey": { "name": "UUIDType", "version": "0.0.1" }, "optional": false } }, { "key": "result", "value": { "key": "result", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "serviceInstanceId", "value": { "key": "serviceInstanceId", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] }, "outputFields": { "entry": [ { "key": "errorLogParam", "value": { "key": "errorLogParam", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } } ] }, "taskParameters": { "entry": [] }, "contextAlbumReference": [], "taskLogic": { "key": "TaskLogic", "logicFlavour": "JAVASCRIPT", "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nexecutor.logger.info(\"Begin Execution ErrorServiceUpdateOneLogTask.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nexecutor.logger.info(executor.outFields);\n\nvar returnValue = executor.isTrue;\nexecutor.logger.info(\"Begin Execution ErrorServiceUpdateOneLogTask.js\");" } } }, { "key": { "name": "ErrorSdncResourceUpdateTaskLogTask", "version": "0.0.1" }, "value": { "key": { "name": "ErrorSdncResourceUpdateTaskLogTask", "version": "0.0.1" }, "inputFields": { "entry": [ { "key": "attachmentPoint", "value": { "key": "attachmentPoint", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "requestID", "value": { "key": "requestID", "fieldSchemaKey": { "name": "UUIDType", "version": "0.0.1" }, "optional": false } }, { "key": "result", "value": { "key": "result", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "serviceInstanceId", "value": { "key": "serviceInstanceId", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] }, "outputFields": { "entry": [ { "key": "errorLogParam", "value": { "key": "errorLogParam", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } } ] }, "taskParameters": { "entry": [] }, "contextAlbumReference": [], "taskLogic": { "key": "TaskLogic", "logicFlavour": "JAVASCRIPT", "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nexecutor.logger.info(\"Begin Execution ErrorResourceUpdateLogTask.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar returnValue = executor.isTrue;\nexecutor.logger.info(\"End Execution ErrorResourceUpdateLogTask.js\");" } } }, { "key": { "name": "GetBBSCloseLoopEventTask", "version": "0.0.1" }, "value": { "key": { "name": "GetBBSCloseLoopEventTask", "version": "0.0.1" }, "inputFields": { "entry": [ { "key": "VirtualControlLoopEvent", "value": { "key": "VirtualControlLoopEvent", "fieldSchemaKey": { "name": "VirtualControlLoopEventType", "version": "0.0.1" }, "optional": false } } ] }, "outputFields": { "entry": [ { "key": "attachmentPoint", "value": { "key": "attachmentPoint", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "requestID", "value": { "key": "requestID", "fieldSchemaKey": { "name": "UUIDType", "version": "0.0.1" }, "optional": false } }, { "key": "serviceInstanceId", "value": { "key": "serviceInstanceId", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] }, "taskParameters": { "entry": [] }, "contextAlbumReference": [ { "name": "NomadicONTContextAlbum", "version": "0.0.1" } ], "taskLogic": { "key": "TaskLogic", "logicFlavour": "JAVASCRIPT", "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nload(\"nashorn:mozilla_compat.js\");\n\nexecutor.logger.info(\"Begin Execution GetBBSCloseLoopEventTask.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\nvar returnValue = executor.isTrue;\n\nvar clEventType = Java.type(\n \"org.onap.policy.controlloop.VirtualControlLoopEvent\");\nvar clEvent = executor.inFields.get(\"VirtualControlLoopEvent\");\nexecutor.logger.info(clEvent.toString());\nexecutor.logger.info(clEvent.getClosedLoopControlName());\n\nvar requestID = clEvent.getRequestId();\nexecutor.logger.info(\"requestID = \" + requestID);\nvar attachmentPoint = null;\nvar NomadicONTContext = null;\nvar serviceInstanceId = null;\n\nif (clEvent.getAai().get(\"attachmentPoint\") != null) {\n attachmentPoint = clEvent.getAai().get(\"attachmentPoint\");\n executor.logger.info(\"attachmentPoint = \" + attachmentPoint);\n NomadicONTContext = executor.getContextAlbum(\"NomadicONTContextAlbum\").get(\n attachmentPoint);\n serviceInstanceId = clEvent.getAai().get(\n \"service-information.hsia-cfs-service-instance-id\");\n executor.logger.info(\"serviceInstanceId = \" + serviceInstanceId);\n\n if (NomadicONTContext == null) {\n executor.logger.info(\n \"Creating context information for new ONT Device \\\"\" +\n attachmentPoint.toString() + \"\\\"\");\n\n NomadicONTContext = executor.getContextAlbum(\"NomadicONTContextAlbum\").getSchemaHelper()\n .createNewInstance();\n\n NomadicONTContext.put(\"closedLoopControlName\", clEvent.getClosedLoopControlName());\n NomadicONTContext.put(\"closedLoopAlarmStart\", clEvent.getClosedLoopAlarmStart()\n .toEpochMilli());\n NomadicONTContext.put(\"closedLoopEventClient\", clEvent.getClosedLoopEventClient());\n NomadicONTContext.put(\"closedLoopEventStatus\", clEvent.getClosedLoopEventStatus()\n .toString());\n NomadicONTContext.put(\"version\", clEvent.getVersion());\n NomadicONTContext.put(\"requestID\", clEvent.getRequestId().toString());\n NomadicONTContext.put(\"target_type\", clEvent.getTargetType().toString());\n NomadicONTContext.put(\"target\", clEvent.getTarget());\n NomadicONTContext.put(\"from\", clEvent.getFrom());\n NomadicONTContext.put(\"policyScope\", \"Nomadic ONT\");\n NomadicONTContext.put(\"policyName\", clEvent.getPolicyName());\n NomadicONTContext.put(\"policyVersion\", \"1.0.0\");\n NomadicONTContext.put(\"notificationTime\", java.lang.System.currentTimeMillis());\n NomadicONTContext.put(\"message\", \"\");\n NomadicONTContext.put(\"result\", \"SUCCESS\");\n var aaiInfo = executor.getContextAlbum(\"NomadicONTContextAlbum\").getSchemaHelper()\n .createNewSubInstance(\"VCPE_AAI_Type\");\n\n aaiInfo.put(\"attachmentPoint\", clEvent.getAai().get(\"attachmentPoint\"));\n aaiInfo.put(\"cvlan\", clEvent.getAai().get(\"cvlan\"));\n aaiInfo.put(\"service_information_hsia_cfs_service_instance_id\", clEvent\n .getAai().get(\n \"service-information.hsia-cfs-service-instance-id\"));\n aaiInfo.put(\"svlan\", clEvent.getAai().get(\"svlan\"));\n aaiInfo.put(\"remoteId\", clEvent.getAai().get(\"remoteId\"));\n\n\n NomadicONTContext.put(\"AAI\", aaiInfo);\n\n if (clEvent.getClosedLoopAlarmEnd() != null) {\n NomadicONTContext.put(\"closedLoopAlarmEnd\", clEvent.getClosedLoopAlarmEnd()\n .toEpochMilli());\n } else {\n NomadicONTContext.put(\"closedLoopAlarmEnd\", java.lang.Long.valueOf(\n 0));\n }\n\n executor.getContextAlbum(\"NomadicONTContextAlbum\").put(attachmentPoint.toString(),\n NomadicONTContext);\n executor.logger.info(\"Created context information for new vCPE VNF \\\"\" +\n attachmentPoint.toString() + \"\\\"\");\n }\n\n executor.outFields.put(\"requestID\", requestID);\n executor.outFields.put(\"attachmentPoint\", attachmentPoint);\n executor.outFields.put(\"serviceInstanceId\", serviceInstanceId);\n executor.logger.info(executor.outFields);\n executor.logger.info(\"Event Successfully Received and stored in album\");\n}\nelse\n{\n executor.message = \"Received NULL attachment-point\";\n returnValue = executor.isFalse;\n}" } } }, { "key": { "name": "NomadicEventSuccessTask", "version": "0.0.1" }, "value": { "key": { "name": "NomadicEventSuccessTask", "version": "0.0.1" }, "inputFields": { "entry": [ { "key": "attachmentPoint", "value": { "key": "attachmentPoint", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "requestID", "value": { "key": "requestID", "fieldSchemaKey": { "name": "UUIDType", "version": "0.0.1" }, "optional": false } }, { "key": "serviceInstanceId", "value": { "key": "serviceInstanceId", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] }, "outputFields": { "entry": [ { "key": "result", "value": { "key": "result", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] }, "taskParameters": { "entry": [] }, "contextAlbumReference": [ { "name": "NomadicONTContextAlbum", "version": "0.0.1" } ], "taskLogic": { "key": "TaskLogic", "logicFlavour": "JAVASCRIPT", "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nload(\"nashorn:mozilla_compat.js\");\nimportClass(org.apache.avro.Schema);\n\nexecutor.logger.info(\"Begin Execution NomadicEventSuccess.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar attachmentPoint = executor.inFields.get(\"attachmentPoint\");\nvar NomadicONTContext = executor.getContextAlbum(\"NomadicONTContextAlbum\").get(\n attachmentPoint);\n\nexecutor.logger.info(executor.outFields);\nexecutor.logger.info(executor.inFields);\n\nresult = NomadicONTContext.get(\"result\");\n\nif (result === \"SUCCESS\") {\n returnValue = executor.isTrue;\n executor.outFields.put(\"result\", \"SUCCCESS\");\n executor.logger.info(\"BBS policy Execution Done\");\n} else {\n executor.logger.info(\"BBS policy Execution Failed\");\n executor.outFields.put(\"result\", \"FAILURE\");\n returnValue = executor.isFalse;\n}\n\nvar returnValue = executor.isTrue;\nexecutor.logger.info(\"End Execution NomadicEventSuccess.js\");" } } }, { "key": { "name": "SdncResourceUpdateTask", "version": "0.0.1" }, "value": { "key": { "name": "SdncResourceUpdateTask", "version": "0.0.1" }, "inputFields": { "entry": [ { "key": "attachmentPoint", "value": { "key": "attachmentPoint", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "requestID", "value": { "key": "requestID", "fieldSchemaKey": { "name": "UUIDType", "version": "0.0.1" }, "optional": false } }, { "key": "serviceInstanceId", "value": { "key": "serviceInstanceId", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] }, "outputFields": { "entry": [ { "key": "attachmentPoint", "value": { "key": "attachmentPoint", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "requestID", "value": { "key": "requestID", "fieldSchemaKey": { "name": "UUIDType", "version": "0.0.1" }, "optional": false } }, { "key": "result", "value": { "key": "result", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "serviceInstanceId", "value": { "key": "serviceInstanceId", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] }, "taskParameters": { "entry": [] }, "contextAlbumReference": [ { "name": "NomadicONTContextAlbum", "version": "0.0.1" } ], "taskLogic": { "key": "TaskLogic", "logicFlavour": "JAVASCRIPT", "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nload(\"nashorn:mozilla_compat.js\");\nimportClass(org.apache.avro.Schema);\nimportClass(java.io.BufferedReader);\nimportClass(java.io.IOException);\nimportClass(java.nio.file.Files);\nimportClass(java.nio.file.Paths);\n\nimportPackage(org.json.XML);\n\nexecutor.logger.info(\"Begin Execution SdncResourceUpdateTask.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar attachmentPoint = executor.inFields.get(\"attachmentPoint\");\nvar requestID = executor.inFields.get(\"requestID\");\nvar serviceInstanceId = executor.inFields.get(\"serviceInstanceId\");\nvar uuidType = Java.type(\"java.util.UUID\");\n\nvar wbClient = Java.type(\"org.onap.policy.apex.examples.bbs.WebClient\");\nvar client = new wbClient();\n\nvar NomadicONTContext = executor.getContextAlbum(\"NomadicONTContextAlbum\").get(attachmentPoint);\nvar sdncUUID = uuidType.randomUUID();\nexecutor.logger.info(NomadicONTContext);\nvar jsonObj;\nvar aaiUpdateResult = true;\nvar SDNC_URL = \"localhost:8080\";\nvar HTTP_PROTOCOL = \"http://\"\nvar SVC_NOTIFICATION_URL;\nvar putUpddateServInstance = JSON.parse(NomadicONTContext.get(\"aai_message\"));\nvar input_param = JSON.parse(putUpddateServInstance['input-parameters']);\ntry {\n var br = Files.newBufferedReader(Paths.get(\"/home/apexuser/examples/config/ONAPBBS/config.txt\"));\n var line;\n while ((line = br.readLine()) != null) {\n if (line.startsWith(\"SDNC_URL\")) {\n var str = line.split(\"=\");\n SDNC_URL = str[str.length - 1];\n } else if (line.startsWith(\"SVC_NOTIFICATION_URL\")) {\n var str = line.split(\"=\");\n SVC_NOTIFICATION_URL = str[str.length - 1];\n } else if (line.startsWith(\"SDNC_USERNAME\")) {\n var str = line.split(\"=\");\n SDNC_USERNAME = str[str.length - 1];\n } else if (line.startsWith(\"SDNC_PASSWORD\")) {\n var str = line.split(\"=\");\n SDNC_PASSWORD = str[str.length - 1];\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n}\nexecutor.logger.info(\"SDNC_URL \" + SDNC_URL);\n\nvar result;\nvar jsonObj;\nvar sdncUpdateResult = true;\n\n/* BBS Policy calls SDN-C GR-API to delete AccessConnectivity VF ID */\n/* Prepare Data */\nvar xmlDeleteAccess = \"\";\ntry {\n var br = Files.newBufferedReader(Paths\n .get(\"/home/apexuser/examples/config/ONAPBBS/sdnc_DeleteAccessConnectivityInstance.txt\"));\n var line;\n while ((line = br.readLine()) != null) {\n xmlDeleteAccess += line;\n }\n\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n}\n\n/* BBS Policy calls SDN-C GR-API to delete AccessConnectivity */\nxmlDeleteAccess = xmlDeleteAccess.replace(\"svc_request_id_value\", sdncUUID);\nxmlDeleteAccess = xmlDeleteAccess.replace(\"svc_notification_url_value\", SVC_NOTIFICATION_URL);\nxmlDeleteAccess = xmlDeleteAccess.replace(\"request_id_value\", sdncUUID);\nxmlDeleteAccess = xmlDeleteAccess.replace(\"service_id_value\", sdncUUID);\nxmlDeleteAccess = xmlDeleteAccess.replace(\"service_instance_id_value\", putUpddateServInstance['service-instance-id']);\nxmlDeleteAccess = xmlDeleteAccess.replace(\"service_type_value\", input_param['service']['serviceType']);\nxmlDeleteAccess = xmlDeleteAccess.replace(\"customer_id_value\", input_param['service']['globalSubscriberId']);\nxmlDeleteAccess = xmlDeleteAccess.replace(\"customer_name_value\", input_param['service']['globalSubscriberId']);\n\nxmlDeleteAccess = xmlDeleteAccess.replace(\"srv_info_model_inv_uuid_value\", getResourceInvariantUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlDeleteAccess = xmlDeleteAccess.replace(\"srv_info_model_custom_uuid_value\", getResourceCustomizationUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlDeleteAccess = xmlDeleteAccess.replace(\"srv_info_model_uuid_value\", getResourceUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlDeleteAccess = xmlDeleteAccess.replace(\"srv_info_model_name_value\", \"AccessConnectivity\");\nxmlDeleteAccess = xmlDeleteAccess.replace(\"network_info_model_inv_uuid_value\", getResourceInvariantUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlDeleteAccess = xmlDeleteAccess.replace(\"network_info_model_custom_uuid_value\", getResourceCustomizationUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlDeleteAccess = xmlDeleteAccess.replace(\"network_info_model_uuid_value\", getResourceUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlDeleteAccess = xmlDeleteAccess.replace(\"network_info_model_name_value\", \"AccessConnectivity\");\n\nxmlDeleteAccess = xmlDeleteAccess.replace(\"vendor_value\",\n input_param['service']['parameters']['requestInputs']['ont_ont_manufacturer']);\nxmlDeleteAccess = xmlDeleteAccess.replace(\"service_id_value\", getMetaValue(\n putUpddateServInstance['metadata']['metadatum'], 'controller-service-id'));\nexecutor.logger.info(client.toPrettyString(xmlDeleteAccess, 4));\n\ntry {\n var urlPost1 = HTTP_PROTOCOL + SDNC_URL + \"/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation\";\n result = client.httpRequest(urlPost1, \"POST\", xmlDeleteAccess, SDNC_USERNAME, SDNC_PASSWORD, \"application/xml\");\n executor.logger.info(\"Data received From \" + urlPost1 + \" \" + result);\n if (result == \"\") {\n sdncUpdateResult = false;\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n sdncUpdateResult = false;\n}\n\n/* BBS Policy calls SDN-C GR-API to create new AccessConnectivity VF */\n\n/* Prepare Data */\nvar xmlCreateAccess = \"\";\ntry {\n var br = Files.newBufferedReader(Paths\n .get(\"/home/apexuser/examples/config/ONAPBBS/sdnc_CreateAccessConnectivityInstance.txt\"));\n var line;\n while ((line = br.readLine()) != null) {\n xmlCreateAccess += line;\n }\n\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n}\nxmlCreateAccess = xmlCreateAccess.replace(\"svc_request_id_value\", sdncUUID);\nxmlCreateAccess = xmlCreateAccess.replace(\"svc_notification_url_value\", SVC_NOTIFICATION_URL);\nxmlCreateAccess = xmlCreateAccess.replace(\"request_id_value\", requestID);\nxmlCreateAccess = xmlCreateAccess.replace(\"service_id_value\", sdncUUID);\nxmlCreateAccess = xmlCreateAccess.replace(\"service_instance_id_value\", putUpddateServInstance['service-instance-id']);\nxmlCreateAccess = xmlCreateAccess.replace(\"service_type_value\", input_param['service']['serviceType']);\nxmlCreateAccess = xmlCreateAccess.replace(\"customer_id_value\", input_param['service']['globalSubscriberId']);\nxmlCreateAccess = xmlCreateAccess.replace(\"customer_name_value\", input_param['service']['globalSubscriberId']);\n\nxmlCreateAccess = xmlCreateAccess.replace(\"srv_info_model_inv_uuid_value\", getResourceInvariantUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlCreateAccess = xmlCreateAccess.replace(\"srv_info_model_custom_uuid_value\", getResourceCustomizationUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlCreateAccess = xmlCreateAccess.replace(\"srv_info_model_uuid_value\", getResourceUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlCreateAccess = xmlCreateAccess.replace(\"srv_info_model_name_value\", \"AccessConnectivity\");\nxmlCreateAccess = xmlCreateAccess.replace(\"network_info_model_inv_uuid_value\", getResourceInvariantUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlCreateAccess = xmlCreateAccess.replace(\"network_info_model_custom_uuid_value\", getResourceCustomizationUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlCreateAccess = xmlCreateAccess.replace(\"network_info_model_uuid_value\", getResourceUuid(\n input_param['service']['parameters']['resources'], 'AccessConnectivity'));\nxmlCreateAccess = xmlCreateAccess.replace(\"network_info_model_name_value\", \"AccessConnectivity\");\n\nxmlCreateAccess = xmlCreateAccess.replace(\"vendor_value\",\n input_param['service']['parameters']['requestInputs']['ont_ont_manufacturer']);\nxmlCreateAccess = xmlCreateAccess.replace(\"ont_sn_value\",\n input_param['service']['parameters']['requestInputs']['ont_ont_serial_num']);\nxmlCreateAccess = xmlCreateAccess.replace(\"s_vlan_value\", getMetaValue(putUpddateServInstance['metadata']['metadatum'],\n 'svlan'));\nxmlCreateAccess = xmlCreateAccess.replace(\"c_vlan_value\", getMetaValue(putUpddateServInstance['metadata']['metadatum'],\n 'cvlan'));\nxmlCreateAccess = xmlCreateAccess.replace(\"remote_id_value\", getMetaValue(\n putUpddateServInstance['metadata']['metadatum'], 'remote-id'));\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:network-topology-operation\";\n result = client.httpRequest(urlPost2, \"POST\", xmlCreateAccess, SDNC_USERNAME, SDNC_PASSWORD, \"application/xml\");\n executor.logger.info(\"Data received From \" + urlPost2 + \" \" + result);\n if (result == \"\") {\n sdncUpdateResult = false;\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n sdncUpdateResult = false;\n}\n\n/* BBS Policy calls SDN-C GR-API to create change Internet Profile */\nvar xmlChangeProfile = \"\";\ntry {\n var br = Files.newBufferedReader(Paths\n .get(\"/home/apexuser/examples/config/ONAPBBS/sdnc_ChangeInternetProfileInstance.txt\"));\n var line;\n while ((line = br.readLine()) != null) {\n xmlChangeProfile += line;\n }\n\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n}\n\nxmlChangeProfile = xmlChangeProfile.replace(\"svc_request_id_value\", sdncUUID);\nxmlChangeProfile = xmlChangeProfile.replace(\"svc_notification_url_value\", SVC_NOTIFICATION_URL);\nxmlChangeProfile = xmlChangeProfile.replace(\"request_id_value\", requestID);\nxmlChangeProfile = xmlChangeProfile.replace(\"service_id_value\", sdncUUID);\nxmlChangeProfile = xmlChangeProfile.replace(\"service_instance_id_value\", putUpddateServInstance['service-instance-id']);\nxmlChangeProfile = xmlChangeProfile.replace(\"service_type_value\", input_param['service']['serviceType']);\nxmlChangeProfile = xmlChangeProfile.replace(\"customer_id_value\", input_param['service']['globalSubscriberId']);\nxmlChangeProfile = xmlChangeProfile.replace(\"customer_name_value\", input_param['service']['globalSubscriberId']);\n\nxmlCreateAccess = xmlCreateAccess.replace(\"srv_info_model_inv_uuid_value\", getResourceInvariantUuid(\n input_param['service']['parameters']['resources'], 'InternetProfile'));\nxmlCreateAccess = xmlCreateAccess.replace(\"srv_info_model_custom_uuid_value\", getResourceCustomizationUuid(\n input_param['service']['parameters']['resources'], 'InternetProfile'));\nxmlCreateAccess = xmlCreateAccess.replace(\"srv_info_model_uuid_value\", getResourceUuid(\n input_param['service']['parameters']['resources'], 'InternetProfile'));\nxmlCreateAccess = xmlCreateAccess.replace(\"srv_info_model_name_value\", \"InternetProfile\");\nxmlCreateAccess = xmlCreateAccess.replace(\"network_info_model_inv_uuid_value\", getResourceInvariantUuid(\n input_param['service']['parameters']['resources'], 'InternetProfile'));\nxmlCreateAccess = xmlCreateAccess.replace(\"network_info_model_custom_uuid_value\", getResourceCustomizationUuid(\n input_param['service']['parameters']['resources'], 'InternetProfile'));\nxmlCreateAccess = xmlCreateAccess.replace(\"network_info_model_uuid_value\", getResourceUuid(\n input_param['service']['parameters']['resources'], 'InternetProfile'));\nxmlCreateAccess = xmlCreateAccess.replace(\"network_info_model_name_value\", \"InternetProfile\");\n\nxmlChangeProfile = xmlChangeProfile.replace(\"vendor_value\",\n input_param['service']['parameters']['requestInputs']['ont_ont_manufacturer']);\nxmlChangeProfile = xmlChangeProfile.replace(\"service_id_value\", getMetaValue(\n putUpddateServInstance['metadata']['metadatum'], 'controller-service-id'));\nxmlChangeProfile = xmlChangeProfile.replace(\"remote_id_value\", getMetaValue(\n putUpddateServInstance['metadata']['metadatum'], 'remote-id'));\nxmlChangeProfile = xmlChangeProfile.replace(\"ont_sn_value\",\n input_param['service']['parameters']['requestInputs']['ont_ont_serial_num']);\nxmlChangeProfile = xmlChangeProfile.replace(\"service_type_value\", input_param['service']['serviceType']);\nxmlChangeProfile = xmlChangeProfile.replace(\"mac_value\", getMetaValue(putUpddateServInstance['metadata']['metadatum'],\n 'rgw-mac-address'));\nxmlChangeProfile = xmlChangeProfile.replace(\"up_speed_value\", getMetaValue(\n putUpddateServInstance['metadata']['metadatum'], 'up-speed'));\nxmlChangeProfile = xmlChangeProfile.replace(\"down_speed_value\", getMetaValue(\n putUpddateServInstance['metadata']['metadatum'], 'down-speed'));\nxmlChangeProfile = xmlChangeProfile.replace(\"s_vlan_value\", getMetaValue(\n putUpddateServInstance['metadata']['metadatum'], 'svlan'));\nxmlChangeProfile = xmlChangeProfile.replace(\"c_vlan_value\", getMetaValue(\n putUpddateServInstance['metadata']['metadatum'], 'cvlan'));\n\nexecutor.logger.info(client.toPrettyString(xmlChangeProfile, 4));\ntry {\n if (sdncUpdateResult == true) {\n var urlPost3 = HTTP_PROTOCOL + SDNC_URL\n + \"/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation\";\n result = client\n .httpRequest(urlPost3, \"POST\", xmlChangeProfile, SDNC_USERNAME, SDNC_PASSWORD, \"application/xml\");\n executor.logger.info(\"Data received From \" + urlPost3 + \" \" + result);\n if (result == \"\") {\n sdncUpdateResult = false;\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n sdncUpdateResult = false;\n}\n\n/* If Success then Fill output schema */\n\nif (sdncUpdateResult === true) {\n NomadicONTContext.put(\"result\", \"SUCCESS\");\n executor.outFields.put(\"result\", \"SUCCESS\");\n} else {\n NomadicONTContext.put(\"result\", \"FAILURE\");\n executor.outFields.put(\"result\", \"FAILURE\");\n}\n\nexecutor.outFields.put(\"requestID\", requestID);\nexecutor.outFields.put(\"attachmentPoint\", attachmentPoint);\nexecutor.outFields.put(\"serviceInstanceId\", executor.inFields.get(\"serviceInstanceId\"));\n\nvar returnValue = executor.isTrue;\nexecutor.logger.info(executor.outFields);\nexecutor.logger.info(\"End Execution SdncResourceUpdateTask.js\");\n\nfunction getMetaValue(metaJson, metaname) {\n for (var i = 0; i < metaJson.length; i++) {\n if (metaJson[i]['metaname'] == metaname) {\n var metaValue = metaJson[i]['metaval'];\n return metaValue;\n }\n }\n\n}\n\nfunction getResourceInvariantUuid(resJson, resourceName) {\n for (var i = 0; i < resJson.length; i++) {\n if (resJson[i]['resourceName'] == resourceName) {\n var resValue = resJson[i]['resourceInvariantUuid'];\n return resValue;\n }\n }\n\n}\n\nfunction getResourceUuid(resJson, resourceName) {\n for (var i = 0; i < resJson.length; i++) {\n if (resJson[i]['resourceName'] == resourceName) {\n var resValue = resJson[i]['resourceUuid'];\n return resValue;\n }\n }\n\n}\n\nfunction getResourceCustomizationUuid(resJson, resourceName) {\n for (var i = 0; i < resJson.length; i++) {\n if (resJson[i]['resourceName'] == resourceName) {\n var resValue = resJson[i]['resourceCustomizationUuid'];\n return resValue;\n }\n }\n\n}\n\n/* Utility functions Begin */\nfunction IsValidJSONString(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n}\n/* Utility functions End */" } } }, { "key": { "name": "ServiceUpdateStateCpeAuthTask", "version": "0.0.1" }, "value": { "key": { "name": "ServiceUpdateStateCpeAuthTask", "version": "0.0.1" }, "inputFields": { "entry": [ { "key": "VirtualControlLoopEvent", "value": { "key": "VirtualControlLoopEvent", "fieldSchemaKey": { "name": "VirtualControlLoopEventType", "version": "0.0.1" }, "optional": false } } ] }, "outputFields": { "entry": [ { "key": "attachmentPoint", "value": { "key": "attachmentPoint", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "requestID", "value": { "key": "requestID", "fieldSchemaKey": { "name": "UUIDType", "version": "0.0.1" }, "optional": false } }, { "key": "result", "value": { "key": "result", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "serviceInstanceId", "value": { "key": "serviceInstanceId", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] }, "taskParameters": { "entry": [] }, "contextAlbumReference": [ { "name": "NomadicONTContextAlbum", "version": "0.0.1" } ], "taskLogic": { "key": "TaskLogic", "logicFlavour": "JAVASCRIPT", "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2019 Huawei. All rights reserved.\n * Modifications Copyright (C) 2019 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nload(\"nashorn:mozilla_compat.js\");\nimportClass(java.io.BufferedReader);\nimportClass(java.io.IOException);\nimportClass(java.nio.file.Files);\nimportClass(java.nio.file.Paths);\n\nexecutor.logger.info(\"Begin Execution ServiceUpdateStateCpeAuthTask.js\");\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar clEventType = Java.type(\"org.onap.policy.controlloop.VirtualControlLoopEvent\");\nvar clEvent = executor.inFields.get(\"VirtualControlLoopEvent\");\n\nvar serviceInstanceId = clEvent.getAai().get(\"service-information.hsia-cfs-service-instance-id\");\nvar requestID = clEvent.getRequestId();\n\nvar jsonObj;\nvar aaiUpdateResult = true;\nvar wbClient = Java.type(\"org.onap.policy.apex.examples.bbs.WebClient\");\nvar client = new wbClient();\nvar oldState = clEvent.getAai().get(\"cpe.old-authentication-state\");\nvar newState = clEvent.getAai().get(\"cpe.new-authentication-state\");\n/* Get AAI URL from Configuration file. */\nvar AAI_URL = \"localhost:8080\";\nvar CUSTOMER_ID = requestID;\nvar SERVICE_INSTANCE_ID = serviceInstanceId;\nvar resource_version;\nvar HTTP_PROTOCOL = \"https://\";\nvar results;\nvar putUrl;\nvar service_instance;\nvar AAI_VERSION = \"v14\";\ntry {\n var br = Files.newBufferedReader(Paths.get(\"/home/apexuser/examples/config/ONAPBBS/config.txt\"));\n var line;\n while ((line = br.readLine()) != null) {\n if (line.startsWith(\"AAI_URL\")) {\n var str = line.split(\"=\");\n AAI_URL = str[str.length - 1];\n } else if (line.startsWith(\"AAI_USERNAME\")) {\n var str = line.split(\"=\");\n AAI_USERNAME = str[str.length - 1];\n } else if (line.startsWith(\"AAI_PASSWORD\")) {\n var str = line.split(\"=\");\n AAI_PASSWORD = str[str.length - 1];\n } else if (line.startsWith(\"AAI_VERSION\")) {\n var str = line.split(\"=\");\n AAI_VERSION = str[str.length - 1];\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n}\n\nexecutor.logger.info(\"AAI_URL=>\" + AAI_URL);\n\n/* Get service instance Id from AAI */\ntry {\n var urlGet = HTTP_PROTOCOL + AAI_URL + \"/aai/\" + AAI_VERSION + \"/nodes/service-instances/service-instance/\"\n + SERVICE_INSTANCE_ID + \"?format=resource_and_url\"\n executor.logger.info(\"Query url\" + urlGet);\n\n result = client.httpRequest(urlGet, \"GET\", null, AAI_USERNAME, AAI_PASSWORD, \"application/json\");\n executor.logger.info(\"Data received From \" + urlGet + \" \" + result);\n jsonObj = JSON.parse(result);\n\n /* Retrieve the service instance id */\n results = jsonObj['results'][0];\n putUrl = results[\"url\"];\n service_instance = results['service-instance'];\n resource_version = service_instance['resource-version'];\n executor.logger.info(\"After Parse service_instance \" + JSON.stringify(service_instance, null, 4) + \"\\n url \"\n + putUrl + \"\\n Service instace Id \" + SERVICE_INSTANCE_ID);\n\n if (result == \"\") {\n aaiUpdateResult = false;\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n aaiUpdateResult = false;\n}\n\n/* BBS Policy updates orchestration status of {{bbs-cfs-service-instance-UUID}} [ active --> assigned ] */\nvar putUpddateServInstance;\nputUpddateServInstance = service_instance;\nif (newState == 'inService') {\n putUpddateServInstance['orchestration-status'] = \"active\";\n} else {\n putUpddateServInstance['orchestration-status'] = \"inActive\";\n}\ntry {\n if (aaiUpdateResult == true) {\n executor.logger.info(\"ready to put After Parse \" + JSON.stringify(putUpddateServInstance, null, 4));\n var urlPut = HTTP_PROTOCOL + AAI_URL + putUrl + \"?resource_version=\" + resource_version;\n result = client.httpRequest(urlPut, \"PUT\", JSON.stringify(putUpddateServInstance), AAI_USERNAME, AAI_PASSWORD,\n \"application/json\");\n executor.logger.info(\"Data received From \" + urlPut + \" \" + result);\n /* If failure to retrieve data proceed to Failure */\n if (result != \"\") {\n aaiUpdateResult = false;\n }\n }\n} catch (err) {\n executor.logger.info(\"Failed to retrieve data \" + err);\n aaiUpdateResult = false;\n}\n\nif (aaiUpdateResult == true) {\n executor.outFields.put(\"result\", \"SUCCCESS\");\n} else {\n executor.outFields.put(\"result\", \"FAILURE\");\n}\n\nexecutor.logger.info(executor.outFields);\nvar returnValue = executor.isTrue;\nexecutor.logger.info(\"End Execution ServiceUpdateStateCpeAuthTask.js\");" } } } ] } }, "events": { "key": { "name": "NomadicONTPolicyModel_Events", "version": "1.0.2" }, "eventMap": { "entry": [ { "key": { "name": "AAI_CPE_AUTH_UPDATE", "version": "1.0.0" }, "value": { "key": { "name": "AAI_CPE_AUTH_UPDATE", "version": "1.0.0" }, "nameSpace": "org.onap.policy.apex.onap.bbs", "source": "APEX", "target": "DCAE", "parameter": { "entry": [ { "key": "attachmentPoint", "value": { "key": "attachmentPoint", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "requestID", "value": { "key": "requestID", "fieldSchemaKey": { "name": "UUIDType", "version": "0.0.1" }, "optional": false } }, { "key": "result", "value": { "key": "result", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "serviceInstanceId", "value": { "key": "serviceInstanceId", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] } } }, { "key": { "name": "AAI_SERVICE_ASSIGNED", "version": "1.0.0" }, "value": { "key": { "name": "AAI_SERVICE_ASSIGNED", "version": "1.0.0" }, "nameSpace": "org.onap.policy.apex.onap.bbs", "source": "APEX", "target": "APEX", "parameter": { "entry": [ { "key": "attachmentPoint", "value": { "key": "attachmentPoint", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "requestID", "value": { "key": "requestID", "fieldSchemaKey": { "name": "UUIDType", "version": "0.0.1" }, "optional": false } }, { "key": "serviceInstanceId", "value": { "key": "serviceInstanceId", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] } } }, { "key": { "name": "AAI_SERVICE_CREATE", "version": "1.0.0" }, "value": { "key": { "name": "AAI_SERVICE_CREATE", "version": "1.0.0" }, "nameSpace": "org.onap.policy.apex.onap.bbs", "source": "APEX", "target": "APEX", "parameter": { "entry": [ { "key": "attachmentPoint", "value": { "key": "attachmentPoint", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "requestID", "value": { "key": "requestID", "fieldSchemaKey": { "name": "UUIDType", "version": "0.0.1" }, "optional": false } }, { "key": "result", "value": { "key": "result", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "serviceInstanceId", "value": { "key": "serviceInstanceId", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] } } }, { "key": { "name": "CPE_Authentication", "version": "1.0.2" }, "value": { "key": { "name": "CPE_Authentication", "version": "1.0.2" }, "nameSpace": "org.onap.policy.apex.onap.bbs", "source": "DCAE", "target": "APEX", "parameter": { "entry": [ { "key": "VirtualControlLoopEvent", "value": { "key": "VirtualControlLoopEvent", "fieldSchemaKey": { "name": "VirtualControlLoopEventType", "version": "0.0.1" }, "optional": false } } ] } } }, { "key": { "name": "END_CONTROL_LOOP", "version": "1.0.0" }, "value": { "key": { "name": "END_CONTROL_LOOP", "version": "1.0.0" }, "nameSpace": "org.onap.policy.apex.onap.bbs", "source": "APEX", "target": "APEX", "parameter": { "entry": [ { "key": "attachmentPoint", "value": { "key": "attachmentPoint", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "requestID", "value": { "key": "requestID", "fieldSchemaKey": { "name": "UUIDType", "version": "0.0.1" }, "optional": false } }, { "key": "result", "value": { "key": "result", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "serviceInstanceId", "value": { "key": "serviceInstanceId", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] } } }, { "key": { "name": "END_EVENT", "version": "1.0.0" }, "value": { "key": { "name": "END_EVENT", "version": "1.0.0" }, "nameSpace": "org.onap.policy.apex.onap.bbs", "source": "APEX", "target": "DCAE", "parameter": { "entry": [ { "key": "attachmentPoint", "value": { "key": "attachmentPoint", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "requestID", "value": { "key": "requestID", "fieldSchemaKey": { "name": "UUIDType", "version": "0.0.1" }, "optional": false } }, { "key": "result", "value": { "key": "result", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } }, { "key": "serviceInstanceId", "value": { "key": "serviceInstanceId", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] } } }, { "key": { "name": "ERROR_LOG", "version": "1.0.0" }, "value": { "key": { "name": "ERROR_LOG", "version": "1.0.0" }, "nameSpace": "org.onap.policy.apex.onap.bbs", "source": "APEX", "target": "APEX", "parameter": { "entry": [ { "key": "errorLogParam", "value": { "key": "errorLogParam", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } } ] } } }, { "key": { "name": "Nomadic_ONT", "version": "1.0.2" }, "value": { "key": { "name": "Nomadic_ONT", "version": "1.0.2" }, "nameSpace": "org.onap.policy.apex.onap.bbs", "source": "DCAE", "target": "APEX", "parameter": { "entry": [ { "key": "VirtualControlLoopEvent", "value": { "key": "VirtualControlLoopEvent", "fieldSchemaKey": { "name": "VirtualControlLoopEventType", "version": "0.0.1" }, "optional": false } } ] } } }, { "key": { "name": "SDNC_RESOURCE_UPDATE", "version": "1.0.0" }, "value": { "key": { "name": "SDNC_RESOURCE_UPDATE", "version": "1.0.0" }, "nameSpace": "org.onap.policy.apex.onap.bbs", "source": "APEX", "target": "APEX", "parameter": { "entry": [ { "key": "attachmentPoint", "value": { "key": "attachmentPoint", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "requestID", "value": { "key": "requestID", "fieldSchemaKey": { "name": "UUIDType", "version": "0.0.1" }, "optional": false } }, { "key": "result", "value": { "key": "result", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": false } }, { "key": "serviceInstanceId", "value": { "key": "serviceInstanceId", "fieldSchemaKey": { "name": "SimpleStringType", "version": "0.0.1" }, "optional": true } } ] } } } ] } }, "albums": { "key": { "name": "NomadicONTPolicyModel_Albums", "version": "1.0.2" }, "albums": { "entry": [ { "key": { "name": "NomadicONTContextAlbum", "version": "0.0.1" }, "value": { "key": { "name": "NomadicONTContextAlbum", "version": "0.0.1" }, "scope": "policy", "isWritable": true, "itemSchema": { "name": "NomadicONTContextType", "version": "0.0.1" } } } ] } }, "schemas": { "key": { "name": "NomadicONTPolicyModel_Schemas", "version": "1.0.2" }, "schemas": { "entry": [ { "key": { "name": "NomadicONTContextType", "version": "0.0.1" }, "value": { "key": { "name": "NomadicONTContextType", "version": "0.0.1" }, "schemaFlavour": "Avro", "schemaDefinition": "{\n \"type\": \"record\",\n \"name\": \"NomadicONTContext\",\n \"fields\": [\n {\n \"name\": \"AAI\",\n \"type\": {\n \"type\": \"record\",\n \"name\": \"VCPE_AAI_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.vcpe\",\n \"fields\": [\n {\n \"name\": \"attachmentPoint\",\n \"type\": \"string\"\n },\n {\n \"name\": \"service_information_hsia_cfs_service_instance_id\",\n \"type\": \"string\"\n },\n {\n \"name\": \"cvlan\",\n \"type\": \"string\"\n },\n {\n \"name\": \"svlan\",\n \"type\": \"string\"\n },\n {\n \"name\": \"remoteId\",\n \"type\": \"string\"\n }\n ]\n }\n },\n {\n \"name\": \"closedLoopAlarmStart\",\n \"type\": \"long\"\n },\n {\n \"name\": \"closedLoopAlarmEnd\",\n \"type\": \"long\"\n },\n {\n \"name\": \"closedLoopControlName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"version\",\n \"type\": \"string\"\n },\n {\n \"name\": \"requestID\",\n \"type\": \"string\"\n },\n {\n \"name\": \"closedLoopEventClient\",\n \"type\": \"string\"\n },\n {\n \"name\": \"closedLoopEventStatus\",\n \"type\": \"string\"\n },\n {\n \"name\": \"target_type\",\n \"type\": \"string\"\n },\n {\n \"name\": \"target\",\n \"type\": \"string\"\n },\n {\n \"name\": \"from\",\n \"type\": \"string\"\n },\n {\n \"name\": \"policyScope\",\n \"type\": \"string\"\n },\n {\n \"name\": \"policyName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"policyVersion\",\n \"type\": \"string\"\n },\n {\n \"name\": \"notification\",\n \"type\": \"string\"\n },\n {\n \"name\": \"notificationTime\",\n \"type\": \"long\"\n },\n {\n \"name\": \"result\",\n \"type\": \"string\"\n },\n {\n \"name\": \"message\",\n \"type\": \"string\"\n },\n {\n \"name\": \"url\",\n \"type\": \"string\"\n },\n {\n \"name\": \"aai_message\",\n \"type\": \"string\"\n }\n ]\n}" } }, { "key": { "name": "SimpleBooleanType", "version": "0.0.1" }, "value": { "key": { "name": "SimpleBooleanType", "version": "0.0.1" }, "schemaFlavour": "Java", "schemaDefinition": "java.lang.Boolean" } }, { "key": { "name": "SimpleLongType", "version": "0.0.1" }, "value": { "key": { "name": "SimpleLongType", "version": "0.0.1" }, "schemaFlavour": "Java", "schemaDefinition": "java.lang.Long" } }, { "key": { "name": "SimpleStringType", "version": "0.0.1" }, "value": { "key": { "name": "SimpleStringType", "version": "0.0.1" }, "schemaFlavour": "Java", "schemaDefinition": "java.lang.String" } }, { "key": { "name": "UUIDType", "version": "0.0.1" }, "value": { "key": { "name": "UUIDType", "version": "0.0.1" }, "schemaFlavour": "Java", "schemaDefinition": "java.util.UUID" } }, { "key": { "name": "VirtualControlLoopEventType", "version": "0.0.1" }, "value": { "key": { "name": "VirtualControlLoopEventType", "version": "0.0.1" }, "schemaFlavour": "Java", "schemaDefinition": "org.onap.policy.controlloop.VirtualControlLoopEvent" } } ] } } } } }, "eventOutputParameters": { "FirstProducer": { "carrierTechnologyParameters": { "carrierTechnology": "FILE", "parameters": { "standardIo": true } }, "eventProtocolParameters": { "eventProtocol": "JSON" } } }, "eventInputParameters": { "DCAEConsumer": { "carrierTechnologyParameters": { "carrierTechnology": "RESTCLIENT", "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters", "parameters": { "url": "http://message-router:3904/events/unauthenticated.DCAE_CL_OUTPUT/g1/c1?timeout=60000" } }, "eventProtocolParameters": { "eventProtocol": "JSON", "parameters": { "nameAlias": "policyName", "versionAlias": "version", "sourceAlias": "from", "pojoField": "VirtualControlLoopEvent" } } } } } } } ] } }
4) Deploy BBS policy
API: POST URL: {{POLICY-PAP-URL}}/policy/pap/v1/pdps/deployments/batch
{ "groups": [ { "name": "defaultGroup", "deploymentSubgroups": [ { "pdpType": "apex", "action": "POST", "policies": [{ "name": "onap.policies.controlloop.operational.apex.onapbbs", "version": "1.0.2" }] } ] } ] }
5) Verify the deployment
API: GET URL: {{POLICY-API-URL}}/policy/api/v1/policytypes/onap.policies.controlloop.operational.Apex/versions/1.0.0/policies/
Edge Services: vBNG+AAA+DHCP, Edge SDN M&C
Swisscom Edge SDN M&C and virtual BNG
BBS Service Configuration
AAI: Business customer
Create a business customer and subscription to BBS service type in AAI
curl -X PUT \ https://aai.api.simpledemo.openecomp.org:30233/aai/v16/business/customers/customer/0dd5ab04-11a1-48b2-9792-6f12a42223d3 \ -H 'Accept: application/json' \ -H 'Authorization: Basic QUFJOkFBSQ==' \ -H 'Cache-Control: no-cache' \ -H 'Connection: keep-alive' \ -H 'Content-Type: application/json' \ -H 'Host: aai.api.simpledemo.openecomp.org:30233' \ -H 'User-Agent: PostmanRuntime/7.15.0' \ -H 'X-FromAppId: Postman Application' \ -H 'X-TransactionId: Postman REST Transaction' \ -H 'accept-encoding: gzip, deflate' \ -H 'cache-control: no-cache' \ -H 'content-length: 140' \ -d '{ "global-customer-id": "0dd5ab04-11a1-48b2-9792-6f12a42223d3", "subscriber-name": "BBSCustomer", "subscriber-type": "CUST" } ' curl -X GET \ https://aai.api.simpledemo.openecomp.org:30233/aai/v16/business/customers/customer/0dd5ab04-11a1-48b2-9792-6f12a42223d3 \ -H 'Accept: application/json' \ -H 'Authorization: Basic QUFJOkFBSQ==' \ -H 'Cache-Control: no-cache' \ -H 'Connection: keep-alive' \ -H 'Content-Type: application/json' \ -H 'Host: aai.api.simpledemo.openecomp.org:30233' \ -H 'User-Agent: PostmanRuntime/7.15.0' \ -H 'X-FromAppId: Postman Application' \ -H 'X-TransactionId: Postman REST Transaction' \ -H 'accept-encoding: gzip, deflate' \ -H 'cache-control: no-cache' { "global-customer-id": "0dd5ab04-11a1-48b2-9792-6f12a42223d3", "subscriber-name": "BBSCustomer", "subscriber-type": "CUST", "resource-version": "1561552477331" }
curl -X PUT \ https://aai.api.simpledemo.openecomp.org:30233/aai/v14/business/customers/customer/0dd5ab04-11a1-48b2-9792-6f12a42223d3/service-subscriptions/service-subscription/BBS_E2E_Service \ -H 'Accept: application/json' \ -H 'Authorization: Basic QUFJOkFBSQ==' \ -H 'Cache-Control: no-cache' \ -H 'Connection: keep-alive' \ -H 'Content-Type: application/json' \ -H 'Host: aai.api.simpledemo.openecomp.org:30233' \ -H 'User-Agent: PostmanRuntime/7.15.0' \ -H 'X-FromAppId: Postman Application' \ -H 'X-TransactionId: Postman REST Transaction' \ -H 'accept-encoding: gzip, deflate' \ -H 'cache-control: no-cache' \ -H 'content-length: 38' \ -d '{ "service-type": "BBS_E2E_Service" }' curl -X GET \ 'https://aai.api.simpledemo.openecomp.org:30233/aai/v16/business/customers/customer/0dd5ab04-11a1-48b2-9792-6f12a42223d3?depth=all' \ -H 'Accept: application/json' \ -H 'Authorization: Basic QUFJOkFBSQ==' \ -H 'Cache-Control: no-cache' \ -H 'Connection: keep-alive' \ -H 'Content-Type: application/json' \ -H 'Host: aai.api.simpledemo.openecomp.org:30233' \ -H 'User-Agent: PostmanRuntime/7.15.0' \ -H 'X-FromAppId: Postman Application' \ -H 'X-TransactionId: Postman REST Transaction' \ -H 'accept-encoding: gzip, deflate' \ -H 'cache-control: no-cache' { "global-customer-id": "0dd5ab04-11a1-48b2-9792-6f12a42223d3", "subscriber-name": "BBSCustomer", "subscriber-type": "CUST", "resource-version": "1561552477331", "service-subscriptions": { "service-subscription": [ { "service-type": "BBS_E2E_Service", "resource-version": "1561553245301" } ] } }
BBS HSIA CFS Onboarding and Distribution
Postman Collection: BBS_Use_Case_PostmanCollection.zip
1) Create Vendor License Model (VLM)
Error rendering macro 'multimedia'
com.atlassian.renderer.v2.macro.MacroException: Cannot find attachment 'BBS_01_Create_VLM.mov'
Error rendering macro 'multimedia'
com.atlassian.renderer.v2.macro.MacroException: Cannot find attachment 'BBS_01_Create_VLM.mov'
2) Resource Onboarding
Notes:
- Create VFCs (CPE, AccessConnectivity, InternetProfile) and VFs with single VFC (CPE, AccessConnectivity, InternetProfile).
- Declare attributes as inputs in VF.
Resource | Description | Template |
---|---|---|
CPE | CPE (ONT+RG) PNF | CpePnf.yml |
AccessConnectivity | Access Connectivity RFS | access_connectivity.yml |
InternetProfile | Internet Profile RFS | InternetProfile.yaml |
Error rendering macro 'multimedia'
com.atlassian.renderer.v2.macro.MacroException: Cannot find attachment 'BBS_02_ResourceOnboarding.mp4'
3) E2E Service Design
Notes:
- Create E2E service, ontNni has CPE as a requirement
- ODN as VnfVirtualLink
- ponUni and oltNni have AccessConnectivity VF as a requirement
Error rendering macro 'multimedia'
com.atlassian.renderer.v2.macro.MacroException: Cannot find attachment 'BBS_03_E2EServiceDesign.mp4'
BSS HSIA Service Order: Request Input
Input provided as part of the service order, sent to External API from BSS
NOTE: ont_ont_manufacturer = [HUAWEI or NOKIA], ont_ont_pnf_name is used as pnf_correlation_id by SO
{ "externalId": "BBS_BSS_TrackindId3584", "category": "NetworkService", "description": "Service Order for a new HSIA CFS", "priority": "1", "relatedParty": [ { "id": "6f486438-87b5-4bee-8f85-30090c760501", "role": "ONAPcustomer", "name": "EnterpriseA", "@referredType": "Consumer" } ], "orderItem": [ { "id": "1", "action": "add", "service": { "name": "BBS_E2E_Service_1", "serviceState": "active", "serviceSpecification": { "id": "0187be8c-8efb-4531-97fa-dbe984ed9cdb" }, "serviceCharacteristic": [ { "name": "ont_ont_serial_num", "value": { "serviceCharacteristicValue": "HWTCC01B7503" } }, { "name": "edgeinternetprofile_ip_rg_mac_addr", "value": { "serviceCharacteristicValue": "54:04:a6:38:12:9d" } }, { "name": "edgeinternetprofile_ip_downstream_speed", "value": { "serviceCharacteristicValue": "10" } }, { "name": "ont_ont_mac_addr", "value": { "serviceCharacteristicValue": "54:04:a6:38:12:9d" } }, { "name": "edgeinternetprofile_ip_remote_id", "value": { "serviceCharacteristicValue": "AC9.000.010.001" } }, { "name": "ont_ont_swVersion", "value": { "serviceCharacteristicValue": "1.0.0" } }, { "name": "ont_ont_manufacturer", "value": { "serviceCharacteristicValue": "HUAWEI" } }, { "name": "edgeinternetprofile_ip_service_type", "value": { "serviceCharacteristicValue": "BBS_E2E_Service" } }, { "name": "ont_ont_pnf_name", "value": { "serviceCharacteristicValue": "Huawei-4857544302FF269D" } }, { "name": "edgeinternetprofile_ip_upstream_speed", "value": { "serviceCharacteristicValue": "10" } }, { "name": "ont_ont_nf_type", "value": { "serviceCharacteristicValue": "HN8255WS" } }, { "name": "cvlan", "value": { "serviceCharacteristicValue": "100" } }, { "name": "svlan", "value": { "serviceCharacteristicValue": "1000" } } ] } } ] }
BBS HSIA Service Creation and Activation
Error rendering macro 'multimedia'
com.atlassian.renderer.v2.macro.MacroException: Cannot find attachment 'BBS_04_HSIACreationAndActivation.mp4'
BBS HSIA Service Reconfiguration. Nomadic ONT
Error rendering macro 'multimedia'
com.atlassian.renderer.v2.macro.MacroException: Cannot find attachment 'BBS_05_NomadicONT.mov'
- No labels