diff options
Diffstat (limited to 'tests')
12 files changed, 275 insertions, 144 deletions
diff --git a/tests/dcaegen2-services-pmsh/testcases/assets/cbs-expectation-unlocked-config.json b/tests/dcaegen2-services-pmsh/testcases/assets/cbs-expectation-unlocked-config.json deleted file mode 100644 index e6d0ef97..00000000 --- a/tests/dcaegen2-services-pmsh/testcases/assets/cbs-expectation-unlocked-config.json +++ /dev/null @@ -1,124 +0,0 @@ -[ - { - "httpRequest": { - "path": "/service_component_all/.*" - }, - "httpResponse": { - "statusCode": 200, - "headers": { - "content-type": [ - "application/json" - ] - }, - "body": { - "type": "JSON", - "json": { - "config": { - "control_loop_name": "pmsh-control-loop", - "operational_policy_name": "pmsh-operational-policy", - "cert_path": "/opt/app/pmsh/etc/certs/cert.pem", - "enable_tls": true, - "ca_cert_path": "/opt/app/pmsh/etc/certs/cacert.pem", - "pmsh_policy": { - "subscription": { - "subscriptionName": "ExtraPM-All-gNB-R2B", - "administrativeState": "UNLOCKED", - "fileBasedGP": 15, - "fileLocation":"\/pm\/pm.xml", - "nfFilter": { - "nfNames": [ - "^pnf.*", - "^vnf.*" - ], - "modelInvariantIDs": [ - "7129e420-d396-4efb-af02-6b83499b12f8" - ], - "modelVersionIDs": [ - ], - "modelNames": [ - ] - }, - "measurementGroups": [ - { - "measurementGroup": { - "measurementTypes": [ - { - "measurementType": "countera" - }, - { - "measurementType": "counterb" - } - ], - "managedObjectDNsBasic": [ - { - "DN": "dna" - }, - { - "DN": "dnb" - } - ] - } - }, - { - "measurementGroup": { - "measurementTypes": [ - { - "measurementType": "counterc" - }, - { - "measurementType": "counterd" - } - ], - "managedObjectDNsBasic": [ - { - "DN": "dnc" - }, - { - "DN": "dnd" - } - ] - } - } - ] - } - }, - "streams_publishes": { - "policy_pm_publisher": { - "dmaap_info": { - "client_id": "1475976809466", - "client_role": "org.onap.dcae.pmPublisher", - "topic_url": "http://mr-sim:3904/events/unauthenticated.DCAE_CL_OUTPUT", - "location": "san-francisco" - }, - "type": "message_router" - } - }, - "streams_subscribes": { - "aai_subscriber": { - "type": "message_router", - "dmaap_info": { - "client_id": "1575976809466", - "client_role": "org.onap.dcae.aaiSub", - "topic_url": "http://mr-sim:3904/events/AAI-EVENT", - "location": "san-francisco" - } - }, - "policy_pm_subscriber": { - "dmaap_info": { - "location": "san-francisco", - "topic_url": "http://mr-sim:3904/events/unauthenticated.PMSH_CL_INPUT", - "client_role": "org.onap.dcae.pmSubscriber", - "client_id": "1575876809456" - }, - "type": "message_router" - } - }, - "key_path": "/opt/app/pmsh/etc/certs/key.pem", - "aaf_identity": "dcae@dcae.onap.org", - "aaf_password": "demo123456!" - } - } - } - } - } -] diff --git a/tests/dcaegen2-services-pmsh/testcases/assets/create_msg_grp.json b/tests/dcaegen2-services-pmsh/testcases/assets/create_msg_grp.json new file mode 100644 index 00000000..57b27b5e --- /dev/null +++ b/tests/dcaegen2-services-pmsh/testcases/assets/create_msg_grp.json @@ -0,0 +1,14 @@ +{ + "measurementGroup": { + "measurementGroupName": "msg_grp_05", + "fileBasedGP": 15, + "fileLocation": "pm.xml", + "administrativeState": "LOCKED", + "measurementTypes": [{ + "measurementType": "counter_a" + }], + "managedObjectDNsBasic": [{ + "DN": "string" + }] + } +}
\ No newline at end of file diff --git a/tests/dcaegen2-services-pmsh/testcases/pmsh.robot b/tests/dcaegen2-services-pmsh/testcases/pmsh.robot index 44052b69..8ab2da6e 100644 --- a/tests/dcaegen2-services-pmsh/testcases/pmsh.robot +++ b/tests/dcaegen2-services-pmsh/testcases/pmsh.robot @@ -14,7 +14,6 @@ Test Teardown Delete All Sessions ${PMSH_BASE_URL} https://${PMSH_IP}:8443 ${MR_SIM_BASE_URL} http://${MR_SIM_IP_ADDRESS}:3904 -${CBS_BASE_URL} https://${CBS_SIM_IP_ADDRESS}:10443 ${SUBSCRIPTION_ENDPOINT} /subscription ${MR_SIM_RESET} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/mr-sim-reset.json @@ -22,11 +21,11 @@ ${MR_AAI_PNF_CREATED} %{WORKSPACE}/tests/dcaegen2-services ${MR_AAI_PNF_REMOVED} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/aai-pnf-delete.json ${MR_POLICY_RESPONSE_PNF_EXISTING} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/policy-sub-created-pnf-existing.json ${MR_POLICY_RESPONSE_PNF_DELETED} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/policy-sub-deleted-pnf-existing.json -${CBS_EXPECTATION_ADMIN_STATE_UNLOCKED} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/cbs-expectation-unlocked-config.json ${CREATE_SUBSCRIPTION_DATA} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/create_subscription_request.json ${CREATE_SECOND_SUBSCRIPTION_DATA} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/create_second_subscription_request.json ${CREATE_SUBSCRIPTION_BAD_DATA} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/create_subscription_bad_request.json ${CREATE_SUBSCRIPTION_SCHEMA_ERROR_DATA} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/create_subscription_schema_error_request.json +${CREATE_MSG_GRP_DATA} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/create_msg_grp.json *** Test Cases *** Verify Get subscriptions with Network Functions None @@ -59,8 +58,6 @@ Verify PNF detected in AAI when administrative state unlocked [Tags] PMSH_03 [Documentation] Verify PNF detected when administrative state unlocked [Timeout] 60 seconds - SetAdministrativeStateToUnlocked - Sleep 31 Allow PMSH time to pick up changes in CBS config ${resp}= GetMeasGrpCall /subscription/subs_01/measurementGroups/msg_grp_01 Should Be Equal As Strings ${resp.json()['subscriptionName']} subs_01 Should Be Equal As Strings ${resp.json()['administrativeState']} UNLOCKED @@ -205,13 +202,10 @@ Verify Measurement Group admin status update from Locking to Locked ${nf_length}= Get length ${resp.json()['networkFunctions']} Should be equal as numbers ${nf_length} 0 -Verify Update Measurement Group admin status to unlocked with no Network Functions in Subscription +Verify Update Measurement Group admin status to unlocked [Tags] PMSH_17 [Documentation] Verify Update Measurement Group admin status to unlocked with no Network Functions in Subscription [Timeout] 60 seconds - ${resp}= GetSubsCall ${SUBSCRIPTION_ENDPOINT}/subs_01 "" - ${nf_length}= Get length ${resp.json()['subscription']['nfs']} - Should be equal as numbers ${nf_length} 0 ${json_string}= Set Variable {"administrativeState": "UNLOCKED"} ${json}= evaluate json.loads('''${json_string}''') json ${resp}= PutMsgGrpStatusCall /subscription/subs_01/measurementGroups/msg_grp_01/adminState ${json} @@ -285,16 +279,47 @@ Verify Get subscriptions with Network Functions Should Be Equal As Strings ${resp.json()[1]['subscription']['measurementGroups'][0]['measurementGroup']['measurementGroupName']} msg_grp_04 Should be equal as numbers ${nf_length_second} 1 -*** Keywords *** +Verify Delete Measurement Group with Administrative State unlocked + [Tags] PMSH_22 + [Documentation] Verify Delete Measurement Group with Administrative State unlocked + [Timeout] 60 seconds + ${json_string}= Set Variable {"administrativeState": "UNLOCKED"} + ${json}= evaluate json.loads('''${json_string}''') json + PutMsgGrpStatusCall /subscription/subs_01/measurementGroups/msg_grp_02/adminState ${json} + ${resp}= DeleteMeasGrpCall /subscription/subs_01/measurementGroups/msg_grp_02 + Should Be True ${resp.status_code} == 409 -SetAdministrativeStateToUnlocked - ${data}= Get Data From File ${CBS_EXPECTATION_ADMIN_STATE_UNLOCKED} - Create Session cbs_sim_session ${CBS_BASE_URL} verify=false - ${resp}= PUT On Session cbs_sim_session url=/clear data={"path": "/service_component_all/.*"} - Should Be True ${resp.status_code} == 200 - Sleep 2 Allow CBS time to set expectation - ${resp} = PUT On Session cbs_sim_session url=/expectation data=${data} - Should Be True ${resp.status_code} == 201 +Verify Delete Measurement Group with incorrect Measurement Group name server error + [Tags] PMSH_23 + [Documentation] Verify Delete Measurement Group with incorrect Measurement Group Name + [Timeout] 60 seconds + ${resp}= DeleteMeasGrpCall /subscription/subs_01/measurementGroups/nonexistent + Should Be True ${resp.status_code} == 500 + +Verify Create Measurement Group successful + [Tags] PMSH_24 + [Documentation] Verify Create Measurement Group successful + [Timeout] 60 seconds + ${json_value}= json_from_file ${CREATE_MSG_GRP_DATA} + ${resp}= PostMsgGrpCall /subscription/subs_01/measurementGroups/msg_grp_05 ${json_value} + Should Be True ${resp.status_code} == 201 + +Verify Create Measurement Group unsuccessful + [Tags] PMSH_25 + [Documentation] Verify Create Measurement Group successful + [Timeout] 60 seconds + ${json_value}= json_from_file ${CREATE_MSG_GRP_DATA} + ${resp}= PostMsgGrpCall /subscription/subs_01/measurementGroups/msg_grp_05 ${json_value} + Should Be True ${resp.status_code} == 409 + +Verify Delete Measurement Group successful + [Tags] PMSH_26 + [Documentation] Verify Delete Measurement Group successful + [Timeout] 60 seconds + ${resp}= DeleteMeasGrpCall /subscription/subs_01/measurementGroups/msg_grp_05 + Should Be True ${resp.status_code} == 204 + +*** Keywords *** AddCreatePolicyResponeToMrSim ${data}= Get Data From File ${MR_POLICY_RESPONSE_PNF_EXISTING} @@ -358,6 +383,12 @@ GetMeasGrpWithNFSCall ${resp}= GET On Session pmsh_session url=${url} [Return] ${resp} +DeleteMeasGrpCall + [Arguments] ${url} + Create Session pmsh_session ${PMSH_BASE_URL} verify=false + ${resp}= DELETE On Session pmsh_session url=${url} expected_status=anything + [Return] ${resp} + PostSubscriptionCall [Arguments] ${url} ${data} Create Session pmsh_sub_session ${PMSH_BASE_URL} verify=false @@ -365,6 +396,13 @@ PostSubscriptionCall ${resp}= POST On Session pmsh_sub_session url=${url} json=${data} headers=${headers} expected_status=anything [Return] ${resp} +PostMsgGrpCall + [Arguments] ${url} ${data} + Create Session pmsh_sub_session ${PMSH_BASE_URL} verify=false + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= POST On Session pmsh_sub_session url=${url} json=${data} headers=${headers} expected_status=anything + [Return] ${resp} + PutMsgGrpStatusCall [Arguments] ${url} ${data} Create Session pmsh_sub_session ${PMSH_BASE_URL} verify=false diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/aai_event_svc_modification_bw.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/aai_event_svc_modification_bw.json new file mode 100644 index 00000000..1bdef685 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/aai_event_svc_modification_bw.json @@ -0,0 +1,45 @@ +{ + "cambria.partition": "AAI", + "event-header": { + "severity": "NORMAL", + "entity-type": "service-instance", + "top-entity-type": "customer", + "entity-link": "/aai/v24/business/customers/customer/IBNCustomer/service-subscriptions/service-subscription/IBN/service-instances/service-instance/test", + "event-type": "AAI-EVENT", + "domain": "dev", + "action": "UPDATE", + "sequence-number": "0", + "id": "48c2016e-12cb-4f9f-ab25-5eaaf8da9fe8", + "source-name": "UUI", + "version": "v24", + "timestamp": "20220406-19:53:41:550" + }, + "entity":{ + "global-customer-id": "IBNCustomer", + "subscriber-name": "IBNCustomer", + "service-subscriptions": { + "service-subscription": [ + { + "service-type": "IBN", + "service-instances": { + "service-instance": [ + { + "model-version-id": "6790ab0e-034f-11eb-adc1-0242ac120002", + "service-instance-id": "test", + "resource-version": "1649274821478", + "service-type": "IBN", + "service-instance-location-id": "cll-101", + "service-role": "TN", + "environment-context": "001-100001", + "bandwidth-total": "4000", + "model-invariant-id": "6790ab0e-034f-11eb-adc1-0242ac120002", + "service-instance-name": "decheng-test-001", + "orchestration-status": "allocated" + } + ] + } + } + ] + } + } +} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_ccvpn0.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_ccvpn0.json new file mode 100644 index 00000000..14ab9187 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_ccvpn0.json @@ -0,0 +1 @@ +{"name":"cloud-leased-line-101","serviceInstanceID":"cll-101","globalSubscriberId":"IBNCustomer","subscriptionServiceType":"IBN","additionalProperties":{"modifyAction":"bandwidth","enableSdnc":"true","transportNetworks":[{"id":"cll-101-network-001","sla":{"latency":2,"maxBandwidth":4000}}]},"serviceType":"CLL","modelInvariantUuid":"6790ab0e-034f-11eb-adc1-0242ac120002","modelUuid":"6790ab0e-034f-11eb-adc1-0242ac120002"}
\ No newline at end of file diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_ccvpn1.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_ccvpn1.json new file mode 100644 index 00000000..7e76c0a0 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_ccvpn1.json @@ -0,0 +1 @@ +{"name":"cloud-leased-line-101","serviceInstanceID":"cll-101","globalSubscriberId":"IBNCustomer","subscriptionServiceType":"IBN","additionalProperties":{"modifyAction":"bandwidth","enableSdnc":"true","transportNetworks":[{"id":"cll-101-network-002","sla":{"latency":2,"maxBandwidth":6000}}]},"serviceType":"CLL","modelInvariantUuid":"6790ab0e-034f-11eb-adc1-0242ac120002","modelUuid":"6790ab0e-034f-11eb-adc1-0242ac120002"}
\ No newline at end of file diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/network_policy_after.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/network_policy_after.json new file mode 100644 index 00000000..16697feb --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/network_policy_after.json @@ -0,0 +1,4 @@ +{ + "network-policy-id": "933dacc1-56e0-4b94-8808-4d099ebc4de5", + "max-bandwidth": 6000 +}
\ No newline at end of file diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/slice_config_request.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/slice_config_request.json new file mode 100644 index 00000000..443e97de --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/slice_config_request.json @@ -0,0 +1,11 @@ +{ + "sliceIdentifiers": [ + "09cad94e-fbb8-4c70-9c4d-74ec75e97683", + "50f418a6-804f-4453-bf70-21f0efaf6fcd" + ], + "configParams": [ + "dLThptPerSlice", + "uLThptPerSlice", + "maxNumberOfConns" + ] +} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/slice_config_response.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/slice_config_response.json new file mode 100644 index 00000000..7bc05164 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/slice_config_response.json @@ -0,0 +1 @@ +{"sliceConfigDetails":[{"sliceIdentifiers":"09cad94e-fbb8-4c70-9c4d-74ec75e97683","aggregatedConfig":{"maxNumberOfConns":null,"dlthptPerSlice":131214207,"ulthptPerSlice":59642989}},{"sliceIdentifiers":"50f418a6-804f-4453-bf70-21f0efaf6fcd","aggregatedConfig":{"maxNumberOfConns":null,"dlthptPerSlice":190857028,"ulthptPerSlice":119285978}}]} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/ves_notification_pmdata.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/ves_notification_pmdata.json new file mode 100644 index 00000000..b98920d7 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/ves_notification_pmdata.json @@ -0,0 +1,34 @@ +{ + "event": { + "commonEventHeader": { + "version": "4.0.1", + "vesEventListenerVersion": "7.0.1", + "domain": "notification", + "eventName": "ccvpnNotification_CloudLeaseLine_BandwidthChanged", + "eventId": "BandwidthChanged_1797490e-10ae-4d48-9ea7-3d7d790b25e1", + "lastEpochMicrosec": 8745745764578, + "priority": "Normal", + "reportingEntityName": "onap-sdnc", + "sequence": 0, + "sourceName": "onap-sdnc", + "startEpochMicrosec": 8745745764578, + "timeZoneOffset": "UTC-05.00" + }, + "notificationFields": { + "changeIdentifier": "PM_BW_UPDATE", + "changeType": "BandwidthChanged", + "notificationFieldsVersion": "2.0", + "arrayOfNamedHashMap": [ + { + "name": "DomainId-1-cll-instance-01-uni-01-8745745764578", + "hashMap": { + "cllId": "cll-101", + "uniId": "uni-01", + "bandwidthValue": "4000000", + "time": "2022-02-08T11:13:34.781-05:00" + } + } + ] + } + } +} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/slice-analysis-ms-test-aai-dcae.robot b/tests/dcaegen2-services-slice-analysis-ms/testcases/slice-analysis-ms-test-aai-dcae.robot new file mode 100644 index 00000000..f0e80299 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/slice-analysis-ms-test-aai-dcae.robot @@ -0,0 +1,96 @@ +*** Settings *** +Library Collections +Library Process +Library RequestsLibrary +Library String +Library OperatingSystem + +Suite Teardown Delete All Sessions + +*** Variables *** +${SLICE_ANALYSIS_MS_BASE_URL} http://${SLICE_ANALYSIS_MS_IP}:8080 +${HEALTHCHECK_ENDPOINT} /healthcheck +${DMAAP_URL} http://${DMAAP_IP}:3904/events +${unauthenticated.DCAE_CL_OUTPUT} /unauthenticated.DCAE_CL_OUTPUT/24/24 +${AAI_EVENT_OUTPUT} /AAI-EVENT/24/24 +${POST_DMAAP_EVENT_FOR_AAI_EVENT_URL} http://${DMAAP_IP}:3904/events/AAI-EVENT +${VESCOLLECTOR_URL} https://${VESCOLLECTOR_IP}:8443/eventListener/v7 +${AAI_NETWORK_POLICY_URL} https://${AAI_RESOURCES_IP}:8447/aai/v24/network/network-policies/network-policy/933dacc1-56e0-4b94-8808-4d099ebc4de5 +*** Test Cases *** + +HealthCheck + + Create Session sliceanalysisms ${SLICE_ANALYSIS_MS_BASE_URL} + ${resp}= Get Request sliceanalysisms ${HEALTHCHECK_ENDPOINT} + Should Be Equal As Strings ${resp.status_code} 200 + +Post pm ves notification to vescollector + + Log posting 6 VES_Notification console=${True} + Create Session ves ${VESCOLLECTOR_URL} + ${headers}= Create Dictionary Content-Type=application/json + ${user_pass}= Evaluate ('sample1', 'sample1') + ${data}= Get File ${TEST_ROBOT_DIR}/data/ves_notification_pmdata.json + FOR ${i} IN RANGE 6 + ${response}= Evaluate requests.post('${VESCOLLECTOR_URL}', headers=${headers}, data=$data, auth=${user_pass}, verify=False) + Should Be Equal As Strings ${response.status_code} 202 + Sleep 2s + END + +Verify periodic checking from dmaap + + Create Session dmaap ${DMAAP_URL} + FOR ${i} IN RANGE 30 + ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT} + Exit For Loop If ${result.json()} != @{EMPTY} + Log Waiting for slice-analysis-ms to handle periodic checking... console=${True} + Sleep 5s + END + ${expected_string}= Get File ${TEST_ROBOT_DIR}/data/expected_payload_ccvpn1.json + ${expected_payload}= Evaluate json.loads("""${expected_string}""") json + ${result}= Convert To String ${result.content} + ${result_string}= Get Substring ${result} 2 -2 + ${actual_data}= Evaluate json.loads("""${result_string}""") json + ${actual_payload_str}= Set Variable ${actual_data['payload']} + ${actual_payload}= Evaluate json.loads("""${actual_payload_str}""") json + Should Be True """${actual_payload}""".strip() == """${expected_payload}""".strip() + + +Post ccvpn modification to dmaap + + ${headers}= Create Dictionary Content-Type=application/merge-patch+json X-HTTP-Method-Override=PATCH Accept=application/json X-FromAppId=AAI X-TransactionId=808b54e3-e563-4144-a1b9-e24e2ed93d4f + ${user_pass}= Evaluate ('AAI', 'AAI') + ${data}= Get File ${TEST_ROBOT_DIR}/data/network_policy_after.json + ${response}= Evaluate requests.post('${AAI_NETWORK_POLICY_URL}', headers=${headers}, data=$data, auth=${user_pass}, verify=False) + Should Be Equal As Strings ${response.status_code} 200 + Log Wait 20s before posting AAI-EVENT console=${True} + Sleep 20s + Log posting AAI-EVENT console=${True} + Create Session dmaap ${DMAAP_URL} + ${headers}= Create Dictionary Content-Type application/json + ${data}= Get File ${TEST_ROBOT_DIR}/data/aai_event_svc_modification_bw.json + ${response}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_AAI_EVENT_URL}', data=$data) + Should Be Equal As Strings ${response.status_code} 200 + + +Verify ccvpn modification from dmaap + + Create Session dmaap ${DMAAP_URL} + FOR ${i} IN RANGE 30 + ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT} + Exit For Loop If ${result.json()} != @{EMPTY} + Log Waiting for slice-analysis-ms to handle trigger... console=${True} + Sleep 5s + END + ${expected_string}= Get File ${TEST_ROBOT_DIR}/data/expected_payload_ccvpn0.json + ${expected_payload}= Evaluate json.loads("""${expected_string}""") json + ${result}= Convert To String ${result.content} + ${result_string}= Get Substring ${result} 2 -2 + ${actual_data}= Evaluate json.loads("""${result_string}""") json + ${actual_payload_str}= Set Variable ${actual_data['payload']} + ${actual_payload}= Evaluate json.loads("""${actual_payload_str}""") json + Should Be True """${actual_payload}""".strip() == """${expected_payload}""".strip() + +*** Keywords *** +Provided precondition + Setup system under test
\ No newline at end of file diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/slice-analysis-ms-test-cps-aai.robot b/tests/dcaegen2-services-slice-analysis-ms/testcases/slice-analysis-ms-test-cps-aai.robot index 8c4d8e23..d57309cf 100644 --- a/tests/dcaegen2-services-slice-analysis-ms/testcases/slice-analysis-ms-test-cps-aai.robot +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/slice-analysis-ms-test-cps-aai.robot @@ -9,11 +9,13 @@ Suite Teardown Delete All Sessions *** Variables *** ${SLICE_ANALYSIS_MS_BASE_URL} http://${SLICE_ANALYSIS_MS_IP}:8080 +${SLICE_CONFIG_ENDPOINT} ${SLICE_ANALYSIS_MS_BASE_URL}/api/v1/slices-config ${HEALTHCHECK_ENDPOINT} /healthcheck ${DMAAP_URL} http://${DMAAP_IP}:3904/events ${unauthenticated.DCAE_CL_OUTPUT} /unauthenticated.DCAE_CL_OUTPUT/23/23 ${POST_DMAAP_EVENT_FOR_ML_NOTIF_URL} http://${DMAAP_IP}:3904/events/unauthenticated.ML_RESPONSE_TOPIC ${POST_DMAAP_EVENT_FOR_PM_NOTIF_URL} http://${DMAAP_IP}:3904/events/unauthenticated.PERFORMANCE_MEASUREMENTS +&{headers} Content-Type=application/json *** Test Cases *** @@ -21,7 +23,7 @@ ${POST_DMAAP_EVENT_FOR_PM_NOTIF_URL} http://${DMAAP_IP}:3904/events/unauthe HealthCheck Create Session sliceanalysisms ${SLICE_ANALYSIS_MS_BASE_URL} - ${resp}= Get Request sliceanalysisms ${HEALTHCHECK_ENDPOINT} + ${resp}= Get On Session sliceanalysisms ${HEALTHCHECK_ENDPOINT} Should Be Equal As Strings ${resp.status_code} 200 @@ -36,7 +38,7 @@ Post ml notification to dmaap Verify ml notification trigger Create Session dmaap ${DMAAP_URL} FOR ${i} IN RANGE 30 - ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT} + ${result}= Get On Session dmaap ${unauthenticated.DCAE_CL_OUTPUT} Exit For Loop If ${result.json()} != @{EMPTY} Log Waiting for slice-analysis-ms to handle trigger... console=${True} Sleep 5s @@ -62,7 +64,7 @@ Post pm notification-1 to dmaap Verify pm notification-1 trigger Create Session dmaap ${DMAAP_URL} FOR ${i} IN RANGE 20 - ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT} + ${result}= Get On Session dmaap ${unauthenticated.DCAE_CL_OUTPUT} Exit For Loop If ${result.json()} != @{EMPTY} Log Waiting for sliceanalysisms to handle trigger... console=${True} Sleep 30s @@ -76,3 +78,11 @@ Verify pm notification-1 trigger ${actual_payload}= Evaluate json.loads("""${actual_payload_str}""") json set to dictionary ${expected_payload['additionalProperties']['nsiInfo']} nsiId=${actual_payload['additionalProperties']['nsiInfo']['nsiId']} Should Be True """${actual_payload}""".strip() == """${expected_payload}""".strip() + + +Verify slice utilization respose + ${data}= Get File ${TEST_ROBOT_DIR}/data/slice_config_request.json + ${result}= Evaluate requests.get('${SLICE_CONFIG_ENDPOINT}', data=$data, headers=${headers}) + ${expected_slice_config}= Get File ${TEST_ROBOT_DIR}/data/slice_config_response.json + ${actual_slice_config}= Convert To String ${result.content} + Should Be True """${actual_slice_config}""".strip() == """${expected_slice_config}""".strip() |