Add Tests for VNF Package Mgmt - Subscribe and Notify
[integration/csit.git] / tests / so / etsi / etsi_vnf_notification_tests.robot
1 *** Settings ***
2 Library     Collections
3 Library     RequestsLibrary
4 Library     OperatingSystem
5 Library     json
6
7 *** Variables ***
8 ${SLEEP_INTERVAL_SEC}=   5
9 ${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.
10 ${PACKAGE_MANAGEMENT_BASE_URL}=    /so/vnfm-adapter/v1/vnfpkgm/v1
11 ${BASIC_AUTH}=    Basic dm5mbTpwYXNzd29yZDEk
12 ${VNF_PACKAGE_ID}=    73522444-e8e9-49c1-be29-d355800aa349
13
14 *** Test Cases ***
15 VNF Package Onboarding Notification Received By Subscriber
16     &{headers}=    Create Dictionary    Authorization=Bearer ${ACCESS_TOKEN}    Content-Type=application/json    Accept=application/json
17     Log To Console    \nChecking If VNF Package Notification was received for vnfPkgId: ${VNF_PACKAGE_ID}
18     ${response}=    Get On Session    vnfm_simulator_session    /vnfpkgm/v1/notification-cache-test/${VNF_PACKAGE_ID}    headers=${headers}
19     Log To Console    \nResponse:${response}
20     Run Keyword If    '${response.status_code}' == '200'    Log To Console    \nexecuted with expected result
21     Should Be Equal As Strings    '${response.status_code}'    '200'
22     Log To Console    \nResponse Content:\n${response.content}
23     ${json_response}=    Evaluate    json.loads(r"""${response.content}""", strict=False)    json
24     Dictionary Should Contain Key        ${json_response}    id
25     Dictionary Should Contain Key        ${json_response}    notificationType
26     Should be Equal As Strings    VnfPackageOnboardingNotification    ${json_response}[notificationType]
27     Dictionary Should Contain Key        ${json_response}    subscriptionId
28     Dictionary Should Contain Key        ${json_response}    timeStamp
29     Dictionary Should Contain Key        ${json_response}    vnfPkgId
30     Should Be Equal As Strings    ${VNF_PACKAGE_ID}    ${json_response}[vnfPkgId]
31     Dictionary Should Contain Key        ${json_response}    vnfdId
32     Dictionary Should Contain Key        ${json_response}    _links
33     Log To Console    \nexecuted with expected result
34
35 Delete Subscription By SubscriptionId
36     Create Session    so_vnfm_adapter_session    http://${REPO_IP}:9092
37     &{headers}=    Create Dictionary    Authorization=${BASIC_AUTH}    Content-Type=application/json    Accept=application/json
38     Log To Console    \nDeleting Subscription with subscriptionId: ${SUBSCRIPTION_ID} from so-vnfm-adapter
39     ${response}=    Delete On Session    so_vnfm_adapter_session    ${PACKAGE_MANAGEMENT_BASE_URL}/subscriptions/${SUBSCRIPTION_ID}    headers=${headers}
40     Log To Console    \nResponse:${response}
41     Run Keyword If    '${response.status_code}' == '204'    Log To Console    \nexecuted with expected result
42     Should Be Equal As Strings    '${response.status_code}'    '204'
43
44