diff options
author | AndrewLamb <andrew.a.lamb@est.tech> | 2021-02-12 13:58:36 +0000 |
---|---|---|
committer | AndrewLamb <andrew.a.lamb@est.tech> | 2021-02-12 14:39:54 +0000 |
commit | 29da40e2e76f35598642d52bdf35fc9a501ac7dc (patch) | |
tree | 22d18e455570613ddf1a1663c9b6f85a39c3b543 /tests/so | |
parent | 4fbb28749f57727dc23790b6e9ec480ca61490fb (diff) |
Add Tests for VNF Package Mgmt - Subscribe and Notify
Change-Id: Ie6a14445f3b90975ec579ebf96c806365a01b8ca
Issue-ID: INT-1847
Signed-off-by: AndrewLamb <andrew.a.lamb@est.tech>
Diffstat (limited to 'tests/so')
-rw-r--r-- | tests/so/etsi/data/responses/expectedVnfPackage.json | 6 | ||||
-rw-r--r-- | tests/so/etsi/data/subscriptionRequest.json | 23 | ||||
-rw-r--r-- | tests/so/etsi/etsi_vnf_notification_tests.robot | 44 | ||||
-rw-r--r-- | tests/so/etsi/etsi_vnf_subscription_tests.robot | 89 |
4 files changed, 159 insertions, 3 deletions
diff --git a/tests/so/etsi/data/responses/expectedVnfPackage.json b/tests/so/etsi/data/responses/expectedVnfPackage.json index c841956c..41eeb8b1 100644 --- a/tests/so/etsi/data/responses/expectedVnfPackage.json +++ b/tests/so/etsi/data/responses/expectedVnfPackage.json @@ -10,13 +10,13 @@ "operationalState": "ENABLED", "_links": { "self": { - "href": "http://so-vnfm-adapter:9092/so/vnfm-adapter/v1/vnfpkgm/v1/vnf_packages/73522444-e8e9-49c1-be29-d355800aa349" + "href": "http://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/vnfpkgm/v1/vnf_packages/73522444-e8e9-49c1-be29-d355800aa349" }, "vnfd": { - "href": "http://so-vnfm-adapter:9092/so/vnfm-adapter/v1/vnfpkgm/v1/vnf_packages/73522444-e8e9-49c1-be29-d355800aa349/vnfd" + "href": "http://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/vnfpkgm/v1/vnf_packages/73522444-e8e9-49c1-be29-d355800aa349/vnfd" }, "packageContent": { - "href": "http://so-vnfm-adapter:9092/so/vnfm-adapter/v1/vnfpkgm/v1/vnf_packages/73522444-e8e9-49c1-be29-d355800aa349/package_content" + "href": "http://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/vnfpkgm/v1/vnf_packages/73522444-e8e9-49c1-be29-d355800aa349/package_content" } } } diff --git a/tests/so/etsi/data/subscriptionRequest.json b/tests/so/etsi/data/subscriptionRequest.json new file mode 100644 index 00000000..c54bf3c2 --- /dev/null +++ b/tests/so/etsi/data/subscriptionRequest.json @@ -0,0 +1,23 @@ +{ + "filter": { + "notificationTypes": [ + "VnfPackageOnboardingNotification", + "VnfPackageChangeNotification" + ], + "vnfdId": [ + "b1bb0ce7-2222-4fa7-95ed-4840d70a1177" + ], + "operationalState": ["ENABLED", "DISABLED"] + }, + "callbackUri": "http://so-vnfm-simulator:9093/vnfpkgm/v1/notification", + "authentication": { + "authType": [ + "OAUTH2_CLIENT_CREDENTIALS" + ], + "paramsOauth2ClientCredentials": { + "clientId": "vnfm", + "clientPassword": "password1$", + "tokenEndpoint": "http://so-vnfm-simulator:9093/oauth/token?grant_type=client_credentials" + } + } +} diff --git a/tests/so/etsi/etsi_vnf_notification_tests.robot b/tests/so/etsi/etsi_vnf_notification_tests.robot new file mode 100644 index 00000000..0d1eb41c --- /dev/null +++ b/tests/so/etsi/etsi_vnf_notification_tests.robot @@ -0,0 +1,44 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json + +*** Variables *** +${SLEEP_INTERVAL_SEC}= 5 +${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}= 48 # Represents the maximum number of attempts that will be made before a timeout. It sleeps for SLEEP_INTERVAL_SEC seconds before retry. +${PACKAGE_MANAGEMENT_BASE_URL}= /so/vnfm-adapter/v1/vnfpkgm/v1 +${BASIC_AUTH}= Basic dm5mbTpwYXNzd29yZDEk +${VNF_PACKAGE_ID}= 73522444-e8e9-49c1-be29-d355800aa349 + +*** Test Cases *** +VNF Package Onboarding Notification Received By Subscriber + &{headers}= Create Dictionary Authorization=Bearer ${ACCESS_TOKEN} Content-Type=application/json Accept=application/json + Log To Console \nChecking If VNF Package Notification was received for vnfPkgId: ${VNF_PACKAGE_ID} + ${response}= Get On Session vnfm_simulator_session /vnfpkgm/v1/notification-cache-test/${VNF_PACKAGE_ID} headers=${headers} + Log To Console \nResponse:${response} + Run Keyword If '${response.status_code}' == '200' Log To Console \nexecuted with expected result + Should Be Equal As Strings '${response.status_code}' '200' + Log To Console \nResponse Content:\n${response.content} + ${json_response}= Evaluate json.loads(r"""${response.content}""", strict=False) json + Dictionary Should Contain Key ${json_response} id + Dictionary Should Contain Key ${json_response} notificationType + Should be Equal As Strings VnfPackageOnboardingNotification ${json_response}[notificationType] + Dictionary Should Contain Key ${json_response} subscriptionId + Dictionary Should Contain Key ${json_response} timeStamp + Dictionary Should Contain Key ${json_response} vnfPkgId + Should Be Equal As Strings ${VNF_PACKAGE_ID} ${json_response}[vnfPkgId] + Dictionary Should Contain Key ${json_response} vnfdId + Dictionary Should Contain Key ${json_response} _links + Log To Console \nexecuted with expected result + +Delete Subscription By SubscriptionId + Create Session so_vnfm_adapter_session http://${REPO_IP}:9092 + &{headers}= Create Dictionary Authorization=${BASIC_AUTH} Content-Type=application/json Accept=application/json + Log To Console \nDeleting Subscription with subscriptionId: ${SUBSCRIPTION_ID} from so-vnfm-adapter + ${response}= Delete On Session so_vnfm_adapter_session ${PACKAGE_MANAGEMENT_BASE_URL}/subscriptions/${SUBSCRIPTION_ID} headers=${headers} + Log To Console \nResponse:${response} + Run Keyword If '${response.status_code}' == '204' Log To Console \nexecuted with expected result + Should Be Equal As Strings '${response.status_code}' '204' + + diff --git a/tests/so/etsi/etsi_vnf_subscription_tests.robot b/tests/so/etsi/etsi_vnf_subscription_tests.robot new file mode 100644 index 00000000..3bf22628 --- /dev/null +++ b/tests/so/etsi/etsi_vnf_subscription_tests.robot @@ -0,0 +1,89 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json + +*** Variables *** +${SLEEP_INTERVAL_SEC}= 5 +${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}= 48 # Represents the maximum number of attempts that will be made before a timeout. It sleeps for SLEEP_INTERVAL_SEC seconds before retry. +${PACKAGE_MANAGEMENT_BASE_URL}= /so/vnfm-adapter/v1/vnfpkgm/v1 +${BASIC_AUTH}= Basic dm5mbTpwYXNzd29yZDEk +${ACCESS_TOKEN}= "" +${SUBSCRIPTION_ID}= "" + +*** Test Cases *** +Subscribe for Notifications + Create Session vnfm_simulator_session http://${REPO_IP}:9093 + &{headers1}= Create Dictionary Authorization=${BASIC_AUTH} Content-Type=application/json Accept=application/json + Log To Console \nGetting Access Token + ${response}= Post On Session vnfm_simulator_session url=/oauth/token?grant_type=client_credentials headers=${headers1} + Log To Console \nResponse:${response} + Run Keyword If '${response.status_code}' == '200' Log To Console \nexecuted with expected result + Should Be Equal As Strings '${response.status_code}' '200' + Log To Console \nResponse Content:\n${response.content} + ${json_response} Evaluate json.loads(r"""${response.content}""", strict=False) json + Set Global Variable ${ACCESS_TOKEN} ${json_response}[access_token] + ${data}= Get Binary File ${CURDIR}${/}data${/}subscriptionRequest.json + &{headers2}= Create Dictionary Authorization=Bearer ${ACCESS_TOKEN} Content-Type=application/json Accept=application/json + Log To Console \nSubscribing For VNF Package Notifications + ${response2}= Post On Session vnfm_simulator_session /vnfpkgm/v1/subscribe data=${data} headers=${headers2} + Log To Console \nResponse:\n${response2} + Log To Console \nResponse Content:\n${response2.content} + Run Keyword If '${response2.status_code}' == '200' Log To Console \nexecuted with expected result + Should Be Equal As Strings '${response2.status_code}' '200' + ${json_response2}= Evaluate json.loads(r"""${response2.content}""", strict=False) json + Dictionary Should Contain Key ${json_response2} id + Set Global Variable ${SUBSCRIPTION_ID} ${json_response2}[id] + Log To Console \nid: ${SUBSCRIPTION_ID} + Dictionary Should Contain Key ${json_response2} filter + ${filter}= Set Variable ${json_response2}[filter] + Dictionary Should Contain Key ${filter} notificationTypes + Dictionary Should Contain Key ${filter} vnfdId + Dictionary Should Contain Key ${filter} operationalState + Dictionary Should Contain Key ${json_response2} callbackUri + Dictionary Should Contain Key ${json_response2} _links + Log To Console \nexecuted with expected result + +Get Subscriptions + Create Session so_vnfm_adapter_session http://${REPO_IP}:9092 + &{headers}= Create Dictionary Authorization=${BASIC_AUTH} Content-Type=application/json Accept=application/json + Log To Console \nGetting Subscriptions from so-vnfm-adapter + ${response}= Get On Session so_vnfm_adapter_session ${PACKAGE_MANAGEMENT_BASE_URL}/subscriptions headers=${headers} + Log To Console \nResponse:${response} + Run Keyword If '${response.status_code}' == '200' Log To Console \nexecuted with expected result + Should Be Equal As Strings '${response.status_code}' '200' + Log To Console \nResponse Content:\n${response.content} + ${json_response} Evaluate json.loads(r"""${response.content}""", strict=False) json + ${subscription}= Set Variable ${json_response}[0] + Dictionary Should Contain Key ${subscription} id + ${sub_id}= Set Variable ${subscription}[id] + Should Be Equal As Strings '${sub_id}' '${SUBSCRIPTION_ID}' + Dictionary Should Contain Key ${subscription} filter + ${filter}= Set Variable ${subscription}[filter] + Dictionary Should Contain Key ${filter} notificationTypes + Dictionary Should Contain Key ${filter} vnfdId + Dictionary Should Contain Key ${filter} operationalState + Dictionary Should Contain Key ${subscription} callbackUri + Log To Console \nexecuted with expected result + +Get Subscription By Subscription Id + Create Session so_vnfm_adapter_session http://${REPO_IP}:9092 + &{headers}= Create Dictionary Authorization=${BASIC_AUTH} Content-Type=application/json Accept=application/json + Log To Console \nGetting Subscription with id ${SUBSCRIPTION_ID} from so-vnfm-adapter + ${response}= Get On Session so_vnfm_adapter_session ${PACKAGE_MANAGEMENT_BASE_URL}/subscriptions/${SUBSCRIPTION_ID} headers=${headers} + Log To Console \nResponse:${response} + Run Keyword If '${response.status_code}' == '200' Log To Console \nexecuted with expected result + Should Be Equal As Strings '${response.status_code}' '200' + Log To Console \nResponse Content:\n${response.content} + ${json_response} Evaluate json.loads(r"""${response.content}""", strict=False) json + Dictionary Should Contain Key ${json_response} id + ${sub_id}= Set Variable ${json_response}[id] + Should Be Equal As Strings '${sub_id}' '${SUBSCRIPTION_ID}' + Dictionary Should Contain Key ${json_response} filter + ${filter}= Set Variable ${json_response}[filter] + Dictionary Should Contain Key ${filter} notificationTypes + Dictionary Should Contain Key ${filter} vnfdId + Dictionary Should Contain Key ${filter} operationalState + Dictionary Should Contain Key ${json_response} callbackUri + Log To Console \nexecuted with expected result |