Automates 5.3.6 "Event pull status notification" tests related to O2 Cloud Notificati... 56/14256/4
authorAlberto Losada <alosadag@redhat.com>
Thu, 13 Mar 2025 10:07:58 +0000 (11:07 +0100)
committerAlberto Losada <alosadag@redhat.com>
Wed, 16 Apr 2025 11:02:13 +0000 (13:02 +0200)
These tests were manual. Includes:
  - A notification event schema.
  - A robot automated test specific for 5.3.6.

Change-Id: I11f10df7c3498675e7630a1d5dd8c06aaa4e1761
Signed-off-by: Alberto Losada <alosadag@redhat.com>
test_scripts/O2IMS_Compliance_Test/o2ims_compliance/5.3.6_Event_pull_status_notification.robot [new file with mode: 0644]
test_scripts/O2IMS_Compliance_Test/o2ims_compliance/schemas/notification_event_properties.json [new file with mode: 0644]

diff --git a/test_scripts/O2IMS_Compliance_Test/o2ims_compliance/5.3.6_Event_pull_status_notification.robot b/test_scripts/O2IMS_Compliance_Test/o2ims_compliance/5.3.6_Event_pull_status_notification.robot
new file mode 100644 (file)
index 0000000..56dcc0b
--- /dev/null
@@ -0,0 +1,72 @@
+*** Settings ***
+Documentation   Event pull status notification
+#Library  REST       ssl_verify=False    loglevel=DEBUG
+Library  REST       ssl_verify=False
+Library  String
+Variables              ${EXECDIR}${/}test_configs.yaml
+
+Suite Setup            Set REST Headers And Publisher API
+Suite Teardown         Clear Subscriptions
+
+*** Variables ***
+${ORAN_HOST_EXTERNAL_IP}       ${ocloud.oran_o2_app.api.host}
+${ORAN_SERVICE_NODE_PORT}      ${ocloud.oran_o2_app.api.node_port}
+${GLOBAL_OCLOUD_ID1}           ${ocloud.oran_o2_app.g_ocloud_id}
+${SMO_TOKEN_DATA}              ${ocloud.oran_o2_app.smo_token_data}
+${globalLocationId}            ${ocloud.oran_o2_app.g_location_id}
+${ENDPOINT_URI}                ${ocloud.oran_o2_notification.endpoint_uri}
+${RESOURCE_ADDRESS}            ${ocloud.oran_o2_notification.resource_address}
+${PUBLISHER_EVENT_ENDPOINT}    ${ocloud.oran_o2_notification.publisher_endpoint}
+
+
+*** Test Cases ***
+s1, The return code is “200 OK” when event notification resource is available on this node.
+    [documentation]  This test case verifies the capability of successfully pulling of the event from an event producer
+    [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_Event_Notification
+
+    # At least one subscription must exist so it can be queried.
+    ${subscriptionRequest}      input   {"EndpointUri": "${ENDPOINT_URI}", "ResourceAddress": "${RESOURCE_ADDRESS}"}
+    ${res}     POST   ${PUBLISHER_EVENT_ENDPOINT}       ${subscriptionRequest}
+
+    Clear Expectations
+    Expect Response Body        ${CURDIR}/schemas/notification_event_properties.json
+    # log    ${publisherApi}
+    ${res}     GET   ${publisherApi}${RESOURCE_ADDRESS}/CurrentState
+    Integer     response status    200
+    Object       response body
+
+s2, Return code is “404 Not Found” when event notification resource is not available on this node.
+    [documentation]  This test case verifies the capability of unsuccessfully pulling of the event from an event producer
+    [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_Event_Notification
+
+    Clear Expectations
+    ${res}     GET   ${publisherApi}/resourceDoesNotExist/CurrentState
+    Integer     response status    404
+
+*** Keywords ***
+Set REST Headers
+    Set Headers     {"accept": "application/json"}
+    Set Headers     {"Content-Type": "application/json"}
+    Set Headers     {"Authorization": "Bearer ${SMO_TOKEN_DATA}"}
+    Set Client Cert   ${CURDIR}/../certs/client.pem
+
+Set Publisher API
+    # Variables setup
+    ${tmpArray}=   Split String   ${PUBLISHER_EVENT_ENDPOINT}   separator=\/subscriptions
+    ${publisherApi}   input   ${tmpArray}[0]
+    Set Suite Variable   ${publisherApi}
+
+Set REST Headers And Publisher API
+    Set REST Headers
+    Set Publisher API
+
+Clear Subscriptions
+    Clear Expectations
+    ${res}     GET   ${PUBLISHER_EVENT_ENDPOINT}
+    log     ${res}   level=DEBUG
+    @{subs}        output  $
+    FOR     ${sub}      IN      @{subs}
+        ${subscriptionId}=  input   ${sub}[SubscriptionId]
+        ${res2}     DELETE   ${PUBLISHER_EVENT_ENDPOINT}/${subscriptionId}
+        log     ${res2}   level=DEBUG
+    END
\ No newline at end of file
diff --git a/test_scripts/O2IMS_Compliance_Test/o2ims_compliance/schemas/notification_event_properties.json b/test_scripts/O2IMS_Compliance_Test/o2ims_compliance/schemas/notification_event_properties.json
new file mode 100644 (file)
index 0000000..08c94f6
--- /dev/null
@@ -0,0 +1,63 @@
+{
+    "type": "object",
+    "properties": {
+        "specversion": {
+            "type": "string"
+        },
+        "id": {
+            "type": "string"
+        },
+        "source": {
+            "type": "string"
+        },
+        "type": {
+            "type": "string"
+        },
+        "time":{
+            "type": "string"
+        },
+        "data": {
+            "type": "object",
+            "properties": {
+                "version": {
+                    "type": "string"
+                },
+                "values": {
+                    "type": "array",
+                    "items": {
+                        "type": "object",
+                        "properties": {
+                            "ResourceAddress": {
+                                "type": "string"
+                            },
+                            "data_type": {
+                                "type": "string"
+                            },
+                            "value_type": {
+                                "type": "string"
+                            },
+                            "value": {
+                                "type": "string"
+                            }
+                        },
+                        "required": [
+                            "ResourceAddress",
+                            "data_type",
+                            "value_type",
+                            "value"
+                        ]
+                    }
+                }
+            }
+
+        }
+    },
+        "required": [
+            "id",
+            "type",
+            "source",
+            "specversion",
+            "time",
+            "data"
+        ]
+}