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