From 4a70dd3bcf1dde19d511f528650b08714b92448f Mon Sep 17 00:00:00 2001 From: Joanna Jeremicz Date: Tue, 25 Jun 2019 13:39:33 +0200 Subject: New BBS PRH testcases Issue-ID: INT-1100 Signed-off-by: Joanna Jeremicz Change-Id: I19455f401beeecf28c94575b8115e6ce8249bf0a --- .../pnf-with-different-logical-link/aai-entry.json | 38 ++++++++++++++++ .../expected-logical-link.json | 13 ++++++ .../expected-pnf-ready-event.json | 8 ++++ .../logical-link.json | 20 +++++++++ .../pnf-with-different-logical-link/ves-event.json | 40 +++++++++++++++++ .../pnf-with-existing-logical-link/aai-entry.json | 38 ++++++++++++++++ .../expected-logical-link.json | 13 ++++++ .../expected-pnf-ready-event.json | 8 ++++ .../logical-link.json | 20 +++++++++ .../pnf-with-existing-logical-link/ves-event.json | 40 +++++++++++++++++ .../re-registration/expected-pnf-update-event.json | 2 +- .../assets/re-registration/logical-link.json | 20 +++++++++ .../assets/re-registration/ves-event.json | 2 +- .../aai-entry-service-instance.json | 25 +++++++++++ .../service-instance-non-active/aai-entry.json | 52 ++++++++++++++++++++++ .../expected-pnf-ready-event.json | 5 +++ .../service-instance-non-active/ves-event.json | 37 +++++++++++++++ .../aai-entry.json | 23 ++++++++++ .../expected-pnf-ready-event.json | 5 +++ .../ves-event.json | 35 +++++++++++++++ .../aai-entry.json | 23 ++++++++++ .../expected-pnf-ready-event.json | 5 +++ .../ves-event.json | 28 ++++++++++++ tests/dcaegen2/prh-testcases/prh_tests.robot | 25 ++++++++--- .../prh-testcases/resources/prh_library.robot | 43 +++++++++++++++++- .../prh-testcases/resources/simulator/AAI.py | 47 +++++++++++++++++-- 26 files changed, 604 insertions(+), 11 deletions(-) create mode 100644 tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/aai-entry.json create mode 100644 tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/expected-logical-link.json create mode 100644 tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/expected-pnf-ready-event.json create mode 100644 tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/logical-link.json create mode 100644 tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/ves-event.json create mode 100644 tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/aai-entry.json create mode 100644 tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/expected-logical-link.json create mode 100644 tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/expected-pnf-ready-event.json create mode 100644 tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/logical-link.json create mode 100644 tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/ves-event.json create mode 100644 tests/dcaegen2/prh-testcases/assets/re-registration/logical-link.json create mode 100644 tests/dcaegen2/prh-testcases/assets/service-instance-non-active/aai-entry-service-instance.json create mode 100644 tests/dcaegen2/prh-testcases/assets/service-instance-non-active/aai-entry.json create mode 100644 tests/dcaegen2/prh-testcases/assets/service-instance-non-active/expected-pnf-ready-event.json create mode 100644 tests/dcaegen2/prh-testcases/assets/service-instance-non-active/ves-event.json create mode 100644 tests/dcaegen2/prh-testcases/assets/ves-event-with-missing-IP-addresses/aai-entry.json create mode 100644 tests/dcaegen2/prh-testcases/assets/ves-event-with-missing-IP-addresses/expected-pnf-ready-event.json create mode 100644 tests/dcaegen2/prh-testcases/assets/ves-event-with-missing-IP-addresses/ves-event.json create mode 100644 tests/dcaegen2/prh-testcases/assets/ves-event-with-only-IP-addresses/aai-entry.json create mode 100644 tests/dcaegen2/prh-testcases/assets/ves-event-with-only-IP-addresses/expected-pnf-ready-event.json create mode 100644 tests/dcaegen2/prh-testcases/assets/ves-event-with-only-IP-addresses/ves-event.json (limited to 'tests') diff --git a/tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/aai-entry.json b/tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/aai-entry.json new file mode 100644 index 00000000..b0749966 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/aai-entry.json @@ -0,0 +1,38 @@ +{ + "pnf-name": "NOK6061ZW9", + "pnf-name2": "example-pnf-name2-val-58071", + "pnf-name2-source": "example-pnf-name2-source-val-22408", + "pnf-id": "example-pnf-id-val-55834", + "equip-type": "example-equip-type-val-5497", + "equip-vendor": "example-equip-vendor-val-85730", + "equip-model": "example-equip-model-val-38526", + "management-option": "example-management-option-val-15776", + "ipaddress-v4-oam": "example-ipaddress-v4-oam-val-33556", + "sw-version": "example-sw-version-val-64239", + "in-maint": true, + "frame-id": "example-frame-id-val-76733", + "serial-number": "example-serial-number-val-79366", + "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-34781", + "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-29979", + "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-53703", + "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-93386", + "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-92665", + "inv-status": "example-inv-status-val-8477", + "prov-status": "example-prov-status-val-68268", + "nf-role": "example-nf-role-val-68489", + "relationship-list": { + "relationship": [ + { + "related-to": "logical-link", + "relationship-label": "org.onap.relationships.inventory.BridgedTo", + "related-link": "/aai/v14/network/logical-links/logical-link/some-link", + "relationship-data": [ + { + "relationship-key": "logical-link.link-name", + "relationship-value": "some-link" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/expected-logical-link.json b/tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/expected-logical-link.json new file mode 100644 index 00000000..8bcc5312 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/expected-logical-link.json @@ -0,0 +1,13 @@ +{ + "link-name": "another-link", + "link-type": "attachment-point", + "relationship-list": + { + "relationship": [ + { + "related-link": "/network/pnfs/pnf/NOK6061ZW9", + "relationship-data": [] + } + ] + } +} diff --git a/tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/expected-pnf-ready-event.json b/tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/expected-pnf-ready-event.json new file mode 100644 index 00000000..d1787797 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/expected-pnf-ready-event.json @@ -0,0 +1,8 @@ +[ + { + "additionalFields": { + "attachment-point": "another-link" + }, + "correlationId": "NOK6061ZW9" + } +] \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/logical-link.json b/tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/logical-link.json new file mode 100644 index 00000000..72b38831 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/logical-link.json @@ -0,0 +1,20 @@ +{ + "link-name": "some-link", + "in-maint": false, + "link-type": "attachment-point", + "resource-version": "1561617000521", + "relationship-list": { + "relationship": [ + { + "related-to": "pnf", + "related-link": "/aai/v11/network/pnfs/pnf/NOK6061ZW9", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "NOK6061ZW9" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/ves-event.json b/tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/ves-event.json new file mode 100644 index 00000000..ef75a884 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/pnf-with-different-logical-link/ves-event.json @@ -0,0 +1,40 @@ +{ + "event": { + "commonEventHeader": { + "startEpochMicrosec": 1540212137393, + "sourceId": "val13", + "eventId": "registration_40212137", + "nfcNamingCode": "oam", + "internalHeaderFields": { + "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC" + }, + "eventType": "pnfRegistration", + "priority": "Normal", + "version": "4.0.1", + "reportingEntityName": "NOK6061ZW9", + "sequence": 0, + "domain": "pnfRegistration", + "lastEpochMicrosec": 1540212137393, + "eventName": "pnfRegistration_Nokia_5gDu", + "vesEventListenerVersion": "7.0.1", + "sourceName": "NOK6061ZW9", + "nfNamingCode": "gNB" + }, + "pnfRegistrationFields": { + "unitType": "val8", + "serialNumber": "6061ZW9", + "pnfRegistrationFieldsVersion": "2.0", + "manufactureDate": "1540212137393", + "modelNumber": "val6", + "lastServiceDate": "1540212137393", + "unitFamily": "BBU", + "vendorName": "Nokia", + "oamV4IpAddress": "val3", + "oamV6IpAddress": "val4", + "softwareVersion": "val7", + "additionalFields": { + "attachment-point": "another-link" + } + } + } +} \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/aai-entry.json b/tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/aai-entry.json new file mode 100644 index 00000000..b0749966 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/aai-entry.json @@ -0,0 +1,38 @@ +{ + "pnf-name": "NOK6061ZW9", + "pnf-name2": "example-pnf-name2-val-58071", + "pnf-name2-source": "example-pnf-name2-source-val-22408", + "pnf-id": "example-pnf-id-val-55834", + "equip-type": "example-equip-type-val-5497", + "equip-vendor": "example-equip-vendor-val-85730", + "equip-model": "example-equip-model-val-38526", + "management-option": "example-management-option-val-15776", + "ipaddress-v4-oam": "example-ipaddress-v4-oam-val-33556", + "sw-version": "example-sw-version-val-64239", + "in-maint": true, + "frame-id": "example-frame-id-val-76733", + "serial-number": "example-serial-number-val-79366", + "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-34781", + "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-29979", + "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-53703", + "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-93386", + "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-92665", + "inv-status": "example-inv-status-val-8477", + "prov-status": "example-prov-status-val-68268", + "nf-role": "example-nf-role-val-68489", + "relationship-list": { + "relationship": [ + { + "related-to": "logical-link", + "relationship-label": "org.onap.relationships.inventory.BridgedTo", + "related-link": "/aai/v14/network/logical-links/logical-link/some-link", + "relationship-data": [ + { + "relationship-key": "logical-link.link-name", + "relationship-value": "some-link" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/expected-logical-link.json b/tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/expected-logical-link.json new file mode 100644 index 00000000..6dcfdfec --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/expected-logical-link.json @@ -0,0 +1,13 @@ +{ + "link-name": "some-link", + "link-type": "attachment-point", + "relationship-list": + { + "relationship": [ + { + "related-link": "/network/pnfs/pnf/NOK6061ZW9", + "relationship-data": [] + } + ] + } +} diff --git a/tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/expected-pnf-ready-event.json b/tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/expected-pnf-ready-event.json new file mode 100644 index 00000000..5a30bec8 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/expected-pnf-ready-event.json @@ -0,0 +1,8 @@ +[ + { + "additionalFields": { + "attachment-point": "some-link" + }, + "correlationId": "NOK6061ZW9" + } +] \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/logical-link.json b/tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/logical-link.json new file mode 100644 index 00000000..72b38831 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/logical-link.json @@ -0,0 +1,20 @@ +{ + "link-name": "some-link", + "in-maint": false, + "link-type": "attachment-point", + "resource-version": "1561617000521", + "relationship-list": { + "relationship": [ + { + "related-to": "pnf", + "related-link": "/aai/v11/network/pnfs/pnf/NOK6061ZW9", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "NOK6061ZW9" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/ves-event.json b/tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/ves-event.json new file mode 100644 index 00000000..fc214556 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/pnf-with-existing-logical-link/ves-event.json @@ -0,0 +1,40 @@ +{ + "event": { + "commonEventHeader": { + "startEpochMicrosec": 1540212137393, + "sourceId": "val13", + "eventId": "registration_40212137", + "nfcNamingCode": "oam", + "internalHeaderFields": { + "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC" + }, + "eventType": "pnfRegistration", + "priority": "Normal", + "version": "4.0.1", + "reportingEntityName": "NOK6061ZW9", + "sequence": 0, + "domain": "pnfRegistration", + "lastEpochMicrosec": 1540212137393, + "eventName": "pnfRegistration_Nokia_5gDu", + "vesEventListenerVersion": "7.0.1", + "sourceName": "NOK6061ZW9", + "nfNamingCode": "gNB" + }, + "pnfRegistrationFields": { + "unitType": "val8", + "serialNumber": "6061ZW9", + "pnfRegistrationFieldsVersion": "2.0", + "manufactureDate": "1540212137393", + "modelNumber": "val6", + "lastServiceDate": "1540212137393", + "unitFamily": "BBU", + "vendorName": "Nokia", + "oamV4IpAddress": "val3", + "oamV6IpAddress": "val4", + "softwareVersion": "val7", + "additionalFields": { + "attachment-point": "some-link" + } + } + } +} \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/re-registration/expected-pnf-update-event.json b/tests/dcaegen2/prh-testcases/assets/re-registration/expected-pnf-update-event.json index 5c77e125..d1787797 100644 --- a/tests/dcaegen2/prh-testcases/assets/re-registration/expected-pnf-update-event.json +++ b/tests/dcaegen2/prh-testcases/assets/re-registration/expected-pnf-update-event.json @@ -1,7 +1,7 @@ [ { "additionalFields": { - "attachment-point": "bbs-link" + "attachment-point": "another-link" }, "correlationId": "NOK6061ZW9" } diff --git a/tests/dcaegen2/prh-testcases/assets/re-registration/logical-link.json b/tests/dcaegen2/prh-testcases/assets/re-registration/logical-link.json new file mode 100644 index 00000000..575b88b0 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/re-registration/logical-link.json @@ -0,0 +1,20 @@ +{ + "link-name": "bbs-link", + "in-maint": false, + "link-type": "attachment-point", + "resource-version": "1561617000521", + "relationship-list": { + "relationship": [ + { + "related-to": "pnf", + "related-link": "/aai/v11/network/pnfs/pnf/NOK6061ZW9", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "NOK6061ZW9" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/re-registration/ves-event.json b/tests/dcaegen2/prh-testcases/assets/re-registration/ves-event.json index 5de986c5..ef75a884 100644 --- a/tests/dcaegen2/prh-testcases/assets/re-registration/ves-event.json +++ b/tests/dcaegen2/prh-testcases/assets/re-registration/ves-event.json @@ -33,7 +33,7 @@ "oamV6IpAddress": "val4", "softwareVersion": "val7", "additionalFields": { - "attachment-point": "bbs-link" + "attachment-point": "another-link" } } } diff --git a/tests/dcaegen2/prh-testcases/assets/service-instance-non-active/aai-entry-service-instance.json b/tests/dcaegen2/prh-testcases/assets/service-instance-non-active/aai-entry-service-instance.json new file mode 100644 index 00000000..e925e000 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/service-instance-non-active/aai-entry-service-instance.json @@ -0,0 +1,25 @@ +{ + "service-instance-id": "bbs_service", + "service-instance-name": "bbs_service", + "environment-context": "General_Revenue-Bearing", + "workload-context": "Production", + "model-invariant-id": "c71827e7-42fc-46ab-b059-22584c58108b", + "model-version-id": "8efe4a8a-6646-43e2-8807-a376ff22d2e0", + "resource-version": "1554127221722", + "orchestration-status": "non-Active", + "relationship-list": { + "relationship": [ + { + "related-to": "pnf", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v12/network/pnfs/pnf/NOK6061ZW8", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "NOK6061ZW8" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/service-instance-non-active/aai-entry.json b/tests/dcaegen2/prh-testcases/assets/service-instance-non-active/aai-entry.json new file mode 100644 index 00000000..802ffd8a --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/service-instance-non-active/aai-entry.json @@ -0,0 +1,52 @@ +{ + "pnf-name": "NOK6061ZW8", + "pnf-name2": "example-pnf-name2-val-58071", + "pnf-name2-source": "example-pnf-name2-source-val-22408", + "pnf-id": "example-pnf-id-val-55834", + "equip-type": "example-equip-type-val-5497", + "equip-vendor": "example-equip-vendor-val-85730", + "equip-model": "example-equip-model-val-38526", + "management-option": "example-management-option-val-15776", + "ipaddress-v4-oam": "example-ipaddress-v4-oam-val-33556", + "sw-version": "example-sw-version-val-64239", + "in-maint": true, + "frame-id": "example-frame-id-val-76733", + "serial-number": "example-serial-number-val-79366", + "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-34781", + "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-29979", + "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-53703", + "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-93386", + "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-92665", + "inv-status": "example-inv-status-val-8477", + "prov-status": "example-prov-status-val-68268", + "nf-role": "example-nf-role-val-68489", + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v12/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW/service-instances/service-instance/bbs_service", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "Demonstration" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "vFW" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "bbs_service" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "bbs_service" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/service-instance-non-active/expected-pnf-ready-event.json b/tests/dcaegen2/prh-testcases/assets/service-instance-non-active/expected-pnf-ready-event.json new file mode 100644 index 00000000..7d6c240b --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/service-instance-non-active/expected-pnf-ready-event.json @@ -0,0 +1,5 @@ +[ + { + "correlationId": "NOK6061ZW8" + } +] \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/service-instance-non-active/ves-event.json b/tests/dcaegen2/prh-testcases/assets/service-instance-non-active/ves-event.json new file mode 100644 index 00000000..3a768df2 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/service-instance-non-active/ves-event.json @@ -0,0 +1,37 @@ +{ + "event": { + "commonEventHeader": { + "startEpochMicrosec": 1540212137393, + "sourceId": "val13", + "eventId": "registration_40212137", + "nfcNamingCode": "oam", + "internalHeaderFields": { + "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC" + }, + "eventType": "pnfRegistration", + "priority": "Normal", + "version": "4.0.1", + "reportingEntityName": "NOK6061ZW8", + "sequence": 0, + "domain": "pnfRegistration", + "lastEpochMicrosec": 1540212137393, + "eventName": "pnfRegistration_Nokia_5gDu", + "vesEventListenerVersion": "7.0.1", + "sourceName": "NOK6061ZW8", + "nfNamingCode": "gNB" + }, + "pnfRegistrationFields": { + "unitType": "val8", + "serialNumber": "6061ZW9", + "pnfRegistrationFieldsVersion": "2.0", + "manufactureDate": "1540212137393", + "modelNumber": "val6", + "lastServiceDate": "1540212137393", + "unitFamily": "BBU", + "vendorName": "Nokia", + "oamV4IpAddress": "val3", + "oamV6IpAddress": "val4", + "softwareVersion": "val7" + } + } +} \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-with-missing-IP-addresses/aai-entry.json b/tests/dcaegen2/prh-testcases/assets/ves-event-with-missing-IP-addresses/aai-entry.json new file mode 100644 index 00000000..1378f58f --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/ves-event-with-missing-IP-addresses/aai-entry.json @@ -0,0 +1,23 @@ +{ + "pnf-name": "NOK6061ZW8", + "pnf-name2": "example-pnf-name2-val-58071", + "pnf-name2-source": "example-pnf-name2-source-val-22408", + "pnf-id": "example-pnf-id-val-55834", + "equip-type": "example-equip-type-val-5497", + "equip-vendor": "example-equip-vendor-val-85730", + "equip-model": "example-equip-model-val-38526", + "management-option": "example-management-option-val-15776", + "ipaddress-v4-oam": "example-ipaddress-v4-oam-val-33556", + "sw-version": "example-sw-version-val-64239", + "in-maint": true, + "frame-id": "example-frame-id-val-76733", + "serial-number": "example-serial-number-val-79366", + "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-34781", + "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-29979", + "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-53703", + "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-93386", + "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-92665", + "inv-status": "example-inv-status-val-8477", + "prov-status": "example-prov-status-val-68268", + "nf-role": "example-nf-role-val-68489" +} \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-with-missing-IP-addresses/expected-pnf-ready-event.json b/tests/dcaegen2/prh-testcases/assets/ves-event-with-missing-IP-addresses/expected-pnf-ready-event.json new file mode 100644 index 00000000..7d6c240b --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/ves-event-with-missing-IP-addresses/expected-pnf-ready-event.json @@ -0,0 +1,5 @@ +[ + { + "correlationId": "NOK6061ZW8" + } +] \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-with-missing-IP-addresses/ves-event.json b/tests/dcaegen2/prh-testcases/assets/ves-event-with-missing-IP-addresses/ves-event.json new file mode 100644 index 00000000..ec8898a6 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/ves-event-with-missing-IP-addresses/ves-event.json @@ -0,0 +1,35 @@ +{ + "event": { + "commonEventHeader": { + "startEpochMicrosec": 1540212137393, + "sourceId": "val13", + "eventId": "registration_40212137", + "nfcNamingCode": "oam", + "internalHeaderFields": { + "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC" + }, + "eventType": "pnfRegistration", + "priority": "Normal", + "version": "4.0.1", + "reportingEntityName": "NOK6061ZW8", + "sequence": 0, + "domain": "pnfRegistration", + "lastEpochMicrosec": 1540212137393, + "eventName": "pnfRegistration_Nokia_5gDu", + "vesEventListenerVersion": "7.0.1", + "sourceName": "NOK6061ZW8", + "nfNamingCode": "gNB" + }, + "pnfRegistrationFields": { + "unitType": "val8", + "serialNumber": "6061ZW9", + "pnfRegistrationFieldsVersion": "2.0", + "manufactureDate": "1540212137393", + "modelNumber": "val6", + "lastServiceDate": "1540212137393", + "unitFamily": "BBU", + "vendorName": "Nokia", + "softwareVersion": "val7" + } + } +} \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-with-only-IP-addresses/aai-entry.json b/tests/dcaegen2/prh-testcases/assets/ves-event-with-only-IP-addresses/aai-entry.json new file mode 100644 index 00000000..1378f58f --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/ves-event-with-only-IP-addresses/aai-entry.json @@ -0,0 +1,23 @@ +{ + "pnf-name": "NOK6061ZW8", + "pnf-name2": "example-pnf-name2-val-58071", + "pnf-name2-source": "example-pnf-name2-source-val-22408", + "pnf-id": "example-pnf-id-val-55834", + "equip-type": "example-equip-type-val-5497", + "equip-vendor": "example-equip-vendor-val-85730", + "equip-model": "example-equip-model-val-38526", + "management-option": "example-management-option-val-15776", + "ipaddress-v4-oam": "example-ipaddress-v4-oam-val-33556", + "sw-version": "example-sw-version-val-64239", + "in-maint": true, + "frame-id": "example-frame-id-val-76733", + "serial-number": "example-serial-number-val-79366", + "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-34781", + "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-29979", + "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-53703", + "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-93386", + "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-92665", + "inv-status": "example-inv-status-val-8477", + "prov-status": "example-prov-status-val-68268", + "nf-role": "example-nf-role-val-68489" +} \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-with-only-IP-addresses/expected-pnf-ready-event.json b/tests/dcaegen2/prh-testcases/assets/ves-event-with-only-IP-addresses/expected-pnf-ready-event.json new file mode 100644 index 00000000..7d6c240b --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/ves-event-with-only-IP-addresses/expected-pnf-ready-event.json @@ -0,0 +1,5 @@ +[ + { + "correlationId": "NOK6061ZW8" + } +] \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/ves-event-with-only-IP-addresses/ves-event.json b/tests/dcaegen2/prh-testcases/assets/ves-event-with-only-IP-addresses/ves-event.json new file mode 100644 index 00000000..e85747f8 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/ves-event-with-only-IP-addresses/ves-event.json @@ -0,0 +1,28 @@ +{ + "event": { + "commonEventHeader": { + "startEpochMicrosec": 1540212137393, + "sourceId": "val13", + "eventId": "registration_40212137", + "nfcNamingCode": "oam", + "internalHeaderFields": { + "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC" + }, + "eventType": "pnfRegistration", + "priority": "Normal", + "version": "4.0.1", + "reportingEntityName": "NOK6061ZW8", + "sequence": 0, + "domain": "pnfRegistration", + "lastEpochMicrosec": 1540212137393, + "eventName": "pnfRegistration_Nokia_5gDu", + "vesEventListenerVersion": "7.0.1", + "sourceName": "NOK6061ZW8", + "nfNamingCode": "gNB" + }, + "pnfRegistrationFields": { + "oamV4IpAddress": "val3", + "oamV6IpAddress": "val4" + } + } +} \ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/prh_tests.robot b/tests/dcaegen2/prh-testcases/prh_tests.robot index 4e387b91..c8297ec6 100644 --- a/tests/dcaegen2/prh-testcases/prh_tests.robot +++ b/tests/dcaegen2/prh-testcases/prh_tests.robot @@ -24,36 +24,51 @@ Simple registration event [Tags] PRH Valid event [Template] Verify PNF ready sent ${TEST_CASES_DIR}/ves-event-without-additional-fields + ${TEST_CASES_DIR}/ves-event-with-missing-IP-addresses + ${TEST_CASES_DIR}/ves-event-with-only-IP-addresses ${TEST_CASES_DIR}/ves-event-with-empty-additional-fields ${TEST_CASES_DIR}/ves-event-with-empty-attachment-point -Should not sent PNF ready when DMaaP event is invalid +Should not send PNF ready when DMaaP event is invalid [Documentation] PRH get from DMaaP event with missing required field [Tags] PRH Invalid event [Template] Verify event with missing required field is logged ${TEST_CASES_DIR}/ves-event-missing-field -Should not sent PNF ready when DMaaP event is not JSON array +Should not send PNF ready when DMaaP event is not JSON array [Documentation] Event from DMaaP is not JSON array [Tags] PRH Invalid event Verify incorrect JSON event is logged ${TEST_CASES_DIR}/ves-event-not-array -Should not sent PNF ready when AAI record doesn't exist +Should not send PNF ready when AAI record doesn't exist [Documentation] PRH get from DMaaP valid event but given PNF doesn't exists in AAI [Tags] PRH Missing AAI record Verify missing AAI record is logged ${TEST_CASES_DIR}/aai-missing-entry -Should not sent PNF ready when AAI is not responding +Should not send PNF ready when AAI is not responding [Documentation] PRH get from DMaaP valid event but AAI is not responding [Tags] PRH AAI not responding Verify AAI not responding is logged ${TEST_CASES_DIR}/aai-not-responding +Should send PNF ready when logical link exists and replace it in AAI + [Documentation] PRH gets event from DMaaP with an attachment point, PNF is related to a logical link in AAI + [Tags] PRH Attachment point + [Template] Verify PNF ready sent and old logical link removed from AAI + ${TEST_CASES_DIR}/pnf-with-existing-logical-link + ${TEST_CASES_DIR}/pnf-with-different-logical-link + BBS case event - Re-registration - [Documentation] After regitered PNF, PRH reads another one PRH event with registration event + [Documentation] After registered PNF, PRH reads another one PRH event with registration event [Tags] PRH Valid event Re registraiton [Template] Verify PNF re registration ${TEST_CASES_DIR}/re-registration +Should send PNF ready when the associated service instance is non-Active + [Documentation] PNF has a non active service instance, should send PNF_READY event + [Tags] PRH Service instance non active + [Template] Verify PNF ready sent when service instance non active + ${TEST_CASES_DIR}/service-instance-non-active + PRH logging level change [Documentation] ad-hoc PRH logging level change using rest endpoint [Tags] PRH logging level diff --git a/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/tests/dcaegen2/prh-testcases/resources/prh_library.robot index 3ed377c7..cf3f1097 100644 --- a/tests/dcaegen2/prh-testcases/resources/prh_library.robot +++ b/tests/dcaegen2/prh-testcases/resources/prh_library.robot @@ -15,6 +15,13 @@ Verify PNF ready sent Wait Until Keyword Succeeds 10x 3000ms Check CBS ready Wait Until Keyword Succeeds 10x 3000ms Check created PNF_READY notification ${expected_pnf_ready_event} +Verify PNF ready sent and old logical link removed from AAI + [Arguments] ${test_case_directory} + ${logical_link}= Get Data From File ${test_case_directory}/logical-link.json + Add logical link entry in AAI ${logical_link} + Verify PNF ready sent ${test_case_directory} + Wait Until Keyword Succeeds 10x 3000ms Check no logical link in AAI ${test_case_directory} + Verify PNF ready sent and logical link created [Arguments] ${test_case_directory} ${expected_logical_link}= Get Data From File ${test_case_directory}/expected-logical-link.json @@ -63,11 +70,38 @@ Verify PNF re registration Add PNF entry in AAI ${aai_entry} ${service_instance}= Get Data From File ${test_case_directory}/aai-entry-service-instance.json Add service instance entry in AAI ${service_instance} + ${logical_link}= Get Data From File ${test_case_directory}/logical-link.json + Add logical link entry in AAI ${logical_link} ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json Set VES event in DMaaP ${ves_event} ${expected_pnf_update_event}= Get Data From File ${test_case_directory}/expected-pnf-update-event.json Wait Until Keyword Succeeds 10x 3000ms Check created PNF_UPDATE notification ${expected_pnf_update_event} + Wait Until Keyword Succeeds 10x 3000ms Check logical link not modified ${test_case_directory} + +Verify PNF ready sent when service instance non active + [Arguments] ${test_case_directory} + ${pnf_entry}= Get Data From File ${test_case_directory}/aai-entry.json + ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json + ${expected_pnf_ready_event}= Get Data From File ${test_case_directory}/expected-pnf-ready-event.json + ${service_instance}= Get Data From File ${test_case_directory}/aai-entry-service-instance.json + Add PNF entry in AAI ${pnf_entry} + Add service instance entry in AAI ${service_instance} + + Set VES event in DMaaP ${ves_event} + Wait Until Keyword Succeeds 10x 3000ms Check CBS ready + Wait Until Keyword Succeeds 10x 3000ms Check created PNF_READY notification ${expected_pnf_ready_event} + +Check logical link not modified + [Arguments] ${test_case_directory} + ${expected_logical_link}= Get Data From File ${test_case_directory}/logical-link.json + ${actual_logical_link}= Get Request ${aai_session} /verify/logical-link/bbs-link headers=${suite_headers} + Should Be Equal As JSON ${expected_logical_link} ${actual_logical_link.content} + +Check no logical link in AAI + [Arguments] ${test_case_directory} + ${logical_links}= Get Request ${aai_session} /verify/logical-links headers=${suite_headers} + Should Be Equal As JSON {} ${logical_links.content} Check CBS ready ${resp}= Get Request ${consul_session} /v1/catalog/services @@ -86,7 +120,7 @@ Check created PNF_UPDATE notification ${resp}= Get Request ${dmaap_session} /verify/pnf_update headers=${suite_headers} Log Response from DMaaP: ${resp.content} Should Be Equal As Strings ${resp.status_code} 200 - #Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dpaap} + Should Be Equal As JSON ${resp.content} ${expected_event_pnf_update_in_dpaap} Check created Logical Link [Arguments] ${expected_logical_link_in_aai} @@ -124,6 +158,13 @@ Add service instance entry in AAI ${resp}= Put Request ${aai_session} /setup/add_service_instace headers=${suite_headers} data=${aai_service_instance} Should Be Equal As Strings ${resp.status_code} 200 +Add logical link entry in AAI + [Arguments] ${logical_link} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + Log AAI url ${AAI_SIMULATOR_SETUP_URL} + ${resp}= Put Request ${aai_session} /setup/add_logical_link headers=${suite_headers} data=${logical_link} + Should Be Equal As Strings ${resp.status_code} 200 + Set VES event in DMaaP [Arguments] ${ves_event} ${resp}= Put Request ${dmaap_session} /setup/ves_event headers=${suite_headers} data=${ves_event} diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py index f6d3b1f6..e5f0b102 100644 --- a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py +++ b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py @@ -20,6 +20,7 @@ logger = logging.getLogger('AAI-simulator-logger') AAI_RESOURCE_NOT_FOUND = b'{}' pnf_entries = {} +logical_links = {} patched_pnf = AAI_RESOURCE_NOT_FOUND created_logical_link = AAI_RESOURCE_NOT_FOUND service_instance = AAI_RESOURCE_NOT_FOUND @@ -34,6 +35,12 @@ class AAISetup(BaseHTTPRequestHandler): elif re.search('/verify/created_logical_link', self.path): httpServerLib.set_response_200_ok(self, payload = created_logical_link) logger.debug('AAISetup GET /setup/created_logical_link -> 200 OK') + elif re.search('/verify/logical-links', self.path): + httpServerLib.set_response_200_ok(self, payload= json.dumps(logical_links).encode('utf-8')) + elif re.search('/verify/logical-link/bbs-link', self.path): + link_name = basename(self.path) + if link_name in logical_links: + httpServerLib.set_response_200_ok(self, payload = logical_links[link_name]) else: httpServerLib.set_response_404_not_found(self) logger.info('AAISetup GET ' + self.path + ' -> 404 Not found') @@ -60,6 +67,18 @@ class AAISetup(BaseHTTPRequestHandler): service_instance = json.loads(service_instance_payload) httpServerLib.set_response_200_ok(self) logger.debug('AAISetup PUT /setup/add_service_instace -> 200 OK') + elif re.search('/setup/add_logical_link', self.path): + logical_link_payload = httpServerLib.get_payload(self) + logical_link_name = json.loads(logical_link_payload).get("link-name") + if logical_link_name == None: + raise Exception("Invalid logical link entry, could not extract `link-name`") + + global logical_link + logical_links[logical_link_name] = logical_link_payload + + logical_link = json.loads(logical_link_payload) + httpServerLib.set_response_200_ok(self) + logger.debug('AAISetup PUT /setup/add_logical_link -> 200 OK') elif re.search('/set_pnf', self.path): pnf_name = httpServerLib.get_payload(self).decode() @@ -105,9 +124,17 @@ class AAIHandler(BaseHTTPRequestHandler): else: httpServerLib.set_response_404_not_found(self) logger.info('AAIHandler GET /aai/v12/network/pnfs/pnf/' + pnf_name + ' -> 404 Not found, actual entries: ' + str(pnf_entries.keys())) - elif re.search('aai/v12/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW/service-instances/service-instance/bbs_service', self.path): - httpServerLib.set_response_200_ok(self, payload = service_instance) - logger.debug('AAIHandler GET aai/v12/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW/service-instances/service-instance/bbs_service -> 200 OK') + elif re.search('/aai/v12/network/logical-links/logical-link/[^/]*$', self.path): + logical_link_name = basename(self.path) + if logical_link_name in logical_links: + httpServerLib.set_response_200_ok(self, payload = logical_links[logical_link_name]) + logger.debug('AAIHandler GET /aai/v12/network/logical-links/logical-link/' + logical_link_name + ' -> 200 OK') + else: + httpServerLib.set_response_404_not_found(self) + logger.info('AAIHandler GET /aai/v12/network/logical-links/logical-link/' + logical_link_name + ' -> 404 Not found, actual entries: ' + str(logical_links.keys())) + elif re.search('aai/v12/network/pnfs/pnf/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW/service-instances/service-instance/bbs_service', self.path): + httpServerLib.set_response_200_ok(self, payload = json.dumps(service_instance).encode('utf-8')) + logger.debug('AAIHandler GET aai/v12/network/pnfs/pnf/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW/service-instances/service-instance/bbs_service -> 200 OK') else: httpServerLib.set_response_404_not_found(self) logger.info('AAIHandler GET ' + self.path + ' -> 404 Not found') @@ -152,6 +179,20 @@ class AAIHandler(BaseHTTPRequestHandler): logger.error(e) httpServerLib.set_response_500_server_error(self) + def do_DELETE(self): + try: + if re.search('/aai/v12/network/logical-links/logical-link/[^/]*\?resource-version=\d+$', self.path): + httpServerLib.set_response_200_ok(self) + logical_link_name = re.search('.+?(?=\?)', basename(self.path)).group(0) + + del logical_links[logical_link_name] + logger.debug('AAIHandler DELETE /aai/v12/network/logical-links/logical-link/' + logical_link_name + ' -> 200 OK') + else: + httpServerLib.set_response_404_not_found(self) + logger.info('AAIHandler DELETE ' + self.path + ' -> 404 Not found') + except Exception as e: + logger.error(e) + httpServerLib.set_response_500_server_error(self) def _main_(handler_class=AAIHandler, protocol="HTTP/1.0"): handler_class.protocol_version = protocol -- cgit 1.2.3-korg