blob: 34913f0aa0ae8f93d22590f67ac0a5c6112a71d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
*** Settings ***
Library Collections
Library RequestsLibrary
Library OperatingSystem
Library json
Documentation Test cases that tests subscription functionality for VNF package onboarding/change notifications
... Tests include subscribing for notifications, and querying that the subscriptions have been created
... Note: creates ACCESS_TOKEN and SUBSCRIPTION_ID variables used in later etsi_vnf_notification_tests
*** 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
|