blob: 192753e0e24cb44b78558fc190943ba64aa70654 [file] [log] [blame]
Keong Limeff1eab2019-03-19 15:44:35 +11001*** Settings ***
2Documentation Operations on vpn-bindings in AAI for CCVPN use case,
3... using earliest API version where changes are implemented and
4... latest API version where changes are not implemented
5
Keong Limeff1eab2019-03-19 15:44:35 +11006Resource aai_interface.robot
7Resource api_version_properties.robot
8Resource add-relationship-list.robot
9Library OperatingSystem
10Library Collections
DR695Hd9794652019-07-19 18:20:40 -040011Library ONAPLibrary.Templating WITH NAME Templating
12Library ONAPLibrary.AAI WITH NAME AAI
Keong Limeff1eab2019-03-19 15:44:35 +110013
14*** Variables ***
15${AAI_VPNB_ROOT_PATH} /network/vpn-bindings/vpn-binding
16${AAI_VPNB_EXAMPLES_PATH} /examples/vpn-bindings
17${AAI_VPNB_NODES_PATH} /nodes/vpn-bindings
DR695H3bb6cf42019-06-20 15:04:04 -040018${AAI_ADD_VPNBINDING_BODY}= aai/add-vpn-binding.jinja
Keong Limeff1eab2019-03-19 15:44:35 +110019${AAI_VPNB_API_NA_INDEX_PATH}= ${AAI_BEIJING_INDEX_PATH}
20${AAI_VPNB_API_IMPL_INDEX_PATH}= ${AAI_CASABLANCA_INDEX_PATH}
21
22*** Keywords ***
23Create VPN Binding If Not Exists
24 [Documentation] Creates VPN Binding in AAI if it doesn't exist
25 [Arguments] ${vpn_id}
DR695Hd9794652019-07-19 18:20:40 -040026 ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD}
27 ${get_resp}= AAI.Run Get Request ${AAI_FRONTEND_ENDPOINT} ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id} auth=${auth}
Keong Limeff1eab2019-03-19 15:44:35 +110028 Return From Keyword If '${get_resp.status_code}' == '200'
29 Create VPN Binding ${vpn_id}
30
31Create VPN Binding
32 [Documentation] Creates VPN Binding in AAI
33 [Arguments] ${vpn_id}
34 ${arguments}= Create Dictionary vpn_id=${vpn_id}
DR695Hd9794652019-07-19 18:20:40 -040035 Templating.Create Environment aai ${GLOBAL_TEMPLATE_FOLDER}
36 ${data}= Templating.Apply Template aai ${AAI_ADD_VPNBINDING_BODY} ${arguments}
37 ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD}
38 ${put_resp}= AAI.Run Put Request ${AAI_FRONTEND_ENDPOINT} ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id} ${data} auth=${auth}
Keong Limeff1eab2019-03-19 15:44:35 +110039 ${status_string}= Convert To String ${put_resp.status_code}
40 Should Match Regexp ${status_string} ^(201|200)$
41
42Delete VPN Binding If Exists
43 [Documentation] Removes VPN Binding from AAI if it exists
44 [Arguments] ${vpn_id}
DR695Hd9794652019-07-19 18:20:40 -040045 ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD}
46 ${get_resp}= AAI.Run Get Request ${AAI_FRONTEND_ENDPOINT} ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id} auth=${auth}
Keong Limeff1eab2019-03-19 15:44:35 +110047 Run Keyword If '${get_resp.status_code}' == '200' Delete VPN Binding ${vpn_id} ${get_resp.json()}
48
49Delete VPN Binding
50 [Documentation] Removes VPN Binding from AAI
51 [Arguments] ${vpn_id} ${json}
52 ${resource_version}= Catenate ${json['resource-version']}
DR695Hd9794652019-07-19 18:20:40 -040053 ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD}
54 ${put_resp}= AAI.Run Delete Request ${AAI_FRONTEND_ENDPOINT} ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id} ${resource_version} auth=${auth}
Keong Limeff1eab2019-03-19 15:44:35 +110055 Should Be Equal As Strings ${put_resp.status_code} 204
56
57Get VPN Binding
58 [Documentation] Return VPN Binding
59 [Arguments] ${vpn_id}
DR695Hd9794652019-07-19 18:20:40 -040060 ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD}
61 ${resp}= AAI.Run Get Request ${AAI_FRONTEND_ENDPOINT} ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id} auth=${auth}
Keong Limeff1eab2019-03-19 15:44:35 +110062 Should Be Equal As Strings ${resp.status_code} 200
63 [Return] ${resp.json()}
64
65Get Valid VPN Binding URL
66 [Documentation] Return Valid VPN Binding URL
67 [Arguments] ${vpn_id}
DR695Hd9794652019-07-19 18:20:40 -040068 ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD}
69 ${resp}= AAI.Run Get Request ${AAI_FRONTEND_ENDPOINT} ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id} auth=${auth}
Keong Limeff1eab2019-03-19 15:44:35 +110070 Should Be Equal As Strings ${resp.status_code} 200
71 [Return] ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id}
72
73Get Nodes Query VPN Binding
74 [Documentation] Return Nodes query VPN Binding
75 [Arguments] ${vpn_id}
DR695Hd9794652019-07-19 18:20:40 -040076 ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD}
77 ${resp}= AAI.Run Get Request ${AAI_FRONTEND_ENDPOINT} ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_NODES_PATH}?vpn-id=${vpn_id} auth=${auth}
Keong Limeff1eab2019-03-19 15:44:35 +110078 Should Be Equal As Strings ${resp.status_code} 200
79 [Return] ${resp.json()}
80
81Get Example VPN Binding
82 [Documentation] Return Example VPN Binding
DR695Hd9794652019-07-19 18:20:40 -040083 ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD}
84 ${resp}= AAI.Run Get Request ${AAI_FRONTEND_ENDPOINT} ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_EXAMPLES_PATH} auth=${auth}
Keong Limeff1eab2019-03-19 15:44:35 +110085 Should Be Equal As Strings ${resp.status_code} 200
86 [Return] ${resp.json()}
87
88Confirm No VPN Binding
89 [Documentation] Confirm No VPN Binding
90 [Arguments] ${vpn_id}
DR695Hd9794652019-07-19 18:20:40 -040091 ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD}
92 ${resp}= AAI.Run Get Request ${AAI_FRONTEND_ENDPOINT} ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id} auth=${auth}
Keong Limeff1eab2019-03-19 15:44:35 +110093 Should Be Equal As Strings ${resp.status_code} 404
94
Keong Limeff1eab2019-03-19 15:44:35 +110095Add VPN Binding Relationship
96 [Documentation] Adds Relationship to existing VPN Binding in AAI
97 [Arguments] ${vpn_id} ${related_class_name} ${related_object_url}
98 ${put_resp}= Add Relationship ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id} ${related_class_name} ${related_object_url}
99
100Get VPN Binding RelationshipList
101 [Documentation] Return relationship-list from VPN Binding
102 [Arguments] ${vpn_id}
103 ${resp}= Get RelationshipList ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id}
104 [Return] ${resp}
105
106Get VPN Binding With RelationshipList
107 [Documentation] Return VPN Binding with relationship-list
108 [Arguments] ${vpn_id}
109 ${resp}= Get Object With Depth ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id}
110 [Return] ${resp}
111