Keong Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation 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 Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame] | 6 | Resource aai_interface.robot |
| 7 | Resource api_version_properties.robot |
| 8 | Resource add-relationship-list.robot |
| 9 | Library OperatingSystem |
| 10 | Library Collections |
DR695H | d979465 | 2019-07-19 18:20:40 -0400 | [diff] [blame^] | 11 | Library ONAPLibrary.Templating WITH NAME Templating |
| 12 | Library ONAPLibrary.AAI WITH NAME AAI |
Keong Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame] | 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 |
DR695H | 3bb6cf4 | 2019-06-20 15:04:04 -0400 | [diff] [blame] | 18 | ${AAI_ADD_VPNBINDING_BODY}= aai/add-vpn-binding.jinja |
Keong Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame] | 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 *** |
| 23 | Create VPN Binding If Not Exists |
| 24 | [Documentation] Creates VPN Binding in AAI if it doesn't exist |
| 25 | [Arguments] ${vpn_id} |
DR695H | d979465 | 2019-07-19 18:20:40 -0400 | [diff] [blame^] | 26 | ${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 Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame] | 28 | Return From Keyword If '${get_resp.status_code}' == '200' |
| 29 | Create VPN Binding ${vpn_id} |
| 30 | |
| 31 | Create VPN Binding |
| 32 | [Documentation] Creates VPN Binding in AAI |
| 33 | [Arguments] ${vpn_id} |
| 34 | ${arguments}= Create Dictionary vpn_id=${vpn_id} |
DR695H | d979465 | 2019-07-19 18:20:40 -0400 | [diff] [blame^] | 35 | 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 Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame] | 39 | ${status_string}= Convert To String ${put_resp.status_code} |
| 40 | Should Match Regexp ${status_string} ^(201|200)$ |
| 41 | |
| 42 | Delete VPN Binding If Exists |
| 43 | [Documentation] Removes VPN Binding from AAI if it exists |
| 44 | [Arguments] ${vpn_id} |
DR695H | d979465 | 2019-07-19 18:20:40 -0400 | [diff] [blame^] | 45 | ${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 Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame] | 47 | Run Keyword If '${get_resp.status_code}' == '200' Delete VPN Binding ${vpn_id} ${get_resp.json()} |
| 48 | |
| 49 | Delete VPN Binding |
| 50 | [Documentation] Removes VPN Binding from AAI |
| 51 | [Arguments] ${vpn_id} ${json} |
| 52 | ${resource_version}= Catenate ${json['resource-version']} |
DR695H | d979465 | 2019-07-19 18:20:40 -0400 | [diff] [blame^] | 53 | ${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 Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame] | 55 | Should Be Equal As Strings ${put_resp.status_code} 204 |
| 56 | |
| 57 | Get VPN Binding |
| 58 | [Documentation] Return VPN Binding |
| 59 | [Arguments] ${vpn_id} |
DR695H | d979465 | 2019-07-19 18:20:40 -0400 | [diff] [blame^] | 60 | ${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 Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame] | 62 | Should Be Equal As Strings ${resp.status_code} 200 |
| 63 | [Return] ${resp.json()} |
| 64 | |
| 65 | Get Valid VPN Binding URL |
| 66 | [Documentation] Return Valid VPN Binding URL |
| 67 | [Arguments] ${vpn_id} |
DR695H | d979465 | 2019-07-19 18:20:40 -0400 | [diff] [blame^] | 68 | ${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 Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame] | 70 | Should Be Equal As Strings ${resp.status_code} 200 |
| 71 | [Return] ${AAI_VPNB_API_IMPL_INDEX_PATH}${AAI_VPNB_ROOT_PATH}/${vpn_id} |
| 72 | |
| 73 | Get Nodes Query VPN Binding |
| 74 | [Documentation] Return Nodes query VPN Binding |
| 75 | [Arguments] ${vpn_id} |
DR695H | d979465 | 2019-07-19 18:20:40 -0400 | [diff] [blame^] | 76 | ${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 Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame] | 78 | Should Be Equal As Strings ${resp.status_code} 200 |
| 79 | [Return] ${resp.json()} |
| 80 | |
| 81 | Get Example VPN Binding |
| 82 | [Documentation] Return Example VPN Binding |
DR695H | d979465 | 2019-07-19 18:20:40 -0400 | [diff] [blame^] | 83 | ${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 Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame] | 85 | Should Be Equal As Strings ${resp.status_code} 200 |
| 86 | [Return] ${resp.json()} |
| 87 | |
| 88 | Confirm No VPN Binding |
| 89 | [Documentation] Confirm No VPN Binding |
| 90 | [Arguments] ${vpn_id} |
DR695H | d979465 | 2019-07-19 18:20:40 -0400 | [diff] [blame^] | 91 | ${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 Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame] | 93 | Should Be Equal As Strings ${resp.status_code} 404 |
| 94 | |
Keong Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame] | 95 | Add 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 | |
| 100 | Get 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 | |
| 106 | Get 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 | |