From: sebdet Date: Mon, 8 Nov 2021 14:58:31 +0000 (+0100) Subject: Add test folder to the smo package installation X-Git-Tag: f-release~25^2~4 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F15%2F7015%2F1;p=it%2Fdep.git Add test folder to the smo package installation Add the test folder containing test of O1, A1 interfaces Signed-off-by: sebdet Signed-off-by: xuegao Issue-ID: NONRTRIC-609 Change-Id: Icab9af13124397c92c9b5f2f629d7b2117680739 --- diff --git a/smo-install/onap_oom b/smo-install/onap_oom index a697f8ab..c0d611ce 160000 --- a/smo-install/onap_oom +++ b/smo-install/onap_oom @@ -1 +1 @@ -Subproject commit a697f8ab8f2b47100cb73a7f5812f70e242b75a6 +Subproject commit c0d611ce70bcc49952ca87de8a62249c60506346 diff --git a/smo-install/test/a1-validation/data/ECS/EiJob.json b/smo-install/test/a1-validation/data/ECS/EiJob.json new file mode 100644 index 00000000..003c70f9 --- /dev/null +++ b/smo-install/test/a1-validation/data/ECS/EiJob.json @@ -0,0 +1,11 @@ +{ + "eiTypeId": "type1", + "jobResultUri": "https://ricsim_g3_1:8185/datadelivery", + "jobOwner": "ricsim_g3_1", + "jobStatusNotificationUri": "http://producer:80/", + "jobDefinition": { + "jobparam1": "value1_job1", + "jobparam2": "value2_job1", + "jobparam3": "value3_job1" + } +} \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/ECS/EiProducer.json b/smo-install/test/a1-validation/data/ECS/EiProducer.json new file mode 100644 index 00000000..a691e8b2 --- /dev/null +++ b/smo-install/test/a1-validation/data/ECS/EiProducer.json @@ -0,0 +1,5 @@ +{ + "supported_info_types": ["type1"], + "info_job_callback_url": "http://producer:80/callbacks/job/prod-a", + "info_producer_supervision_callback_url": "http://producer:80/callbacks/supervision/prod-a" +} \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/ECS/EiType.json b/smo-install/test/a1-validation/data/ECS/EiType.json new file mode 100644 index 00000000..03762e52 --- /dev/null +++ b/smo-install/test/a1-validation/data/ECS/EiType.json @@ -0,0 +1,8 @@ +{ + "info_job_data_schema":{ + "$schema":"http://json-schema.org/draft-07/schema#", + "title":"STD_Type1_1.0.0", + "description":"EI-Type 1", + "type":"object" + } + } \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/OSC/policy_type.json b/smo-install/test/a1-validation/data/OSC/policy_type.json new file mode 100644 index 00000000..aeea7733 --- /dev/null +++ b/smo-install/test/a1-validation/data/OSC/policy_type.json @@ -0,0 +1,45 @@ +{ + "name": "pt1", + "description": "pt1 policy type", + "policy_type_id": 1, + "create_schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "OSC_Type1_1.0.0", + "description": "Type 1 policy type", + "type": "object", + "properties": { + "scope": { + "type": "object", + "properties": { + "ueId": { + "type": "string" + }, + "qosId": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "ueId", + "qosId" + ] + }, + "qosObjectives": { + "type": "object", + "properties": { + "priorityLevel": { + "type": "number" + } + }, + "additionalProperties": false, + "required": [ + "priorityLevel" + ] + } + }, + "additionalProperties": false, + "required": [ + "scope", "qosObjectives" + ] + } +} diff --git a/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-pms-status.json b/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-pms-status.json new file mode 100644 index 00000000..5c7968e6 --- /dev/null +++ b/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-pms-status.json @@ -0,0 +1,14 @@ +[ + { + "apiVersion": "1.0", + "operation": "GET", + "correlationId": "1596363451067769100", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-02 10:17:31.067784", + "type": "request", + "url": "/status" + } +] \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-policy-create.json b/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-policy-create.json new file mode 100644 index 00000000..23d7bed6 --- /dev/null +++ b/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-policy-create.json @@ -0,0 +1,102 @@ +[ + { + "apiVersion": "1.0", + "operation": "PUT", + "correlationId": "1596304565904621535", + "originatorId": "849e6c6b420", + "payload": { + "scope": { + "ueId": "ue3000", + "qosId": "qos3000" + }, + "qosObjectives": { + "priorityLevel": 3000 + } + }, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:05.905035", + "type": "request", + "url": "/policy?id=0f7bb041e1584b1fa17e87520d70a3000&ric=ric1&service=service1&type=1" + }, + { + "apiVersion": "1.0", + "operation": "PUT", + "correlationId": "1596304566656253556", + "originatorId": "849e6c6b420", + "payload": { + "scope": { + "ueId": "ue3100", + "qosId": "qos3100" + }, + "qosObjectives": { + "priorityLevel": 3100 + } + }, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:06.656949", + "type": "request", + "url": "/policy?id=0f7bb041e1584b1fa17e87520d70a3100&ric=ric1&service=service1&type=1" + }, + { + "apiVersion": "1.0", + "operation": "PUT", + "correlationId": "1596304566656253557", + "originatorId": "849e6c6b420", + "payload": { + "scope": { + "ueId": "ue3100", + "qosId": "qos3100" + }, + "qosObjectives": { + "priorityLevel": 3200 + } + }, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:06.656949", + "type": "request", + "url": "/policy?id=0f7bb041e1584b1fa17e87520d70a3101&ric=ric1&service=service1&type=1" + }, + { + "apiVersion": "1.0", + "operation": "PUT", + "correlationId": "1596304566656253558", + "originatorId": "849e6c6b420", + "payload": { + "scope": { + "ueId": "ue3102", + "qosId": "qos3102" + }, + "qosObjectives": { + "priorityLevel": 3201 + } + }, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:06.656949", + "type": "request", + "url": "/policy?id=0f7bb041e1584b1fa17e87520d70a3102&ric=ric2&service=service1" + }, + { + "apiVersion": "1.0", + "operation": "PUT", + "correlationId": "1596304566656253558", + "originatorId": "849e6c6b420", + "payload": { + "scope": { + "ueId": "ue3103", + "qosId": "qos3103" + }, + "qosObjectives": { + "priorityLevel": 3203 + } + }, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:06.656949", + "type": "request", + "url": "/policy?id=0f7bb041e1584b1fa17e87520d70a3103&ric=ric3&service=service1&type=2" + } +] \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-policy-delete.json b/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-policy-delete.json new file mode 100644 index 00000000..6065af32 --- /dev/null +++ b/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-policy-delete.json @@ -0,0 +1,50 @@ +[ + { + "apiVersion": "1.0", + "operation": "DELETE", + "correlationId": "1596304567816229314", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:07.816235", + "type": "request", + "url": "/policy?id=0f7bb041e1584b1fa17e87520d70a3000" + }, + { + "apiVersion": "1.0", + "operation": "DELETE", + "correlationId": "1596304567816229314", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:07.816235", + "type": "request", + "url": "/policy?id=0f7bb041e1584b1fa17e87520d70a3100" + }, + { + "apiVersion": "1.0", + "operation": "DELETE", + "correlationId": "1596304567816229314", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:07.816235", + "type": "request", + "url": "/policy?id=0f7bb041e1584b1fa17e87520d70a3101" + }, + { + "apiVersion": "1.0", + "operation": "DELETE", + "correlationId": "1596304567816229314", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:07.816235", + "type": "request", + "url": "/policy?id=0f7bb041e1584b1fa17e87520d70a3102" + } +] \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-policy-get.json b/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-policy-get.json new file mode 100644 index 00000000..abcaa35a --- /dev/null +++ b/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-policy-get.json @@ -0,0 +1,50 @@ +[ + { + "apiVersion": "1.0", + "operation": "GET", + "correlationId": "1596304567017739720", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:07.017744", + "type": "request", + "url": "/policy?id=0f7bb041e1584b1fa17e87520d70a3000" + }, + { + "apiVersion": "1.0", + "operation": "GET", + "correlationId": "1596304567017739720", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:07.017744", + "type": "request", + "url": "/policy?id=0f7bb041e1584b1fa17e87520d70a3100" + }, + { + "apiVersion": "1.0", + "operation": "GET", + "correlationId": "1596304567017739720", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:07.017744", + "type": "request", + "url": "/policy?id=0f7bb041e1584b1fa17e87520d70a3101" + }, + { + "apiVersion": "1.0", + "operation": "GET", + "correlationId": "1596304567017739720", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:07.017744", + "type": "request", + "url": "/policy?id=0f7bb041e1584b1fa17e87520d70a3102" + } +] \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-policy-schemas-get.json b/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-policy-schemas-get.json new file mode 100644 index 00000000..05a79759 --- /dev/null +++ b/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-policy-schemas-get.json @@ -0,0 +1,13 @@ +[ + { + "type": "request", + "correlationId": "c09ac7d1-de62-0016-2000-e63701125557-201", + "target": "policy-agent", + "timestamp": "2019-05-14T11:44:51.36Z", + "apiVersion": "1.0", + "originatorId": "849e6c6b420", + "requestId": "23343221", + "operation": "GET", + "url": "/policy_schemas?ric=ric1" + } +] diff --git a/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-rics-get.json b/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-rics-get.json new file mode 100644 index 00000000..59562d38 --- /dev/null +++ b/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-rics-get.json @@ -0,0 +1,14 @@ +[ + { + "apiVersion": "1.0", + "operation": "GET", + "correlationId": "1596363459399504200", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-02 10:17:39.399517", + "type": "request", + "url": "/rics" + } +] \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-service-create.json b/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-service-create.json new file mode 100644 index 00000000..3e3d5421 --- /dev/null +++ b/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-service-create.json @@ -0,0 +1,46 @@ +[ + { + "apiVersion": "1.0", + "operation": "PUT", + "correlationId": "1596363458549998500", + "originatorId": "849e6c6b420", + "payload": { + "callbackUrl": "http://callback-receiver:8090/callbacks/1", + "keepAliveIntervalSeconds": "1000", + "serviceName": "serv1" + }, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-02 10:17:38.550324", + "type": "request", + "url": "/service" + }, + { + "apiVersion": "1.0", + "operation": "PUT", + "correlationId": "1596363458549998501", + "originatorId": "849e6c6b421", + "payload": { + "callbackUrl": "http://callback-receiver:8090/callbacks/1", + "keepAliveIntervalSeconds": "1000", + "serviceName": "service1" + }, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-02 10:17:38.550324", + "type": "request", + "url": "/service" + }, + { + "apiVersion": "1.0", + "operation": "PUT", + "correlationId": "1596363459196978900", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-02 10:17:39.197067", + "type": "request", + "url": "/services/keepalive?name=serv1" + } +] \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-services-get.json b/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-services-get.json new file mode 100644 index 00000000..e9c2f8c6 --- /dev/null +++ b/smo-install/test/a1-validation/data/dmaap/v1/dmaap-msg-services-get.json @@ -0,0 +1,14 @@ +[ + { + "apiVersion": "1.0", + "operation": "GET", + "correlationId": "1596363458896827100", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-02 10:17:38.897367", + "type": "request", + "url": "/services" + } +] \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-pms-status.json b/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-pms-status.json new file mode 100644 index 00000000..439da01b --- /dev/null +++ b/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-pms-status.json @@ -0,0 +1,14 @@ +[ + { + "apiVersion": "1.0", + "operation": "GET", + "correlationId": "1596363451067769100", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-02 10:17:31.067784", + "type": "request", + "url": "/a1-policy/v2/status" + } +] \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-policy-create.json b/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-policy-create.json new file mode 100644 index 00000000..3b42dfec --- /dev/null +++ b/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-policy-create.json @@ -0,0 +1,114 @@ +[ + { + "apiVersion": "1.0", + "operation": "PUT", + "correlationId": "1596304565904621535", + "originatorId": "849e6c6b420", + "payload": { + "policy_data": { + "scope": { + "ueId": "ue3010", + "qosId": "qos3010" + }, + "qosObjectives": { + "priorityLevel": 3010 + } + }, + "policy_id": "0f7bb041e1584b1fa17e87520d70a3010", + "policytype_id": "1", + "ric_id": "ric1", + "service_id": "service2", + "status_notification_uri": "http://example.com", + "transient": true + }, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:05.905035", + "type": "request", + "url": "/a1-policy/v2/policies/" + }, + { + "apiVersion": "1.0", + "operation": "PUT", + "correlationId": "1596304566656253556", + "originatorId": "849e6c6b420", + "payload": { + "policy_data": { + "scope": { + "ueId": "ue3120", + "qosId": "qos3120" + }, + "qosObjectives": { + "priorityLevel": 3120 + } + }, + "policy_id": "0f7bb041e1584b1fa17e87520d70a3120", + "policytype_id": "1", + "ric_id": "ric1", + "service_id": "service2", + "status_notification_uri": "http://example.com", + "transient": true + }, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:06.656949", + "type": "request", + "url": "/a1-policy/v2/policies/" + }, + { + "apiVersion": "1.0", + "operation": "PUT", + "correlationId": "1596304566656253557", + "originatorId": "849e6c6b420", + "payload": { + "policy_data": { + "scope": { + "ueId": "ue3131", + "qosId": "qos3131" + }, + "qosObjectives": { + "priorityLevel": 3101 + } + }, + "policy_id": "0f7bb041e1584b1fa17e87520d70a3131", + "policytype_id": "1", + "ric_id": "ric1", + "service_id": "service2", + "status_notification_uri": "http://example.com", + "transient": true + }, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:06.656949", + "type": "request", + "url": "/a1-policy/v2/policies/" + }, + { + "apiVersion": "1.0", + "operation": "PUT", + "correlationId": "1596304566656253758", + "originatorId": "849e6c6b422", + "payload": { + "policy_data": { + "scope": { + "ueId": "ue3153", + "qosId": "qos3153" + }, + "qosObjectives": { + "priorityLevel": 3103 + } + }, + "policy_id": "0f7bb041e1584b1fa17e87520d70a3153", + "policytype_id": "2", + "ric_id": "ric2", + "service_id": "service2", + "status_notification_uri": "http://example.com", + "transient": true + }, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:06.656949", + "type": "request", + "url": "/a1-policy/v2/policies/" + } +] \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-policy-delete.json b/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-policy-delete.json new file mode 100644 index 00000000..1a126fde --- /dev/null +++ b/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-policy-delete.json @@ -0,0 +1,50 @@ +[ + { + "apiVersion": "1.0", + "operation": "DELETE", + "correlationId": "1596304567816229314", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:07.816235", + "type": "request", + "url": "/a1-policy/v2/policies/0f7bb041e1584b1fa17e87520d70a3000" + }, + { + "apiVersion": "1.0", + "operation": "DELETE", + "correlationId": "1596304567816229314", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:07.816235", + "type": "request", + "url": "/a1-policy/v2/policies/0f7bb041e1584b1fa17e87520d70a3100" + }, + { + "apiVersion": "1.0", + "operation": "DELETE", + "correlationId": "1596304567816229314", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:07.816235", + "type": "request", + "url": "/a1-policy/v2/policies/0f7bb041e1584b1fa17e87520d70a3101" + }, + { + "apiVersion": "1.0", + "operation": "DELETE", + "correlationId": "1596304567816229314", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:07.816235", + "type": "request", + "url": "/a1-policy/v2/policies/0f7bb041e1584b1fa17e87520d70a3102" + } +] \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-policy-get.json b/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-policy-get.json new file mode 100644 index 00000000..a45e06bc --- /dev/null +++ b/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-policy-get.json @@ -0,0 +1,50 @@ +[ + { + "apiVersion": "1.0", + "operation": "GET", + "correlationId": "1596304567017739720", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:07.017744", + "type": "request", + "url": "/a1-policy/v2/policies/0f7bb041e1584b1fa17e87520d70a3000" + }, + { + "apiVersion": "1.0", + "operation": "GET", + "correlationId": "1596304567017739720", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:07.017744", + "type": "request", + "url": "/a1-policy/v2/policies/0f7bb041e1584b1fa17e87520d70a3100" + }, + { + "apiVersion": "1.0", + "operation": "GET", + "correlationId": "1596304567017739720", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:07.017744", + "type": "request", + "url": "/a1-policy/v2/policies/0f7bb041e1584b1fa17e87520d70a3101" + }, + { + "apiVersion": "1.0", + "operation": "GET", + "correlationId": "1596304567017739720", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-01 17:56:07.017744", + "type": "request", + "url": "/a1-policy/v2/policies/0f7bb041e1584b1fa17e87520d70a3102" + } +] \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-policy-schemas-get.json b/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-policy-schemas-get.json new file mode 100644 index 00000000..b1b2b550 --- /dev/null +++ b/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-policy-schemas-get.json @@ -0,0 +1,13 @@ +[ + { + "type": "request", + "correlationId": "c09ac7d1-de62-0016-2000-e63701125557-201", + "target": "policy-agent", + "timestamp": "2019-05-14T11:44:51.36Z", + "apiVersion": "1.0", + "originatorId": "849e6c6b420", + "requestId": "23343221", + "operation": "GET", + "url": "/a1-policy/v2/policy-types/1" + } +] diff --git a/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-rics-get.json b/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-rics-get.json new file mode 100644 index 00000000..9c047c01 --- /dev/null +++ b/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-rics-get.json @@ -0,0 +1,14 @@ +[ + { + "apiVersion": "1.0", + "operation": "GET", + "correlationId": "1596363459399504200", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-02 10:17:39.399517", + "type": "request", + "url": "/a1-policy/v2/rics" + } +] \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-service-create.json b/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-service-create.json new file mode 100644 index 00000000..1cd9c255 --- /dev/null +++ b/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-service-create.json @@ -0,0 +1,46 @@ +[ + { + "apiVersion": "1.0", + "operation": "PUT", + "correlationId": "1596363458549998500", + "originatorId": "849e6c6b420", + "payload": { + "callback_url": "http://callback-receiver:8090/callbacks/1", + "keep_alive_interval_seconds": "1000", + "service_id": "serv2" + }, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-02 10:17:38.550324", + "type": "request", + "url": "/a1-policy/v2/services" + }, + { + "apiVersion": "1.0", + "operation": "PUT", + "correlationId": "1596363458549998501", + "originatorId": "849e6c6b421", + "payload": { + "callback_url": "http://callback-receiver:8090/callbacks/1", + "keep_alive_interval_seconds": "1000", + "service_id": "service2" + }, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-02 10:17:38.550324", + "type": "request", + "url": "/a1-policy/v2/services" + }, + { + "apiVersion": "1.0", + "operation": "PUT", + "correlationId": "1596363459196978900", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-02 10:17:39.197067", + "type": "request", + "url": "/a1-policy/v2/services/serv2/keepalive" + } +] \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-services-get.json b/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-services-get.json new file mode 100644 index 00000000..7d2d153f --- /dev/null +++ b/smo-install/test/a1-validation/data/dmaap/v2/dmaap-msg-services-get.json @@ -0,0 +1,14 @@ +[ + { + "apiVersion": "1.0", + "operation": "GET", + "correlationId": "1596363458896827100", + "originatorId": "849e6c6b420", + "payload": {}, + "requestId": "23343221", + "target": "policy-agent", + "timestamp": "2020-08-02 10:17:38.897367", + "type": "request", + "url": "a1-policy/v2/services" + } +] \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/v2/policy_osc.json b/smo-install/test/a1-validation/data/v2/policy_osc.json new file mode 100644 index 00000000..902f9111 --- /dev/null +++ b/smo-install/test/a1-validation/data/v2/policy_osc.json @@ -0,0 +1,16 @@ +{ + "ric_id": "ric1", + "policy_id": "aa8feaa88d944d919ef0e83f2172a5100", + "service_id": "controlpanel", + "policytype_id": "1", + "status_notification_uri": "http://callback-receiver:8090/callbacks/test", + "policy_data": { + "scope": { + "ueId": "ue5100", + "qosId": "qos5100" + }, + "qosObjectives": { + "priorityLevel": 5100 + } + } +} \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/v2/policy_std_v2.json b/smo-install/test/a1-validation/data/v2/policy_std_v2.json new file mode 100644 index 00000000..ff5056c0 --- /dev/null +++ b/smo-install/test/a1-validation/data/v2/policy_std_v2.json @@ -0,0 +1,16 @@ +{ + "ric_id": "ric5", + "policy_id": "aa8feaa88d944d919ef0e83f2172a5000", + "service_id": "controlpanel", + "policytype_id": "2", + "status_notification_uri": "http://callback-receiver:8090/callbacks/test", + "policy_data": { + "scope": { + "ueId": "ue5000", + "qosId": "qos5000" + }, + "qosObjectives": { + "priorityLevel": 5000 + } + } +} \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/v2/policy_type.json b/smo-install/test/a1-validation/data/v2/policy_type.json new file mode 100644 index 00000000..931498c4 --- /dev/null +++ b/smo-install/test/a1-validation/data/v2/policy_type.json @@ -0,0 +1,56 @@ +{ + "policySchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "STD_QOS_0_2_0", + "description": "STD QOS policy type", + "type": "object", + "properties": { + "scope": { + "type": "object", + "properties": { + "ueId": { + "type": "string" + }, + "qosId": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "ueId", + "qosId" + ] + }, + "qosObjectives": { + "type": "object", + "properties": { + "priorityLevel": { + "type": "number" + } + }, + "additionalProperties": false, + "required": [ + "priorityLevel" + ] + } + } + }, + "statusSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "STD_QOS_0.2.0", + "description": "STD QOS policy type status", + "type": "object", + "properties": { + "enforceStatus": { + "type": "string" + }, + "enforceReason": { + "type": "string" + }, + "additionalProperties": false, + "required": [ + "enforceStatus" + ] + } + } + } \ No newline at end of file diff --git a/smo-install/test/a1-validation/data/v2/service.json b/smo-install/test/a1-validation/data/v2/service.json new file mode 100644 index 00000000..d984cbab --- /dev/null +++ b/smo-install/test/a1-validation/data/v2/service.json @@ -0,0 +1,5 @@ +{ + "callback_url": "http://callback-receiver:8090/callbacks/ric-registration", + "keep_alive_interval_seconds": "0", + "service_id": "ric-registration" +} \ No newline at end of file diff --git a/smo-install/test/a1-validation/subscripts/health_check.sh b/smo-install/test/a1-validation/subscripts/health_check.sh new file mode 100755 index 00000000..9f675ab9 --- /dev/null +++ b/smo-install/test/a1-validation/subscripts/health_check.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + +enrichment_service_url=${1:-localhost:9082} +a1_sim_OSC_url=${2:-localhost:8085} +a1_sim_STD_url=${3:-localhost:8085} +a1_sim_STD_v2_url=${4:-localhost:8085} +policy_agent_url=${5:-localhost:9080} +a1_controller_url=${6:false} + +echo -e "NONRTRIC HealthCheck\n" +echo "using enrichment service url: "$enrichment_service_url +echo "using a1-sim-OSC url: "$a1_sim_OSC_url +echo "using a1-sim-STD url: "$a1_sim_STD_url +echo "using a1-sim-STD-v2 url: "$a1_sim_STD_v2_url +echo "using policy agent url: "$policy_agent_url +if [ "$a1_controller_url" != "false" ]; then + echo "using a1 controller url: "$a1_controller_url +fi + +echo -e "\n" + +checkStatus(){ + for i in {1..60}; do + res=$($1) + echo "$res" + expect=$2 + if [[ $res == *"$expect"* ]]; then + echo -e "$3 is alive!\n" + break; + else + sleep $i + fi + done +} + +# check SIM1 status +echo "check SIM1(OSC) status:" +checkStatus "curl -vskw %{http_code} http://$a1_sim_OSC_url/" "OK200" "SIM1" + +# check SIM2 status +echo "check SIM2(STD) status:" +checkStatus "curl -vskw %{http_code} http://$a1_sim_STD_url/" "OK200" "SIM2" + +# check SIM3 status +echo "check SIM3(STD) status:" +checkStatus "curl -vskw %{http_code} http://$a1_sim_STD_v2_url/" "OK200" "SIM3" + +# check PMS status +echo "check Policy Agent status:" +checkStatus "curl -vskw %{http_code} http://$policy_agent_url/status" "hunky dory200" "PMS" + +# check ECS status +echo "check Enrichment service status:" +checkStatus "curl -vskw %{http_code} http://$enrichment_service_url/status" '{"status":"hunky dory"' "ECS" + +if [ "$a1_controller_url" != "false" ]; then + # check SDNC status + echo "check A1 Controller (SDNC) status:" + checkStatus "curl -s -o /dev/null -I -w %{http_code} http://$a1_controller_url/apidoc/explorer/" "200" "SDNC" +fi + + + +echo "NONRTRIC health check passed." diff --git a/smo-install/test/a1-validation/subscripts/prepareDmaapMsg.sh b/smo-install/test/a1-validation/subscripts/prepareDmaapMsg.sh new file mode 100755 index 00000000..9a06a864 --- /dev/null +++ b/smo-install/test/a1-validation/subscripts/prepareDmaapMsg.sh @@ -0,0 +1,157 @@ +#!/bin/bash + +# ============LICENSE_START=============================================== +# Copyright (C) 2020 Nordix Foundation. All rights reserved. +# ======================================================================== +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END================================================= +# + +# The scripts in data/ will generate some dummy data in the running system. +# It will create: +# one policy type in a1-sim-OSC +# one service in policy agent +# one policy in a1-sim-OSC +# one policy in a1-sim-STD + +# Run command: +# ./prepareDmaapMsg.sh [dmaap-mr url] [a1-sim-OSC url] [a1-sim-STD url] [a1-sim-STD2 url] [http/https] + +dmaap_mr_url=${1:-localhost:3904} +a1_sim_OSC_url=${2:-localhost:8085} +a1_sim_STD_url=${3:-localhost:8085} +a1_sim_STD_v2_url=${4:-localhost:8085} +policy_agent_url=${5:-localhost:9081} +httpx=${6:-"http"} + +echo "using dmaap-mr url: "$dmaap_mr_url +echo "using a1-sim-OSC url: "$a1_sim_OSC_url +echo "using a1-sim-STD url: "$a1_sim_STD_url +echo "using a1-sim-STD-v2 url: "$a1_sim_STD_v2_url +echo "using policy-agent url: "$policy_agent_url +echo "using protocol: "$httpx +echo -e "\n" + +echo "dmaap-mr topics: $httpx://$dmaap_mr_url/topics/listAll" +curl -skw %{http_code} $httpx://$dmaap_mr_url/topics/listAll +echo -e "\n" + +echo "dmaap-mr create topic A1-POLICY-AGENT-READ:" +curl -skw %{http_code} -X POST "$httpx://$dmaap_mr_url/topics/create" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"topicName\": \"A1-POLICY-AGENT-READ\", \"topicDescription\": \"test topic\", \"partitionCount\": 1, \"replicationCount\": 1, \"transactionEnabled\": \"false\"}" +echo -e "\n" + +echo "dmaap-mr create topic A1-POLICY-AGENT-WRITE:" +curl -skw %{http_code} -X POST "$httpx://$dmaap_mr_url/topics/create" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"topicName\": \"A1-POLICY-AGENT-WRITE\", \"topicDescription\": \"test topic\", \"partitionCount\": 1, \"replicationCount\": 1, \"transactionEnabled\": \"false\"}" +echo -e "\n" + +echo "dmaap-mr topics:" +curl -skw %{http_code} $httpx://$dmaap_mr_url/topics/listAll +echo -e "\n" + +echo "ric1 version:" +curl -skw %{http_code} $httpx://$a1_sim_OSC_url/counter/interface +echo -e "\n" + +echo "ric2 version:" +curl -skw %{http_code} $httpx://$a1_sim_STD_url/counter/interface +echo -e "\n" + +echo "ric3 version:" +curl -skw %{http_code} $httpx://$a1_sim_STD_v2_url/counter/interface +echo -e "\n" + +echo "create policy type 1 to ric1:" +curl -X PUT -skw %{http_code} $httpx://$a1_sim_OSC_url/policytype?id=1 -H Content-Type:application/json --data-binary @../data/OSC/policy_type.json +echo -e "\n" + +echo "create policy type 2 to ric3:" +curl -skw %{http_code} $httpx://$a1_sim_STD_v2_url/policytype?id=2 -X PUT -H Accept:application/json -H Content-Type:application/json -H X-Requested-With:XMLHttpRequest --data-binary @../data/v2/policy_type.json +echo -e "\n" + +for i in {1..60}; do + echo "policy types from policy agent:" + curlString="curl -skw %{http_code} $httpx://$policy_agent_url/policy_types" + res=$($curlString) + echo "$res" + expect="[\"\",\"1\",\"2\"]200" + if [ "$res" == "$expect" ]; then + echo -e "\n" + break; + else + sleep $i + fi +done + +## Using PMS v1 interface +echo "create service 1 to policy agent via dmaap_mr:" +curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://$dmaap_mr_url/events/A1-POLICY-AGENT-READ/" --data-binary @../data/dmaap/v1/dmaap-msg-service-create.json +echo -e "\n" + +echo "get result from mr of previous request:" +curl -X GET "$httpx://$dmaap_mr_url/events/A1-POLICY-AGENT-WRITE/users/policy-agent?timeout=15000&limit=100" -H "accept: application/json" -H "Content-Type: application/json" | jq . +echo -e "\n" + +echo "create policies to ric1 & ric2 & ric3 with type1 and service1 via dmaa_mr:" +curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://$dmaap_mr_url/events/A1-POLICY-AGENT-READ/" --data-binary @../data/dmaap/v1/dmaap-msg-policy-create.json +echo -e "\n" + +echo "get result from mr of previous request:" +curl -X GET "$httpx://$dmaap_mr_url/events/A1-POLICY-AGENT-WRITE/users/policy-agent?timeout=15000&limit=100" -H "accept: application/json" -H "Content-Type: application/json" | jq . +echo -e "\n" + +echo "get policy from policy agent via dmaap_mr:" +curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://$dmaap_mr_url/events/A1-POLICY-AGENT-READ/" --data-binary @../data/dmaap/v1/dmaap-msg-policy-get.json +echo -e "\n" + +echo "get result from mr of previous request:" +curl -X GET "$httpx://$dmaap_mr_url/events/A1-POLICY-AGENT-WRITE/users/policy-agent?timeout=15000&limit=100" -H "accept: application/json" -H "Content-Type: application/json" | jq . +echo -e "\n" + +## Using PMS v2 interface +echo "create service 2 to policy agent via dmaap_mr:" +curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://$dmaap_mr_url/events/A1-POLICY-AGENT-READ/" --data-binary @../data/dmaap/v2/dmaap-msg-service-create.json +echo -e "\n" + +echo "get result from mr of previous request:" +curl -X GET "$httpx://$dmaap_mr_url/events/A1-POLICY-AGENT-WRITE/users/policy-agent?timeout=15000&limit=100" -H "accept: application/json" -H "Content-Type: application/json" | jq . +echo -e "\n" + +echo "create policies to ric1 & ric2 & ric3 with type1 and service1 via dmaa_mr:" +curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://$dmaap_mr_url/events/A1-POLICY-AGENT-READ/" --data-binary @../data/dmaap/v2/dmaap-msg-policy-create.json +echo -e "\n" + +echo "get result from mr of previous request:" +curl -X GET "$httpx://$dmaap_mr_url/events/A1-POLICY-AGENT-WRITE/users/policy-agent?timeout=15000&limit=100" -H "accept: application/json" -H "Content-Type: application/json" | jq . +echo -e "\n" + +echo "get policy from policy agent via dmaap_mr:" +curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://$dmaap_mr_url/events/A1-POLICY-AGENT-READ/" --data-binary @../data/dmaap/v2/dmaap-msg-policy-get.json +echo -e "\n" + +echo "get result from mr of previous request:" +curl -X GET "$httpx://$dmaap_mr_url/events/A1-POLICY-AGENT-WRITE/users/policy-agent?timeout=15000&limit=100" -H "accept: application/json" -H "Content-Type: application/json" | jq . +echo -e "\n" + +## Get metric from rics +echo "policy numbers from ric1:" +curl -skw %{http_code} $httpx://$a1_sim_OSC_url/counter/num_instances +echo -e "\n" + +echo "policy numbers from ric2:" +curl -skw %{http_code} $httpx://$a1_sim_STD_url/counter/num_instances +echo -e "\n" + +echo "policy numbers from ric3:" +curl -skw %{http_code} $httpx://$a1_sim_STD_v2_url/counter/num_instances +echo -e "\n" + diff --git a/smo-install/test/a1-validation/subscripts/prepareEcsData.sh b/smo-install/test/a1-validation/subscripts/prepareEcsData.sh new file mode 100755 index 00000000..39e20106 --- /dev/null +++ b/smo-install/test/a1-validation/subscripts/prepareEcsData.sh @@ -0,0 +1,89 @@ +#!/bin/bash + +# ============LICENSE_START=============================================== +# Copyright (C) 2020 Nordix Foundation. All rights reserved. +# ======================================================================== +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END================================================= +# + +# The scripts in data/ will generate some dummy data in the running system. +# It will create: +# one EiProducer in ECS +# one EiType in ECS +# one EiJob in ECS + +# Run command: +# ./prepareEcsData.sh [ECS host] + +ecs_url=${1:-localhost:9083} +httpx="http" + +echo -e "\n" +echo "using ecs port: "$ecs_url +echo "using protocol: "$httpx +echo -e "\n" + +echo "ECS status:" +curl -skw " %{http_code}" $httpx://$ecs_url/status +echo -e "\n" + +# Create EiType +echo "Create EiType:" +curl -X PUT -skw %{http_code} $httpx://$ecs_url/data-producer/v1/info-types/type1 -H accept:application/json -H Content-Type:application/json --data-binary @../data/ECS/EiType.json +echo -e "\n" + +# Get EiTypes +echo "Get EiTypes:" +curl -X GET -skw %{http_code} $httpx://$ecs_url/data-producer/v1/info-types -H Content-Type:application/json | jq +echo -e "\n" + +# Get Individual EiType +echo "Get Individual EiType:" +curl -X GET -skw %{http_code} $httpx://$ecs_url/data-producer/v1/info-types/type1 -H Content-Type:application/json | jq +echo -e "\n" + +# Create EiProducer +echo "Create EiProducer:" +curl -X PUT -skw %{http_code} $httpx://$ecs_url/data-producer/v1/info-producers/1 -H Content-Type:application/json --data-binary @../data/ECS/EiProducer.json +echo -e "\n" + +# Get EiProducers +echo "Get EiProducers:" +curl -X GET -skw %{http_code} $httpx://$ecs_url/data-producer/v1/info-producers -H Content-Type:application/json | jq +echo -e "\n" + +# Get Individual EiProducer +echo "Get Individual EiProducer:" +curl -X GET -skw %{http_code} $httpx://$ecs_url/data-producer/v1/info-producers/1 -H Content-Type:application/json | jq +echo -e "\n" + +# Get Individual EiProducer Status +echo "Get Individual EiProducer:" +curl -X GET -skw %{http_code} $httpx://$ecs_url/data-producer/v1/info-producers/1/status -H Content-Type:application/json | jq +echo -e "\n" + +# Create EiJob +echo "Create EiJob Of A Certain Type type1:" +curl -X PUT -skw %{http_code} $httpx://$ecs_url/A1-EI/v1/eijobs/job1 -H Content-Type:application/json --data-binary @../data/ECS/EiJob.json +echo -e "\n" + +# Get EiJobs +echo "Get EiJobs:" +curl -X GET -skw %{http_code} $httpx://$ecs_url/A1-EI/v1/eijobs -H Content-Type:application/json | jq +echo -e "\n" + +# Get Individual EiJob: +echo "Get Individual EiJob:" +curl -X GET -skw %{http_code} $httpx://$ecs_url/A1-EI/v1/eijobs/job1 -H Content-Type:application/json | jq +echo -e "\n" \ No newline at end of file diff --git a/smo-install/test/a1-validation/subscripts/preparePmsData.sh b/smo-install/test/a1-validation/subscripts/preparePmsData.sh new file mode 100755 index 00000000..49194817 --- /dev/null +++ b/smo-install/test/a1-validation/subscripts/preparePmsData.sh @@ -0,0 +1,165 @@ +#!/bin/bash + +# ============LICENSE_START=============================================== +# Copyright (C) 2021 Nordix Foundation. All rights reserved. +# ======================================================================== +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END================================================= +# + +# The scripts in data/ will generate some dummy data in the running system. +# It will create: +# one policy type in a1-sim-OSC +# one service in policy agent +# one policy in a1-sim-OSC +# one policy in a1-sim-STD + +# Run command: +# ./preparePmsData.sh [a1-sim-OSC url] [a1-sim-STD-2 url] [policy agent url] [http/https] + +a1_sim_OSC_url=${1:-localhost:8085} +a1_sim_STD_v2_url=${2:-localhost:8085} +policy_agent_url=${3:-localhost:9081} +httpx=${4:-"http"} +SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) + +echo "using a1-sim-OSC url: "$a1_sim_OSC_url +echo "using a1-sim-STD-v2 url: "$a1_sim_STD_v2_url +echo "using policy-agent url: "$policy_agent_url +echo "using protocol: "$httpx +echo -e "\n" + +checkRes (){ + if [[ $res != *"$expect"* ]]; then + if [ "$res" != "$expect2" ]; then + echo "$res is not expected! exit!" + exit 1; + fi + fi +} + +echo "policy agent status:" +curlString="curl -skw %{http_code} $httpx://$policy_agent_url/status" +res=$($curlString) +echo "$res" +expect="hunky dory200" +checkRes +echo -e "\n" + +echo "ric1 version:" +curlString="curl -skw %{http_code} $httpx://$a1_sim_OSC_url/counter/interface" +res=$($curlString) +echo "$res" +expect="OSC_2.1.0200" +checkRes +echo -e "\n" + +echo "ric2 version:" +curlString="curl -skw %{http_code} $httpx://$a1_sim_STD_v2_url/counter/interface" +res=$($curlString) +echo "$res" +expect="STD_2.0.0200" +checkRes +echo -e "\n" + +echo "create policy type 1 to ric1:" +curlString="curl -X PUT -skw %{http_code} $httpx://$a1_sim_OSC_url/policytype?id=1 -H Content-Type:application/json --data-binary @${SHELL_FOLDER}/../data/OSC/policy_type.json" +res=$($curlString) +echo "$res" +expect="Policy type 1 is OK" +expect2="The policy type already exists and instances exists400" +checkRes +echo -e "\n" + +echo "create policy type 2 to ric2:" +curlString="curl -skw %{http_code} $httpx://$a1_sim_STD_v2_url/policytype?id=2 -X PUT -H Accept:application/json -H Content-Type:application/json -H X-Requested-With:XMLHttpRequest --data-binary @${SHELL_FOLDER}/../data/v2/policy_type.json" +res=$($curlString) +echo "$res" +expect="Policy type 2 is OK" +expect2="The policy type already exists and instances exists400" +checkRes +echo -e "\n" + +for i in {1..60}; do + echo "policy types from policy agent:" + curlString="curl -skw %{http_code} $httpx://$policy_agent_url/a1-policy/v2/policy-types" + res=$($curlString) + echo "$res" + expect="{\"policytype_ids\":[\"\",\"1\",\"2\"]}200" + if [ "$res" == "$expect" ]; then + echo -e "\n" + break; + else + sleep $i + fi +done + +echo "create service ric-registration to policy agent:" +curlString="curl -k -X PUT -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://$policy_agent_url/a1-policy/v2/services" --data-binary @${SHELL_FOLDER}/../data/v2/service.json" +res=$($curlString) +echo "$res" +expect="201" +expect2="200" +checkRes +echo -e "\n" + +echo "create policy aa8feaa88d944d919ef0e83f2172a5000 to ric1 with type 1 and service controlpanel via policy agent:" +curlString="curl -k -X PUT -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://$policy_agent_url/a1-policy/v2/policies" --data-binary @${SHELL_FOLDER}/../data/v2/policy_osc.json" +res=$($curlString) +echo "$res" +expect="201" +expect2="200" +checkRes +echo -e "\n" + +sleep 5 +echo "policy numbers from ric1:" +curlString="curl -skw %{http_code} $httpx://$a1_sim_OSC_url/counter/num_instances" +res=$($curlString) +echo "$res" +expect="7200" +checkRes +echo -e "\n" + +echo "create policy aa8feaa88d944d919ef0e83f2172a5100 to ric2 with type 2 and service controlpanel via policy agent:" +curlString="curl -k -X PUT -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://$policy_agent_url/a1-policy/v2/policies" --data-binary @${SHELL_FOLDER}/../data/v2/policy_std_v2.json" +res=$($curlString) +echo "$res" +expect="201" +expect2="200" +checkRes +echo -e "\n" + +echo "policy numbers from ric2:" +curlString="curl -skw %{http_code} $httpx://$a1_sim_STD_v2_url/counter/num_instances" +res=$($curlString) +echo "$res" +expect="1200" +checkRes +echo -e "\n" + +echo "policy id aa8feaa88d944d919ef0e83f2172a5000 from policy agent:" +curlString="curl -s -o /dev/null -I -w %{http_code} $httpx://$policy_agent_url/a1-policy/v2/policies/aa8feaa88d944d919ef0e83f2172a5000" +res=$($curlString) +echo "$res" +expect="200" +checkRes +echo -e "\n" + +echo "policy id aa8feaa88d944d919ef0e83f2172a5100 from policy agent:" +curlString="curl -s -o /dev/null -I -w %{http_code} $httpx://$policy_agent_url/a1-policy/v2/policies/aa8feaa88d944d919ef0e83f2172a5100" +res=$($curlString) +echo "$res" +expect="200" +checkRes +echo -e "\n" diff --git a/smo-install/test/a1-validation/validate-a1.sh b/smo-install/test/a1-validation/validate-a1.sh new file mode 100755 index 00000000..7ba9cb16 --- /dev/null +++ b/smo-install/test/a1-validation/validate-a1.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# ORAN SMO Package +# ================================================================================ +# Copyright (C) 2021 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END============================================ +# =================================================================== +# +### + +set +x + +if ! [ -x "$(command -v jq)" ]; then + echo 'Error: jq is not installed. Try to install it with APT-GET, YUM or APK' >&2 + echo 'e.g: sudo apt-get update && apt-get -y install jq' + + exit 1 +fi + + +dmaap_port=3904 +ecs_port=8083 +a1_sim_port=8085 +policy_agent_port=8081 +sdnc_port=8282 + +# get ip of dmaap +dmaap_url=`kubectl get services message-router -n onap |grep message-router | awk '{print $3}'`:$dmaap_port +echo "Dmaap Address:" $dmaap_url + +# get ip of enrichment service +ecs_url=`kubectl get services enrichmentservice -n nonrtric | grep enrichmentservice | awk '{print $3}'`:$ecs_port +echo "Enrichment Service Address:" $ecs_url + +# get ip of A1 simulators +a1_osc_url=`kubectl describe pods a1-sim-osc-0 -n nonrtric | grep IP: | sed -n '2p' | awk '{print $2}'`:$a1_sim_port +echo "A1 SIM OSC Address 0:" $a1_osc_url + +a1_std_url=`kubectl describe pods a1-sim-std-0 -n nonrtric | grep IP: | sed -n '2p' | awk '{print $2}'`:$a1_sim_port +echo "A1 SIM STD Address 0:" $a1_std_url + +a1_std2_url=`kubectl describe pods a1-sim-std2-0 -n nonrtric | grep IP: | sed -n '2p' | awk '{print $2}'`:$a1_sim_port +echo "A1 SIM STD Address 2:" $a1_std2_url + +policy_agent_url=`kubectl get service -n onap | grep 'a1policymanagement ' | awk '{print $3}'`:$policy_agent_port +echo "Policy Agent IP:" $policy_agent_url + +sdnc_url=`kubectl get service -n onap | grep sdnc-oam | awk '{print $3}'`:$sdnc_port +echo "A1 Controller IP:" $sdnc_url + +cd ./subscripts +./health_check.sh $ecs_url $a1_osc_url $a1_std_url $a1_std2_url $policy_agent_url $sdnc_url +./prepareDmaapMsg.sh $dmaap_url $a1_osc_url $a1_std_url $a1_std2_url $policy_agent_url +./preparePmsData.sh $a1_osc_url $a1_std2_url $policy_agent_url +./prepareEcsData.sh $ecs_url diff --git a/smo-install/test/apex-policy-test/apex-policy-test.sh b/smo-install/test/apex-policy-test/apex-policy-test.sh new file mode 100755 index 00000000..0bfaee6a --- /dev/null +++ b/smo-install/test/apex-policy-test/apex-policy-test.sh @@ -0,0 +1,151 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# ORAN SMO Package +# ================================================================================ +# Copyright (C) 2021 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END============================================ +# =================================================================== +# +### +pap_port=6969 +api_port=6969 +dmaap_port=3904 +sdnc_port=8282 + +pap_url=`kubectl get services policy-pap -n onap |grep policy-pap | awk '{print $3}'`:$pap_port +echo "Policy pap url: $pap_url" + +api_url=`kubectl get services policy-api -n onap |grep policy-api | awk '{print $3}'`:$api_port +echo "Policy api url: $api_url" + +dmaap_url=`kubectl get services message-router -n onap |grep message-router | awk '{print $3}'`:$dmaap_port +echo "Dmaap url: $dmaap_url" + +sdnc_url=`kubectl get services -n onap | grep sdnc-oam | awk '{print $3}'`:$sdnc_port +echo "SDNC url: $sdnc_url" +echo -e "\n" + +verifyApexPolicyStatus(){ + for i in {1..60}; do + curl -s -o /dev/null -X POST -H accept:application/json -H Content-Type:application/json "http://$dmaap_url/events/unauthenticated.SEC_FAULT_OUTPUT/" -d @./data/LinkFailureEvent.json + sleep 3 + res=`kubectl logs onap-policy-apex-pdp-0 -n onap | grep "Task Selection Execution: 'LinkMonitorPolicy:0.0.1:NULL:LinkFailureOrClearedState'" | wc -l` + if [[ $res != 0 ]]; then + echo -e "LinkFailureEvent sent to Dmaap\n" + break; + else + sleep 2 + fi + done +} + +checkStatus(){ + echo "res:$1" + if [ "$1" == "$2" ]; then + echo -e "$3\n" + else + echo -e "Result is not as expected: $2\n" + exit; + fi +} + +checkPolicyStatus(){ + for i in {1..60}; do + res=$(curl -sk -u 'healthcheck:zb!XztG34' -X GET "https://$pap_url/policy/pap/v1/components/healthcheck") + apex_info=$(echo $res| cut -d'{' -f 4) + + echo "Verify policy Pap" + if [[ $res == *"url\":\"https://$1:6969/policy/pap/v1/healthcheck\",\"healthy\":true"* ]]; then + echo "Policy Pap is ready" + echo "Verify policy api" + if [[ $res == *"url\":\"https://$2:6969/policy/api/v1/healthcheck\",\"healthy\":true"* ]]; then + echo "Policy API is ready" + echo "Verify policy Apex pdp" + if [[ $apex_info == *"instanceId\":\"apex"* && $apex_info == *"healthy\":\"HEALTHY"* ]]; then + echo "Policy APEX pdp is ready" + break; + else + echo "Policy Apex pdp not ready yet. Wait for a while and retry." + sleep $i + fi + else + echo "Policy api not ready yet. Wait for a while and retry." + sleep $i + fi + else + echo "Policy Pap not ready yet. Wait for a while and retry." + sleep $i + fi + done +} + +checkPolicyDeployment (){ + res=$(curl -sk -u 'healthcheck:zb!XztG34' -X GET "https://$pap_url/policy/pap/v1/policies/status") + str1="onap.policies.native.apex.LinkMonitor\",\"version\":\"1.0.0\"},\"policyType\":{\"name\":\"onap.policies.native.Apex\",\"version\":\"1.0.0\"},\"deploy\":true" + if [[ $res == *"$str1"* ]]; then + echo "Policy successfully deployed" + else + echo "Policy deployment failed" + exit; + fi +} + +echo "Create topic:" +curl -sk -X POST "http://$dmaap_url/topics/create" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"topicName\": \"unauthenticated.SEC_FAULT_OUTPUT\", \"topicDescription\": \"test topic\", \"partitionCount\": 1, \"replicationCnCount\": 1, \"transactionEnabled\": \"false\"}" +echo "Get topics:" +curl -sk http://$dmaap_url/topics/listAll +echo -e "\n" + +echo "Policy component healthcheck:" +pap_pod=`kubectl get pods -n onap | grep onap-policy-pap | awk '{print $1}'` +api_pod=`kubectl get pods -n onap | grep onap-policy-api | awk '{print $1}'` +checkPolicyStatus $pap_pod $api_pod +echo -e "\n" + +echo "Create policy:" +res=`curl -sk -u 'healthcheck:zb!XztG34' -X POST "https://$api_url/policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies" -H "Accept: application/json" -H "Content-Type: application/json" -d @./data/ToscaPolicy.json` +res2=`curl -sk -u 'healthcheck:zb!XztG34' -X GET "https://$api_url/policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies/onap.policies.native.apex.LinkMonitor/versions/1.0.0"` +if [[ $res2 ]]; then + echo "Policy created successfully" +fi +echo -e "\n" + +echo "Deploy the policy to apex-pdp via Policy PAP:" +curl -sk -u 'healthcheck:zb!XztG34' -X POST "https://$pap_url/policy/pap/v1/pdps/policies" -H "Accept: application/json" -H "Content-Type: application/json" -d @./data/DeployPolicyPAP.json +echo -e "\n" + +echo "Verify policy deployed:" +checkPolicyDeployment +echo -e "\n" + +echo "Check O-du/O-ru status" +res=$(curl -sk -H "Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==" -X GET "http://$sdnc_url/rests/data/network-topology:network-topology/topology=topology-netconf/node=o-du-1122/yang-ext:mount/o-ran-sc-du-hello-world:network-function/du-to-ru-connection=o-ru-11221") +expected="{\"o-ran-sc-du-hello-world:du-to-ru-connection\":[{\"name\":\"o-ru-11221\",\"operational-state\":\"ENABLED\",\"administrative-state\":\"LOCKED\",\"status\":\"disconnected\"}]}" +checkStatus $res $expected "O-ru has status LOCKED" + +echo -e "\n" +echo "Wait for a while for Apex engine to be ready before sending Dmaap event" +verifyApexPolicyStatus + +echo -e "\n" +echo "Wait for a while and check O-du/O-ru status again" +sleep 5 +res=$(curl -sk -H "Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==" -X GET "http://$sdnc_url/rests/data/network-topology:network-topology/topology=topology-netconf/node=o-du-1122/yang-ext:mount/o-ran-sc-du-hello-world:network-function/du-to-ru-connection=o-ru-11221") +expected="{\"o-ran-sc-du-hello-world:du-to-ru-connection\":[{\"name\":\"o-ru-11221\",\"operational-state\":\"ENABLED\",\"administrative-state\":\"UNLOCKED\",\"status\":\"disconnected\"}]}" +checkStatus $res $expected "O-ru has status UNLOCKED" + diff --git a/smo-install/test/apex-policy-test/data/DeployPolicyPAP.json b/smo-install/test/apex-policy-test/data/DeployPolicyPAP.json new file mode 100644 index 00000000..68eab98c --- /dev/null +++ b/smo-install/test/apex-policy-test/data/DeployPolicyPAP.json @@ -0,0 +1,8 @@ +{ + "policies": [ + { + "policy-id": "onap.policies.native.apex.LinkMonitor", + "policy-version": "1.0.0" + } + ] +} diff --git a/smo-install/test/apex-policy-test/data/LinkFailureEvent.json b/smo-install/test/apex-policy-test/data/LinkFailureEvent.json new file mode 100644 index 00000000..fe1e4bfa --- /dev/null +++ b/smo-install/test/apex-policy-test/data/LinkFailureEvent.json @@ -0,0 +1,38 @@ +{ + "event": { + "commonEventHeader": { + "domain": "fault", + "eventId": "nt:network-topology/nt:topology/nt:node/nt:node-id", + "eventName": "fault_O-RAN-RU-Fault_Alarms_CUS_Link_Failure", + "eventType": "O-RAN-RU-Fault", + "sequence": 0, + "priority": "Normal", + "reportingEntityId": "SDNR", + "reportingEntityName": "@controllerName@", + "sourceId": "", + "sourceName": "o-ru-11221", + "startEpochMicrosec": "@timestamp@", + "lastEpochMicrosec": "@timestamp@", + "nfNamingCode": "", + "nfVendorName": "ietf-hardware (RFC8348) /hardware/component[not(parent)][1]/mfg-name", + "timeZoneOffset": "+00:00", + "version": "4.1", + "vesEventListenerVersion": "7.2.1" + }, + "faultFields": { + "faultFieldsVersion": "4.0", + "alarmCondition": "28", + "alarmInterfaceA": "o-ran-fm:alarm-notif/fault-source", + "eventSourceType": "ietf-hardware (RFC8348) /hardware/component[not(parent)][1]/mfg-model or \"O-RU\"", + "specificProblem": "", + "eventSeverity": "CRITICAL", + "vfStatus": "Active", + "alarmAdditionalInformation": { + "eventTime": "@eventTime@", + "equipType": "@type@", + "vendor": "@vendor@", + "model": "@model@" + } + } + } +} diff --git a/smo-install/test/apex-policy-test/data/ToscaPolicy.json b/smo-install/test/apex-policy-test/data/ToscaPolicy.json new file mode 100644 index 00000000..69741282 --- /dev/null +++ b/smo-install/test/apex-policy-test/data/ToscaPolicy.json @@ -0,0 +1 @@ +{"tosca_definitions_version":"tosca_simple_yaml_1_1_0","topology_template":{"policies":[{"onap.policies.native.apex.LinkMonitor":{"type":"onap.policies.native.Apex","type_version":"1.0.0","name":"onap.policies.native.apex.LinkMonitor","version":"1.0.0","properties":{"engineServiceParameters":{"name":"LinkMonitorApexEngine","version":"0.0.1","id":101,"instanceCount":1,"deploymentPort":12345,"engineParameters":{"executorParameters":{"JAVASCRIPT":{"parameterClassName":"org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"}},"contextParameters":{"parameterClassName":"org.onap.policy.apex.context.parameters.ContextParameters","schemaParameters":{"Avro":{"parameterClassName":"org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters"}}},"taskParameters":[{"key":"ORU-ODU-Map","value":"{\"o-ru-11221\": \"o-du-1122\"}"}]},"policy_type_impl":{"apexPolicyModel":{"key":{"name":"LinkMonitorModel","version":"0.0.1"},"keyInformation":{"key":{"name":"LinkMonitorModel_KeyInfo","version":"0.0.1"},"keyInfoMap":{"entry":[{"key":{"name":"ApexMessageOutputEvent","version":"0.0.1"},"value":{"key":{"name":"ApexMessageOutputEvent","version":"0.0.1"},"UUID":"cca47d74-7754-4a61-b163-ca31f66b157b","description":"Generated description for concept referred to by key \"ApexMessageOutputEvent:0.0.1\""}},{"key":{"name":"CreateLinkClearedOutfieldsEvent","version":"0.0.1"},"value":{"key":{"name":"CreateLinkClearedOutfieldsEvent","version":"0.0.1"},"UUID":"a295d6a3-1b73-387e-abba-b41e9b608802","description":"Generated description for concept referred to by key \"CreateLinkClearedOutfieldsEvent:0.0.1\""}},{"key":{"name":"CreateLinkClearedOutfieldsTask","version":"0.0.1"},"value":{"key":{"name":"CreateLinkClearedOutfieldsTask","version":"0.0.1"},"UUID":"fd594e88-411d-4a94-b2be-697b3a0d7adf","description":"This task creates the output fields when link failure is cleared."}},{"key":{"name":"CreateLinkFailureOutfieldsEvent","version":"0.0.1"},"value":{"key":{"name":"CreateLinkFailureOutfieldsEvent","version":"0.0.1"},"UUID":"02be2b5d-45b7-3c54-ae54-97f2b5c30125","description":"Generated description for concept referred to by key \"CreateLinkFailureOutfieldsEvent:0.0.1\""}},{"key":{"name":"CreateLinkFailureOutfieldsTask","version":"0.0.1"},"value":{"key":{"name":"CreateLinkFailureOutfieldsTask","version":"0.0.1"},"UUID":"ac3d9842-80af-4a98-951c-bd79a431c613","description":"This task the output fields when link failure is detected."}},{"key":{"name":"LinkClearedTask","version":"0.0.1"},"value":{"key":{"name":"LinkClearedTask","version":"0.0.1"},"UUID":"eecfde90-896c-4343-8f9c-2603ced94e2d","description":"This task sends a message to the output when link failure is cleared."}},{"key":{"name":"LinkFailureInputEvent","version":"0.0.1"},"value":{"key":{"name":"LinkFailureInputEvent","version":"0.0.1"},"UUID":"c4500941-3f98-4080-a9cc-5b9753ed050b","description":"Generated description for concept referred to by key \"LinkFailureInputEvent:0.0.1\""}},{"key":{"name":"LinkFailureInputSchema","version":"0.0.1"},"value":{"key":{"name":"LinkFailureInputSchema","version":"0.0.1"},"UUID":"3b3974fc-3012-3b02-9f33-c9d8eefe4dc1","description":"Generated description for concept referred to by key \"LinkFailureInputSchema:0.0.1\""}},{"key":{"name":"LinkFailureOutputEvent","version":"0.0.1"},"value":{"key":{"name":"LinkFailureOutputEvent","version":"0.0.1"},"UUID":"4f04aa98-e917-4f4a-882a-c75ba5a99374","description":"Generated description for concept referred to by key \"LinkFailureOutputEvent:0.0.1\""}},{"key":{"name":"LinkFailureOutputSchema","version":"0.0.1"},"value":{"key":{"name":"LinkFailureOutputSchema","version":"0.0.1"},"UUID":"2d1a7f6e-eb9a-3984-be1f-283d98111b84","description":"Generated description for concept referred to by key \"LinkFailureOutputSchema:0.0.1\""}},{"key":{"name":"LinkFailureTask","version":"0.0.1"},"value":{"key":{"name":"LinkFailureTask","version":"0.0.1"},"UUID":"3351b0f4-cf06-4fa2-8823-edf67bd30223","description":"This task updates the config for O-RU when link failure is detected."}},{"key":{"name":"LinkMonitorModel","version":"0.0.1"},"value":{"key":{"name":"LinkMonitorModel","version":"0.0.1"},"UUID":"540226fb-55ee-4f0e-a444-983a0494818e","description":"This is the Apex Policy Model for link monitoring."}},{"key":{"name":"LinkMonitorModel_Events","version":"0.0.1"},"value":{"key":{"name":"LinkMonitorModel_Events","version":"0.0.1"},"UUID":"27ad3e7e-fe3b-3bd6-9081-718705c2bcea","description":"Generated description for concept referred to by key \"LinkMonitorModel_Events:0.0.1\""}},{"key":{"name":"LinkMonitorModel_KeyInfo","version":"0.0.1"},"value":{"key":{"name":"LinkMonitorModel_KeyInfo","version":"0.0.1"},"UUID":"ea0b5f58-eefd-358a-9660-840c640bf981","description":"Generated description for concept referred to by key \"LinkMonitorModel_KeyInfo:0.0.1\""}},{"key":{"name":"LinkMonitorModel_Policies","version":"0.0.1"},"value":{"key":{"name":"LinkMonitorModel_Policies","version":"0.0.1"},"UUID":"ee9e0b0f-2b7d-3ab7-9a98-c5ec05ed823d","description":"Generated description for concept referred to by key \"LinkMonitorModel_Policies:0.0.1\""}},{"key":{"name":"LinkMonitorModel_Schemas","version":"0.0.1"},"value":{"key":{"name":"LinkMonitorModel_Schemas","version":"0.0.1"},"UUID":"fa5f9b8f-796c-3c70-84e9-5140c958c4bb","description":"Generated description for concept referred to by key \"LinkMonitorModel_Schemas:0.0.1\""}},{"key":{"name":"LinkMonitorModel_Tasks","version":"0.0.1"},"value":{"key":{"name":"LinkMonitorModel_Tasks","version":"0.0.1"},"UUID":"eec592f7-69d5-39a9-981a-e552f787ed01","description":"Generated description for concept referred to by key \"LinkMonitorModel_Tasks:0.0.1\""}},{"key":{"name":"LinkMonitorPolicy","version":"0.0.1"},"value":{"key":{"name":"LinkMonitorPolicy","version":"0.0.1"},"UUID":"6c5e410f-489a-46ff-964e-982ce6e8b6d0","description":"Generated description for concept referred to by key \"LinkMonitorPolicy:0.0.1\""}},{"key":{"name":"MessageSchema","version":"0.0.1"},"value":{"key":{"name":"MessageSchema","version":"0.0.1"},"UUID":"ac4b34ac-39d6-3393-a267-8d5b84854018","description":"A schema for messages from apex"}},{"key":{"name":"NoPolicyDefinedTask","version":"0.0.1"},"value":{"key":{"name":"NoPolicyDefinedTask","version":"0.0.1"},"UUID":"d48b619e-d00d-4008-b884-02d76ea4350b","description":"This task sends a message to the output when an event is received for which no policy has been defined."}},{"key":{"name":"OduIdSchema","version":"0.0.1"},"value":{"key":{"name":"OduIdSchema","version":"0.0.1"},"UUID":"50662174-a88b-3cbd-91bd-8e91b40b2660","description":"A schema for O-DU-ID"}},{"key":{"name":"OruIdSchema","version":"0.0.1"},"value":{"key":{"name":"OruIdSchema","version":"0.0.1"},"UUID":"54daf32b-015f-39cd-8530-a1175c5553e9","description":"A schema for O-RU-ID"}}]}},"policies":{"key":{"name":"LinkMonitorModel_Policies","version":"0.0.1"},"policyMap":{"entry":[{"key":{"name":"LinkMonitorPolicy","version":"0.0.1"},"value":{"policyKey":{"name":"LinkMonitorPolicy","version":"0.0.1"},"template":"Freestyle","state":{"entry":[{"key":"LinkClearedState","value":{"stateKey":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"NULL","localName":"LinkClearedState"},"trigger":{"name":"CreateLinkClearedOutfieldsEvent","version":"0.0.1"},"stateOutputs":{"entry":[{"key":"LinkClearedLogic_Output_Direct","value":{"key":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"LinkClearedState","localName":"LinkClearedLogic_Output_Direct"},"outgoingEvent":{"name":"ApexMessageOutputEvent","version":"0.0.1"},"nextState":{"parentKeyName":"NULL","parentKeyVersion":"0.0.0","parentLocalName":"NULL","localName":"NULL"}}}]},"contextAlbumReference":[],"taskSelectionLogic":{"key":"NULL","logicFlavour":"UNDEFINED","logic":""},"stateFinalizerLogicMap":{"entry":[]},"defaultTask":{"name":"LinkClearedTask","version":"0.0.1"},"taskReferences":{"entry":[{"key":{"name":"LinkClearedTask","version":"0.0.1"},"value":{"key":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"LinkClearedState","localName":"LinkClearedTask"},"outputType":"DIRECT","output":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"LinkClearedState","localName":"LinkClearedLogic_Output_Direct"}}}]}}},{"key":"LinkFailureOrClearedState","value":{"stateKey":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"NULL","localName":"LinkFailureOrClearedState"},"trigger":{"name":"LinkFailureInputEvent","version":"0.0.1"},"stateOutputs":{"entry":[{"key":"CreateLinkClearedOutfieldsLogic_Output_Direct","value":{"key":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"LinkFailureOrClearedState","localName":"CreateLinkClearedOutfieldsLogic_Output_Direct"},"outgoingEvent":{"name":"CreateLinkClearedOutfieldsEvent","version":"0.0.1"},"nextState":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"NULL","localName":"LinkClearedState"}}},{"key":"CreateLinkFailureOutfieldsLogic_Output_Direct","value":{"key":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"LinkFailureOrClearedState","localName":"CreateLinkFailureOutfieldsLogic_Output_Direct"},"outgoingEvent":{"name":"CreateLinkFailureOutfieldsEvent","version":"0.0.1"},"nextState":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"NULL","localName":"LinkFailureState"}}},{"key":"NoPolicyDefinedLogic_Output_Direct","value":{"key":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"LinkFailureOrClearedState","localName":"NoPolicyDefinedLogic_Output_Direct"},"outgoingEvent":{"name":"ApexMessageOutputEvent","version":"0.0.1"},"nextState":{"parentKeyName":"NULL","parentKeyVersion":"0.0.0","parentLocalName":"NULL","localName":"NULL"}}}]},"contextAlbumReference":[],"taskSelectionLogic":{"key":"TaskSelectionLogic","logicFlavour":"JAVASCRIPT","logic":"/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2021 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(\"Task Selection Execution: '\"+executor.subject.id+\n \"'. InputFields: '\"+executor.inFields+\"'\");\n\nvar linkFailureInput = executor.inFields.get(\"LinkFailureInput\");\nvar commonEventHeader = linkFailureInput.get(\"event\").get(\"commonEventHeader\");\nvar domain = commonEventHeader.get(\"domain\");\n\ntaskFailure = executor.subject.getTaskKey(\"CreateLinkFailureOutfieldsTask\");\ntaskCleared = executor.subject.getTaskKey(\"CreateLinkClearedOutfieldsTask\");\ntaskDefault = executor.subject.getDefaultTaskKey();\n\nif (domain == \"fault\") {\n var faultFields = linkFailureInput.get(\"event\").get(\"faultFields\");\n var alarmCondition = faultFields.get(\"alarmCondition\");\n var eventSeverity = faultFields.get(\"eventSeverity\");\n if (alarmCondition == \"28\" && eventSeverity != \"NORMAL\") {\n taskFailure.copyTo(executor.selectedTask);\n } else if (alarmCondition == \"28\" && eventSeverity == \"NORMAL\") {\n taskCleared.copyTo(executor.selectedTask);\n } else {\n taskDefault.copyTo(executor.selectedTask);\n }\n} else {\n taskDefault.copyTo(executor.selectedTask);\n}\n\ntrue;"},"stateFinalizerLogicMap":{"entry":[]},"defaultTask":{"name":"NoPolicyDefinedTask","version":"0.0.1"},"taskReferences":{"entry":[{"key":{"name":"CreateLinkClearedOutfieldsTask","version":"0.0.1"},"value":{"key":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"LinkFailureOrClearedState","localName":"CreateLinkClearedOutfieldsTask"},"outputType":"DIRECT","output":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"LinkFailureOrClearedState","localName":"CreateLinkClearedOutfieldsLogic_Output_Direct"}}},{"key":{"name":"CreateLinkFailureOutfieldsTask","version":"0.0.1"},"value":{"key":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"LinkFailureOrClearedState","localName":"CreateLinkFailureOutfieldsTask"},"outputType":"DIRECT","output":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"LinkFailureOrClearedState","localName":"CreateLinkFailureOutfieldsLogic_Output_Direct"}}},{"key":{"name":"NoPolicyDefinedTask","version":"0.0.1"},"value":{"key":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"LinkFailureOrClearedState","localName":"NoPolicyDefinedTask"},"outputType":"DIRECT","output":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"LinkFailureOrClearedState","localName":"NoPolicyDefinedLogic_Output_Direct"}}}]}}},{"key":"LinkFailureState","value":{"stateKey":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"NULL","localName":"LinkFailureState"},"trigger":{"name":"CreateLinkFailureOutfieldsEvent","version":"0.0.1"},"stateOutputs":{"entry":[{"key":"LinkFailureLogic_Output_Direct","value":{"key":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"LinkFailureState","localName":"LinkFailureLogic_Output_Direct"},"outgoingEvent":{"name":"LinkFailureOutputEvent","version":"0.0.1"},"nextState":{"parentKeyName":"NULL","parentKeyVersion":"0.0.0","parentLocalName":"NULL","localName":"NULL"}}}]},"contextAlbumReference":[],"taskSelectionLogic":{"key":"NULL","logicFlavour":"UNDEFINED","logic":""},"stateFinalizerLogicMap":{"entry":[]},"defaultTask":{"name":"LinkFailureTask","version":"0.0.1"},"taskReferences":{"entry":[{"key":{"name":"LinkFailureTask","version":"0.0.1"},"value":{"key":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"LinkFailureState","localName":"LinkFailureTask"},"outputType":"DIRECT","output":{"parentKeyName":"LinkMonitorPolicy","parentKeyVersion":"0.0.1","parentLocalName":"LinkFailureState","localName":"LinkFailureLogic_Output_Direct"}}}]}}}]},"firstState":"LinkFailureOrClearedState"}}]}},"tasks":{"key":{"name":"LinkMonitorModel_Tasks","version":"0.0.1"},"taskMap":{"entry":[{"key":{"name":"CreateLinkClearedOutfieldsTask","version":"0.0.1"},"value":{"key":{"name":"CreateLinkClearedOutfieldsTask","version":"0.0.1"},"inputFields":{"entry":[{"key":"LinkFailureInput","value":{"key":"LinkFailureInput","fieldSchemaKey":{"name":"LinkFailureInputSchema","version":"0.0.1"},"optional":false}}]},"outputFields":{"entry":[{"key":"OruId","value":{"key":"OruId","fieldSchemaKey":{"name":"OruIdSchema","version":"0.0.1"},"optional":false}}]},"taskParameters":{"entry":[]},"contextAlbumReference":[],"taskLogic":{"key":"TaskLogic","logicFlavour":"JAVASCRIPT","logic":"/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2021 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(\"Task Execution: '\"+executor.subject.id+\"'. Input Fields: '\"+executor.inFields+\"'\");\n\nvar linkFailureInput = executor.inFields.get(\"LinkFailureInput\");\nvar oruId = linkFailureInput.get(\"event\").get(\"commonEventHeader\").get(\"sourceName\");\n\nexecutor.outFields.put(\"OruId\", oruId);\n\nexecutor.logger.info(executor.outFields);\n\ntrue;"}}},{"key":{"name":"CreateLinkFailureOutfieldsTask","version":"0.0.1"},"value":{"key":{"name":"CreateLinkFailureOutfieldsTask","version":"0.0.1"},"inputFields":{"entry":[{"key":"LinkFailureInput","value":{"key":"LinkFailureInput","fieldSchemaKey":{"name":"LinkFailureInputSchema","version":"0.0.1"},"optional":false}}]},"outputFields":{"entry":[{"key":"OduId","value":{"key":"OduId","fieldSchemaKey":{"name":"OduIdSchema","version":"0.0.1"},"optional":false}},{"key":"OruId","value":{"key":"OruId","fieldSchemaKey":{"name":"OruIdSchema","version":"0.0.1"},"optional":false}}]},"taskParameters":{"entry":[]},"contextAlbumReference":[],"taskLogic":{"key":"TaskLogic","logicFlavour":"JAVASCRIPT","logic":"/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2021 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(\"Task Execution: '\"+executor.subject.id+\"'. Input Fields: '\"+executor.inFields+\"'\");\n\nvar returnValue = true;\nvar linkFailureInput = executor.inFields.get(\"LinkFailureInput\");\nvar oruId = linkFailureInput.get(\"event\").get(\"commonEventHeader\").get(\"sourceName\");\nvar oruOduMap = JSON.parse(executor.parameters.get(\"ORU-ODU-Map\"));\n\nif (oruId in oruOduMap) {\n var oduId = oruOduMap[oruId];\n executor.outFields.put(\"OruId\", oruId);\n executor.outFields.put(\"OduId\", oduId);\n executor.logger.info(executor.outFields);\n} else {\n executor.message = \"No O-RU found in the config with this ID: \" + oruId;\n returnValue = false;\n}\n\nreturnValue;"}}},{"key":{"name":"LinkClearedTask","version":"0.0.1"},"value":{"key":{"name":"LinkClearedTask","version":"0.0.1"},"inputFields":{"entry":[{"key":"OruId","value":{"key":"OruId","fieldSchemaKey":{"name":"OruIdSchema","version":"0.0.1"},"optional":false}}]},"outputFields":{"entry":[{"key":"message","value":{"key":"message","fieldSchemaKey":{"name":"MessageSchema","version":"0.0.1"},"optional":false}}]},"taskParameters":{"entry":[]},"contextAlbumReference":[],"taskLogic":{"key":"TaskLogic","logicFlavour":"JAVASCRIPT","logic":"/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2021 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(\"Task Execution: '\"+executor.subject.id+\"'. Input Fields: '\"+executor.inFields+\"'\");\n\nvar oruId = executor.inFields.get(\"OruId\");\n\nexecutor.outFields.put(\"message\", \"CLEARED link failure for O-RU: \" + oruId);\n\nexecutor.logger.info(executor.outFields);\n\ntrue;"}}},{"key":{"name":"LinkFailureTask","version":"0.0.1"},"value":{"key":{"name":"LinkFailureTask","version":"0.0.1"},"inputFields":{"entry":[{"key":"OduId","value":{"key":"OduId","fieldSchemaKey":{"name":"OduIdSchema","version":"0.0.1"},"optional":false}},{"key":"OruId","value":{"key":"OruId","fieldSchemaKey":{"name":"OruIdSchema","version":"0.0.1"},"optional":false}}]},"outputFields":{"entry":[{"key":"LinkFailureOutput","value":{"key":"LinkFailureOutput","fieldSchemaKey":{"name":"LinkFailureOutputSchema","version":"0.0.1"},"optional":false}}]},"taskParameters":{"entry":[]},"contextAlbumReference":[],"taskLogic":{"key":"TaskLogic","logicFlavour":"JAVASCRIPT","logic":"/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2021 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(\"Task Execution: '\"+executor.subject.id+\"'. Input Fields: '\"+executor.inFields+\"'\");\n\nvar linkFailureOutput = executor.subject.getOutFieldSchemaHelper(\"LinkFailureOutput\").createNewInstance();\n\nvar oruId = executor.inFields.get(\"OruId\");\nvar oduId = executor.inFields.get(\"OduId\");\n\nvar unlockMessageArray = new java.util.ArrayList();\nfor (var i = 0; i < 1; i++) {\n unlockMessageArray.add({\n \"name\" : oruId,\n \"administrative_DasH_state\" : \"UNLOCKED\"\n });\n}\n\nlinkFailureOutput.put(\"o_DasH_ran_DasH_sc_DasH_du_DasH_hello_DasH_world_ColoN_du_DasH_to_DasH_ru_DasH_connection\", unlockMessageArray);\nexecutor.outFields.put(\"LinkFailureOutput\", linkFailureOutput.toString());\n\nexecutor.getExecutionProperties().setProperty(\"OduId\", oduId);\nexecutor.getExecutionProperties().setProperty(\"OruId\", oruId);\n\nexecutor.logger.info(executor.outFields);\n\ntrue;"}}},{"key":{"name":"NoPolicyDefinedTask","version":"0.0.1"},"value":{"key":{"name":"NoPolicyDefinedTask","version":"0.0.1"},"inputFields":{"entry":[{"key":"LinkFailureInput","value":{"key":"LinkFailureInput","fieldSchemaKey":{"name":"LinkFailureInputSchema","version":"0.0.1"},"optional":false}}]},"outputFields":{"entry":[{"key":"message","value":{"key":"message","fieldSchemaKey":{"name":"MessageSchema","version":"0.0.1"},"optional":false}}]},"taskParameters":{"entry":[]},"contextAlbumReference":[],"taskLogic":{"key":"TaskLogic","logicFlavour":"JAVASCRIPT","logic":"/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2021 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(\"Task Execution: '\"+executor.subject.id+\"'. Input Fields: '\"+executor.inFields+\"'\");\n\nexecutor.outFields.put(\"message\", \"No policy defined for this event\");\n\nexecutor.logger.info(executor.outFields);\n\ntrue;"}}}]}},"events":{"key":{"name":"LinkMonitorModel_Events","version":"0.0.1"},"eventMap":{"entry":[{"key":{"name":"ApexMessageOutputEvent","version":"0.0.1"},"value":{"key":{"name":"ApexMessageOutputEvent","version":"0.0.1"},"nameSpace":"org.onap.policy.apex.auth.clieditor","source":"APEX","target":"APEX","parameter":{"entry":[{"key":"message","value":{"key":"message","fieldSchemaKey":{"name":"MessageSchema","version":"0.0.1"},"optional":false}}]}}},{"key":{"name":"CreateLinkClearedOutfieldsEvent","version":"0.0.1"},"value":{"key":{"name":"CreateLinkClearedOutfieldsEvent","version":"0.0.1"},"nameSpace":"org.onap.policy.apex.auth.clieditor","source":"APEX","target":"APEX","parameter":{"entry":[{"key":"OruId","value":{"key":"OruId","fieldSchemaKey":{"name":"OruIdSchema","version":"0.0.1"},"optional":false}}]}}},{"key":{"name":"CreateLinkFailureOutfieldsEvent","version":"0.0.1"},"value":{"key":{"name":"CreateLinkFailureOutfieldsEvent","version":"0.0.1"},"nameSpace":"org.onap.policy.apex.auth.clieditor","source":"APEX","target":"APEX","parameter":{"entry":[{"key":"OduId","value":{"key":"OduId","fieldSchemaKey":{"name":"OduIdSchema","version":"0.0.1"},"optional":false}},{"key":"OruId","value":{"key":"OruId","fieldSchemaKey":{"name":"OruIdSchema","version":"0.0.1"},"optional":false}}]}}},{"key":{"name":"LinkFailureInputEvent","version":"0.0.1"},"value":{"key":{"name":"LinkFailureInputEvent","version":"0.0.1"},"nameSpace":"org.onap.policy.apex.auth.clieditor","source":"DMAAP","target":"APEX","parameter":{"entry":[{"key":"LinkFailureInput","value":{"key":"LinkFailureInput","fieldSchemaKey":{"name":"LinkFailureInputSchema","version":"0.0.1"},"optional":false}}]}}},{"key":{"name":"LinkFailureOutputEvent","version":"0.0.1"},"value":{"key":{"name":"LinkFailureOutputEvent","version":"0.0.1"},"nameSpace":"org.onap.policy.apex.auth.clieditor","source":"APEX","target":"OAM","parameter":{"entry":[{"key":"LinkFailureOutput","value":{"key":"LinkFailureOutput","fieldSchemaKey":{"name":"LinkFailureOutputSchema","version":"0.0.1"},"optional":false}}]}}}]}},"schemas":{"key":{"name":"LinkMonitorModel_Schemas","version":"0.0.1"},"schemas":{"entry":[{"key":{"name":"LinkFailureInputSchema","version":"0.0.1"},"value":{"key":{"name":"LinkFailureInputSchema","version":"0.0.1"},"schemaFlavour":"Avro","schemaDefinition":"{\n \"type\": \"record\",\n \"name\": \"Link_Failure_Input\",\n \"fields\": [\n {\n \"name\": \"event\",\n \"type\": {\n \"type\": \"record\",\n \"name\": \"Event_Type\",\n \"fields\": [\n {\n \"name\": \"commonEventHeader\",\n \"type\": {\n \"type\": \"record\",\n \"name\": \"Common_Event_Header_Type\",\n \"fields\": [\n {\n \"name\": \"domain\",\n \"type\": \"string\"\n },\n {\n \"name\": \"eventId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"eventName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"eventType\",\n \"type\": \"string\"\n },\n {\n \"name\": \"sequence\",\n \"type\": \"int\"\n },\n {\n \"name\": \"priority\",\n \"type\": \"string\"\n },\n {\n \"name\": \"reportingEntityId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"reportingEntityName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"sourceId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"sourceName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"startEpochMicrosec\",\n \"type\": \"string\"\n },\n {\n \"name\": \"lastEpochMicrosec\",\n \"type\": \"string\"\n },\n {\n \"name\": \"nfNamingCode\",\n \"type\": \"string\"\n },\n {\n \"name\": \"nfVendorName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"timeZoneOffset\",\n \"type\": \"string\"\n },\n {\n \"name\": \"version\",\n \"type\": \"string\"\n },\n {\n \"name\": \"vesEventListenerVersion\",\n \"type\": \"string\"\n }\n ]\n }\n },\n {\n \"name\": \"faultFields\",\n \"type\": {\n \"type\": \"record\",\n \"name\": \"Fault_Fields_Type\",\n \"fields\": [\n {\n \"name\": \"faultFieldsVersion\",\n \"type\": \"string\"\n },\n {\n \"name\": \"alarmCondition\",\n \"type\": \"string\"\n },\n {\n \"name\": \"alarmInterfaceA\",\n \"type\": \"string\"\n },\n {\n \"name\": \"eventSourceType\",\n \"type\": \"string\"\n },\n {\n \"name\": \"specificProblem\",\n \"type\": \"string\"\n },\n {\n \"name\": \"eventSeverity\",\n \"type\": \"string\"\n },\n {\n \"name\": \"vfStatus\",\n \"type\": \"string\"\n },\n {\n \"name\": \"alarmAdditionalInformation\",\n \"type\": {\n \"type\": \"record\",\n \"name\": \"Alarm_Additional_Information_Type\",\n \"fields\": [\n {\n \"name\": \"eventTime\",\n \"type\": \"string\"\n },\n {\n \"name\": \"equipType\",\n \"type\": \"string\"\n },\n {\n \"name\": \"vendor\",\n \"type\": \"string\"\n },\n {\n \"name\": \"model\",\n \"type\": \"string\"\n }\n ]\n }\n }\n ]\n }\n }\n ]\n }\n }\n ]\n}"}},{"key":{"name":"LinkFailureOutputSchema","version":"0.0.1"},"value":{"key":{"name":"LinkFailureOutputSchema","version":"0.0.1"},"schemaFlavour":"Avro","schemaDefinition":"{\n \"type\": \"record\",\n \"name\": \"Link_Failure_Output\",\n \"fields\": [\n {\n \"name\": \"o_DasH_ran_DasH_sc_DasH_du_DasH_hello_DasH_world_ColoN_du_DasH_to_DasH_ru_DasH_connection\",\n \"type\": {\n \t\"type\": \"array\",\n \t\"items\": {\n\t\t \"name\": \"Config_Change_Message\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"name\",\n \"type\": \"string\"\n },\n\t\t\t{\n \"name\": \"administrative_DasH_state\",\n \"type\": \"string\"\n }\n ]\n }\n\t }\n }\n ]\n}"}},{"key":{"name":"MessageSchema","version":"0.0.1"},"value":{"key":{"name":"MessageSchema","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.String"}},{"key":{"name":"OduIdSchema","version":"0.0.1"},"value":{"key":{"name":"OduIdSchema","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.String"}},{"key":{"name":"OruIdSchema","version":"0.0.1"},"value":{"key":{"name":"OruIdSchema","version":"0.0.1"},"schemaFlavour":"Java","schemaDefinition":"java.lang.String"}}]}}}}},"eventOutputParameters":{"RestProducer":{"carrierTechnologyParameters":{"carrierTechnology":"RESTCLIENT","parameterClassName":"org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters","parameters":{"url":"http://sdnc-oam:8282/rests/data/network-topology:network-topology/topology=topology-netconf/node={OduId}/yang-ext:mount/o-ran-sc-du-hello-world:network-function/du-to-ru-connection={OruId}","httpMethod":"PUT","httpHeaders":[["Authorization","Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ=="]]}},"eventProtocolParameters":{"eventProtocol":"JSON","parameters":{"pojoField":"LinkFailureOutput"}},"eventNameFilter":"LinkFailureOutputEvent"},"StdOutProducer":{"carrierTechnologyParameters":{"carrierTechnology":"FILE","parameters":{"standardIo":true}},"eventProtocolParameters":{"eventProtocol":"JSON","parameters":{"pojoField":"message"}},"eventNameFilter":"ApexMessageOutputEvent"}},"eventInputParameters":{"DMaaPConsumer":{"carrierTechnologyParameters":{"carrierTechnology":"RESTCLIENT","parameterClassName":"org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters","parameters":{"url":"http://message-router:3904/events/unauthenticated.SEC_FAULT_OUTPUT/users/link-monitor-nonrtric?timeout=15000&limit=100"}},"eventProtocolParameters":{"eventProtocol":"JSON","parameters":{"versionAlias":"version","pojoField":"LinkFailureInput"}},"eventName":"LinkFailureInputEvent"}}}}}]}} diff --git a/smo-install/test/enable-sim-fault-report/data/event-settings-du.json b/smo-install/test/enable-sim-fault-report/data/event-settings-du.json new file mode 100644 index 00000000..108b10a6 --- /dev/null +++ b/smo-install/test/enable-sim-fault-report/data/event-settings-du.json @@ -0,0 +1,23 @@ +{ + "nts-network-function:network-function": { + "fault-generation": { + "fault-delay-list": [ + { + "index": 0, + "delay-period": 20 + } + ] + }, + "ves": { + "pnf-registration": true, + "faults-enabled": true, + "heartbeat-period": 120 + }, + "netconf": { + "faults-enabled": false, + "call-home": false + }, + "mount-point-addressing-method": "docker-mapping", + "function-type": "NTS_FUNCTION_TYPE_O_RAN_O_DU" + } + } \ No newline at end of file diff --git a/smo-install/test/enable-sim-fault-report/data/event-settings-ru.json b/smo-install/test/enable-sim-fault-report/data/event-settings-ru.json new file mode 100644 index 00000000..ff875def --- /dev/null +++ b/smo-install/test/enable-sim-fault-report/data/event-settings-ru.json @@ -0,0 +1,27 @@ +{ + "nts-network-function:network-function": { + "fault-generation": { + "fault-delay-list": [ + { + "index": 0, + "delay-period": 10 + }, + { + "index": 1, + "delay-period": 30 + } + ] + }, + "ves": { + "pnf-registration": false, + "faults-enabled": false, + "heartbeat-period": 0 + }, + "netconf": { + "faults-enabled": true, + "call-home": true + }, + "mount-point-addressing-method": "docker-mapping", + "function-type": "NTS_FUNCTION_TYPE_O_RAN_O_RU_FH" + } + } \ No newline at end of file diff --git a/smo-install/test/enable-sim-fault-report/enable-network-sim-fault-reporting.sh b/smo-install/test/enable-sim-fault-report/enable-network-sim-fault-reporting.sh new file mode 100755 index 00000000..8f6af432 --- /dev/null +++ b/smo-install/test/enable-sim-fault-report/enable-network-sim-fault-reporting.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env python3.8 +################################################################################ +# Copyright 2021 highstreet technologies GmbH +#################################################################### +# Modifications Copyright (C) 2021 AT&T +#################################################################### +# +# Licensed under the Apache License, Version 2.0 (the 'License'); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an 'AS IS' BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# importing the sys, json, requests library +import os +import sys +import json +import requests +import subprocess + +dockerFilter = subprocess.check_output("kubectl get services -n network -o name | awk -F \"/\" '{print $2}'", shell=True) +containers = dockerFilter.splitlines() +dockerSdnc = subprocess.check_output("kubectl get services sdnc-web-service -n onap | grep sdnc-web-service | awk '{print $3}'", shell=True) + +mapping = dict({"ntsim-ng-o-ru": "o-ru", "ntsim-ng-o-du": "o-du"}) +# base = 'https://sdnc-web:8453' +base = 'https://'+ dockerSdnc.decode("utf-8").strip() +':8443' +username = 'admin' +password = 'Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U' + +# REST to set event settings +def configEventSettings(nfName, nfType): + file = os.path.dirname(os.path.abspath(__file__)) + '/data/' + 'event-settings-'+nfType+'.json' + print ("File name:" + file) + with open(file) as json_file: + body = json.load(json_file) + url = base + '/rests/data/network-topology:network-topology/topology=topology-netconf/node=' + nfName + '/yang-ext:mount/nts-network-function:simulation/network-function' + print ("url:"+url) + headers = { + 'content-type': 'application/yang-data+json', + 'accept': 'application/yang-data+json' + } + try: + response = requests.put(url, verify=False, auth=(username, password), json=body, headers=headers) + print("Response:" + str(response)) + except requests.exceptions.Timeout: + sys.exit('HTTP request failed, please check you internet connection.') + except requests.exceptions.TooManyRedirects: + sys.exit('HTTP request failed, please check your proxy settings.') + except requests.exceptions.RequestException as e: + # catastrophic error. bail. + raise SystemExit(e) + + return response.status_code >= 200 and response.status_code < 300 + +# main +print ("Container Lines:"+str(containers)) +for container in containers: + name = container.decode("utf-8") + if "o-" in name: + if "o-ru" in name: + print("Set", name, configEventSettings(name, "ru")) + if "o-du" in name: + print("Set", name, configEventSettings(name, "du")) diff --git a/smo-install/test/pythonsdk/src/oransdk/a1sim/__init__.py b/smo-install/test/pythonsdk/src/oransdk/a1sim/__init__.py new file mode 100644 index 00000000..5cdc8642 --- /dev/null +++ b/smo-install/test/pythonsdk/src/oransdk/a1sim/__init__.py @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: Apache-2.0 +"""ORAN A1 Simulator package.""" diff --git a/smo-install/test/pythonsdk/src/oransdk/a1sim/a1sim.py b/smo-install/test/pythonsdk/src/oransdk/a1sim/a1sim.py new file mode 100644 index 00000000..19bbe6b1 --- /dev/null +++ b/smo-install/test/pythonsdk/src/oransdk/a1sim/a1sim.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# SPDX-License-Identifier: Apache-2.0 +"""Oran A1 Simulator module.""" + +from onapsdk.onap_service import OnapService + +class A1sim(OnapService): + + @classmethod + def check_version(cls, url) -> str: + """ + Return ric version. + + Returns: + the ric version + + """ + url = f"{url}/counter/interface" + version = cls.send_message('GET', + 'Get ric version', + url) + return version diff --git a/smo-install/test/pythonsdk/src/oransdk/dmaap/__init__.py b/smo-install/test/pythonsdk/src/oransdk/dmaap/__init__.py new file mode 100644 index 00000000..421a8dba --- /dev/null +++ b/smo-install/test/pythonsdk/src/oransdk/dmaap/__init__.py @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: Apache-2.0 +"""ORAN Dmaap package.""" diff --git a/smo-install/test/pythonsdk/src/oransdk/dmaap/oran_dmaap.py b/smo-install/test/pythonsdk/src/oransdk/dmaap/oran_dmaap.py new file mode 100644 index 00000000..a3079090 --- /dev/null +++ b/smo-install/test/pythonsdk/src/oransdk/dmaap/oran_dmaap.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# SPDX-License-Identifier: Apache-2.0 +"""Oran Dmaap module.""" +from typing import Dict +from onapsdk.dmaap.dmaap import Dmaap +from onapsdk.dmaap.dmaap_service import DmaapService + +class OranDmaap(Dmaap): + """Dmaap library provides functions for getting events from Dmaap.""" + + get_all_topics_url = f"{DmaapService._url}/topics/listAll" + + @classmethod + def create_topic(cls, + topic, + basic_auth: Dict[str, str]) -> dict: + """ + Create topic in Dmaap. + + Args: + topic: the topic to create, in json format + basic_auth: (Dict[str, str]) for example:{ 'username': 'bob', 'password': 'secret' } + + """ + create_events_url = f"{DmaapService._url}/topics/create" + instance_details = cls.send_message('POST', + 'Create Dmaap Topic', + create_events_url, + data=topic) + + @classmethod + def get_all_topics(cls, + basic_auth: Dict[str, str]) -> dict: + """ + Get all topics stored in Dmaap. + + Args: + basic_auth: (Dict[str, str]) for example:{ 'username': 'bob', 'password': 'secret' } + + Returns: + (dict) Topics from Dmaap + + """ + return super().get_all_topics(basic_auth) \ No newline at end of file diff --git a/smo-install/test/pythonsdk/test/test_dmaap.py b/smo-install/test/pythonsdk/test/test_dmaap.py new file mode 100644 index 00000000..e1ff1bd2 --- /dev/null +++ b/smo-install/test/pythonsdk/test/test_dmaap.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +import logging +from onapsdk.configuration import settings +from oransdk.dmaap.oran_dmaap import OranDmaap +from oransdk.a1sim.a1sim import A1sim + +BASIC_AUTH = {} +logger = logging.getLogger("") +logger.setLevel(logging.DEBUG) +fh = logging.StreamHandler() +fh_formatter = logging.Formatter('%(asctime)s %(levelname)s %(lineno)d:%(filename)s(%(process)d) - %(message)s') +fh.setFormatter(fh_formatter) +logger.addHandler(fh) + +dmaap = OranDmaap() +logger.info("Get all the topics") +topiclist = dmaap.get_all_topics(BASIC_AUTH) +logger.info("response is: %s", topiclist) + + +logger.info("Create new topic") +topic = '{ "topicName": "unauthenticated.SEC_FAULT_OUTPUT", "topicDescription": "test topic", "partitionCount": 1, "replicationCnCount": 1, "transactionEnabled": "false"}' +response = dmaap.create_topic(topic, BASIC_AUTH) +logger.info("response is: %s", response) + + +logger.info("Get topics again") +topiclist = dmaap.get_all_topics(BASIC_AUTH) +logger.info("response is: %s", topiclist) + + + +logger.info("Get ric version for ost") +a1sim = A1sim() +version1 = a1sim.check_version(settings.A1SIM_OST_URL) +version2 = a1sim.check_version(settings.A1SIM_STD1_URL) +version3 = a1sim.check_version(settings.A1SIM_STD2_URL) \ No newline at end of file diff --git a/smo-install/test/pythonsdk/test/test_settings.py b/smo-install/test/pythonsdk/test/test_settings.py new file mode 100644 index 00000000..1b909fac --- /dev/null +++ b/smo-install/test/pythonsdk/test/test_settings.py @@ -0,0 +1,4 @@ +DMAAP_URL = "http://10.152.183.162:3904" +A1SIM_OST_URL = "http://10.1.244.4:8085" +A1SIM_STD1_URL = "http://10.1.244.48:8085" +A1SIM_STD2_URL = "http://10.1.244.30:8085"