Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 1 | *** Settings *** |
Kailash Khalasi | 3a4e0f5 | 2017-06-01 16:35:59 -0700 | [diff] [blame] | 2 | Documentation Test suite for VTN Functionality |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 3 | Suite Setup Suite Setup |
| 4 | Suite Teardown Suite Teardown |
| 5 | Variables ../Framework/restApi.py |
| 6 | Library Collections |
| 7 | Library String |
| 8 | Library OperatingSystem |
| 9 | Library XML |
| 10 | Library RequestsLibrary |
| 11 | Library ../Framework/utils/utils.py |
| 12 | Library ../Framework/restApi.py |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 13 | Library ../Framework/utils/openstackUtils.py |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 14 | Variables ../Properties/RestApiProperties.py |
| 15 | Resource ../Framework/utils/utils.robot |
| 16 | |
| 17 | *** Variables *** |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 18 | ${VM_USER} admin |
| 19 | ${VM_PASS} admin |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 20 | ${head_node} head1 |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 21 | ${SSH_KEY} id_rsa.pub |
| 22 | ${ONOS_CORDVTN_API} http://onos-cord:8182/onos/cordvtn |
| 23 | ${CORE_SERVICE_PATHFILE} ${CURDIR}/data/Service.json |
| 24 | ${CORE_NETWORK_PATHFILE} ${CURDIR}/data/CoreNetwork.json |
| 25 | ${CORE_SLICE_PATHFILE} ${CURDIR}/data/CoreSlice.json |
| 26 | ${CORE_NETWORK_SLICE_PATHFILE} ${CURDIR}/data/CoreNetworkSlice.json |
| 27 | ${CORE_INSTANCE_PATHFILE} ${CURDIR}/data/CoreInstance.json |
| 28 | ${CORD_SUBSCRIBER_PATHFILE} ${CURDIR}/data/CordSubscriber.json |
| 29 | ${VOLT_TENANT_PATHFILE} ${CURDIR}/data/CordVoltTenant.json |
Kailash Khalasi | 3a4e0f5 | 2017-06-01 16:35:59 -0700 | [diff] [blame] | 30 | ${ciab_local} True |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 31 | ${physical_pod} True |
| 32 | ${default_flow_count} 42 |
| 33 | ${final_flow_count} 49 |
| 34 | ${expected_num_networks} 4 |
| 35 | ${expected_num_ports} 5 |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 36 | |
| 37 | *** Test Cases *** |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 38 | Validate Default OVS Flow Count |
| 39 | [Documentation] Logs into the compute-node where OVS is running and validates the default flow count |
| 40 | [Tags] ovsflows |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 41 | Wait Until Keyword Succeeds 30s 5s Validate Flow Count ${default_flow_count} |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 42 | |
| 43 | Validate Current VTN Service Networks and Ports |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 44 | [Documentation] Makes rest calls to XOS to validate the default VTN Service Networks + Ports (public,management,exampleservice_network,mysite_vsg-access) |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 45 | [Tags] vtn pod |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 46 | Validate Default CIAB Service Networks and Ports via XOS |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 47 | |
| 48 | Validate Default Subscriber |
| 49 | [Documentation] Validates the default subscriber set up in CIAB (My House) |
| 50 | [Tags] vsg |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 51 | ${resp}= CORD GET ${SERVER_IP} ${VOLT_SUBSCRIBER}/5 |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 52 | Should Be Equal As Strings ${resp.status_code} 200 |
| 53 | Log ${resp.content} |
| 54 | ${name}= Get Json Value ${resp.content} /name |
| 55 | ${service_specific_id}= Get Json Value ${resp.content} /service_specific_id |
| 56 | ${uplink_speed}= Get Json Value ${resp.content} /uplink_speed |
| 57 | Should Be Equal As Strings ${name} "My House" |
| 58 | Should Be Equal As Strings ${service_specific_id} "123" |
| 59 | Should Be Equal As Strings ${uplink_speed} 1000000000 |
| 60 | |
| 61 | Create New Test Service |
| 62 | [Documentation] Creates a generic service that will be used for the new VTN Network |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 63 | [Tags] vtn pod |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 64 | ${updatedcservList}= utils.setFieldValueInDict ${cservlist[0]} name CordVTN-Test-Service |
| 65 | ${updatedcservList}= utils.setFieldValueInDict ${updatedcservList} description Test Service for CordVTN Test Suite |
| 66 | ${resp}= Cord POST ${SERVER_IP} ${CH_CORE_SERVICES} ${updatedcservList} |
| 67 | Should Be Equal As Strings ${resp.status_code} 200 |
| 68 | ${name}= Get Json Value ${resp.content} /name |
| 69 | ${generic_service_id}= Get Json Value ${resp.content} /id |
| 70 | ${description}= Get Json Value ${resp.content} /description |
| 71 | ${kind}= Get Json Value ${resp.content} /kind |
| 72 | Should Be Equal As Strings ${name} "CordVTN-Test-Service" |
| 73 | Should Be Equal As Strings ${description} "Test Service for CordVTN Test Suite" |
| 74 | Should Be Equal As Strings ${kind} "generic" |
| 75 | Set Suite Variable ${generic_service_id} |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 76 | |
| 77 | Create New VTN Service Network |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 78 | [Documentation] Makes a POST Request to XOS to create a new core network |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 79 | [Tags] vtn pod |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 80 | ${updatedCnList}= utils.setFieldValueInDict ${cnlist[0]} template_id ${vsg_network_template_id} |
| 81 | ${updatedCnList}= utils.setFieldValueInDict ${updatedCnList} owner_id ${vsg_slice_id} |
| 82 | Log ${updatedCnList} |
| 83 | ${resp}= Cord POST ${SERVER_IP} ${CH_CORE_NETWORKS} ${cnlist[0]} |
| 84 | Should Be Equal As Strings ${resp.status_code} 200 |
| 85 | ${name}= Get Json Value ${resp.content} /name |
| 86 | ${network_id}= Get Json Value ${resp.content} /id |
| 87 | ${subnet}= Get Json Value ${resp.content} /subnet |
| 88 | ${start_ip}= Get Json Value ${resp.content} /start_ip |
| 89 | ${end_ip}= Get Json Value ${resp.content} /end_ip |
| 90 | Should Be Equal As Strings ${name} "test-network" |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 91 | Should Be Equal As Strings ${subnet} "2.2.2.0/24" |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 92 | Should Be Equal As Strings ${start_ip} "2.2.2.2" |
| 93 | Should Be Equal As Strings ${end_ip} "2.2.2.254" |
| 94 | Set Suite Variable ${network_id} |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 95 | |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 96 | Create New Slice with New Test Service |
| 97 | [Documentation] Makes a POST Request to XOS to create a new slice and adds new generic test service to that slice |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 98 | [Tags] vtn pod |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 99 | ${updatedCsList}= utils.setFieldValueInDict ${cslist[0]} service_id ${generic_service_id} |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 100 | #${updatedCsList}= utils.setFieldValueInDict ${cslist[0]} service_id 12 |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 101 | Log ${updatedCsList} |
| 102 | ${resp}= Cord POST ${SERVER_IP} ${CH_CORE_SLICES} ${updatedCsList} |
| 103 | Should Be Equal As Strings ${resp.status_code} 200 |
| 104 | ${name}= Get Json Value ${resp.content} /name |
| 105 | ${new_slice_id}= Get Json Value ${resp.content} /id |
| 106 | ${max_instances}= Get Json Value ${resp.content} /max_instances |
| 107 | ${ser_id}= Get Json Value ${resp.content} /service_id |
| 108 | ${default_isolation}= Get Json Value ${resp.content} /default_isolation |
| 109 | Should Be Equal As Strings ${name} "mysite_testservice" |
| 110 | Should Be Equal As Strings ${max_instances} 10 |
| 111 | Should Be Equal As Strings ${ser_id} ${generic_service_id} |
| 112 | Should Be Equal As Strings ${default_isolation} "vm" |
| 113 | Set Suite Variable ${new_slice_id} |
| 114 | |
| 115 | Add Networks to New Test Network Slice |
| 116 | [Documentation] Creates a new network slice for the new slice and adds mgmt and new network to it |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 117 | [Tags] vsg pod |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 118 | ${updatedCsList}= utils.setFieldValueInDict ${cnslist[0]} network_id ${network_id} |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 119 | #${updatedCsList}= utils.setFieldValueInDict ${cnslist[0]} network_id 5 |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 120 | ${updatedCsList}= utils.setFieldValueInDict ${updatedCsList} slice_id ${new_slice_id} |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 121 | #${updatedCsList}= utils.setFieldValueInDict ${updatedCsList} slice_id 5 |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 122 | Log ${updatedCsList} |
| 123 | ${resp}= Cord POST ${SERVER_IP} ${CH_CORE_NETWORK_SLICES} ${updatedCsList} |
| 124 | Should Be Equal As Strings ${resp.status_code} 200 |
| 125 | ${s_id}= Get Json Value ${resp.content} /slice_id |
| 126 | ${n_id}= Get Json Value ${resp.content} /network_id |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 127 | #Should Be Equal As Strings ${s_id} 5 |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 128 | Should Be Equal As Strings ${s_id} ${new_slice_id} |
| 129 | Should Be Equal As Strings ${n_id} ${network_id} |
| 130 | ##Add mgmt network to this network slice |
| 131 | ${updatedCsList}= utils.setFieldValueInDict ${cnslist[0]} network_id ${mgmt_network_id} |
| 132 | ${updatedCsList}= utils.setFieldValueInDict ${updatedCsList} slice_id ${new_slice_id} |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 133 | #${updatedCsList}= utils.setFieldValueInDict ${updatedCsList} slice_id 5 |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 134 | Log ${updatedCsList} |
| 135 | ${resp}= Cord POST ${SERVER_IP} ${CH_CORE_NETWORK_SLICES} ${updatedCsList} |
| 136 | Should Be Equal As Strings ${resp.status_code} 200 |
| 137 | ${s_id}= Get Json Value ${resp.content} /slice_id |
| 138 | ${n_id}= Get Json Value ${resp.content} /network_id |
| 139 | Should Be Equal As Strings ${s_id} ${new_slice_id} |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 140 | #Should Be Equal As Strings ${s_id} 5 |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 141 | Should Be Equal As Strings ${n_id} ${mgmt_network_id} |
| 142 | |
| 143 | Create New Test Instance |
| 144 | [Documentation] Creates a new instance for the test service |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 145 | [Tags] vsg pod |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 146 | ${updatedCiList}= utils.setFieldValueInDict ${cilist[0]} slice_id ${new_slice_id} |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 147 | #${updatedCiList}= utils.setFieldValueInDict ${cilist[0]} slice_id 5 |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 148 | ${updatedCiList}= utils.setFieldValueInDict ${updatedCiList} image_id ${image_id} |
| 149 | Log ${updatedCiList} |
| 150 | ${resp}= Cord POST ${SERVER_IP} ${CH_CORE_INSTANCES} ${updatedCiList} |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 151 | #${resp}= Cord POST ${SERVER_IP} ${CH_CORE_INSTANCES} ${cilist[0]} |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 152 | Should Be Equal As Strings ${resp.status_code} 200 |
| 153 | ${new_instance_id}= Get Json Value ${resp.content} /id |
| 154 | ${slice_id}= Get Json Value ${resp.content} /slice_id |
| 155 | ${i_id}= Get Json Value ${resp.content} /image_id |
| 156 | ${node_id}= Get Json Value ${resp.content} /node_id |
| 157 | ${name}= Get Json Value ${resp.content} /name |
| 158 | ${instance_name}= Get Json Value ${resp.content} /instance_name |
| 159 | Should Be Equal As Strings ${slice_id} ${new_slice_id} |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 160 | #Should Be Equal As Strings ${slice_id} 5 |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 161 | Should Be Equal As Strings ${i_id} ${image_id} |
| 162 | Should Be Equal As Strings ${node_id} 1 |
| 163 | Should Be Equal As Strings ${name} "mysite_testservice" |
| 164 | Should Be Equal As Strings ${instance_name} "mysite_testservice-1" |
| 165 | Set Suite Variable ${new_instance_id} |
| 166 | |
| 167 | Validate New OVS Flow Count |
| 168 | [Documentation] Logs into the compute-node where OVS is running and validates the new flow count (new flow rules for new volt tenant instance) |
| 169 | [Tags] ovsflows |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 170 | Wait Until Keyword Succeeds 300s 5s Validate Flow Count ${final_flow_count} |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 171 | |
| 172 | Validate Creation of Openstack Resources |
| 173 | [Documentation] Retrieves openstack compute node state and validates the new network and instance has been created properly |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 174 | [Tags] openstack pod |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 175 | Wait Until Keyword Succeeds 300s 5s Validate Openstack Network test-network 2.2.2.0/24 |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 176 | Sleep 300 |
| 177 | ${test_instance_name}= Get New Instance |
| 178 | Wait Until Keyword Succeeds 300s 5s Validate Openstack Nova Instance ${test_instance_name} test-network |
| 179 | Set Suite Variable ${test_instance_name} |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 180 | |
| 181 | Validate New Flows Pushed to OVS |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 182 | [Documentation] Logs into the compute-node where OVS is running and validates the new flows added |
Kailash Khalasi | 3a4e0f5 | 2017-06-01 16:35:59 -0700 | [diff] [blame] | 183 | [Tags] ovsflows |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 184 | ${ovs_flow_count}= Run Keyword If '${ciab_local}' == 'False' Execute Command on Compute Node in CIAB ${SERVER_IP} ${head_node} ${compute_node_hostname} ovs-ofctl dump-flows br-int | grep 2.2.2.0 | wc -l ELSE Execute Command Locally ssh -q root@${compute_node_hostname} "ovs-ofctl dump-flows br-int | grep 2.2.2.0 | wc -l" |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 185 | ${ovs_flow_count}= Get Line ${ovs_flow_count} 0 |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 186 | Should Be Equal As Integers ${ovs_flow_count} 2 |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 187 | ${flows_added}= Run Keyword If '${ciab_local}' == 'False' Execute Command on Compute Node in CIAB ${SERVER_IP} ${head_node} ${compute_node_hostname} ovs-ofctl dump-flows br-int ELSE Execute Command Locally ssh -q root@${compute_node_hostname} "ovs-ofctl dump-flows br-int" |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 188 | ${flows_added}= Get Lines Containing String ${flows_added} cookie= |
| 189 | Log ${flows_added} |
| 190 | ## Match src/dst (bi-directional) rules on new flows added |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 191 | Should Contain ${flows_added} nw_src=2.2.2.0/24,nw_dst=2.2.2.0/24 |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 192 | |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 193 | Create New Cord Subscriber |
| 194 | [Documentation] Creates a new cord root subscriber |
| 195 | [Tags] vsg |
| 196 | ${blacklist_sr_ids}= Get Subscriber Root IDs in Use |
| 197 | ${ss_id}= Generate Random Number from Blacklist ${blacklist_sr_ids} |
| 198 | Set Suite Variable ${ss_id} |
| 199 | ${updatedcsList}= utils.setFieldValueInDict ${csubList[0]} service_specific_id ${ss_id} |
| 200 | Log ${updatedcsList} |
| 201 | ${resp}= Cord POST ${SERVER_IP} ${VOLT_SUBSCRIBER} ${updatedcsList} |
| 202 | Should Be Equal As Strings ${resp.status_code} 200 |
| 203 | ${subscriber_root_id}= Get Json Value ${resp.content} /id |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 204 | ${enable_uverse}= Get Json Value ${resp.content} /enable_uverse |
| 205 | ${uplink_speed}= Get Json Value ${resp.content} /uplink_speed |
| 206 | ${downlink_speed}= Get Json Value ${resp.content} /downlink_speed |
| 207 | ${status}= Get Json Value ${resp.content} /status |
| 208 | ${is_demo_user}= Get Json Value ${resp.content} /is_demo_user |
| 209 | ${service_specific_id}= Get Json Value ${resp.content} /service_specific_id |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 210 | Should Be Equal As Strings ${enable_uverse} true |
| 211 | Should Be Equal As Strings ${uplink_speed} 1000000011 |
| 212 | Should Be Equal As Strings ${downlink_speed} 1000000011 |
| 213 | Should Be Equal As Strings ${status} "enabled" |
| 214 | Should Be Equal As Strings ${is_demo_user} false |
| 215 | Should Be Equal As Strings ${service_specific_id} "${ss_id}" |
| 216 | Set Suite Variable ${service_specific_id} |
| 217 | Set Suite Variable ${subscriber_root_id} |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 218 | |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 219 | Create New Volt Tenant for New Cord Subscriber |
| 220 | [Documentation] Creates a new volt tenant for the newly created cord root subscriber |
| 221 | [Tags] vsg |
| 222 | ${blacklist_tags}= Get Tags in Use |
| 223 | Log ${blacklist_tags} |
| 224 | ${s_tag}= Generate Random Number from Blacklist ${blacklist_tags} 1 4096 True |
| 225 | Append To List ${blacklist_tags} ${s_tag} |
| 226 | ${c_tag}= Generate Random Number from Blacklist ${blacklist_tags} 1 4096 True |
| 227 | Append To List ${blacklist_tags} ${c_tag} |
| 228 | Log ${blacklist_tags} |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 229 | ${updatedvtList}= utils.setFieldValueInDict ${vtList[0]} service_specific_id ${subscriber_root_id} |
| 230 | #${updatedvtList}= utils.setFieldValueInDict ${vtList[0]} subscriber_root_id ${subscriber_root_id} |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 231 | ${updatedvtList}= utils.setFieldValueInDict ${updatedvtList} s_tag ${s_tag} |
| 232 | ${updatedvtList}= utils.setFieldValueInDict ${updatedvtList} c_tag ${c_tag} |
| 233 | Log ${updatedvtList} |
| 234 | ${resp}= Cord POST ${SERVER_IP} ${VOLT_TENANT} ${vtList[0]} |
| 235 | Should Be Equal As Strings ${resp.status_code} 200 |
| 236 | ${volt_tenant_id}= Get Json Value ${resp.content} /id |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 237 | Set Suite Variable ${volt_tenant_id} |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 238 | ${stag}= Get Json Value ${resp.content} /s_tag |
| 239 | ${ctag}= Get Json Value ${resp.content} /c_tag |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 240 | ${ssid}= Get Json Value ${resp.content} /service_specific_id |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 241 | Should Be Equal As Strings ${stag} ${s_tag} |
| 242 | Should Be Equal As Strings ${ctag} ${c_tag} |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 243 | Should Be Equal As Strings ${ssid} "${subscriber_root_id}" |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 244 | |
| 245 | Validate Creation of New Subscriber Instance |
| 246 | [Documentation] Validates instance (vm) for new subscriber is created in the vsg slice |
| 247 | [Tags] openstack |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 248 | Sleep 300 |
| 249 | ${new_vsg_instance}= Get New Instance |
| 250 | Wait Until Keyword Succeeds 300s 5s Validate Openstack Nova Instance ${new_vsg_instance} mysite_vsg-access |
| 251 | Set Suite Variable ${new_vsg_instance} |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 252 | |
| 253 | Delete Volt Tenant |
| 254 | [Documentation] Deletes new volt tenant |
| 255 | [Tags] delete |
| 256 | ${resp}= Cord DELETE ${SERVER_IP} ${VOLT_TENANT} ${volt_tenant_id} |
| 257 | Should Be Equal As Strings ${resp.status_code} 200 |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 258 | Wait Until Keyword Succeeds 300s 5s Validate Openstack Nova Instance ${new_vsg_instance} mysite_vsg-access destroyed=True |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 259 | |
| 260 | Delete Cord Subscriber |
| 261 | [Documentation] Deletes new cord subscriber |
Kailash Khalasi | d01bec6 | 2017-05-30 13:53:01 -0700 | [diff] [blame] | 262 | [Tags] delete |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 263 | ${resp}= Cord DELETE ${SERVER_IP} ${VOLT_SUBSCRIBER} ${subscriber_root_id} |
| 264 | Should Be Equal As Strings ${resp.status_code} 200 |
| 265 | |
| 266 | Delete Test Instance |
| 267 | [Documentation] Deletes the test instance created previously |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 268 | [Tags] delete pod |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 269 | ${resp}= Cord DELETE ${SERVER_IP} ${CH_CORE_INSTANCES} ${new_instance_id} |
| 270 | Should Be Equal As Strings ${resp.status_code} 200 |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 271 | Wait Until Keyword Succeeds 300s 5s Validate Openstack Nova Instance ${test_instance_name} test-network destroyed=True |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 272 | |
| 273 | Delete Test Slice |
| 274 | [Documentation] Deletes the test slice created previously |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 275 | [Tags] delete pod |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 276 | ${resp}= Cord DELETE ${SERVER_IP} ${CH_CORE_SLICES} ${new_slice_id} |
| 277 | Should Be Equal As Strings ${resp.status_code} 200 |
| 278 | |
| 279 | Delete VTN Test Network |
| 280 | [Documentation] Deletes the test network created previously |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 281 | [Tags] delete pod |
Kailash Khalasi | 3a4e0f5 | 2017-06-01 16:35:59 -0700 | [diff] [blame] | 282 | ## Wait for test network to be destroyed via get neutron lists |
| 283 | ##TODO: Find someting to poll on rather than wait 5 mins |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 284 | #Sleep 300 |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 285 | ${resp}= Cord DELETE ${SERVER_IP} ${CH_CORE_NETWORKS} ${network_id} |
| 286 | Should Be Equal As Strings ${resp.status_code} 200 |
| 287 | |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 288 | Delete Test Service |
| 289 | [Documentation] Deletes the test service created |
| 290 | [Tags] delete pod |
| 291 | ${resp}= Cord DELETE ${SERVER_IP} ${CH_CORE_SERVICES} ${generic_service_id} |
| 292 | Should Be Equal As Strings ${resp.status_code} 200 |
| 293 | |
Kailash Khalasi | d01bec6 | 2017-05-30 13:53:01 -0700 | [diff] [blame] | 294 | Validate OVS Flow Count Back to Default |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 295 | [Documentation] Logs into the compute-node where OVS is running and validates the new flow count (new flow rules for new volt tenant instance) |
| 296 | [Tags] ovsflows |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 297 | Wait Until Keyword Succeeds 60s 5s Validate Flow Count ${default_flow_count} |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 298 | |
| 299 | Validate New Flows Removed From OVS |
| 300 | [Documentation] Validates that the flow rules added by ONOS from the network creation has been removed |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 301 | [Tags] ovsflows |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 302 | ${ovs_flow_count}= Run Keyword If '${ciab_local}' == 'False' Execute Command on Compute Node in CIAB ${SERVER_IP} ${head_node} ${compute_node_hostname} ovs-ofctl dump-flows br-int | grep 2.2.2.0 | wc -l ELSE Execute Command Locally ssh -q root@${compute_node_hostname} "ovs-ofctl dump-flows br-int | grep 2.2.2.0 | wc -l" |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 303 | ${ovs_flow_count}= Get Line ${ovs_flow_count} 0 |
| 304 | Should Be Equal As Integers ${ovs_flow_count} 0 |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 305 | ${flows_added}= Run Keyword If '${ciab_local}' == 'False' Execute Command on Compute Node in CIAB ${SERVER_IP} ${head_node} ${compute_node_hostname} ovs-ofctl dump-flows br-int ELSE Execute Command Locally ssh -q root@${compute_node_hostname} "ovs-ofctl dump-flows br-int" |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 306 | ${flows_added}= Get Lines Containing String ${flows_added} cookie= |
| 307 | Log ${flows_added} |
| 308 | ## Validate flow rules arent in the flows table |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 309 | Should Not Contain ${flows_added} nw_src=2.2.2.0/24,nw_dst=2.2.2.0/24 |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 310 | |
| 311 | *** Keywords *** |
| 312 | Suite Setup |
| 313 | ${auth} = Create List ${USER} ${PASSWD} |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 314 | ${HEADERS} Create Dictionary Content-Type=application/json |
| 315 | Create Session ${SERVER_IP} http://${SERVER_IP}:${SERVER_PORT} auth=${AUTH} headers=${HEADERS} |
| 316 | Read InputFile |
| 317 | ${vsg_service_id}= Get ID ${CH_CORE_SERVICES} name vsg |
| 318 | Set Suite Variable ${vsg_service_id} |
| 319 | ${vsg_network_template_id}= Get ID ${CH_CORE_NETWORK_TEMPLATES} name vsg |
| 320 | Set Suite Variable ${vsg_network_template_id} |
| 321 | ${mgmt_network_id}= Get ID ${CH_CORE_NETWORKS} name management |
| 322 | Set Suite Variable ${mgmt_network_id} |
| 323 | ${vsg_slice_id}= Get ID ${CH_CORE_SLICES} name mysite_vsg |
| 324 | Set Suite Variable ${vsg_slice_id} |
| 325 | ${volt_service_id}= Get ID ${CH_CORE_SERVICES} name volt |
| 326 | Set Suite Variable ${volt_service_id} |
| 327 | ${image_id}= Get ID ${CH_CORE_IMAGES} name trusty-server-multi-nic |
| 328 | Set Suite Variable ${image_id} |
| 329 | ##Get compute node information |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 330 | ${compute_node_hostname}= Run Keyword If '${ciab_local}' == 'False' Execute Command on CIAB Server in Specific VM ${SERVER_IP} ${head_node} cord prov list | grep node | awk '{print $2}' ELSE Execute Command Locally cord prov list | grep node | awk '{print $2}' |
| 331 | ${compute_node_ip}= Run Keyword If '${ciab_local}' == 'False' Execute Command on CIAB Server in Specific VM ${SERVER_IP} ${head_node} cord prov list | grep node | awk '{print $4}' ELSE Execute Command Locally cord prov list | grep node | awk '{print $4}' |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 332 | Set Suite Variable ${compute_node_hostname} |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 333 | Set Suite Variable ${compute_node_ip} |
| 334 | Get List of Instances |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 335 | |
| 336 | Suite Teardown |
| 337 | Delete All Sessions |
| 338 | Close All Connections |
| 339 | |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 340 | Read InputFile |
| 341 | ${coreServiceList} = utils.jsonToList ${CORE_SERVICE_PATHFILE} ServiceInfo |
| 342 | Set Suite Variable ${cservlist} ${coreServiceList} |
| 343 | ${coreNetworkList} = utils.jsonToList ${CORE_NETWORK_PATHFILE} NetworkInfo |
| 344 | Set Suite Variable ${cnlist} ${coreNetworkList} |
| 345 | ${coreSliceList} = utils.jsonToList ${CORE_SLICE_PATHFILE} SliceInfo |
| 346 | Set Suite Variable ${cslist} ${coreSliceList} |
| 347 | ${coreNetworkSliceList} = utils.jsonToList ${CORE_NETWORK_SLICE_PATHFILE} NetworkSliceInfo |
| 348 | Set Suite Variable ${cnslist} ${coreNetworkSliceList} |
| 349 | ${coreInstanceList} = utils.jsonToList ${CORE_INSTANCE_PATHFILE} InstanceInfo |
| 350 | Set Suite Variable ${cilist} ${coreInstanceList} |
| 351 | ${cordSubscriberList} = utils.jsonToList ${CORD_SUBSCRIBER_PATHFILE} CordSubscriberInfo |
| 352 | Set Suite Variable ${csubList} ${cordSubscriberList} |
| 353 | ${voltTenantList} = utils.jsonToList ${VOLT_TENANT_PATHFILE} VoltTenantInfo |
| 354 | Set Suite Variable ${vtList} ${voltTenantList} |
| 355 | |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 356 | CORD Get |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 357 | [Documentation] Make a GET call to the CORD controller |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 358 | [Arguments] ${session} ${service} |
| 359 | ${resp}= Get Request ${session} ${service} |
| 360 | Log ${resp.content} |
| 361 | [Return] ${resp} |
| 362 | |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 363 | CORD Post |
| 364 | [Documentation] Make a POST call to the CORD controller |
| 365 | [Arguments] ${session} ${service} ${data} |
| 366 | ${data}= Evaluate json.dumps(${data}) json |
| 367 | ${resp}= Post Request ${session} uri=${service} data=${data} |
| 368 | Log ${resp.content} |
| 369 | [Return] ${resp} |
| 370 | |
| 371 | CORD Delete |
| 372 | [Documentation] Make a DELETE call to the CORD controller |
| 373 | [Arguments] ${session} ${service} ${id} |
| 374 | ${resp}= Delete Request ${session} uri=${service}/${id} |
| 375 | Log ${resp.content} |
| 376 | [Return] ${resp} |
| 377 | |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 378 | Validate Default CIAB Service Networks and Ports via XOS |
| 379 | [Documentation] Using XOS API, this validates the default VTN Service Networks + Ports for a CIAB Environment |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 380 | @{expected_network_names}= Create List public management exampleservice_network mysite_vsg-access |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 381 | Run Keyword If '${physical_pod}' == 'True' Remove Values From List ${expected_network_names} exampleservice_network |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 382 | @{names}= Create List |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 383 | @{network_names}= Create List |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 384 | ${resp}= CORD GET ${SERVER_IP} ${CH_CORE_NETWORKS} |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 385 | Should Be Equal As Strings ${resp.status_code} 200 |
| 386 | ${jsondata}= To Json ${resp.content} |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 387 | Log ${jsondata} |
| 388 | ${length}= Get Length ${jsondata['items']} |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 389 | Should Be Equal As Integers ${length} ${expected_num_networks} |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 390 | : FOR ${INDEX} IN RANGE 0 ${length} |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 391 | \ ${item}= Get From List ${jsondata['items']} ${INDEX} |
| 392 | \ ${name}= Get From Dictionary ${item} name |
| 393 | \ Append To List ${names} ${name} |
| 394 | : FOR ${value} IN @{expected_network_names} |
| 395 | \ List Should Contain Value ${names} ${value} |
| 396 | ${resp}= CORD GET ${SERVER_IP} ${CH_CORE_PORTS} |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 397 | Should Be Equal As Strings ${resp.status_code} 200 |
| 398 | ${jsondata}= To Json ${resp.content} |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 399 | ${length}= Get Length ${jsondata['items']} |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 400 | Should Be Equal As Integers ${length} ${expected_num_ports} |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 401 | |
| 402 | Validate Default CIAB Service Networks via ONOSCORD |
| 403 | [Documentation] Validates the default VTN Service Network via ONOSCORD for a CIAB Environment |
| 404 | [Arguments] ${jsondata} |
| 405 | @{network_ids}= Create List |
| 406 | @{expected_types}= Create List PUBLIC PRIVATE MANAGEMENT_LOCAL VSG |
| 407 | @{expected_names}= Create List public exampleservice_network management mysite_vsg-access |
Kailash Khalasi | 9d8412d | 2017-06-09 15:00:33 -0700 | [diff] [blame] | 408 | Run Keyword If '${physical_pod}' == 'True' Remove From List ${expected_types} VSG |
| 409 | Run Keyword If '${physical_pod}' == 'True' Remove From List ${expected_names} exampleservice_network |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 410 | @{types}= Create List |
| 411 | @{names}= Create List |
| 412 | ${jsondata}= To Json ${jsondata} |
| 413 | ${length}= Get Length ${jsondata['ServiceNetworks']} |
| 414 | Should Be Equal As Integers ${length} 4 |
| 415 | : FOR ${INDEX} IN RANGE 0 ${length} |
| 416 | \ ${item}= Get From List ${jsondata['ServiceNetworks']} ${INDEX} |
| 417 | \ ${network_id}= Get From Dictionary ${item} id |
| 418 | \ ${type}= Get From Dictionary ${item} type |
| 419 | \ ${name}= Get From Dictionary ${item} name |
| 420 | \ Append To List ${network_ids} ${network_id} |
| 421 | \ Append To List ${types} ${type} |
| 422 | \ Append To List ${names} ${name} |
| 423 | \ Run Keyword If "${name}" == "management" Set Suite Variable ${management_network_id} ${network_id} |
| 424 | \ Run Keyword If "${name}" == "public" Set Suite Variable ${public_network_id} ${network_id} |
| 425 | : FOR ${value} IN @{expected_types} |
| 426 | \ List Should Contain Value ${types} ${value} |
| 427 | : FOR ${value} IN @{expected_names} |
| 428 | \ List Should Contain Value ${names} ${value} |
| 429 | Set Suite Variable ${network_ids} |
| 430 | |
| 431 | Validate Default CIAB Service Ports via ONOSCORD |
| 432 | [Documentation] Validates the default VTN Service Ports via ONOSCORD for a CIAB Environment |
| 433 | [Arguments] ${jsondata} |
| 434 | ${net_ids}= Create List |
| 435 | ${jsondata}= To Json ${jsondata} |
| 436 | ${length}= Get Length ${jsondata['ServicePorts']} |
| 437 | Should Be Equal As Integers ${length} 5 |
| 438 | : FOR ${INDEX} IN RANGE 0 ${length} |
| 439 | \ ${item}= Get From List ${jsondata['ServicePorts']} ${INDEX} |
| 440 | \ ${net_id}= Get From Dictionary ${item} network_id |
| 441 | \ Append To List ${net_ids} ${net_id} |
| 442 | : FOR ${value} IN @{net_ids} |
| 443 | \ List Should Contain Value ${network_ids} ${value} |
| 444 | ${management_len}= Count Values in List ${net_ids} ${management_network_id} |
| 445 | Should Be Equal As Integers ${management_len} 2 |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 446 | |
| 447 | Get ID |
| 448 | [Documentation] Retreives the id of any specific component |
| 449 | [Arguments] ${endpoint} ${item} ${match} |
| 450 | ${resp}= CORD GET ${SERVER_IP} ${endpoint} |
| 451 | Should Be Equal As Strings ${resp.status_code} 200 |
| 452 | ${jsondata}= To Json ${resp.content} |
| 453 | Log ${jsondata} |
| 454 | ${length}= Get Length ${jsondata['items']} |
| 455 | : FOR ${INDEX} IN RANGE 0 ${length} |
| 456 | \ ${value}= Get From List ${jsondata['items']} ${INDEX} |
| 457 | \ ${name}= Get From Dictionary ${value} ${item} |
| 458 | \ ${id}= Get From Dictionary ${value} id |
| 459 | \ Run Keyword If '${name}' == '${match}' Exit For Loop |
| 460 | [Return] ${id} |
| 461 | |
| 462 | Validate Flow Count |
| 463 | [Documentation] Gets the count of the flows pushed to an ovs switch and validates that against expected count |
| 464 | [Arguments] ${count} |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 465 | ${ovs_flow_count}= Run Keyword If '${ciab_local}' == 'False' Execute Command on Compute Node in CIAB ${SERVER_IP} ${head_node} ${compute_node_hostname} ovs-ofctl dump-flows br-int | wc -l ELSE Execute Command Locally ssh -q root@${compute_node_hostname} "ovs-ofctl dump-flows br-int | wc -l" |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 466 | ${ovs_flow_count}= Get Line ${ovs_flow_count} 0 |
| 467 | Should Be Equal As Integers ${ovs_flow_count} ${count} |
| 468 | |
| 469 | Get Subscriber Root IDs in Use |
| 470 | [Documentation] Retrieves information for current subscribers and "blacklists" their subscriber root ids |
| 471 | @{sr_id_blacklist}= Create List |
| 472 | ${resp}= CORD GET ${SERVER_IP} ${VOLT_SUBSCRIBER} |
| 473 | ${jsondata}= To Json ${resp.content} |
| 474 | ${length}= Get Length ${jsondata['items']} |
| 475 | : FOR ${INDEX} IN RANGE 0 ${length} |
| 476 | \ ${item}= Get From List ${jsondata['items']} ${INDEX} |
| 477 | \ ${id}= Get From Dictionary ${item} service_specific_id |
| 478 | \ Append To List ${sr_id_blacklist} ${id} |
| 479 | [Return] @{sr_id_blacklist} |
| 480 | |
| 481 | Get Tags in Use |
| 482 | [Documentation] Retrieves information for current active volt tenants and "blacklists" their s/c tags |
| 483 | @{tag_blacklist}= Create List |
| 484 | ${resp}= CORD GET ${SERVER_IP} ${VOLT_TENANT} |
| 485 | ${jsondata}= To Json ${resp.content} |
| 486 | ${length}= Get Length ${jsondata['items']} |
| 487 | : FOR ${INDEX} IN RANGE 0 ${length} |
| 488 | \ ${item}= Get From List ${jsondata['items']} ${INDEX} |
| 489 | \ ${s_tag}= Get From Dictionary ${item} s_tag |
| 490 | \ ${c_tag}= Get From Dictionary ${item} c_tag |
| 491 | \ Append To List ${tag_blacklist} ${s_tag} |
| 492 | \ Append To List ${tag_blacklist} ${c_tag} |
| 493 | [Return] @{tag_blacklist} |
| 494 | |
| 495 | Get Openstack Info |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 496 | [Documentation] Executes a command in the headnode vm in a CIAB environment where openstack is running |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 497 | [Arguments] ${cmd} |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 498 | ${output}= Run Keyword If '${ciab_local}' == 'False' Execute Command on CIAB Server in Specific VM ${SERVER_IP} ${head_node} source /opt/cord_profile/admin-openrc.sh; ${cmd} strip_line=False ELSE Execute Command Locally . /opt/cord_profile/admin-openrc.sh; ${cmd} |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 499 | Log ${output} |
| 500 | [Return] ${output} |
| 501 | |
| 502 | Validate Openstack Network |
| 503 | [Documentation] Validates that a particular network/subnet exists |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 504 | [Arguments] ${network_name} ${subnet} ${destroyed}=False |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 505 | ${netlist}= Get Openstack Info neutron net-list |
| 506 | Log ${netlist} |
| 507 | ${NET_DICT}= openstackUtils.Get Neutron Lists ${netlist} |
| 508 | Log ${NET_DICT} |
| 509 | ${test-net}= Get From Dictionary ${NET_DICT} ${network_name} |
| 510 | Should Contain ${test-net} ${subnet} |
| 511 | |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 512 | |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 513 | Validate Openstack Nova Instance |
| 514 | [Documentation] Validates that a particular nova instance/tenant exists |
| 515 | [Arguments] ${instance_name} ${network} ${destroyed}=False |
| 516 | ${novalist}= Get Openstack Info nova list --all-tenants |
| 517 | Log ${novalist} |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 518 | Run Keyword If '${destroyed}' == 'True' Should Not Contain ${novalist} ${instance_name} |
| 519 | ${INSTANCE_STATUS}= openstackUtils.Get Instance Status ${novalist} ${instance_name} |
| 520 | Run Keyword If '${destroyed}' == 'False' Should Contain ${INSTANCE_STATUS} ACTIVE |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 521 | ${NOVA_DICT}= openstackUtils.Get Nova Lists ${novalist} ${instance_name} |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 522 | Run Keyword If '${destroyed}' == 'False' Should Contain ${NOVA_DICT} ${network} |
| 523 | |
| 524 | Get List of Instances |
| 525 | ${instances}= Create List |
| 526 | Set Suite Variable ${instances} |
| 527 | ${resp}= Cord GET ${SERVER_IP} ${CH_CORE_INSTANCES} |
| 528 | Should Be Equal As Strings ${resp.status_code} 200 |
| 529 | ${jsondata}= To Json ${resp.content} |
| 530 | Log ${jsondata} |
| 531 | ${instance_length}= Get Length ${jsondata['items']} |
| 532 | : FOR ${INDEX} IN RANGE 0 ${instance_length} |
| 533 | \ ${item}= Get From List ${jsondata['items']} ${INDEX} |
| 534 | \ ${name}= Get From Dictionary ${item} instance_name |
| 535 | \ Append To List ${instances} ${name} |
| 536 | Log ${instances} |
| 537 | Set Suite Variable ${instance_length} |
| 538 | |
| 539 | Get New Instance |
| 540 | ${new_instance}= Set Variable null |
| 541 | ${resp}= Cord GET ${SERVER_IP} ${CH_CORE_INSTANCES} |
| 542 | Should Be Equal As Strings ${resp.status_code} 200 |
| 543 | ${jsondata}= To Json ${resp.content} |
| 544 | Log ${jsondata} |
| 545 | ${length}= Get Length ${jsondata['items']} |
| 546 | : FOR ${INDEX} IN RANGE 0 ${length} |
| 547 | \ ${item}= Get From List ${jsondata['items']} ${INDEX} |
| 548 | \ ${name}= Get From Dictionary ${item} instance_name |
| 549 | \ ${passed}= Run Keyword And Return Status List Should Contain Value ${instances} ${name} |
| 550 | \ ${new_instance}= Set Variable If '${passed}' == 'False' ${name} ${new_instance} |
| 551 | Log ${new_instance} |
| 552 | Append To List ${instances} ${new_instance} |
| 553 | [Return] ${new_instance} |