2 Documentation Openstack library. This library is useful for tests to create network, subnet, router and vm instances
5 Variables ../variables/Variables.py
9 [Arguments] ${force}=no ${source_pwd}=yes
10 [Documentation] Sourcing the Openstack PAsswords for neutron configurations
11 Run Keyword If '${source_pwd}' == 'yes' or '${force}' == 'yes' Write Commands Until Prompt cd ${DEVSTACK_DEPLOY_PATH}; source openrc admin admin
13 Get Tenant ID From Security Group
14 [Documentation] Returns tenant ID by reading it from existing default security-group.
15 ${devstack_conn_id}= Get ControlNode Connection
16 Switch Connection ${devstack_conn_id}
17 ${output}= Write Commands Until Prompt neutron security-group-show default | grep "| tenant_id" | awk '{print $4}'
21 Get Tenant ID From Network
22 [Arguments] ${network_uuid}
23 [Documentation] Returns tenant ID by reading it from existing network.
24 ${resp}= Get_From_Uri uri=${CONFIG_API}/neutron:neutron/networks/network/${network_uuid}/ accept=${ACCEPT_EMPTY} session=session
25 ${tenant_id}= Utils.Extract Value From Content ${resp} /network/0/tenant-id strip
29 [Arguments] ${network_name} ${additional_args}=${EMPTY} ${verbose}=TRUE
30 [Documentation] Create Network with neutron request.
31 ${devstack_conn_id}= Get ControlNode Connection
32 Switch Connection ${devstack_conn_id}
33 ${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}'
34 ${output}= Write Commands Until Prompt ${command} 30s
39 [Documentation] List networks and return output with neutron client.
40 ${devstack_conn_id}= Get ControlNode Connection
41 Switch Connection ${devstack_conn_id}
42 ${output}= Write Commands Until Prompt neutron net-list 30s
48 [Documentation] List subnets and return output with neutron client.
49 ${devstack_conn_id}= Get ControlNode Connection
50 Switch Connection ${devstack_conn_id}
51 ${output}= Write Commands Until Prompt neutron subnet-list 30s
57 [Arguments] ${network_name}
58 [Documentation] Delete Network with neutron request.
59 ${devstack_conn_id}= Get ControlNode Connection
60 Switch Connection ${devstack_conn_id}
61 ${output}= Write Commands Until Prompt neutron -v net-delete ${network_name} 30s
64 Should Match Regexp ${output} Deleted network: ${network_name}|Deleted network\\(s\\): ${network_name}
67 [Arguments] ${network_name} ${subnet} ${range_ip} ${additional_args}=${EMPTY}
68 [Documentation] Create SubNet for the Network with neutron request.
69 ${devstack_conn_id}= Get ControlNode Connection
70 Switch Connection ${devstack_conn_id}
71 ${output}= Write Commands Until Prompt neutron -v subnet-create ${network_name} ${range_ip} --name ${subnet} ${additional_args} 30s
74 Should Contain ${output} Created a new subnet
77 [Arguments] ${network_name} ${port_name} ${sg}=default
78 [Documentation] Create Port with neutron request.
79 ${devstack_conn_id}= Get ControlNode Connection
80 Switch Connection ${devstack_conn_id}
81 ${output}= Write Commands Until Prompt neutron -v port-create ${network_name} --name ${port_name} --security-group ${sg} 30s
84 Should Contain ${output} Created a new port
87 [Arguments] ${port_name}
88 [Documentation] Delete Port with neutron request.
89 ${devstack_conn_id}= Get ControlNode Connection
90 Switch Connection ${devstack_conn_id}
91 ${output}= Write Commands Until Prompt neutron -v port-delete ${port_name} 30s
94 Should Match Regexp ${output} Deleted port: ${port_name}|Deleted port\\(s\\): ${port_name}
97 [Documentation] List ports and return output with neutron client.
98 ${devstack_conn_id}= Get ControlNode Connection
99 Switch Connection ${devstack_conn_id}
100 ${output}= Write Commands Until Prompt neutron port-list 30s
106 [Documentation] List VMs and return output with nova client.
107 ${devstack_conn_id}= Get ControlNode Connection
108 Switch Connection ${devstack_conn_id}
109 ${output}= Write Commands Until Prompt nova list 30s
114 Create And Associate Floating IPs
115 [Arguments] ${external_net} @{vm_list}
116 [Documentation] Create and associate floating IPs to VMs with nova request
117 ${devstack_conn_id}= Get ControlNode Connection
118 Switch Connection ${devstack_conn_id}
119 ${ip_list}= Create List @{EMPTY}
120 : FOR ${vm} IN @{vm_list}
121 \ ${output}= Write Commands Until Prompt neutron floatingip-create ${external_net} 30s
123 \ @{ip} Get Regexp Matches ${output} [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}
124 \ ${ip_length} Get Length ${ip}
125 \ Run Keyword If ${ip_length}>0 Append To List ${ip_list} @{ip}[0]
126 \ ... ELSE Append To List ${ip_list} None
127 \ ${output}= Write Commands Until Prompt nova floating-ip-associate ${vm} @{ip}[0] 30s
132 [Documentation] Verifies the Gateway Ips with dump flow.
133 ${output}= Write Commands Until Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
135 : FOR ${GatewayIpElement} IN @{GATEWAY_IPS}
136 \ Should Contain ${output} ${GatewayIpElement}
139 [Documentation] Verifies the Dhcp Ips with dump flow.
140 ${output}= Write Commands Until Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
142 : FOR ${DhcpIpElement} IN @{DHCP_IPS}
143 \ Should Contain ${output} ${DhcpIpElement}
146 [Documentation] Verifies the Dhcp Ips with dump flow.
147 ${output}= Write Commands Until Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
149 : FOR ${DhcpIpElement} IN @{DHCP_IPS}
150 \ Should Not Contain ${output} ${DhcpIpElement}
153 [Arguments] ${subnet}
154 [Documentation] Delete SubNet for the Network with neutron request.
156 ${devstack_conn_id}= Get ControlNode Connection
157 Switch Connection ${devstack_conn_id}
158 ${output}= Write Commands Until Prompt neutron -v subnet-delete ${subnet}
161 Should Match Regexp ${output} Deleted subnet: ${subnet}|Deleted subnet\\(s\\): ${subnet}
163 Verify No Gateway Ips
164 [Documentation] Verifies the Gateway Ips removed with dump flow.
165 ${output}= Write Commands Until Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
167 : FOR ${GatewayIpElement} IN @{GATEWAY_IPS}
168 \ Should Not Contain ${output} ${GatewayIpElement}
171 [Arguments] ${vm_name}
172 [Documentation] Delete Vm instances using instance names.
173 ${devstack_conn_id}= Get ControlNode Connection
174 Switch Connection ${devstack_conn_id}
175 ${output}= Write Commands Until Prompt nova force-delete ${vm_name} 40s
179 [Arguments] ${network_name} ${devstack_conn_id}
180 [Documentation] Retrieve the net id for the given network name to create specific vm instance
181 Switch Connection ${devstack_conn_id}
182 ${output}= Write Commands Until Prompt neutron net-list | grep "${network_name}" | awk '{print $2}' 30s
184 ${splitted_output}= Split String ${output} ${EMPTY}
185 ${net_id}= Get from List ${splitted_output} 0
190 [Arguments] ${port_name} ${devstack_conn_id}
191 [Documentation] Retrieve the port id for the given port name to attach specific vm instance to a particular port
192 Switch Connection ${devstack_conn_id}
193 ${output}= Write Commands Until Prompt neutron port-list | grep "${port_name}" | awk '{print $2}' 30s
195 ${splitted_output}= Split String ${output} ${EMPTY}
196 ${port_id}= Get from List ${splitted_output} 0
201 [Arguments] ${router1} ${devstack_conn_id}
202 [Documentation] Retrieve the net id for the given network name to create specific vm instance
203 Switch Connection ${devstack_conn_id}
204 ${output}= Write Commands Until Prompt neutron router-list | grep "${router1}" | awk '{print $2}' 30s
206 ${splitted_output}= Split String ${output} ${EMPTY}
207 ${router_id}= Get from List ${splitted_output} 0
209 [Return] ${router_id}
212 [Arguments] ${net_name} ${vm_instance_names} ${image}=cirros-0.3.4-x86_64-uec ${flavor}=m1.nano ${sg}=default
213 [Documentation] Create X Vm Instance with the net id of the Netowrk.
214 ${devstack_conn_id}= Get ControlNode Connection
215 Switch Connection ${devstack_conn_id}
216 ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
217 : FOR ${VmElement} IN @{vm_instance_names}
218 \ ${output}= Write Commands Until Prompt nova boot --image ${image} --flavor ${flavor} --nic net-id=${net_id} ${VmElement} --security-groups ${sg} 30s
221 Create Vm Instance With Port On Compute Node
222 [Arguments] ${port_name} ${vm_instance_name} ${compute_node} ${image}=cirros-0.3.4-x86_64-uec ${flavor}=m1.nano ${sg}=default
223 [Documentation] Create One VM instance using given ${port_name} and for given ${compute_node}
224 ${devstack_conn_id}= Get ControlNode Connection
225 Switch Connection ${devstack_conn_id}
226 ${port_id}= Get Port Id ${port_name} ${devstack_conn_id}
227 ${hostname_compute_node}= Run Command On Remote System ${compute_node} hostname
228 ${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
230 Wait Until Keyword Succeeds 25s 5s Verify VM Is ACTIVE ${vm_instance_name}
233 [Arguments] ${vm_name}
234 [Documentation] Run these commands to check whether the created vm instance is active or not.
235 ${devstack_conn_id}= Get ControlNode Connection
236 Switch Connection ${devstack_conn_id}
237 ${output}= Write Commands Until Prompt nova show ${vm_name} | grep OS-EXT-STS:vm_state 30s
239 Should Contain ${output} active
241 Verify VMs Received DHCP Lease
242 [Arguments] @{vm_list}
243 [Documentation] Using nova console-log on the provided ${vm_list} to search for the string "obtained" which
244 ... correlates to the instance receiving it's IP address via DHCP. Also retrieved is the ip of the nameserver
245 ... if available in the console-log output. The keyword will also return a list of the learned ips as it
246 ... finds them in the console log output, and will have "None" for Vms that no ip was found.
247 ${devstack_conn_id}= Get ControlNode Connection
248 Switch Connection ${devstack_conn_id}
249 ${ip_list} Create List @{EMPTY}
250 ${dhcp_ip} Create List @{EMPTY}
251 : FOR ${vm} IN @{vm_list}
252 \ ${vm_ip_line}= Write Commands Until Prompt nova console-log ${vm} | grep -i "obtained" 30s
254 \ @{vm_ip} Get Regexp Matches ${vm_ip_line} [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}
255 \ ${vm_ip_length} Get Length ${vm_ip}
256 \ Run Keyword If ${vm_ip_length}>0 Append To List ${ip_list} @{vm_ip}[0]
257 \ ... ELSE Append To List ${ip_list} None
258 \ ${dhcp_ip_line}= Write Commands Until Prompt nova console-log ${vm} | grep "^nameserver" 30s
259 \ Log ${dhcp_ip_line}
260 \ @{dhcp_ip} Get Regexp Matches ${dhcp_ip_line} [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}
262 ${dhcp_length} Get Length ${dhcp_ip}
263 Return From Keyword If ${dhcp_length}==0 ${ip_list} ${EMPTY}
264 [Return] ${ip_list} @{dhcp_ip}[0]
267 [Arguments] ${vm_instance_names}
268 [Documentation] View Console log of the created vm instances using nova show.
269 : FOR ${VmElement} IN @{vm_instance_names}
270 \ ${output}= Write Commands Until Prompt nova show ${VmElement}
272 \ ${output}= Write Commands Until Prompt nova console-log ${VmElement}
275 Ping Vm From DHCP Namespace
276 [Arguments] ${net_name} ${vm_ip}
277 [Documentation] Reach all Vm Instance with the net id of the Netowrk.
279 ${devstack_conn_id}= Get ControlNode Connection
280 Switch Connection ${devstack_conn_id}
281 ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
283 ${output}= Write Commands Until Prompt sudo ip netns exec qdhcp-${net_id} ping -c 3 ${vm_ip} 20s
286 Should Contain ${output} 64 bytes
288 Ping From DHCP Should Not Succeed
289 [Arguments] ${net_name} ${vm_ip}
290 [Documentation] Should Not Reach Vm Instance with the net id of the Netowrk.
292 ${devstack_conn_id}= Get ControlNode Connection
293 Switch Connection ${devstack_conn_id}
294 ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
296 ${output}= Write Commands Until Prompt sudo ip netns exec qdhcp-${net_id} ping -c 3 ${vm_ip} 20s
299 Should Not Contain ${output} 64 bytes
301 Ping Vm From Control Node
302 [Arguments] ${vm_floating_ip}
303 [Documentation] Ping VM floating IP from control node
304 Log ${vm_floating_ip}
305 ${devstack_conn_id}= Get ControlNode Connection
306 Switch Connection ${devstack_conn_id}
307 ${output}= Write Commands Until Prompt ping -c 3 ${vm_floating_ip} 20s
310 Should Contain ${output} 64 bytes
313 [Arguments] ${dest_vm_ip}
314 [Documentation] Ping to the expected destination ip.
315 ${output}= Write Commands Until Expected Prompt ping -c 3 ${dest_vm_ip} ${OS_SYSTEM_PROMPT}
320 [Documentation] Ping to the expected destination ip.
321 ${output}= Write Commands Until Expected Prompt curl -i http://169.254.169.254 ${OS_SYSTEM_PROMPT}
322 Write Commands Until Prompt exit
323 Should Contain ${output} 200
326 [Documentation] Exit the vm instance.
327 ${output}= Write Commands Until Prompt exit
330 Check If Console Is VmInstance
331 [Arguments] ${console}=cirros
332 [Documentation] Check if the session has been able to login to the VM instance
333 ${output}= Write Commands Until Expected Prompt id ${OS_SYSTEM_PROMPT}
334 Should Contain ${output} ${console}
337 [Documentation] Check if the session has been able to login to the VM instance and exit the instance
338 ${rcode}= Run Keyword And Return Status Check If Console Is VmInstance cirros
339 Run Keyword If ${rcode} Write Commands Until Prompt exit
343 [Arguments] ${ip_address}
344 [Documentation] Run Ping command on the IP available as argument
345 ${output}= Write Commands Until Expected Prompt ping -c 3 ${ip_address} ${OS_SYSTEM_PROMPT}
346 Should Contain ${output} 64 bytes
348 Check Metadata Access
349 [Documentation] Try curl on the Metadataurl and check if it is okay
350 ${output}= Write Commands Until Expected Prompt curl -i http://169.254.169.254 ${OS_SYSTEM_PROMPT}
351 Should Contain ${output} 200
353 Execute Command on VM Instance
354 [Arguments] ${net_name} ${vm_ip} ${cmd} ${user}=cirros ${password}=cubswin:)
355 [Documentation] Login to the vm instance using ssh in the network, executes a command inside the VM and returns the ouput.
356 ${devstack_conn_id} = Get ControlNode Connection
357 Switch Connection ${devstack_conn_id}
358 ${net_id} = Get Net Id ${net_name} ${devstack_conn_id}
360 ${output} = Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ssh ${user}@${vm_ip} -o ConnectTimeout=10 -o StrictHostKeyChecking=no d:
362 ${output} = Write Commands Until Expected Prompt ${password} ${OS_SYSTEM_PROMPT}
364 ${rcode} = Run Keyword And Return Status Check If Console Is VmInstance
365 ${output} = Run Keyword If ${rcode} Write Commands Until Expected Prompt ${cmd} ${OS_SYSTEM_PROMPT}
366 [Teardown] Exit From Vm Console
369 Test Operations From Vm Instance
370 [Arguments] ${net_name} ${src_ip} ${dest_ips} ${user}=cirros ${password}=cubswin:)
371 [Documentation] Login to the vm instance using ssh in the network.
372 ${devstack_conn_id}= Get ControlNode Connection
373 Switch Connection ${devstack_conn_id}
375 ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
376 ${output}= Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no ${user}@${src_ip} d:
378 ${output}= Write Commands Until Expected Prompt ${password} ${OS_SYSTEM_PROMPT}
380 ${rcode}= Run Keyword And Return Status Check If Console Is VmInstance
381 Run Keyword If ${rcode} Write Commands Until Expected Prompt ifconfig ${OS_SYSTEM_PROMPT}
382 Run Keyword If ${rcode} Write Commands Until Expected Prompt route ${OS_SYSTEM_PROMPT}
383 Run Keyword If ${rcode} Write Commands Until Expected Prompt arp -an ${OS_SYSTEM_PROMPT}
384 : FOR ${dest_ip} IN @{dest_ips}
386 \ ${string_empty}= Run Keyword And Return Status Should Be Empty ${dest_ip}
387 \ Run Keyword If ${string_empty} Continue For Loop
388 \ Run Keyword If ${rcode} Check Ping ${dest_ip}
389 Run Keyword If ${rcode} Check Metadata Access
390 [Teardown] Exit From Vm Console
393 [Arguments] ${list_of_external_dst_ips}
394 [Documentation] Check reachability with other network's instances.
395 ${rcode}= Run Keyword And Return Status Check If Console Is VmInstance
396 : FOR ${dest_ip} IN @{list_of_external_dst_ips}
398 \ Check Ping ${dest_ip}
401 [Arguments] ${router_name}
402 [Documentation] Create Router and Add Interface to the subnets.
403 ${devstack_conn_id}= Get ControlNode Connection
404 Switch Connection ${devstack_conn_id}
405 ${output}= Write Commands Until Prompt neutron -v router-create ${router_name} 30s
407 Should Contain ${output} Created a new router
410 [Arguments] ${router_name} ${interface_name}
411 ${devstack_conn_id}= Get ControlNode Connection
412 Switch Connection ${devstack_conn_id}
413 ${output}= Write Commands Until Prompt neutron -v router-interface-add ${router_name} ${interface_name}
415 Should Contain ${output} Added interface
418 [Arguments] ${router_name} ${network_name}
419 ${devstack_conn_id}= Get ControlNode Connection
420 Switch Connection ${devstack_conn_id}
421 ${output}= Write Commands Until Prompt neutron -v router-gateway-set ${router_name} ${network_name}
423 Should Contain ${output} Set gateway
426 [Arguments] ${router_name} ${interface_name}
427 [Documentation] Remove Interface to the subnets.
428 ${devstack_conn_id}= Get ControlNode Connection
429 Switch Connection ${devstack_conn_id}
430 ${output}= Write Commands Until Prompt neutron -v router-interface-delete ${router_name} ${interface_name}
432 Should Contain ${output} Removed interface from router
435 [Arguments] ${router_name} ${cmd}
436 [Documentation] Update the router with the command. Router name and command should be passed as argument.
437 ${devstack_conn_id} = Get ControlNode Connection
438 Switch Connection ${devstack_conn_id}
439 ${output} = Write Commands Until Prompt neutron router-update ${router_name} ${cmd} 30s
441 Should Contain ${output} Updated
444 [Arguments] ${router_name} ${options}
445 [Documentation] Show information of a given router. Router name and optional fields should be sent as arguments.
446 ${devstack_conn_id} = Get ControlNode Connection
447 Switch Connection ${devstack_conn_id}
448 ${output} = Write Commands Until Prompt neutron router-show ${router_name} ${options} 30s
453 [Arguments] ${router_name}
454 [Documentation] Delete Router and Interface to the subnets.
455 ${devstack_conn_id}= Get ControlNode Connection
456 Switch Connection ${devstack_conn_id}
457 ${output}= Write Commands Until Prompt neutron -v router-delete ${router_name} 60s
459 Should Match Regexp ${output} Deleted router: ${router_name}|Deleted router\\(s\\): ${router_name}
461 Get DumpFlows And Ovsconfig
462 [Arguments] ${openstack_node_ip}
463 [Documentation] Get the OvsConfig and Flow entries from OVS from the Openstack Node
464 Log ${openstack_node_ip}
465 SSHLibrary.Open Connection ${openstack_node_ip} prompt=${DEFAULT_LINUX_PROMPT}
466 Utils.Flexible SSH Login ${OS_USER} ${DEVSTACK_SYSTEM_PASSWORD}
467 SSHLibrary.Set Client Configuration timeout=${default_devstack_prompt_timeout}
468 Write Commands Until Expected Prompt ip -o link ]>
469 Write Commands Until Expected Prompt ip -o addr ]>
470 Write Commands Until Expected Prompt ip route ]>
471 Write Commands Until Expected Prompt arp -an ]>
472 ${nslist}= Write Commands Until Expected Prompt ip netns list | awk '{print $1}' ]>
473 @{lines} Split To Lines ${nslist}
474 : FOR ${line} IN @{lines}
475 \ Write Commands Until Expected Prompt sudo ip netns exec ${line} ip -o link ]>
476 \ Write Commands Until Expected Prompt sudo ip netns exec ${line} ip -o addr ]>
477 \ Write Commands Until Expected Prompt sudo ip netns exec ${line} ip route ]>
478 Write Commands Until Expected Prompt sudo ovs-vsctl show ]>
479 Write Commands Until Expected Prompt sudo ovs-vsctl list Open_vSwitch ]>
480 Write Commands Until Expected Prompt sudo ovs-ofctl show br-int -OOpenFlow13 ]>
481 Write Commands Until Expected Prompt sudo ovs-ofctl dump-ports-desc br-int -OOpenFlow13 ]>
482 Write Commands Until Expected Prompt sudo ovs-ofctl dump-flows br-int -OOpenFlow13 ]>
483 Write Commands Until Expected Prompt sudo ovs-ofctl dump-groups br-int -OOpenFlow13 ]>
484 Write Commands Until Expected Prompt sudo ovs-ofctl dump-group-stats br-int -OOpenFlow13 ]>
486 Get ControlNode Connection
487 ${control_conn_id}= SSHLibrary.Open Connection ${OS_CONTROL_NODE_IP} prompt=${DEFAULT_LINUX_PROMPT_STRICT}
488 Utils.Flexible SSH Login ${OS_USER} ${DEVSTACK_SYSTEM_PASSWORD}
489 SSHLibrary.Set Client Configuration timeout=30s
490 Source Password force=yes
491 [Return] ${control_conn_id}
494 [Documentation] Get the OvsConfig and Flow entries from all Openstack nodes
495 Run Keyword If 0 < ${NUM_OS_SYSTEM} Get DumpFlows And Ovsconfig ${OS_CONTROL_NODE_IP}
496 Run Keyword If 1 < ${NUM_OS_SYSTEM} Get DumpFlows And Ovsconfig ${OS_COMPUTE_1_IP}
497 Run Keyword If 2 < ${NUM_OS_SYSTEM} Get DumpFlows And Ovsconfig ${OS_COMPUTE_2_IP}
500 [Arguments] @{vm_indices}
501 [Documentation] Run these commands for debugging, it can list state of VM instances and ip information in control node
502 ${devstack_conn_id}= Get ControlNode Connection
503 Switch Connection ${devstack_conn_id}
504 ${output}= Write Commands Until Prompt sudo ip netns list
506 : FOR ${index} IN @{vm_indices}
507 \ ${output}= Write Commands Until Prompt nova show ${index} 30s
515 Create Security Group
516 [Arguments] ${sg_name} ${desc}
517 ${devstack_conn_id}= Get ControlNode Connection
518 Switch Connection ${devstack_conn_id}
519 ${output}= Write Commands Until Prompt nova secgroup-create ${sg_name} ${desc} 40s
523 [Arguments] ${direction} ${protocol} ${min_port} ${max_port} ${remote_ip} ${sg_name}
524 ${devstack_conn_id}= Get ControlNode Connection
525 Switch Connection ${devstack_conn_id}
526 ${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}
529 Neutron Security Group Show
530 [Arguments] ${SecurityGroupRuleName} ${additional_args}=${EMPTY}
531 [Documentation] Displays the neutron security group configurations that belongs to a given neutron security group name
532 ${devstack_conn_id}= Get ControlNode Connection
533 Switch Connection ${devstack_conn_id}
534 ${cmd}= Set Variable neutron security-group-show ${SecurityGroupRuleName} ${additional_args}
536 ${output}= Write Commands Until Prompt ${cmd} 30s
542 [Arguments] ${PortName} ${additional_args}=${EMPTY}
543 [Documentation] Display the port configuration that belong to a given neutron port
544 ${devstack_conn_id}= Get ControlNode Connection
545 Switch Connection ${devstack_conn_id}
546 ${cmd}= Set Variable neutron port-show ${PortName} ${additional_args}
548 ${output}= Write Commands Until Prompt ${cmd} 30s
553 Neutron Security Group Create
554 [Arguments] ${SecurityGroupName} ${additional_args}=${EMPTY}
555 [Documentation] Create a security group with specified name ,description & protocol value according to security group template
556 ${devstack_conn_id}= Get ControlNode Connection
557 Switch Connection ${devstack_conn_id}
558 ${cmd}= Set Variable neutron security-group-create ${SecurityGroupName} ${additional_args}
560 ${output}= Write Commands Until Prompt ${cmd} 30s
562 Should Contain ${output} Created a new security_group
563 ${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}
566 [Return] ${output} ${sgp_id}
568 Neutron Security Group Update
569 [Arguments] ${SecurityGroupName} ${additional_args}=${EMPTY}
570 [Documentation] Updating security groups
571 ${devstack_conn_id}= Get ControlNode Connection
572 Switch Connection ${devstack_conn_id}
573 ${cmd}= Set Variable neutron security-group-update ${SecurityGroupName} ${additional_args}
575 ${output}= Write Commands Until Prompt ${cmd} 30s
580 Neutron Security Group Rule Create
581 [Arguments] ${Security_group_name} &{Kwargs}
582 [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]} ..."
583 ${devstack_conn_id}= Get ControlNode Connection
584 Switch Connection ${devstack_conn_id}
585 Run Keyword If ${Kwargs} Log ${Kwargs}
586 ${description} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} description default=${None}
587 ${direction} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} direction default=${None}
588 ${ethertype} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} ethertype default=${None}
589 ${port_range_max} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} port_range_max default=${None}
590 ${port_range_min} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} port_range_min default=${None}
591 ${protocol} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} protocol default=${None}
592 ${remote_group_id} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} remote_group_id default=${None}
593 ${remote_ip_prefix} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} remote_ip_prefix default=${None}
594 ${cmd}= Set Variable neutron security-group-rule-create ${Security_group_name}
595 ${cmd}= Run Keyword If '${description}'!='None' Catenate ${cmd} --description ${description}
596 ... ELSE Catenate ${cmd}
597 ${cmd}= Run Keyword If '${direction}'!='None' Catenate ${cmd} --direction ${direction}
598 ... ELSE Catenate ${cmd}
599 ${cmd}= Run Keyword If '${ethertype}'!='None' Catenate ${cmd} --ethertype ${ethertype}
600 ... ELSE Catenate ${cmd}
601 ${cmd}= Run Keyword If '${port_range_max}'!='None' Catenate ${cmd} --port_range_max ${port_range_max}
602 ... ELSE Catenate ${cmd}
603 ${cmd}= Run Keyword If '${port_range_min}'!='None' Catenate ${cmd} --port_range_min ${port_range_min}
604 ... ELSE Catenate ${cmd}
605 ${cmd}= Run Keyword If '${protocol}'!='None' Catenate ${cmd} --protocol ${protocol}
606 ... ELSE Catenate ${cmd}
607 ${cmd}= Run Keyword If '${remote_group_id}'!='None' Catenate ${cmd} --remote_group_id ${remote_group_id}
608 ... ELSE Catenate ${cmd}
609 ${cmd}= Run Keyword If '${remote_ip_prefix}'!='None' Catenate ${cmd} --remote_ip_prefix ${remote_ip_prefix}
610 ... ELSE Catenate ${cmd}
611 ${output}= Write Commands Until Prompt ${cmd} 30s
612 ${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}
614 Should Contain ${output} Created a new security_group_rule
616 [Return] ${output} ${rule_id}
618 Create Neutron Port With Additional Params
619 [Arguments] ${network_name} ${port_name} ${additional_args}=${EMPTY}
620 [Documentation] Create Port With given additional parameters
621 ${devstack_conn_id}= Get ControlNode Connection
622 Switch Connection ${devstack_conn_id}
623 ${cmd}= Set Variable neutron -v port-create ${network_name} --name ${port_name} ${additional_args}
625 ${OUTPUT}= Write Commands Until Prompt ${cmd} 30s
627 Should Contain ${output} Created a new port
628 ${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}
631 [Return] ${OUTPUT} ${port_id}