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