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