3 Library RequestsLibrary
4 Library OperatingSystem
6 Documentation Test cases for VNF package subscription notifications and subscription cleanup
7 ... Test include checking that VNF package notification was received and deleting the subscription
9 ... -subscription being created in etsi_vnf_subscription_tests and
10 ... -package being onboarded in etsi_package_onboarding_tests
13 ${SLEEP_INTERVAL_SEC}= 5
14 ${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.
15 ${PACKAGE_MANAGEMENT_BASE_URL}= /so/vnfm-adapter/v1/vnfpkgm/v1
16 ${BASIC_AUTH}= Basic dm5mbTpwYXNzd29yZDEk
17 ${VNF_PACKAGE_ID}= 73522444-e8e9-49c1-be29-d355800aa349
20 VNF Package Onboarding Notification Received By Subscriber
21 &{headers}= Create Dictionary Authorization=Bearer ${ACCESS_TOKEN} Content-Type=application/json Accept=application/json
22 Log To Console \nChecking If VNF Package Notification was received for vnfPkgId: ${VNF_PACKAGE_ID}
23 ${response}= Get On Session vnfm_simulator_session /vnfpkgm/v1/notification-cache-test/${VNF_PACKAGE_ID} headers=${headers}
24 Log To Console \nResponse:${response}
25 Run Keyword If '${response.status_code}' == '200' Log To Console \nexecuted with expected result
26 Should Be Equal As Strings '${response.status_code}' '200'
27 Log To Console \nResponse Content:\n${response.content}
28 ${json_response}= Evaluate json.loads(r"""${response.content}""", strict=False) json
29 Dictionary Should Contain Key ${json_response} id
30 Dictionary Should Contain Key ${json_response} notificationType
31 Should be Equal As Strings VnfPackageOnboardingNotification ${json_response}[notificationType]
32 Dictionary Should Contain Key ${json_response} subscriptionId
33 Dictionary Should Contain Key ${json_response} timeStamp
34 Dictionary Should Contain Key ${json_response} vnfPkgId
35 Should Be Equal As Strings ${VNF_PACKAGE_ID} ${json_response}[vnfPkgId]
36 Dictionary Should Contain Key ${json_response} vnfdId
37 Dictionary Should Contain Key ${json_response} _links
38 Log To Console \nexecuted with expected result
40 Delete Subscription By SubscriptionId
41 Create Session so_vnfm_adapter_session http://${REPO_IP}:9092
42 &{headers}= Create Dictionary Authorization=${BASIC_AUTH} Content-Type=application/json Accept=application/json
43 Log To Console \nDeleting Subscription with subscriptionId: ${SUBSCRIPTION_ID} from so-vnfm-adapter
44 ${response}= Delete On Session so_vnfm_adapter_session ${PACKAGE_MANAGEMENT_BASE_URL}/subscriptions/${SUBSCRIPTION_ID} headers=${headers}
45 Log To Console \nResponse:${response}
46 Run Keyword If '${response.status_code}' == '204' Log To Console \nexecuted with expected result
47 Should Be Equal As Strings '${response.status_code}' '204'