2 Documentation Openstack library. This library is useful for tests to create network, subnet, router and vm instances
4 Resource DataModels.robot
6 Resource L2GatewayOperations.robot
7 Resource ../variables/Variables.robot
8 Variables ../variables/netvirt/Modules.py
12 [Arguments] ${force}=no ${source_pwd}=yes
13 [Documentation] Sourcing the Openstack PAsswords for neutron configurations
14 Run Keyword If '${source_pwd}' == 'yes' or '${force}' == 'yes' Write Commands Until Prompt cd ${DEVSTACK_DEPLOY_PATH}; source openrc admin admin
16 Get Tenant ID From Security Group
17 [Documentation] Returns tenant ID by reading it from existing default security-group.
18 ${devstack_conn_id}= Get ControlNode Connection
19 Switch Connection ${devstack_conn_id}
20 ${output}= Write Commands Until Prompt neutron security-group-show default | grep "| tenant_id" | awk '{print $4}'
24 Get Tenant ID From Network
25 [Arguments] ${network_uuid}
26 [Documentation] Returns tenant ID by reading it from existing network.
27 ${resp}= Get_From_Uri uri=${CONFIG_API}/neutron:neutron/networks/network/${network_uuid}/ accept=${ACCEPT_EMPTY} session=session
28 ${tenant_id}= Utils.Extract Value From Content ${resp} /network/0/tenant-id strip
32 [Arguments] ${network_name} ${additional_args}=${EMPTY} ${verbose}=TRUE
33 [Documentation] Create Network with neutron request.
34 ${devstack_conn_id}= Get ControlNode Connection
35 Switch Connection ${devstack_conn_id}
36 ${command} Set Variable If "${verbose}" == "TRUE" neutron -v net-create ${network_name} ${additional_args} neutron net-create ${network_name} ${additional_args} | grep -w id | awk '{print $4}'
37 ${output}= Write Commands Until Prompt ${command} 30s
42 [Arguments] ${network_name} ${additional_args}=${EMPTY}
43 [Documentation] Update Network with neutron request.
44 ${devstack_conn_id}= Get ControlNode Connection
45 Switch Connection ${devstack_conn_id}
46 ${output}= Write Commands Until Prompt neutron -v net-update ${network_name} ${additional_args} 30s
52 [Arguments] ${network_name}
53 [Documentation] Show Network with neutron request.
54 ${devstack_conn_id}= Get ControlNode Connection
55 Switch Connection ${devstack_conn_id}
56 ${output}= Write Commands Until Prompt neutron -v net-show ${network_name} 30s
62 [Documentation] List networks and return output with neutron client.
63 ${devstack_conn_id}= Get ControlNode Connection
64 Switch Connection ${devstack_conn_id}
65 ${output}= Write Commands Until Prompt neutron net-list 30s
71 [Documentation] List subnets and return output with neutron client.
72 ${devstack_conn_id}= Get ControlNode Connection
73 Switch Connection ${devstack_conn_id}
74 ${output}= Write Commands Until Prompt neutron subnet-list 30s
80 [Arguments] ${network_name}
81 [Documentation] Delete Network with neutron request.
82 ${devstack_conn_id}= Get ControlNode Connection
83 Switch Connection ${devstack_conn_id}
84 ${output}= Write Commands Until Prompt neutron -v net-delete ${network_name} 30s
87 Should Match Regexp ${output} Deleted network: ${network_name}|Deleted network\\(s\\): ${network_name}
90 [Arguments] ${network_name} ${subnet} ${range_ip} ${additional_args}=${EMPTY}
91 [Documentation] Create SubNet for the Network with neutron request.
92 ${devstack_conn_id}= Get ControlNode Connection
93 Switch Connection ${devstack_conn_id}
94 ${output}= Write Commands Until Prompt neutron -v subnet-create ${network_name} ${range_ip} --name ${subnet} ${additional_args} 30s
97 Should Contain ${output} Created a new subnet
100 [Arguments] ${subnet_name} ${additional_args}=${EMPTY}
101 [Documentation] Update subnet with neutron request.
102 ${devstack_conn_id}= Get ControlNode Connection
103 Switch Connection ${devstack_conn_id}
104 ${output}= Write Commands Until Prompt neutron -v subnet-update ${subnet_name} ${additional_args} 30s
110 [Arguments] ${subnet_name}
111 [Documentation] Show subnet with neutron request.
112 ${devstack_conn_id}= Get ControlNode Connection
113 Switch Connection ${devstack_conn_id}
114 ${output}= Write Commands Until Prompt neutron -v subnet-show ${subnet_name} 30s
120 [Arguments] ${network_name} ${port_name} ${sg}=default ${additional_args}=${EMPTY}
121 [Documentation] Create Port with neutron request.
122 ${devstack_conn_id}= Get ControlNode Connection
123 Switch Connection ${devstack_conn_id}
124 ${output}= Write Commands Until Prompt neutron -v port-create ${network_name} --name ${port_name} --security-group ${sg} ${additional_args} 30s
127 Should Contain ${output} Created a new port
130 [Arguments] ${port_name} ${additional_args}=${EMPTY}
131 [Documentation] Update port with neutron request.
132 ${devstack_conn_id}= Get ControlNode Connection
133 Switch Connection ${devstack_conn_id}
134 ${output}= Write Commands Until Prompt neutron -v port-update ${port_name} ${additional_args} 30s
140 [Arguments] ${port_name}
141 [Documentation] Show port with neutron request.
142 ${devstack_conn_id}= Get ControlNode Connection
143 Switch Connection ${devstack_conn_id}
144 ${output}= Write Commands Until Prompt neutron -v port-show ${port_name} 30s
150 [Arguments] ${port_name}
151 [Documentation] Delete Port with neutron request.
152 ${devstack_conn_id}= Get ControlNode Connection
153 Switch Connection ${devstack_conn_id}
154 ${output}= Write Commands Until Prompt neutron -v port-delete ${port_name} 30s
157 Should Match Regexp ${output} Deleted port: ${port_name}|Deleted port\\(s\\): ${port_name}
160 [Documentation] List ports and return output with neutron client.
161 ${devstack_conn_id}= Get ControlNode Connection
162 Switch Connection ${devstack_conn_id}
163 ${output}= Write Commands Until Prompt neutron port-list 30s
169 [Documentation] List VMs and return output with nova client.
170 ${devstack_conn_id}= Get ControlNode Connection
171 Switch Connection ${devstack_conn_id}
172 ${output}= Write Commands Until Prompt nova list 30s
177 Create And Associate Floating IPs
178 [Arguments] ${external_net} @{vm_list}
179 [Documentation] Create and associate floating IPs to VMs with nova request
180 ${devstack_conn_id}= Get ControlNode Connection
181 Switch Connection ${devstack_conn_id}
182 ${ip_list}= Create List @{EMPTY}
183 : FOR ${vm} IN @{vm_list}
184 \ ${output}= Write Commands Until Prompt neutron floatingip-create ${external_net} 30s
186 \ @{ip} Get Regexp Matches ${output} [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}
187 \ ${ip_length} Get Length ${ip}
188 \ Run Keyword If ${ip_length}>0 Append To List ${ip_list} @{ip}[0]
189 \ ... ELSE Append To List ${ip_list} None
190 \ ${output}= Write Commands Until Prompt nova floating-ip-associate ${vm} @{ip}[0] 30s
195 [Documentation] Verifies the Gateway Ips with dump flow.
196 ${output}= Write Commands Until Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
198 : FOR ${GatewayIpElement} IN @{GATEWAY_IPS}
199 \ Should Contain ${output} ${GatewayIpElement}
202 [Documentation] Verifies the Dhcp Ips with dump flow.
203 ${output}= Write Commands Until Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
205 : FOR ${DhcpIpElement} IN @{DHCP_IPS}
206 \ Should Contain ${output} ${DhcpIpElement}
209 [Documentation] Verifies the Dhcp Ips with dump flow.
210 ${output}= Write Commands Until Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
212 : FOR ${DhcpIpElement} IN @{DHCP_IPS}
213 \ Should Not Contain ${output} ${DhcpIpElement}
216 [Arguments] ${subnet}
217 [Documentation] Delete SubNet for the Network with neutron request.
219 ${devstack_conn_id}= Get ControlNode Connection
220 Switch Connection ${devstack_conn_id}
221 ${output}= Write Commands Until Prompt neutron -v subnet-delete ${subnet}
224 Should Match Regexp ${output} Deleted subnet: ${subnet}|Deleted subnet\\(s\\): ${subnet}
226 Verify No Gateway Ips
227 [Documentation] Verifies the Gateway Ips removed with dump flow.
228 ${output}= Write Commands Until Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
230 : FOR ${GatewayIpElement} IN @{GATEWAY_IPS}
231 \ Should Not Contain ${output} ${GatewayIpElement}
234 [Arguments] ${vm_name}
235 [Documentation] Delete Vm instances using instance names.
236 ${devstack_conn_id}= Get ControlNode Connection
237 Switch Connection ${devstack_conn_id}
238 ${output}= Write Commands Until Prompt nova force-delete ${vm_name} 40s
242 [Arguments] ${network_name} ${devstack_conn_id}
243 [Documentation] Retrieve the net id for the given network name to create specific vm instance
244 Switch Connection ${devstack_conn_id}
245 ${output}= Write Commands Until Prompt neutron net-list | grep "${network_name}" | awk '{print $2}' 30s
247 ${splitted_output}= Split String ${output} ${EMPTY}
248 ${net_id}= Get from List ${splitted_output} 0
253 [Arguments] ${subnet_name} ${devstack_conn_id}
254 [Documentation] Retrieve the subnet id for the given subnet name
255 Switch Connection ${devstack_conn_id}
256 ${output}= Write Commands Until Prompt neutron subnet-list | grep "${subnet_name}" | awk '{print $2}' 30s
258 ${splitted_output}= Split String ${output} ${EMPTY}
259 ${subnet_id}= Get from List ${splitted_output} 0
261 [Return] ${subnet_id}
264 [Arguments] ${port_name} ${devstack_conn_id}
265 [Documentation] Retrieve the port id for the given port name to attach specific vm instance to a particular port
266 Switch Connection ${devstack_conn_id}
267 ${output}= Write Commands Until Prompt neutron port-list | grep "${port_name}" | awk '{print $2}' 30s
269 ${splitted_output}= Split String ${output} ${EMPTY}
270 ${port_id}= Get from List ${splitted_output} 0
275 [Arguments] ${router1} ${devstack_conn_id}
276 [Documentation] Retrieve the router id for the given router name
277 Switch Connection ${devstack_conn_id}
278 ${output}= Write Commands Until Prompt neutron router-list | grep "${router1}" | awk '{print $2}' 30s
280 ${splitted_output}= Split String ${output} ${EMPTY}
281 ${router_id}= Get from List ${splitted_output} 0
283 [Return] ${router_id}
286 [Arguments] ${net_name} ${vm_instance_names} ${image}=cirros-0.3.4-x86_64-uec ${flavor}=m1.nano ${sg}=default
287 [Documentation] Create X Vm Instance with the net id of the Netowrk.
288 ${devstack_conn_id}= Get ControlNode Connection
289 Switch Connection ${devstack_conn_id}
290 ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
291 : FOR ${VmElement} IN @{vm_instance_names}
292 \ ${output}= Write Commands Until Prompt nova boot --image ${image} --flavor ${flavor} --nic net-id=${net_id} ${VmElement} --security-groups ${sg} 30s
295 Create Vm Instance With Port
296 [Arguments] ${port_name} ${vm_instance_name} ${image}=cirros-0.3.4-x86_64-uec ${flavor}=m1.nano ${sg}=default
297 [Documentation] Create One VM instance using given ${port_name} and for given ${compute_node}
298 ${devstack_conn_id}= Get ControlNode Connection
299 Switch Connection ${devstack_conn_id}
300 ${port_id}= Get Port Id ${port_name} ${devstack_conn_id}
301 ${output}= Write Commands Until Prompt nova boot --image ${image} --flavor ${flavor} --nic port-id=${port_id} ${vm_instance_name} --security-groups ${sg} 30s
304 Create Vm Instance With Ports
305 [Arguments] ${port_name} ${port2_name} ${vm_instance_name} ${image}=cirros-0.3.4-x86_64-uec ${flavor}=m1.nano ${sg}=default
306 [Documentation] Create One VM instance using given ${port_name} and for given ${compute_node}
307 ${devstack_conn_id}= Get ControlNode Connection
308 Switch Connection ${devstack_conn_id}
309 ${port_id}= Get Port Id ${port_name} ${devstack_conn_id}
310 ${port2_id}= Get Port Id ${port2_name} ${devstack_conn_id}
311 ${output}= Write Commands Until Prompt nova boot --image ${image} --flavor ${flavor} --nic port-id=${port_id} --nic port-id=${port2_id} ${vm_instance_name} --security-groups ${sg} 30s
314 Create Vm Instance With Port On Compute Node
315 [Arguments] ${port_name} ${vm_instance_name} ${compute_node} ${image}=cirros-0.3.4-x86_64-uec ${flavor}=m1.nano ${sg}=default
316 [Documentation] Create One VM instance using given ${port_name} and for given ${compute_node}
317 ${devstack_conn_id}= Get ControlNode Connection
318 Switch Connection ${devstack_conn_id}
319 ${port_id}= Get Port Id ${port_name} ${devstack_conn_id}
320 ${hostname_compute_node}= Run Command On Remote System ${compute_node} hostname
321 ${output}= Write Commands Until Prompt nova boot --image ${image} --flavor ${flavor} --nic port-id=${port_id} ${vm_instance_name} --security-groups ${sg} --availability-zone nova:${hostname_compute_node} 30s
325 [Arguments] ${vm_name}
326 [Documentation] Run these commands to check whether the created vm instance is active or not.
327 ${devstack_conn_id}= Get ControlNode Connection
328 Switch Connection ${devstack_conn_id}
329 ${output}= Write Commands Until Prompt nova show ${vm_name} | grep OS-EXT-STS:vm_state 30s
331 Should Contain ${output} active
333 Collect VM IP Addresses
334 [Arguments] ${fail_on_none} @{vm_list}
335 [Documentation] Using nova console-log on the provided ${vm_list} to search for the string "obtained" which
336 ... correlates to the instance receiving it's IP address via DHCP. Also retrieved is the ip of the nameserver
337 ... if available in the console-log output. The keyword will also return a list of the learned ips as it
338 ... finds them in the console log output, and will have "None" for Vms that no ip was found.
339 ${devstack_conn_id}= Get ControlNode Connection
340 Switch Connection ${devstack_conn_id}
341 ${ip_list} Create List @{EMPTY}
342 : FOR ${vm} IN @{vm_list}
343 \ ${vm_ip_line}= Write Commands Until Prompt nova console-log ${vm} | grep -i "obtained" 30s
345 \ @{vm_ip} Get Regexp Matches ${vm_ip_line} [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}
346 \ ${vm_ip_length} Get Length ${vm_ip}
347 \ Run Keyword If ${vm_ip_length}>0 Append To List ${ip_list} @{vm_ip}[0]
348 \ ... ELSE Append To List ${ip_list} None
349 \ ${dhcp_ip_line}= Write Commands Until Prompt nova console-log ${vm} | grep "^nameserver" 30s
350 \ Log ${dhcp_ip_line}
351 \ ${dhcp_ip} Get Regexp Matches ${dhcp_ip_line} [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}
352 \ ${dhcp_ip_length} Get Length ${dhcp_ip}
353 \ Run Keyword If ${dhcp_ip_length}<=0 Append To List ${dhcp_ip} None
355 ${dhcp_length} Get Length ${dhcp_ip}
356 Run Keyword If '${fail_on_none}' == 'true' Should Not Contain ${ip_list} None
357 Run Keyword If '${fail_on_none}' == 'true' Should Not Contain ${dhcp_ip} None
358 Should Be True ${dhcp_length} <= 1
359 Return From Keyword If ${dhcp_length}==0 ${ip_list} ${EMPTY}
360 [Return] ${ip_list} ${dhcp_ip}
362 Collect VM IPv6 SLAAC Addresses
363 [Arguments] ${fail_on_none} ${prefix} @{vm_list}
364 [Documentation] Using nova console-log on the provided ${vm_list} to search for the string "inet6" which
365 ... correlates to the instance generated IPv6 address, based on the ${prefix} received from ODL (SLAAC mode).
366 ${devstack_conn_id}= Get ControlNode Connection
367 Switch Connection ${devstack_conn_id}
368 ${ip_list} Create List @{EMPTY}
369 : FOR ${vm} IN @{vm_list}
371 \ ${vm_ip_line}= Write Commands Until Prompt nova console-log ${vm} | grep -i "inet6" 30s
373 \ @{vm_ip_list} Get Regexp Matches ${vm_ip_line} ${prefix}
374 \ ${vm_ip_length} Get Length ${vm_ip_list}
375 \ Run Keyword If ${vm_ip_length}>0 Append To List ${ip_list} @{vm_ip_list}[0]
376 \ ... ELSE Append To List ${ip_list} None
378 Run Keyword If '${fail_on_none}' == 'true' Should Not Contain ${ip_list} None
383 [Arguments] ${vm_instance_names}
384 [Documentation] View Console log of the created vm instances using nova show.
385 : FOR ${VmElement} IN @{vm_instance_names}
386 \ ${output}= Write Commands Until Prompt nova show ${VmElement}
388 \ ${output}= Write Commands Until Prompt nova console-log ${VmElement}
391 Ping Vm From DHCP Namespace
392 [Arguments] ${net_name} ${vm_ip}
393 [Documentation] Reach all Vm Instance with the net id of the Netowrk.
395 ${devstack_conn_id}= Get ControlNode Connection
396 Switch Connection ${devstack_conn_id}
397 ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
399 ${output}= Write Commands Until Prompt sudo ip netns exec qdhcp-${net_id} ping -c 3 ${vm_ip} 20s
402 Should Contain ${output} 64 bytes
404 Ping From DHCP Should Not Succeed
405 [Arguments] ${net_name} ${vm_ip}
406 [Documentation] Should Not Reach Vm Instance with the net id of the Netowrk.
408 ${devstack_conn_id}= Get ControlNode Connection
409 Switch Connection ${devstack_conn_id}
410 ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
412 ${output}= Write Commands Until Prompt sudo ip netns exec qdhcp-${net_id} ping -c 3 ${vm_ip} 20s
415 Should Not Contain ${output} 64 bytes
417 Ping Vm From Control Node
418 [Arguments] ${vm_floating_ip} ${additional_args}=${EMPTY}
419 [Documentation] Ping VM floating IP from control node
420 Log ${vm_floating_ip}
421 ${devstack_conn_id}= Get ControlNode Connection
422 Switch Connection ${devstack_conn_id}
423 ${output}= Write Commands Until Prompt ping ${additional_args} -c 3 ${vm_floating_ip} 20s
426 Should Contain ${output} 64 bytes
429 [Arguments] ${dest_vm_ip}
430 [Documentation] Ping to the expected destination ip.
431 ${output}= Write Commands Until Expected Prompt ping -c 3 ${dest_vm_ip} ${OS_SYSTEM_PROMPT}
436 [Documentation] Ping to the expected destination ip.
437 ${output}= Write Commands Until Expected Prompt curl -i http://169.254.169.254 ${OS_SYSTEM_PROMPT}
438 Write Commands Until Prompt exit
439 Should Contain ${output} 200
442 [Documentation] Exit the vm instance.
443 ${output}= Write Commands Until Prompt exit
446 Check If Console Is VmInstance
447 [Arguments] ${console}=cirros
448 [Documentation] Check if the session has been able to login to the VM instance
449 ${output}= Write Commands Until Expected Prompt id ${OS_SYSTEM_PROMPT}
450 Should Contain ${output} ${console}
453 [Documentation] Check if the session has been able to login to the VM instance and exit the instance
454 ${rcode}= Run Keyword And Return Status Check If Console Is VmInstance cirros
455 Run Keyword If ${rcode} Write Commands Until Prompt exit
458 [Arguments] ${ip_address} ${ttl}=64
459 [Documentation] Run Ping command on the IP available as argument
460 ${ethertype}= Get Regexp Matches ${ip_address} ${IP_REGEX}
461 ${output}= Run Keyword If ${ethertype} Write Commands Until Expected Prompt ping -t ${ttl} -c 3 ${ip_address} ${OS_SYSTEM_PROMPT}
462 ... ELSE Write Commands Until Expected Prompt ping6 -t ${ttl} -c 3 ${ip_address} ${OS_SYSTEM_PROMPT}
463 Should Contain ${output} 64 bytes
465 Check Metadata Access
466 [Documentation] Try curl on the Metadataurl and check if it is okay
467 ${output}= Write Commands Until Expected Prompt curl -i http://169.254.169.254 ${OS_SYSTEM_PROMPT}
468 Should Contain ${output} 200
470 Execute Command on VM Instance
471 [Arguments] ${net_name} ${vm_ip} ${cmd} ${user}=cirros ${password}=cubswin:)
472 [Documentation] Login to the vm instance using ssh in the network, executes a command inside the VM and returns the ouput.
473 ${devstack_conn_id} = Get ControlNode Connection
474 Switch Connection ${devstack_conn_id}
475 ${net_id} = Get Net Id ${net_name} ${devstack_conn_id}
477 ${output} = Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ssh ${user}@${vm_ip} -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null d:
479 ${output} = Write Commands Until Expected Prompt ${password} ${OS_SYSTEM_PROMPT}
481 ${rcode} = Run Keyword And Return Status Check If Console Is VmInstance
482 ${output} = Run Keyword If ${rcode} Write Commands Until Expected Prompt ${cmd} ${OS_SYSTEM_PROMPT}
483 [Teardown] Exit From Vm Console
486 Test Operations From Vm Instance
487 [Arguments] ${net_name} ${src_ip} ${dest_ips} ${user}=cirros ${password}=cubswin:) ${ttl}=64
488 [Documentation] Login to the vm instance using ssh in the network.
489 ${devstack_conn_id}= Get ControlNode Connection
490 Switch Connection ${devstack_conn_id}
492 ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
493 ${output}= Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no ${user}@${src_ip} -o UserKnownHostsFile=/dev/null d:
495 ${output}= Write Commands Until Expected Prompt ${password} ${OS_SYSTEM_PROMPT}
497 ${rcode}= Run Keyword And Return Status Check If Console Is VmInstance
498 Run Keyword If ${rcode} Write Commands Until Expected Prompt ifconfig ${OS_SYSTEM_PROMPT}
499 Run Keyword If ${rcode} Write Commands Until Expected Prompt route ${OS_SYSTEM_PROMPT}
500 Run Keyword If ${rcode} Write Commands Until Expected Prompt route -A inet6 ${OS_SYSTEM_PROMPT}
501 Run Keyword If ${rcode} Write Commands Until Expected Prompt arp -an ${OS_SYSTEM_PROMPT}
502 : FOR ${dest_ip} IN @{dest_ips}
504 \ ${string_empty}= Run Keyword And Return Status Should Be Empty ${dest_ip}
505 \ Run Keyword If ${string_empty} Continue For Loop
506 \ Run Keyword If ${rcode} Check Ping ${dest_ip} ttl=${ttl}
507 ${ethertype}= Get Regexp Matches ${src_ip} ${IP_REGEX}
508 Run Keyword If ${rcode} and ${ethertype} Check Metadata Access
509 [Teardown] Exit From Vm Console
511 Test Netcat Operations From Vm Instance
512 [Arguments] ${net_name} ${vm_ip} ${dest_ip} ${additional_args}=${EMPTY} ${port}=12345 ${user}=cirros
513 ... ${password}=cubswin:)
514 [Documentation] Use Netcat to test TCP/UDP connections to the controller
515 ${client_data} Set Variable Test Client Data
516 ${server_data} Set Variable Test Server Data
517 ${devstack_conn_id}= Get ControlNode Connection
518 Switch Connection ${devstack_conn_id}
520 ${output}= Write Commands Until Prompt ( ( echo "${server_data}" | sudo timeout 60 nc -l ${additional_args} ${port} ) & )
522 ${output}= Write Commands Until Prompt sudo netstat -nlap | grep ${port}
524 ${nc_output}= Execute Command on VM Instance ${net_name} ${vm_ip} sudo echo "${client_data}" | nc -v -w 5 ${additional_args} ${dest_ip} ${port}
526 ${output}= Execute Command on VM Instance ${net_name} ${vm_ip} sudo route -n
528 ${output}= Execute Command on VM Instance ${net_name} ${vm_ip} sudo arp -an
530 Should Match Regexp ${nc_output} ${server_data}
533 [Arguments] ${list_of_external_dst_ips}
534 [Documentation] Check reachability with other network's instances.
535 ${rcode}= Run Keyword And Return Status Check If Console Is VmInstance
536 : FOR ${dest_ip} IN @{list_of_external_dst_ips}
538 \ Check Ping ${dest_ip}
541 [Arguments] ${router_name}
542 [Documentation] Create Router and Add Interface to the subnets.
543 ${devstack_conn_id}= Get ControlNode Connection
544 Switch Connection ${devstack_conn_id}
545 ${output}= Write Commands Until Prompt neutron -v router-create ${router_name} 30s
547 Should Contain ${output} Created a new router
550 [Documentation] List Router and return output with neutron client.
551 ${devstack_conn_id}= Get ControlNode Connection
552 Switch Connection ${devstack_conn_id}
553 ${output}= Write Commands Until Prompt neutron router-list 30s
559 [Arguments] ${router_name} ${interface_name}
560 ${devstack_conn_id}= Get ControlNode Connection
561 Switch Connection ${devstack_conn_id}
562 ${output}= Write Commands Until Prompt neutron -v router-interface-add ${router_name} ${interface_name}
564 Should Contain ${output} Added interface
566 Show Router Interface
567 [Arguments] ${router_name}
568 [Documentation] List Router interface associated with given Router and return output with neutron client.
569 ${devstack_conn_id}= Get ControlNode Connection
570 Switch Connection ${devstack_conn_id}
571 ${output}= Write Commands Until Prompt neutron router-port-list ${router_name} -f csv 30s
577 [Arguments] ${router_name} ${network_name}
578 ${devstack_conn_id}= Get ControlNode Connection
579 Switch Connection ${devstack_conn_id}
580 ${output}= Write Commands Until Prompt neutron -v router-gateway-set ${router_name} ${network_name}
582 Should Contain ${output} Set gateway
585 [Arguments] ${router_name} ${interface_name}
586 [Documentation] Remove Interface to the subnets.
587 ${devstack_conn_id}= Get ControlNode Connection
588 Switch Connection ${devstack_conn_id}
589 ${output}= Write Commands Until Prompt neutron -v router-interface-delete ${router_name} ${interface_name}
591 Should Contain ${output} Removed interface from router
594 [Arguments] ${router_name} ${cmd}
595 [Documentation] Update the router with the command. Router name and command should be passed as argument.
596 ${devstack_conn_id} = Get ControlNode Connection
597 Switch Connection ${devstack_conn_id}
598 ${output} = Write Commands Until Prompt neutron router-update ${router_name} ${cmd} 30s
600 Should Contain ${output} Updated
603 [Arguments] ${router_name} ${options}
604 [Documentation] Show information of a given router. Router name and optional fields should be sent as arguments.
605 ${devstack_conn_id} = Get ControlNode Connection
606 Switch Connection ${devstack_conn_id}
607 ${output} = Write Commands Until Prompt neutron router-show ${router_name} ${options} 30s
612 [Arguments] ${router_name}
613 [Documentation] Delete Router and Interface to the subnets.
614 ${devstack_conn_id}= Get ControlNode Connection
615 Switch Connection ${devstack_conn_id}
616 ${output}= Write Commands Until Prompt neutron -v router-delete ${router_name} 60s
618 Should Match Regexp ${output} Deleted router: ${router_name}|Deleted router\\(s\\): ${router_name}
620 Get DumpFlows And Ovsconfig
621 [Arguments] ${openstack_node_ip}
622 [Documentation] Get the OvsConfig and Flow entries from OVS from the Openstack Node
623 Log ${openstack_node_ip}
624 SSHLibrary.Open Connection ${openstack_node_ip} prompt=${DEFAULT_LINUX_PROMPT}
625 Utils.Flexible SSH Login ${OS_USER} ${DEVSTACK_SYSTEM_PASSWORD}
626 SSHLibrary.Set Client Configuration timeout=${default_devstack_prompt_timeout}
627 Write Commands Until Expected Prompt ip -o link ${DEFAULT_LINUX_PROMPT_STRICT}
628 Write Commands Until Expected Prompt ip -o addr ${DEFAULT_LINUX_PROMPT_STRICT}
629 Write Commands Until Expected Prompt ip route ${DEFAULT_LINUX_PROMPT_STRICT}
630 Write Commands Until Expected Prompt arp -an ${DEFAULT_LINUX_PROMPT_STRICT}
631 ${nslist}= Write Commands Until Expected Prompt ip netns list | awk '{print $1}' ${DEFAULT_LINUX_PROMPT_STRICT}
632 @{lines} Split To Lines ${nslist}
633 : FOR ${line} IN @{lines}
634 \ Write Commands Until Expected Prompt sudo ip netns exec ${line} ip -o link ${DEFAULT_LINUX_PROMPT_STRICT}
635 \ Write Commands Until Expected Prompt sudo ip netns exec ${line} ip -o addr ${DEFAULT_LINUX_PROMPT_STRICT}
636 \ Write Commands Until Expected Prompt sudo ip netns exec ${line} ip route ${DEFAULT_LINUX_PROMPT_STRICT}
637 Write Commands Until Expected Prompt sudo ovs-vsctl show ${DEFAULT_LINUX_PROMPT_STRICT}
638 Write Commands Until Expected Prompt sudo ovs-vsctl list Open_vSwitch ${DEFAULT_LINUX_PROMPT_STRICT}
639 Write Commands Until Expected Prompt sudo ovs-ofctl show br-int -OOpenFlow13 ${DEFAULT_LINUX_PROMPT_STRICT}
640 Write Commands Until Expected Prompt sudo ovs-ofctl dump-flows br-int -OOpenFlow13 ${DEFAULT_LINUX_PROMPT_STRICT}
641 Write Commands Until Expected Prompt sudo ovs-ofctl dump-groups br-int -OOpenFlow13 ${DEFAULT_LINUX_PROMPT_STRICT}
642 Write Commands Until Expected Prompt sudo ovs-ofctl dump-group-stats br-int -OOpenFlow13 ${DEFAULT_LINUX_PROMPT_STRICT}
644 Get Karaf Log Type From Test Start
645 [Arguments] ${ip} ${test_name} ${type} ${user}=${ODL_SYSTEM_USER} ${password}=${ODL_SYSTEM_PASSWORD} ${prompt}=${ODL_SYSTEM_PROMPT}
646 ... ${log_file}=${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log
647 ${cmd} Set Variable sed '1,/ROBOT MESSAGE: Starting test ${test_name}/d' ${log_file} | grep '${type}'
648 ${output} Run Command On Controller ${ip} ${cmd} ${user} ${password} ${prompt}
651 Get Karaf Log Types From Test Start
652 [Arguments] ${ip} ${test_name} ${types} ${user}=${ODL_SYSTEM_USER} ${password}=${ODL_SYSTEM_PASSWORD} ${prompt}=${ODL_SYSTEM_PROMPT}
653 ... ${log_file}=${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log
654 : FOR ${type} IN @{types}
655 \ Get Karaf Log Type From Test Start ${ip} ${test_name} ${type} ${user} ${password}
656 \ ... ${prompt} ${log_file}
658 Get Karaf Log Events From Test Start
659 [Arguments] ${test_name} ${user}=${ODL_SYSTEM_USER} ${password}=${ODL_SYSTEM_PASSWORD} ${prompt}=${ODL_SYSTEM_PROMPT}
660 ${log_types} = Create List ERROR WARN Exception
661 Run Keyword If 0 < ${NUM_ODL_SYSTEM} Get Karaf Log Types From Test Start ${ODL_SYSTEM_IP} ${test_name} ${log_types}
662 Run Keyword If 1 < ${NUM_ODL_SYSTEM} Get Karaf Log Types From Test Start ${ODL_SYSTEM_2_IP} ${test_name} ${log_types}
663 Run Keyword If 2 < ${NUM_ODL_SYSTEM} Get Karaf Log Types From Test Start ${ODL_SYSTEM_3_IP} ${test_name} ${log_types}
665 Get ControlNode Connection
666 ${control_conn_id}= SSHLibrary.Open Connection ${OS_CONTROL_NODE_IP} prompt=${DEFAULT_LINUX_PROMPT_STRICT}
667 Utils.Flexible SSH Login ${OS_USER} ${DEVSTACK_SYSTEM_PASSWORD}
668 SSHLibrary.Set Client Configuration timeout=30s
669 Source Password force=yes
670 [Return] ${control_conn_id}
673 [Documentation] Get the OvsConfig and Flow entries from all Openstack nodes
674 Run Keyword If 0 < ${NUM_OS_SYSTEM} Get DumpFlows And Ovsconfig ${OS_CONTROL_NODE_IP}
675 Run Keyword If 1 < ${NUM_OS_SYSTEM} Get DumpFlows And Ovsconfig ${OS_COMPUTE_1_IP}
676 Run Keyword If 2 < ${NUM_OS_SYSTEM} Get DumpFlows And Ovsconfig ${OS_COMPUTE_2_IP}
678 Get Test Teardown Debugs
679 [Arguments] ${test_name}=${TEST_NAME}
681 Run Keyword And Ignore Error Get Model Dump ${HA_PROXY_IP} ${netvirt_data_models}
682 Get Karaf Log Events From Test Start ${test_name}
684 Get Suite Teardown Debugs
686 Get Model Dump ${HA_PROXY_IP} ${netvirt_data_models}
689 [Arguments] @{vm_indices}
690 [Documentation] Run these commands for debugging, it can list state of VM instances and ip information in control node
691 ${devstack_conn_id}= Get ControlNode Connection
692 Switch Connection ${devstack_conn_id}
693 ${output}= Write Commands Until Prompt sudo ip netns list
695 : FOR ${index} IN @{vm_indices}
696 \ ${output}= Write Commands Until Prompt nova show ${index} 30s
704 Create Security Group
705 [Arguments] ${sg_name} ${desc}
706 ${devstack_conn_id}= Get ControlNode Connection
707 Switch Connection ${devstack_conn_id}
708 ${output}= Write Commands Until Prompt nova secgroup-create ${sg_name} ${desc} 40s
712 [Arguments] ${direction} ${protocol} ${min_port} ${max_port} ${remote_ip} ${sg_name}
713 ${devstack_conn_id}= Get ControlNode Connection
714 Switch Connection ${devstack_conn_id}
715 ${output}= Write Commands Until Prompt neutron security-group-rule-create --direction ${direction} --protocol ${protocol} --port-range-min ${min_port} --port-range-max ${max_port} --remote-ip-prefix ${remote_ip} ${sg_name}
718 Neutron Security Group Show
719 [Arguments] ${SecurityGroupRuleName} ${additional_args}=${EMPTY}
720 [Documentation] Displays the neutron security group configurations that belongs to a given neutron security group name
721 ${devstack_conn_id}= Get ControlNode Connection
722 Switch Connection ${devstack_conn_id}
723 ${cmd}= Set Variable neutron security-group-show ${SecurityGroupRuleName} ${additional_args}
725 ${output}= Write Commands Until Prompt ${cmd} 30s
731 [Arguments] ${PortName} ${additional_args}=${EMPTY}
732 [Documentation] Display the port configuration that belong to a given neutron port
733 ${devstack_conn_id}= Get ControlNode Connection
734 Switch Connection ${devstack_conn_id}
735 ${cmd}= Set Variable neutron port-show ${PortName} ${additional_args}
737 ${output}= Write Commands Until Prompt ${cmd} 30s
742 Neutron Security Group Create
743 [Arguments] ${SecurityGroupName} ${additional_args}=${EMPTY}
744 [Documentation] Create a security group with specified name ,description & protocol value according to security group template
745 ${devstack_conn_id}= Get ControlNode Connection
746 Switch Connection ${devstack_conn_id}
747 ${cmd}= Set Variable neutron security-group-create ${SecurityGroupName} ${additional_args}
749 ${output}= Write Commands Until Prompt ${cmd} 30s
751 Should Contain ${output} Created a new security_group
752 ${sgp_id}= Should Match Regexp ${output} [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
755 [Return] ${output} ${sgp_id}
757 Neutron Security Group Update
758 [Arguments] ${SecurityGroupName} ${additional_args}=${EMPTY}
759 [Documentation] Updating security groups
760 ${devstack_conn_id}= Get ControlNode Connection
761 Switch Connection ${devstack_conn_id}
762 ${cmd}= Set Variable neutron security-group-update ${SecurityGroupName} ${additional_args}
764 ${output}= Write Commands Until Prompt ${cmd} 30s
770 [Arguments] ${sg_name}
771 [Documentation] Delete Security group
772 ${devstack_conn_id}= Get ControlNode Connection
773 Switch Connection ${devstack_conn_id}
774 ${output}= Write Commands Until Prompt neutron security-group-delete ${sg_name} 40s
776 Should Match Regexp ${output} Deleted security_group: ${sg_name}|Deleted security_group\\(s\\): ${sg_name}
779 Neutron Security Group Rule Create
780 [Arguments] ${Security_group_name} &{Kwargs}
781 [Documentation] Creates neutron security rule with neutron request with or without optional params, here security group name is mandatory args, rule with optional params can be created by passing the optional args values ex: direction=${INGRESS_EGRESS}, Then these optional params are catenated with mandatory args, example of usage: "Neutron Security Group Rule Create ${SGP_SSH} direction=${RULE_PARAMS[0]} ethertype=${RULE_PARAMS[1]} ..."
782 ${devstack_conn_id}= Get ControlNode Connection
783 Switch Connection ${devstack_conn_id}
784 Run Keyword If ${Kwargs} Log ${Kwargs}
785 ${description} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} description default=${None}
786 ${direction} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} direction default=${None}
787 ${ethertype} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} ethertype default=${None}
788 ${port_range_max} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} port_range_max default=${None}
789 ${port_range_min} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} port_range_min default=${None}
790 ${protocol} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} protocol default=${None}
791 ${remote_group_id} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} remote_group_id default=${None}
792 ${remote_ip_prefix} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} remote_ip_prefix default=${None}
793 ${cmd}= Set Variable neutron security-group-rule-create ${Security_group_name}
794 ${cmd}= Run Keyword If '${description}'!='None' Catenate ${cmd} --description ${description}
795 ... ELSE Catenate ${cmd}
796 ${cmd}= Run Keyword If '${direction}'!='None' Catenate ${cmd} --direction ${direction}
797 ... ELSE Catenate ${cmd}
798 ${cmd}= Run Keyword If '${ethertype}'!='None' Catenate ${cmd} --ethertype ${ethertype}
799 ... ELSE Catenate ${cmd}
800 ${cmd}= Run Keyword If '${port_range_max}'!='None' Catenate ${cmd} --port_range_max ${port_range_max}
801 ... ELSE Catenate ${cmd}
802 ${cmd}= Run Keyword If '${port_range_min}'!='None' Catenate ${cmd} --port_range_min ${port_range_min}
803 ... ELSE Catenate ${cmd}
804 ${cmd}= Run Keyword If '${protocol}'!='None' Catenate ${cmd} --protocol ${protocol}
805 ... ELSE Catenate ${cmd}
806 ${cmd}= Run Keyword If '${remote_group_id}'!='None' Catenate ${cmd} --remote_group_id ${remote_group_id}
807 ... ELSE Catenate ${cmd}
808 ${cmd}= Run Keyword If '${remote_ip_prefix}'!='None' Catenate ${cmd} --remote_ip_prefix ${remote_ip_prefix}
809 ... ELSE Catenate ${cmd}
810 ${output}= Write Commands Until Prompt ${cmd} 30s
811 ${rule_id}= Should Match Regexp ${output} [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
813 Should Contain ${output} Created a new security_group_rule
815 [Return] ${output} ${rule_id}
817 Create Neutron Port With Additional Params
818 [Arguments] ${network_name} ${port_name} ${additional_args}=${EMPTY}
819 [Documentation] Create Port With given additional parameters
820 ${devstack_conn_id}= Get ControlNode Connection
821 Switch Connection ${devstack_conn_id}
822 ${cmd}= Set Variable neutron -v port-create ${network_name} --name ${port_name} ${additional_args}
824 ${OUTPUT}= Write Commands Until Prompt ${cmd} 30s
826 Should Contain ${output} Created a new port
827 ${port_id}= Should Match Regexp ${OUTPUT} [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
830 [Return] ${OUTPUT} ${port_id}
833 [Arguments] ${portName_list}
834 [Documentation] Retrieve the port MacAddr for the given list of port name and return the MAC address list.
835 ${devstack_conn_id}= Get ControlNode Connection
836 Switch Connection ${devstack_conn_id}
837 ${MacAddr-list} Create List
838 : FOR ${portName} IN @{portName_list}
839 \ ${macAddr}= OpenStackOperations.Get Port Mac ${portName} ${devstack_conn_id}
840 \ Append To List ${MacAddr-list} ${macAddr}
841 [Return] ${MacAddr-list}
844 [Arguments] ${port_name}
845 [Documentation] Keyword would return the IP of the ${port_name} received.
846 Switch Connection ${devstack_conn_id}
847 ${output}= Write Commands Until Prompt neutron port-list | grep "${port_name}" | awk '{print $11}' | awk -F "\\"" '{print $2}' 30s
849 ${splitted_output}= Split String ${output} ${EMPTY}
850 ${port_ip}= Get from List ${splitted_output} 0
855 [Arguments] ${port_name} ${conn_id}=${devstack_conn_id}
856 [Documentation] Keyword would return the MAC ID of the ${port_name} received.
857 Switch Connection ${conn_id}
858 ${output}= Write Commands Until Prompt neutron port-list | grep "${port_name}" | awk '{print $6}' 30s
860 ${splitted_output}= Split String ${output} ${EMPTY}
861 ${port_mac}= Get from List ${splitted_output} 0
866 [Arguments] ${bridge_name} ${intf_name} ${gw_name}
867 [Documentation] Keyword to create an L2 Gateway ${gw_name} for bridge ${bridge_name} connected to interface ${intf_name} (Using Neutron CLI).
868 Switch Connection ${devstack_conn_id}
869 ${l2gw_output}= Write Commands Until Prompt ${L2GW_CREATE} name=${bridge_name},interface_names=${intf_name} ${gw_name} 30s
871 [Return] ${l2gw_output}
873 Create L2Gateway Connection
874 [Arguments] ${gw_name} ${net_name}
875 [Documentation] Keyword would create a new L2 Gateway Connection for ${gw_name} to ${net_name} (Using Neutron CLI).
876 Switch Connection ${devstack_conn_id}
877 ${l2gw_output}= Write Commands Until Prompt ${L2GW_CONN_CREATE} ${gw_name} ${net_name} 30s
879 [Return] ${l2gw_output}
882 [Documentation] Keyword to return all the L2 Gateways available (Using Neutron CLI).
883 Switch Connection ${devstack_conn_id}
884 ${output}= Write Commands Until Prompt ${L2GW_GET_YAML} 30s
887 Get All L2Gateway Connection
888 [Documentation] Keyword to return all the L2 Gateway connections available (Using Neutron CLI).
889 Switch Connection ${devstack_conn_id}
890 ${output}= Write Commands Until Prompt ${L2GW_GET_CONN_YAML} 30s
895 [Documentation] Keyword to check if the ${gw_id} is available in the L2 Gateway list (Using Neutron CLI).
896 Switch Connection ${devstack_conn_id}
897 ${output}= Write Commands Until Prompt ${L2GW_SHOW} ${gw_id} 30s
902 [Arguments] ${l2gw_name}
903 [Documentation] Keyword to retrieve the L2 Gateway ID for the ${l2gw_name} (Using Neutron CLI).
904 Switch Connection ${devstack_conn_id}
905 ${output}= Write Commands Until Prompt ${L2GW_GET} | grep "${l2gw_name}" | awk '{print $2}' 30s
907 ${splitted_output}= Split String ${output} ${EMPTY}
908 ${l2gw_id}= Get from List ${splitted_output} 0
912 Get L2gw Connection Id
913 [Arguments] ${l2gw_name}
914 [Documentation] Keyword to retrieve the L2 Gateway Connection ID for the ${l2gw_name} (Using Neutron CLI).
915 Switch Connection ${devstack_conn_id}
916 ${l2gw_id}= OpenStackOperations.Get L2gw Id ${l2gw_name}
917 ${output}= Write Commands Until Prompt ${L2GW_GET_CONN} | grep "${l2gw_id}" | awk '{print $2}' 30s
919 ${splitted_output}= Split String ${output} ${EMPTY}
920 ${l2gw_conn_id}= Get from List ${splitted_output} 0
922 [Return] ${l2gw_conn_id}
924 Neutron Port List Rest
925 [Documentation] Keyword to get all ports details in Neutron (Using REST).
926 ${resp} = RequestsLibrary.Get Request session ${PORT_URL}
928 Should Be Equal As Strings ${resp.status_code} 200
929 [Return] ${resp.content}
931 Get Neutron Port Rest
932 [Arguments] ${port_id}
933 [Documentation] Keyword to get the specific port details in Neutron (Using REST).
934 ${resp} = RequestsLibrary.Get Request session ${CONFIG_API}/${GET_PORT_URL}/${port_id}
936 Should Be Equal As Strings ${resp.status_code} 200
937 [Return] ${resp.content}
940 [Arguments] ${port_id} ${json_data}
941 [Documentation] Keyword to update ${port_id} with json data received in ${json_data} (Using REST).
943 ${resp} = RequestsLibrary.Put Request session ${CONFIG_API}/${GET_PORT_URL}/${port_id} ${json_data}
945 Should Be Equal As Strings ${resp.status_code} 200
946 [Return] ${resp.content}
948 Create And Configure Security Group
949 [Arguments] ${sg-name}
950 Neutron Security Group Create ${sg-name}
951 Neutron Security Group Rule Create ${sg-name} direction=ingress port_range_max=65535 port_range_min=1 protocol=tcp remote_ip_prefix=0.0.0.0/0
952 Neutron Security Group Rule Create ${sg-name} direction=egress port_range_max=65535 port_range_min=1 protocol=tcp remote_ip_prefix=0.0.0.0/0
953 Neutron Security Group Rule Create ${sg-name} direction=ingress protocol=icmp remote_ip_prefix=0.0.0.0/0
954 Neutron Security Group Rule Create ${sg-name} direction=egress protocol=icmp remote_ip_prefix=0.0.0.0/0
955 Neutron Security Group Rule Create ${sg-name} direction=ingress port_range_max=65535 port_range_min=1 protocol=udp remote_ip_prefix=0.0.0.0/0
956 Neutron Security Group Rule Create ${sg-name} direction=egress port_range_max=65535 port_range_min=1 protocol=udp remote_ip_prefix=0.0.0.0/0
958 Create SFC Flow Classifier
959 [Arguments] ${name} ${src_ip} ${dest_ip} ${protocol} ${dest_port} ${neutron_src_port}
960 [Documentation] Create a flow classifier for SFC
961 ${devstack_conn_id}= Get ControlNode Connection
962 Switch Connection ${devstack_conn_id}
963 ${cmd}= Set Variable neutron flow-classifier-create --ethertype IPv4 --source-ip-prefix ${src_ip}/32 --destination-ip-prefix ${dest_ip}/32 --protocol ${protocol} --destination-port ${dest_port}:${dest_port} --logical-source-port ${neutron_src_port} ${name}
965 ${output}= Write Commands Until Prompt ${cmd} 30s
968 Should Contain ${output} Created a new flow_classifier
971 Delete SFC Flow Classifier
973 [Documentation] Delete a SFC flow classifier
974 ${devstack_conn_id}= Get ControlNode Connection
975 Switch Connection ${devstack_conn_id}
976 ${cmd}= Set Variable neutron flow-classifier-delete ${name}
978 ${output}= Write Commands Until Prompt ${cmd} 30s
981 Should Contain ${output} Deleted flow_classifier
985 [Arguments] ${name} ${port_in} ${port_out}
986 [Documentation] Creates a neutron port pair for SFC
987 ${devstack_conn_id}= Get ControlNode Connection
988 Switch Connection ${devstack_conn_id}
989 ${cmd}= Set Variable neutron port-pair-create --ingress=${port_in} --egress=${port_out} ${name}
991 ${output}= Write Commands Until Prompt ${cmd} 30s
994 Should Contain ${output} Created a new port_pair
999 [Documentation] Delete a SFC port pair
1000 ${devstack_conn_id}= Get ControlNode Connection
1001 Switch Connection ${devstack_conn_id}
1002 ${cmd}= Set Variable neutron port-pair-delete ${name}
1004 ${output}= Write Commands Until Prompt ${cmd} 30s
1007 Should Contain ${output} Deleted port_pair
1010 Create SFC Port Pair Group
1011 [Arguments] ${name} ${port_pair}
1012 [Documentation] Creates a port pair group with a single port pair for SFC
1013 ${devstack_conn_id}= Get ControlNode Connection
1014 Switch Connection ${devstack_conn_id}
1015 ${cmd}= Set Variable neutron port-pair-group-create --port-pair ${port_pair} ${name}
1017 ${output}= Write Commands Until Prompt ${cmd} 30s
1020 Should Contain ${output} Created a new port_pair_group
1023 Create SFC Port Pair Group With Two Pairs
1024 [Arguments] ${name} ${port_pair1} ${port_pair2}
1025 [Documentation] Creates a port pair group with two port pairs for SFC
1026 ${devstack_conn_id}= Get ControlNode Connection
1027 Switch Connection ${devstack_conn_id}
1028 ${cmd}= Set Variable neutron port-pair-group-create --port-pair ${port_pair1} --port-pair ${port_pair2} ${name}
1030 ${output}= Write Commands Until Prompt ${cmd} 30s
1033 Should Contain ${output} Created a new port_pair_group
1036 Delete SFC Port Pair Group
1038 [Documentation] Delete a SFC port pair group
1039 ${devstack_conn_id}= Get ControlNode Connection
1040 Switch Connection ${devstack_conn_id}
1041 ${cmd}= Set Variable neutron port-pair-group-delete ${name}
1043 ${output}= Write Commands Until Prompt ${cmd} 30s
1046 Should Contain ${output} Deleted port_pair_group
1049 Create SFC Port Chain
1050 [Arguments] ${name} ${pg1} ${pg2} ${fc}
1051 [Documentation] Creates a port pair chain with two port groups and a singel classifier.
1052 ${devstack_conn_id}= Get ControlNode Connection
1053 Switch Connection ${devstack_conn_id}
1054 ${cmd}= Set Variable neutron port-chain-create --port-pair-group ${pg1} --port-pair-group ${pg2} --flow-classifier ${fc} ${name}
1056 ${output}= Write Commands Until Prompt ${cmd} 30s
1059 Should Contain ${output} Created a new port_chain
1062 Delete SFC Port Chain
1064 [Documentation] Delete a SFC port chain
1065 ${devstack_conn_id}= Get ControlNode Connection
1066 Switch Connection ${devstack_conn_id}
1067 ${cmd}= Set Variable neutron port-chain-delete ${name}
1069 ${output}= Write Commands Until Prompt ${cmd} 30s
1072 Should Contain ${output} Deleted port_chain
1076 [Arguments] ${vm_name}
1077 [Documentation] Reboot NOVA VM
1078 ${devstack_conn_id}= Get ControlNode Connection
1079 Switch Connection ${devstack_conn_id}
1080 ${output}= Write Commands Until Prompt nova reboot --poll ${vm_name} 30s
1082 Wait Until Keyword Succeeds 35s 10s Verify VM Is ACTIVE ${vm_name}
1085 Remove RSA Key From KnowHosts
1086 [Arguments] ${vm_ip}
1087 [Documentation] Remove RSA
1088 ${devstack_conn_id}= Get ControlNode Connection
1089 Switch Connection ${devstack_conn_id}
1090 ${output}= Write Commands Until Prompt sudo cat /root/.ssh/known_hosts 30s
1092 ${output}= Write Commands Until Prompt sudo ssh-keygen -f "/root/.ssh/known_hosts" -R ${vm_ip} 30s
1094 ${output}= Write Commands Until Prompt sudo cat "/root/.ssh/known_hosts" 30s