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 | 3bb6cf4 | 2019-06-20 15:04:04 -0400 | [diff] [blame^] | 11 | Library ONAPLibrary.Templating |
Keong Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame] | 12 | |
| 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 |
DR695H | 3bb6cf4 | 2019-06-20 15:04:04 -0400 | [diff] [blame^] | 17 | ${AAI_ADD_VPNBINDING_BODY}= aai/add-vpn-binding.jinja |
Keong Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame] | 18 | ${AAI_VPNB_API_NA_INDEX_PATH}= ${AAI_BEIJING_INDEX_PATH} |
| 19 | ${AAI_VPNB_API_IMPL_INDEX_PATH}= ${AAI_CASABLANCA_INDEX_PATH} |
| 20 | |
| 21 | *** Keywords *** |
| 22 | Create 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 | |
| 29 | Create VPN Binding |
| 30 | [Documentation] Creates VPN Binding in AAI |
| 31 | [Arguments] ${vpn_id} |
| 32 | ${arguments}= Create Dictionary vpn_id=${vpn_id} |
DR695H | 3bb6cf4 | 2019-06-20 15:04:04 -0400 | [diff] [blame^] | 33 | Create Environment aai ${GLOBAL_TEMPLATE_FOLDER} |
| 34 | ${data}= Apply Template aai ${AAI_ADD_VPNBINDING_BODY} ${arguments} |
Keong Lim | eff1eab | 2019-03-19 15:44:35 +1100 | [diff] [blame] | 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 | |
| 39 | Delete 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 | |
| 45 | Delete 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 | |
| 52 | Get 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 | |
| 59 | Get 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 | |
| 66 | Get 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 | |
| 73 | Get 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 | |
| 79 | Confirm 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 | |
| 92 | Add 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 | |
| 97 | Get 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 | |
| 103 | Get 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 | |