blob: 67789e27e91ccb33687815690c31284cb786b4ef [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
DR695H3bb6cf42019-06-20 15:04:04 -040011Library ONAPLibrary.Templating
Keong Limeff1eab2019-03-19 15:44:35 +110012
13*** Variables ***
14${AAI_VPNB_ROOT_PATH} /network/vpn-bindings/vpn-binding
15${AAI_VPNB_EXAMPLES_PATH} /examples/vpn-bindings
16${AAI_VPNB_NODES_PATH} /nodes/vpn-bindings
DR695H3bb6cf42019-06-20 15:04:04 -040017${AAI_ADD_VPNBINDING_BODY}= aai/add-vpn-binding.jinja
Keong Limeff1eab2019-03-19 15:44:35 +110018${AAI_VPNB_API_NA_INDEX_PATH}= ${AAI_BEIJING_INDEX_PATH}
19${AAI_VPNB_API_IMPL_INDEX_PATH}= ${AAI_CASABLANCA_INDEX_PATH}
20
21*** Keywords ***
22Create VPN Binding If Not Exists
23 [Documentation] Creates VPN Binding in AAI if it doesn't exist
24 [Arguments] ${vpn_id}
25 ${get_resp}= Run A&AI Get Request ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id}
26 Return From Keyword If '${get_resp.status_code}' == '200'
27 Create VPN Binding ${vpn_id}
28
29Create VPN Binding
30 [Documentation] Creates VPN Binding in AAI
31 [Arguments] ${vpn_id}
32 ${arguments}= Create Dictionary vpn_id=${vpn_id}
DR695H3bb6cf42019-06-20 15:04:04 -040033 Create Environment aai ${GLOBAL_TEMPLATE_FOLDER}
34 ${data}= Apply Template aai ${AAI_ADD_VPNBINDING_BODY} ${arguments}
Keong Limeff1eab2019-03-19 15:44:35 +110035 ${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