aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dcaegen2-services-slice-analysis-ms/testcases
diff options
context:
space:
mode:
authordecheng zhang <decheng.zhang@huawei.com>2022-04-10 22:35:55 -0400
committerdecheng zhang <decheng.zhang@huawei.com>2022-04-26 12:24:15 -0400
commit20b23530a59fdad729794164d56a27f2ab3d4614 (patch)
tree7ec42049efb876ee2296cab3619fcacb7b7adf9a /tests/dcaegen2-services-slice-analysis-ms/testcases
parent9ed698d4522c487445a1ca048f29836c5f59c5e6 (diff)
[DCAEGEN2-SLICEANALYSISMS] Add new robot for CCVPN/IBN closed-loop functionality in slice-analysis-ms
Issue-ID: DCAEGEN2-3081 Signed-off-by: decheng zhang <decheng.zhang@huawei.com> Change-Id: Id784631e605552c6753b6cc074032bceac9ddf31 Signed-off-by: decheng zhang <decheng.zhang@huawei.com>
Diffstat (limited to 'tests/dcaegen2-services-slice-analysis-ms/testcases')
-rw-r--r--tests/dcaegen2-services-slice-analysis-ms/testcases/data/aai_event_svc_modification_bw.json45
-rw-r--r--tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_ccvpn0.json1
-rw-r--r--tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_ccvpn1.json1
-rw-r--r--tests/dcaegen2-services-slice-analysis-ms/testcases/data/network_policy_after.json4
-rw-r--r--tests/dcaegen2-services-slice-analysis-ms/testcases/data/ves_notification_pmdata.json34
-rw-r--r--tests/dcaegen2-services-slice-analysis-ms/testcases/slice-analysis-ms-test-aai-dcae.robot96
6 files changed, 181 insertions, 0 deletions
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/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