blob: c139f7cc5258cf8561dc9ef848c1acb2a150ee69 [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
6Resource ../json_templater.robot
7Resource aai_interface.robot
8Resource api_version_properties.robot
9Resource add-relationship-list.robot
10Library OperatingSystem
11Library Collections
12
13
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
18${AAI_ADD_VPNBINDING_BODY}= robot/assets/templates/aai/add-vpn-binding.template
19${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}
26 ${get_resp}= Run A&AI Get Request ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id}
27 Return From Keyword If '${get_resp.status_code}' == '200'
28 Create VPN Binding ${vpn_id}
29
30Create VPN Binding
31 [Documentation] Creates VPN Binding in AAI
32 [Arguments] ${vpn_id}
33 ${arguments}= Create Dictionary vpn_id=${vpn_id}
34 ${data}= Fill JSON Template File ${AAI_ADD_VPNBINDING_BODY} ${arguments}
35 ${put_resp}= Run A&AI Put Request ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id} ${data}
36 ${status_string}= Convert To String ${put_resp.status_code}
37 Should Match Regexp ${status_string} ^(201|200)$
38
39Delete VPN Binding If Exists
40 [Documentation] Removes VPN Binding from AAI if it exists
41 [Arguments] ${vpn_id}
42 ${get_resp}= Run A&AI Get Request ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id}
43 Run Keyword If '${get_resp.status_code}' == '200' Delete VPN Binding ${vpn_id} ${get_resp.json()}
44
45Delete VPN Binding
46 [Documentation] Removes VPN Binding from AAI
47 [Arguments] ${vpn_id} ${json}
48 ${resource_version}= Catenate ${json['resource-version']}
49 ${put_resp}= Run A&AI Delete Request ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id} ${resource_version}
50 Should Be Equal As Strings ${put_resp.status_code} 204
51
52Get VPN Binding
53 [Documentation] Return VPN Binding
54 [Arguments] ${vpn_id}
55 ${resp}= Run A&AI Get Request ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id}
56 Should Be Equal As Strings ${resp.status_code} 200
57 [Return] ${resp.json()}
58
59Get Valid VPN Binding URL
60 [Documentation] Return Valid VPN Binding URL
61 [Arguments] ${vpn_id}
62 ${resp}= Run A&AI Get Request ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id}
63 Should Be Equal As Strings ${resp.status_code} 200
64 [Return] ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id}
65
66Get Nodes Query VPN Binding
67 [Documentation] Return Nodes query VPN Binding
68 [Arguments] ${vpn_id}
69 ${resp}= Run A&AI Get Request ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_NODES_PATH}?vpn-id=${vpn_id}
70 Should Be Equal As Strings ${resp.status_code} 200
71 [Return] ${resp.json()}
72
73Get Example VPN Binding
74 [Documentation] Return Example VPN Binding
75 ${resp}= Run A&AI Get Request ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_EXAMPLES_PATH}
76 Should Be Equal As Strings ${resp.status_code} 200
77 [Return] ${resp.json()}
78
79Confirm No VPN Binding
80 [Documentation] Confirm No VPN Binding
81 [Arguments] ${vpn_id}
82 ${resp}= Run A&AI Get Request ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id}
83 Should Be Equal As Strings ${resp.status_code} 404
84
85# Not applicable to VPN Binding as it appears in all known API versions
86# Confirm API Not Implemented VPN Binding
87 # [Documentation] Confirm latest API version where VPN Binding is not implemented
88 # [Arguments] ${vpn_id}
89 # ${resp}= Run A&AI Get Request ${AAI_VPNB_API_NA_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id}
90 # Should Be Equal As Strings ${resp.status_code} 400
91
92Add VPN Binding Relationship
93 [Documentation] Adds Relationship to existing VPN Binding in AAI
94 [Arguments] ${vpn_id} ${related_class_name} ${related_object_url}
95 ${put_resp}= Add Relationship ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id} ${related_class_name} ${related_object_url}
96
97Get VPN Binding RelationshipList
98 [Documentation] Return relationship-list from VPN Binding
99 [Arguments] ${vpn_id}
100 ${resp}= Get RelationshipList ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id}
101 [Return] ${resp}
102
103Get VPN Binding With RelationshipList
104 [Documentation] Return VPN Binding with relationship-list
105 [Arguments] ${vpn_id}
106 ${resp}= Get Object With Depth ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id}
107 [Return] ${resp}
108