blob: 118032e5df0198a172a4ff6dd3a09522c52c9755 [file] [log] [blame]
Kailash Khalasib6e87fc2017-04-18 15:08:19 -07001*** Settings ***
Kailash Khalasi3a4e0f52017-06-01 16:35:59 -07002Documentation Test suite for VTN Functionality
Kailash Khalasib6e87fc2017-04-18 15:08:19 -07003Suite Setup Suite Setup
4Suite Teardown Suite Teardown
Kailash Khalasib6e87fc2017-04-18 15:08:19 -07005Library Collections
6Library String
7Library OperatingSystem
8Library XML
9Library RequestsLibrary
Zack Williams821c5022020-01-15 15:11:46 -070010Library CORDRobot
11Library ImportResource resources=CORDRobot
Kailash Khalasib6e87fc2017-04-18 15:08:19 -070012
13*** Variables ***
Kailash Khalasi2adbad82017-05-15 14:53:40 -070014${VM_USER} admin
15${VM_PASS} admin
Kailash Khalasif6de2592017-09-13 13:37:14 -070016${head_node} head1
Kailash Khalasi2adbad82017-05-15 14:53:40 -070017${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 Khalasi3a4e0f52017-06-01 16:35:59 -070026${ciab_local} True
Kailash Khalasi9d8412d2017-06-09 15:00:33 -070027${physical_pod} True
28${default_flow_count} 42
29${final_flow_count} 49
30${expected_num_networks} 4
31${expected_num_ports} 5
Kailash Khalasib6e87fc2017-04-18 15:08:19 -070032
33*** Test Cases ***
Kailash Khalasib6e87fc2017-04-18 15:08:19 -070034Validate 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 Khalasi9d8412d2017-06-09 15:00:33 -070037 Wait Until Keyword Succeeds 30s 5s Validate Flow Count ${default_flow_count}
Kailash Khalasib6e87fc2017-04-18 15:08:19 -070038
39Validate Current VTN Service Networks and Ports
Kailash Khalasi2adbad82017-05-15 14:53:40 -070040 [Documentation] Makes rest calls to XOS to validate the default VTN Service Networks + Ports (public,management,exampleservice_network,mysite_vsg-access)
Kailash Khalasi9d8412d2017-06-09 15:00:33 -070041 [Tags] vtn pod
Kailash Khalasib6e87fc2017-04-18 15:08:19 -070042 Validate Default CIAB Service Networks and Ports via XOS
Kailash Khalasi2adbad82017-05-15 14:53:40 -070043
44Validate Default Subscriber
45 [Documentation] Validates the default subscriber set up in CIAB (My House)
46 [Tags] vsg
Kailash Khalasif6de2592017-09-13 13:37:14 -070047 ${resp}= CORD GET ${SERVER_IP} ${VOLT_SUBSCRIBER}/5
Kailash Khalasi2adbad82017-05-15 14:53:40 -070048 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
57Create New Test Service
58 [Documentation] Creates a generic service that will be used for the new VTN Network
Kailash Khalasi9d8412d2017-06-09 15:00:33 -070059 [Tags] vtn pod
Zack Williams821c5022020-01-15 15:11:46 -070060 ${updatedcservList}= CORDRobot.setFieldValueInDict ${cservlist[0]} name CordVTN-Test-Service
61 ${updatedcservList}= CORDRobot.setFieldValueInDict ${updatedcservList} description Test Service for CordVTN Test Suite
Kailash Khalasi2adbad82017-05-15 14:53:40 -070062 ${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 Khalasib6e87fc2017-04-18 15:08:19 -070072
73Create New VTN Service Network
Kailash Khalasi2adbad82017-05-15 14:53:40 -070074 [Documentation] Makes a POST Request to XOS to create a new core network
Kailash Khalasi9d8412d2017-06-09 15:00:33 -070075 [Tags] vtn pod
Zack Williams821c5022020-01-15 15:11:46 -070076 ${updatedCnList}= CORDRobot.setFieldValueInDict ${cnlist[0]} template_id ${vsg_network_template_id}
77 ${updatedCnList}= CORDRobot.setFieldValueInDict ${updatedCnList} owner_id ${vsg_slice_id}
Kailash Khalasi2adbad82017-05-15 14:53:40 -070078 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 Khalasib6e87fc2017-04-18 15:08:19 -070087 Should Be Equal As Strings ${subnet} "2.2.2.0/24"
Kailash Khalasi2adbad82017-05-15 14:53:40 -070088 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 Khalasib6e87fc2017-04-18 15:08:19 -070091
Kailash Khalasi2adbad82017-05-15 14:53:40 -070092Create 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 Khalasi9d8412d2017-06-09 15:00:33 -070094 [Tags] vtn pod
Zack Williams821c5022020-01-15 15:11:46 -070095 ${updatedCsList}= CORDRobot.setFieldValueInDict ${cslist[0]} service_id ${generic_service_id}
96 #${updatedCsList}= CORDRobot.setFieldValueInDict ${cslist[0]} service_id 12
Kailash Khalasi2adbad82017-05-15 14:53:40 -070097 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
111Add 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 Khalasi9d8412d2017-06-09 15:00:33 -0700113 [Tags] vsg pod
Zack Williams821c5022020-01-15 15:11:46 -0700114 ${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 Khalasi2adbad82017-05-15 14:53:40 -0700118 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 Khalasif6de2592017-09-13 13:37:14 -0700123 #Should Be Equal As Strings ${s_id} 5
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700124 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 Williams821c5022020-01-15 15:11:46 -0700127 ${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 Khalasi2adbad82017-05-15 14:53:40 -0700130 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 Khalasif6de2592017-09-13 13:37:14 -0700136 #Should Be Equal As Strings ${s_id} 5
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700137 Should Be Equal As Strings ${n_id} ${mgmt_network_id}
138
139Create New Test Instance
140 [Documentation] Creates a new instance for the test service
Kailash Khalasi9d8412d2017-06-09 15:00:33 -0700141 [Tags] vsg pod
Zack Williams821c5022020-01-15 15:11:46 -0700142 ${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 Khalasi2adbad82017-05-15 14:53:40 -0700145 Log ${updatedCiList}
146 ${resp}= Cord POST ${SERVER_IP} ${CH_CORE_INSTANCES} ${updatedCiList}
Kailash Khalasif6de2592017-09-13 13:37:14 -0700147 #${resp}= Cord POST ${SERVER_IP} ${CH_CORE_INSTANCES} ${cilist[0]}
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700148 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 Khalasif6de2592017-09-13 13:37:14 -0700156 #Should Be Equal As Strings ${slice_id} 5
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700157 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
163Validate 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 Khalasi9d8412d2017-06-09 15:00:33 -0700166 Wait Until Keyword Succeeds 300s 5s Validate Flow Count ${final_flow_count}
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700167
168Validate Creation of Openstack Resources
169 [Documentation] Retrieves openstack compute node state and validates the new network and instance has been created properly
Kailash Khalasi9d8412d2017-06-09 15:00:33 -0700170 [Tags] openstack pod
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700171 Wait Until Keyword Succeeds 300s 5s Validate Openstack Network test-network 2.2.2.0/24
Kailash Khalasif6de2592017-09-13 13:37:14 -0700172 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 Khalasib6e87fc2017-04-18 15:08:19 -0700176
177Validate New Flows Pushed to OVS
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700178 [Documentation] Logs into the compute-node where OVS is running and validates the new flows added
Kailash Khalasi3a4e0f52017-06-01 16:35:59 -0700179 [Tags] ovsflows
Kailash Khalasif6de2592017-09-13 13:37:14 -0700180 ${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 Khalasib6e87fc2017-04-18 15:08:19 -0700181 ${ovs_flow_count}= Get Line ${ovs_flow_count} 0
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700182 Should Be Equal As Integers ${ovs_flow_count} 2
Kailash Khalasif6de2592017-09-13 13:37:14 -0700183 ${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 Khalasib6e87fc2017-04-18 15:08:19 -0700184 ${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 Khalasi2adbad82017-05-15 14:53:40 -0700187 Should Contain ${flows_added} nw_src=2.2.2.0/24,nw_dst=2.2.2.0/24
Kailash Khalasib6e87fc2017-04-18 15:08:19 -0700188
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700189Create 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 Williams821c5022020-01-15 15:11:46 -0700195 ${updatedcsList}= CORDRobot.setFieldValueInDict ${csubList[0]} service_specific_id ${ss_id}
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700196 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 Khalasi2adbad82017-05-15 14:53:40 -0700200 ${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 Khalasi2adbad82017-05-15 14:53:40 -0700206 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 Khalasib6e87fc2017-04-18 15:08:19 -0700214
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700215Create 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 Williams821c5022020-01-15 15:11:46 -0700225 ${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 Khalasi2adbad82017-05-15 14:53:40 -0700229 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 Khalasif6de2592017-09-13 13:37:14 -0700233 Set Suite Variable ${volt_tenant_id}
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700234 ${stag}= Get Json Value ${resp.content} /s_tag
235 ${ctag}= Get Json Value ${resp.content} /c_tag
Kailash Khalasif6de2592017-09-13 13:37:14 -0700236 ${ssid}= Get Json Value ${resp.content} /service_specific_id
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700237 Should Be Equal As Strings ${stag} ${s_tag}
238 Should Be Equal As Strings ${ctag} ${c_tag}
Kailash Khalasif6de2592017-09-13 13:37:14 -0700239 Should Be Equal As Strings ${ssid} "${subscriber_root_id}"
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700240
241Validate Creation of New Subscriber Instance
242 [Documentation] Validates instance (vm) for new subscriber is created in the vsg slice
243 [Tags] openstack
Kailash Khalasif6de2592017-09-13 13:37:14 -0700244 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 Khalasi2adbad82017-05-15 14:53:40 -0700248
249Delete 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 Khalasif6de2592017-09-13 13:37:14 -0700254 Wait Until Keyword Succeeds 300s 5s Validate Openstack Nova Instance ${new_vsg_instance} mysite_vsg-access destroyed=True
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700255
256Delete Cord Subscriber
257 [Documentation] Deletes new cord subscriber
Kailash Khalasid01bec62017-05-30 13:53:01 -0700258 [Tags] delete
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700259 ${resp}= Cord DELETE ${SERVER_IP} ${VOLT_SUBSCRIBER} ${subscriber_root_id}
260 Should Be Equal As Strings ${resp.status_code} 200
261
262Delete Test Instance
263 [Documentation] Deletes the test instance created previously
Kailash Khalasi9d8412d2017-06-09 15:00:33 -0700264 [Tags] delete pod
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700265 ${resp}= Cord DELETE ${SERVER_IP} ${CH_CORE_INSTANCES} ${new_instance_id}
266 Should Be Equal As Strings ${resp.status_code} 200
Kailash Khalasif6de2592017-09-13 13:37:14 -0700267 Wait Until Keyword Succeeds 300s 5s Validate Openstack Nova Instance ${test_instance_name} test-network destroyed=True
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700268
269Delete Test Slice
270 [Documentation] Deletes the test slice created previously
Kailash Khalasi9d8412d2017-06-09 15:00:33 -0700271 [Tags] delete pod
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700272 ${resp}= Cord DELETE ${SERVER_IP} ${CH_CORE_SLICES} ${new_slice_id}
273 Should Be Equal As Strings ${resp.status_code} 200
274
275Delete VTN Test Network
276 [Documentation] Deletes the test network created previously
Kailash Khalasi9d8412d2017-06-09 15:00:33 -0700277 [Tags] delete pod
Kailash Khalasi3a4e0f52017-06-01 16:35:59 -0700278 ## Wait for test network to be destroyed via get neutron lists
279 ##TODO: Find someting to poll on rather than wait 5 mins
Kailash Khalasi9d8412d2017-06-09 15:00:33 -0700280 #Sleep 300
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700281 ${resp}= Cord DELETE ${SERVER_IP} ${CH_CORE_NETWORKS} ${network_id}
282 Should Be Equal As Strings ${resp.status_code} 200
283
Kailash Khalasi9d8412d2017-06-09 15:00:33 -0700284Delete 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 Khalasid01bec62017-05-30 13:53:01 -0700290Validate OVS Flow Count Back to Default
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700291 [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 Khalasif6de2592017-09-13 13:37:14 -0700293 Wait Until Keyword Succeeds 60s 5s Validate Flow Count ${default_flow_count}
Kailash Khalasib6e87fc2017-04-18 15:08:19 -0700294
295Validate New Flows Removed From OVS
296 [Documentation] Validates that the flow rules added by ONOS from the network creation has been removed
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700297 [Tags] ovsflows
Kailash Khalasif6de2592017-09-13 13:37:14 -0700298 ${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 Khalasib6e87fc2017-04-18 15:08:19 -0700299 ${ovs_flow_count}= Get Line ${ovs_flow_count} 0
300 Should Be Equal As Integers ${ovs_flow_count} 0
Kailash Khalasif6de2592017-09-13 13:37:14 -0700301 ${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 Khalasib6e87fc2017-04-18 15:08:19 -0700302 ${flows_added}= Get Lines Containing String ${flows_added} cookie=
303 Log ${flows_added}
304 ## Validate flow rules arent in the flows table
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700305 Should Not Contain ${flows_added} nw_src=2.2.2.0/24,nw_dst=2.2.2.0/24
Kailash Khalasib6e87fc2017-04-18 15:08:19 -0700306
307*** Keywords ***
308Suite Setup
Kailash Khalasi68f9f632018-04-11 08:09:19 -0700309 ${auth} = Create List ${XOS_USER} ${XOS_PASSWD}
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700310 ${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 Khalasif6de2592017-09-13 13:37:14 -0700326 ${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 Khalasi2adbad82017-05-15 14:53:40 -0700328 Set Suite Variable ${compute_node_hostname}
Kailash Khalasif6de2592017-09-13 13:37:14 -0700329 Set Suite Variable ${compute_node_ip}
330 Get List of Instances
Kailash Khalasib6e87fc2017-04-18 15:08:19 -0700331
332Suite Teardown
333 Delete All Sessions
334 Close All Connections
335
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700336Read InputFile
Zack Williams821c5022020-01-15 15:11:46 -0700337 ${coreServiceList} = CORDRobot.jsonToList ${CORE_SERVICE_PATHFILE} ServiceInfo
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700338 Set Suite Variable ${cservlist} ${coreServiceList}
Zack Williams821c5022020-01-15 15:11:46 -0700339 ${coreNetworkList} = CORDRobot.jsonToList ${CORE_NETWORK_PATHFILE} NetworkInfo
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700340 Set Suite Variable ${cnlist} ${coreNetworkList}
Zack Williams821c5022020-01-15 15:11:46 -0700341 ${coreSliceList} = CORDRobot.jsonToList ${CORE_SLICE_PATHFILE} SliceInfo
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700342 Set Suite Variable ${cslist} ${coreSliceList}
Zack Williams821c5022020-01-15 15:11:46 -0700343 ${coreNetworkSliceList} = CORDRobot.jsonToList ${CORE_NETWORK_SLICE_PATHFILE} NetworkSliceInfo
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700344 Set Suite Variable ${cnslist} ${coreNetworkSliceList}
Zack Williams821c5022020-01-15 15:11:46 -0700345 ${coreInstanceList} = CORDRobot.jsonToList ${CORE_INSTANCE_PATHFILE} InstanceInfo
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700346 Set Suite Variable ${cilist} ${coreInstanceList}
Zack Williams821c5022020-01-15 15:11:46 -0700347 ${cordSubscriberList} = CORDRobot.jsonToList ${CORD_SUBSCRIBER_PATHFILE} CordSubscriberInfo
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700348 Set Suite Variable ${csubList} ${cordSubscriberList}
Zack Williams821c5022020-01-15 15:11:46 -0700349 ${voltTenantList} = CORDRobot.jsonToList ${VOLT_TENANT_PATHFILE} VoltTenantInfo
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700350 Set Suite Variable ${vtList} ${voltTenantList}
351
Kailash Khalasib6e87fc2017-04-18 15:08:19 -0700352CORD Get
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700353 [Documentation] Make a GET call to the CORD controller
Kailash Khalasib6e87fc2017-04-18 15:08:19 -0700354 [Arguments] ${session} ${service}
355 ${resp}= Get Request ${session} ${service}
356 Log ${resp.content}
357 [Return] ${resp}
358
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700359CORD 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
367CORD 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 Khalasib6e87fc2017-04-18 15:08:19 -0700374Validate 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 Khalasib6e87fc2017-04-18 15:08:19 -0700376 @{expected_network_names}= Create List public management exampleservice_network mysite_vsg-access
Kailash Khalasi9d8412d2017-06-09 15:00:33 -0700377 Run Keyword If '${physical_pod}' == 'True' Remove Values From List ${expected_network_names} exampleservice_network
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700378 @{names}= Create List
Kailash Khalasib6e87fc2017-04-18 15:08:19 -0700379 @{network_names}= Create List
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700380 ${resp}= CORD GET ${SERVER_IP} ${CH_CORE_NETWORKS}
Kailash Khalasib6e87fc2017-04-18 15:08:19 -0700381 Should Be Equal As Strings ${resp.status_code} 200
382 ${jsondata}= To Json ${resp.content}
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700383 Log ${jsondata}
384 ${length}= Get Length ${jsondata['items']}
Kailash Khalasi9d8412d2017-06-09 15:00:33 -0700385 Should Be Equal As Integers ${length} ${expected_num_networks}
Kailash Khalasib6e87fc2017-04-18 15:08:19 -0700386 : FOR ${INDEX} IN RANGE 0 ${length}
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700387 \ ${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 Khalasib6e87fc2017-04-18 15:08:19 -0700393 Should Be Equal As Strings ${resp.status_code} 200
394 ${jsondata}= To Json ${resp.content}
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700395 ${length}= Get Length ${jsondata['items']}
Kailash Khalasi9d8412d2017-06-09 15:00:33 -0700396 Should Be Equal As Integers ${length} ${expected_num_ports}
Kailash Khalasib6e87fc2017-04-18 15:08:19 -0700397
398Validate 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 Khalasi9d8412d2017-06-09 15:00:33 -0700404 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 Khalasib6e87fc2017-04-18 15:08:19 -0700406 @{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
427Validate 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 Khalasi2adbad82017-05-15 14:53:40 -0700442
443Get 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
458Validate 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 Khalasif6de2592017-09-13 13:37:14 -0700461 ${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 Khalasi2adbad82017-05-15 14:53:40 -0700462 ${ovs_flow_count}= Get Line ${ovs_flow_count} 0
463 Should Be Equal As Integers ${ovs_flow_count} ${count}
464
465Get 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
477Get 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
491Get Openstack Info
Kailash Khalasif6de2592017-09-13 13:37:14 -0700492 [Documentation] Executes a command in the headnode vm in a CIAB environment where openstack is running
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700493 [Arguments] ${cmd}
Kailash Khalasif6de2592017-09-13 13:37:14 -0700494 ${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 Khalasi2adbad82017-05-15 14:53:40 -0700495 Log ${output}
496 [Return] ${output}
497
498Validate Openstack Network
499 [Documentation] Validates that a particular network/subnet exists
Kailash Khalasif6de2592017-09-13 13:37:14 -0700500 [Arguments] ${network_name} ${subnet} ${destroyed}=False
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700501 ${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 Khalasif6de2592017-09-13 13:37:14 -0700508
Kailash Khalasi2adbad82017-05-15 14:53:40 -0700509Validate 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 Khalasif6de2592017-09-13 13:37:14 -0700514 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 Khalasi2adbad82017-05-15 14:53:40 -0700517 ${NOVA_DICT}= openstackUtils.Get Nova Lists ${novalist} ${instance_name}
Kailash Khalasif6de2592017-09-13 13:37:14 -0700518 Run Keyword If '${destroyed}' == 'False' Should Contain ${NOVA_DICT} ${network}
519
520Get 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
535Get 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}