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} = RequestsLibrary.Get Request session ${CONFIG_API}/neutron:neutron/networks/network/${network_uuid}/
26 ${matches} = Get Lines Containing String ${resp.content} tenant-id
27 ${matches}= Fetch From Right ${matches} :
28 ${tenant_id}= Strip String ${matches} characters=}]"
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 [Documentation] List networks and return output with neutron client.
43 ${devstack_conn_id}= Get ControlNode Connection
44 Switch Connection ${devstack_conn_id}
45 ${output}= Write Commands Until Prompt neutron net-list 30s
51 [Documentation] List subnets and return output with neutron client.
52 ${devstack_conn_id}= Get ControlNode Connection
53 Switch Connection ${devstack_conn_id}
54 ${output}= Write Commands Until Prompt neutron subnet-list 30s
60 [Arguments] ${network_name}
61 [Documentation] Delete Network with neutron request.
62 ${devstack_conn_id}= Get ControlNode Connection
63 Switch Connection ${devstack_conn_id}
64 ${output}= Write Commands Until Prompt neutron -v net-delete ${network_name} 30s
67 Should Contain ${output} Deleted network: ${network_name}
70 [Arguments] ${network_name} ${subnet} ${range_ip}
71 [Documentation] Create SubNet for the Network with neutron request.
72 ${devstack_conn_id}= Get ControlNode Connection
73 Switch Connection ${devstack_conn_id}
74 ${output}= Write Commands Until Prompt neutron -v subnet-create ${network_name} ${range_ip} --name ${subnet} 30s
77 Should Contain ${output} Created a new subnet
80 [Arguments] ${network_name} ${port_name}
81 [Documentation] Create Port with neutron request.
82 ${devstack_conn_id}= Get ControlNode Connection
83 Switch Connection ${devstack_conn_id}
84 ${output}= Write Commands Until Prompt neutron -v port-create ${network_name} --name ${port_name} 30s
87 Should Contain ${output} Created a new port
90 [Arguments] ${port_name}
91 [Documentation] Delete Port with neutron request.
92 ${devstack_conn_id}= Get ControlNode Connection
93 Switch Connection ${devstack_conn_id}
94 ${output}= Write Commands Until Prompt neutron -v port-delete ${port_name} 30s
97 Should Contain ${output} Deleted port: ${port_name}
100 [Documentation] List ports and return output with neutron client.
101 ${devstack_conn_id}= Get ControlNode Connection
102 Switch Connection ${devstack_conn_id}
103 ${output}= Write Commands Until Prompt neutron port-list 30s
109 [Documentation] Verifies the Gateway Ips with dump flow.
110 ${output}= Write Commands Until Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
112 : FOR ${GatewayIpElement} IN @{GATEWAY_IPS}
113 \ Should Contain ${output} ${GatewayIpElement}
116 [Documentation] Verifies the Dhcp Ips with dump flow.
117 ${output}= Write Commands Until Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
119 : FOR ${DhcpIpElement} IN @{DHCP_IPS}
120 \ Should Contain ${output} ${DhcpIpElement}
123 [Documentation] Verifies the Dhcp Ips with dump flow.
124 ${output}= Write Commands Until Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
126 : FOR ${DhcpIpElement} IN @{DHCP_IPS}
127 \ Should Not Contain ${output} ${DhcpIpElement}
130 [Arguments] ${subnet}
131 [Documentation] Delete SubNet for the Network with neutron request.
133 ${devstack_conn_id}= Get ControlNode Connection
134 Switch Connection ${devstack_conn_id}
135 ${output}= Write Commands Until Prompt neutron -v subnet-delete ${subnet}
138 Should Contain ${output} Deleted subnet: ${subnet}
140 Verify No Gateway Ips
141 [Documentation] Verifies the Gateway Ips removed with dump flow.
142 ${output}= Write Commands Until Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
144 : FOR ${GatewayIpElement} IN @{GATEWAY_IPS}
145 \ Should Not Contain ${output} ${GatewayIpElement}
148 [Arguments] ${vm_name}
149 [Documentation] Delete Vm instances using instance names.
150 ${devstack_conn_id}= Get ControlNode Connection
151 Switch Connection ${devstack_conn_id}
152 ${output}= Write Commands Until Prompt nova force-delete ${vm_name} 40s
156 [Arguments] ${network_name} ${devstack_conn_id}
157 [Documentation] Retrieve the net id for the given network name to create specific vm instance
158 Switch Connection ${devstack_conn_id}
159 ${output}= Write Commands Until Prompt neutron net-list | grep "${network_name}" | awk '{print $2}' 30s
161 ${splitted_output}= Split String ${output} ${EMPTY}
162 ${net_id}= Get from List ${splitted_output} 0
167 [Arguments] ${port_name} ${devstack_conn_id}
168 [Documentation] Retrieve the port id for the given port name to attach specific vm instance to a particular port
169 Switch Connection ${devstack_conn_id}
170 ${output}= Write Commands Until Prompt neutron port-list | grep "${port_name}" | awk '{print $2}' 30s
172 ${splitted_output}= Split String ${output} ${EMPTY}
173 ${port_id}= Get from List ${splitted_output} 0
178 [Arguments] ${router1} ${devstack_conn_id}
179 [Documentation] Retrieve the net id for the given network name to create specific vm instance
180 Switch Connection ${devstack_conn_id}
181 ${output}= Write Commands Until Prompt neutron router-list | grep "${router1}" | awk '{print $2}' 30s
183 ${splitted_output}= Split String ${output} ${EMPTY}
184 ${router_id}= Get from List ${splitted_output} 0
186 [Return] ${router_id}
189 [Arguments] ${net_name} ${vm_instance_names} ${image}=cirros-0.3.4-x86_64-uec ${flavor}=m1.nano ${sg}=default
190 [Documentation] Create X Vm Instance with the net id of the Netowrk.
191 ${devstack_conn_id}= Get ControlNode Connection
192 Switch Connection ${devstack_conn_id}
193 ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
194 : FOR ${VmElement} IN @{vm_instance_names}
195 \ ${output}= Write Commands Until Prompt nova boot --image ${image} --flavor ${flavor} --nic net-id=${net_id} ${VmElement} --security-groups ${sg} 30s
197 \ Wait Until Keyword Succeeds 25s 5s Verify VM Is ACTIVE ${VmElement}
199 Create Vm Instance With Port On Compute Node
200 [Arguments] ${port_name} ${vm_instance_name} ${compute_node} ${image}=cirros-0.3.4-x86_64-uec ${flavor}=m1.nano
201 [Documentation] Create One VM instance using given ${port_name} and for given ${compute_node}
202 ${devstack_conn_id}= Get ControlNode Connection
203 Switch Connection ${devstack_conn_id}
204 ${port_id}= Get Port Id ${port_name} ${devstack_conn_id}
205 ${hostname_compute_node}= Run Command On Remote System ${compute_node} hostname
206 ${output}= Write Commands Until Prompt nova boot --image ${image} --flavor ${flavor} --nic port-id=${port_id} ${vm_instance_name} --availability-zone nova:${hostname_compute_node} 30s
208 Wait Until Keyword Succeeds 25s 5s Verify VM Is ACTIVE ${vm_instance_name}
211 [Arguments] ${vm_name}
212 [Documentation] Run these commands to check whether the created vm instance is active or not.
213 ${output}= Write Commands Until Prompt nova show ${vm_name} | grep OS-EXT-STS:vm_state 30s
215 Should Contain ${output} active
218 [Arguments] ${vm_instance_names}
219 [Documentation] View Console log of the created vm instances using nova show.
220 : FOR ${VmElement} IN @{vm_instance_names}
221 \ ${output}= Write Commands Until Prompt nova show ${VmElement}
223 \ ${output}= Write Commands Until Prompt nova console-log ${VmElement}
226 Ping Vm From DHCP Namespace
227 [Arguments] ${net_name} ${vm_ip}
228 [Documentation] Reach all Vm Instance with the net id of the Netowrk.
230 ${devstack_conn_id}= Get ControlNode Connection
231 Switch Connection ${devstack_conn_id}
232 ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
234 ${output}= Write Commands Until Prompt sudo ip netns exec qdhcp-${net_id} ping -c 3 ${vm_ip} 20s
237 Should Contain ${output} 64 bytes
239 Ping From DHCP Should Not Succeed
240 [Arguments] ${net_name} ${vm_ip}
241 [Documentation] Should Not Reach Vm Instance with the net id of the Netowrk.
243 ${devstack_conn_id}= Get ControlNode Connection
244 Switch Connection ${devstack_conn_id}
245 ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
247 ${output}= Write Commands Until Prompt sudo ip netns exec qdhcp-${net_id} ping -c 3 ${vm_ip} 20s
250 Should Not Contain ${output} 64 bytes
253 [Arguments] ${dest_vm}
254 [Documentation] Ping to the expected destination ip.
255 ${output}= Write Commands Until Expected Prompt ping -c 3 ${dest_vm} ${OS_SYSTEM_PROMPT}
260 [Documentation] Ping to the expected destination ip.
261 ${output}= Write Commands Until Expected Prompt curl -i http://169.254.169.254 ${OS_SYSTEM_PROMPT}
262 Write Commands Until Prompt exit
263 Should Contain ${output} 200
266 [Documentation] Exit the vm instance.
267 ${output}= Write Commands Until Prompt exit
270 Check If Console Is VmInstance
271 [Arguments] ${console}=cirros
272 [Documentation] Check if the session has been able to login to the VM instance
273 ${output}= Write Commands Until Expected Prompt id ${OS_SYSTEM_PROMPT}
274 Should Contain ${output} ${console}
277 [Documentation] Check if the session has been able to login to the VM instance and exit the instance
278 ${rcode}= Run Keyword And Return Status Check If Console Is VmInstance cirros
279 Run Keyword If ${rcode} Write Commands Until Prompt exit
283 [Arguments] ${ip_address}
284 [Documentation] Run Ping command on the IP available as argument
285 ${output}= Write Commands Until Expected Prompt ping -c 3 ${ip_address} ${OS_SYSTEM_PROMPT}
286 Should Contain ${output} 64 bytes
288 Check Metadata Access
289 [Documentation] Try curl on the Metadataurl and check if it is okay
290 ${output}= Write Commands Until Expected Prompt curl -i http://169.254.169.254 ${OS_SYSTEM_PROMPT}
291 Should Contain ${output} 200
293 Execute Command on VM Instance
294 [Arguments] ${net_name} ${src_ip} ${cmd} ${user}=cirros ${password}=cubswin:)
295 [Documentation] Login to the vm instance using ssh in the network, executes a command inside the VM and returns the ouput.
296 ${devstack_conn_id} = Get ControlNode Connection
297 Switch Connection ${devstack_conn_id}
298 ${net_id} = Get Net Id ${net_name} ${devstack_conn_id}
299 ${output} = Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ssh ${user}@${src_ip} -o ConnectTimeout=10 -o StrictHostKeyChecking=no d:
301 ${output} = Write Commands Until Expected Prompt ${password} ${OS_SYSTEM_PROMPT}
303 ${rcode} = Run Keyword And Return Status Check If Console Is VmInstance
304 ${output} = Run Keyword If ${rcode} Write Commands Until Expected Prompt ${cmd} ${OS_SYSTEM_PROMPT}
305 [Teardown] Exit From Vm Console
308 Test Operations From Vm Instance
309 [Arguments] ${net_name} ${src_ip} ${list_of_local_dst_ips} ${l2_or_l3}=l2 ${list_of_external_dst_ips}=${NONE} ${user}=cirros
310 ... ${password}=cubswin:)
311 [Documentation] Login to the vm instance using ssh in the network.
312 ${devstack_conn_id}= Get ControlNode Connection
313 Switch Connection ${devstack_conn_id}
314 ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
315 ${output}= Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ssh ${user}@${src_ip} -o ConnectTimeout=10 -o StrictHostKeyChecking=no d:
317 ${output}= Write Commands Until Expected Prompt ${password} ${OS_SYSTEM_PROMPT}
319 ${rcode}= Run Keyword And Return Status Check If Console Is VmInstance
320 Run Keyword If ${rcode} Write Commands Until Expected Prompt ifconfig ${OS_SYSTEM_PROMPT}
321 Run Keyword If ${rcode} Write Commands Until Expected Prompt route ${OS_SYSTEM_PROMPT}
322 Run Keyword If ${rcode} Write Commands Until Expected Prompt arp -an ${OS_SYSTEM_PROMPT}
323 : FOR ${dest_ip} IN @{list_of_local_dst_ips}
325 \ Run Keyword If ${rcode} Check Ping ${dest_ip}
326 Run Keyword If ${rcode} Check Metadata Access
327 Run Keyword If '${l2_or_l3}' == 'l3' Ping Other Instances ${list_of_external_dst_ips}
328 [Teardown] Exit From Vm Console
331 [Arguments] ${list_of_external_dst_ips}
332 [Documentation] Check reachability with other network's instances.
333 ${rcode}= Run Keyword And Return Status Check If Console Is VmInstance
334 : FOR ${dest_ip} IN @{list_of_external_dst_ips}
336 \ Run Keyword If ${rcode} Check Ping ${dest_ip}
339 [Arguments] ${router_name}
340 [Documentation] Create Router and Add Interface to the subnets.
341 ${devstack_conn_id}= Get ControlNode Connection
342 Switch Connection ${devstack_conn_id}
343 ${output}= Write Commands Until Prompt neutron -v router-create ${router_name} 30s
345 Should Contain ${output} Created a new router
348 [Arguments] ${router_name} ${interface_name}
349 ${devstack_conn_id}= Get ControlNode Connection
350 Switch Connection ${devstack_conn_id}
351 ${output}= Write Commands Until Prompt neutron -v router-interface-add ${router_name} ${interface_name}
353 Should Contain ${output} Added interface
356 [Arguments] ${router_name} ${interface_name}
357 [Documentation] Remove Interface to the subnets.
358 ${devstack_conn_id}= Get ControlNode Connection
359 Switch Connection ${devstack_conn_id}
360 ${output}= Write Commands Until Prompt neutron -v router-interface-delete ${router_name} ${interface_name}
362 Should Contain ${output} Removed interface from router
365 [Arguments] ${router_name} ${cmd}
366 [Documentation] Update the router with the command. Router name and command should be passed as argument.
367 ${devstack_conn_id} = Get ControlNode Connection
368 Switch Connection ${devstack_conn_id}
369 ${output} = Write Commands Until Prompt neutron router-update ${router_name} ${cmd} 30s
371 Should Contain ${output} Updated
374 [Arguments] ${router_name} ${options}
375 [Documentation] Show information of a given router. Router name and optional fields should be sent as arguments.
376 ${devstack_conn_id} = Get ControlNode Connection
377 Switch Connection ${devstack_conn_id}
378 ${output} = Write Commands Until Prompt neutron router-show ${router_name} ${options} 30s
383 [Arguments] ${router_name}
384 [Documentation] Delete Router and Interface to the subnets.
385 ${devstack_conn_id}= Get ControlNode Connection
386 Switch Connection ${devstack_conn_id}
387 ${output}= Write Commands Until Prompt neutron -v router-delete ${router_name} 60s
389 Should Contain ${output} Deleted router:
391 Get DumpFlows And Ovsconfig
392 [Arguments] ${openstack_node_ip}
393 [Documentation] Get the OvsConfig and Flow entries from OVS from the Openstack Node
394 Log ${openstack_node_ip}
395 SSHLibrary.Open Connection ${openstack_node_ip} prompt=${DEFAULT_LINUX_PROMPT}
396 Utils.Flexible SSH Login ${OS_USER} ${DEVSTACK_SYSTEM_PASSWORD}
397 SSHLibrary.Set Client Configuration timeout=${default_devstack_prompt_timeout}
398 Write Commands Until Expected Prompt ip -o link ]>
399 Write Commands Until Expected Prompt ip -o addr ]>
400 Write Commands Until Expected Prompt ip route ]>
401 Write Commands Until Expected Prompt arp -an ]>
402 ${nslist}= Write Commands Until Expected Prompt ip netns list | awk '{print $1}' ]>
403 @{lines} Split To Lines ${nslist}
404 : FOR ${line} IN @{lines}
405 \ Write Commands Until Expected Prompt sudo ip netns exec ${line} ip -o link ]>
406 \ Write Commands Until Expected Prompt sudo ip netns exec ${line} ip -o addr ]>
407 \ Write Commands Until Expected Prompt sudo ip netns exec ${line} ip route ]>
408 Write Commands Until Expected Prompt sudo ovs-vsctl show ]>
409 Write Commands Until Expected Prompt sudo ovs-vsctl list Open_vSwitch ]>
410 Write Commands Until Expected Prompt sudo ovs-ofctl show br-int -OOpenFlow13 ]>
411 Write Commands Until Expected Prompt sudo ovs-ofctl dump-flows br-int -OOpenFlow13 ]>
412 Write Commands Until Expected Prompt sudo ovs-ofctl dump-groups br-int -OOpenFlow13 ]>
413 Write Commands Until Expected Prompt sudo ovs-ofctl dump-group-stats br-int -OOpenFlow13 ]>
415 Get ControlNode Connection
416 ${control_conn_id}= SSHLibrary.Open Connection ${OS_CONTROL_NODE_IP} prompt=${DEFAULT_LINUX_PROMPT_STRICT}
417 Utils.Flexible SSH Login ${OS_USER} ${DEVSTACK_SYSTEM_PASSWORD}
418 SSHLibrary.Set Client Configuration timeout=30s
419 Source Password force=yes
420 [Return] ${control_conn_id}
423 [Documentation] Get the OvsConfig and Flow entries from all Openstack nodes
424 Run Keyword If 0 < ${NUM_OS_SYSTEM} Get DumpFlows And Ovsconfig ${OS_CONTROL_NODE_IP}
425 Run Keyword If 1 < ${NUM_OS_SYSTEM} Get DumpFlows And Ovsconfig ${OS_COMPUTE_1_IP}
426 Run Keyword If 2 < ${NUM_OS_SYSTEM} Get DumpFlows And Ovsconfig ${OS_COMPUTE_2_IP}
429 [Arguments] ${vm_indices}
430 [Documentation] Run these commands for debugging, it can list state of VM instances and ip information in control node
431 ${devstack_conn_id}= Get ControlNode Connection
432 Switch Connection ${devstack_conn_id}
433 ${output}= Write Commands Until Prompt sudo ip netns list
435 : FOR ${index} IN @{vm_indices}
436 \ ${output}= Write Commands Until Prompt nova show ${index} 30s
443 Create Security Group
444 [Arguments] ${sg_name} ${desc}
445 ${devstack_conn_id}= Get ControlNode Connection
446 Switch Connection ${devstack_conn_id}
447 ${output}= Write Commands Until Prompt nova secgroup-create ${sg_name} ${desc} 40s
451 [Arguments] ${direction} ${protocol} ${min_port} ${max_port} ${remote_ip} ${sg_name}
452 ${devstack_conn_id}= Get ControlNode Connection
453 Switch Connection ${devstack_conn_id}
454 ${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}
457 Neutron Security Group Show
458 [Arguments] ${SecurityGroupRuleName} ${additional_args}=${EMPTY}
459 [Documentation] Displays the neutron security group configurations that belongs to a given neutron security group name
460 ${devstack_conn_id}= Get ControlNode Connection
461 Switch Connection ${devstack_conn_id}
462 ${cmd}= Set Variable neutron security-group-show ${SecurityGroupRuleName} ${additional_args}
464 ${output}= Write Commands Until Prompt ${cmd} 30s
470 [Arguments] ${PortName} ${additional_args}=${EMPTY}
471 [Documentation] Display the port configuration that belong to a given neutron port
472 ${devstack_conn_id}= Get ControlNode Connection
473 Switch Connection ${devstack_conn_id}
474 ${cmd}= Set Variable neutron port-show ${PortName} ${additional_args}
476 ${output}= Write Commands Until Prompt ${cmd} 30s
481 Neutron Security Group Create
482 [Arguments] ${SecurityGroupName} ${additional_args}=${EMPTY}
483 [Documentation] Create a security group with specified name ,description & protocol value according to security group template
484 ${devstack_conn_id}= Get ControlNode Connection
485 Switch Connection ${devstack_conn_id}
486 ${cmd}= Set Variable neutron security-group-create ${SecurityGroupName} ${additional_args}
488 ${output}= Write Commands Until Prompt ${cmd} 30s
490 Should Contain ${output} Created a new security_group
491 ${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}
494 [Return] ${output} ${sgp_id}
496 Neutron Security Group Update
497 [Arguments] ${SecurityGroupName} ${additional_args}=${EMPTY}
498 [Documentation] Updating security groups
499 ${devstack_conn_id}= Get ControlNode Connection
500 Switch Connection ${devstack_conn_id}
501 ${cmd}= Set Variable neutron security-group-update ${SecurityGroupName} ${additional_args}
503 ${output}= Write Commands Until Prompt ${cmd} 30s
508 Neutron Security Group Rule Create
509 [Arguments] ${Security_group_name} &{Kwargs}
510 [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]} ..."
511 ${devstack_conn_id}= Get ControlNode Connection
512 Switch Connection ${devstack_conn_id}
513 Run Keyword If ${Kwargs} Log ${Kwargs}
514 ${description} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} description default=${None}
515 ${direction} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} direction default=${None}
516 ${ethertype} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} ethertype default=${None}
517 ${port_range_max} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} port_range_max default=${None}
518 ${port_range_min} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} port_range_min default=${None}
519 ${protocol} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} protocol default=${None}
520 ${remote_group_id} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} remote_group_id default=${None}
521 ${remote_ip_prefix} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} remote_ip_prefix default=${None}
522 ${cmd}= Set Variable neutron security-group-rule-create ${Security_group_name}
523 ${cmd}= Run Keyword If '${description}'!='None' Catenate ${cmd} --description ${description}
524 ... ELSE Catenate ${cmd}
525 ${cmd}= Run Keyword If '${direction}'!='None' Catenate ${cmd} --direction ${direction}
526 ... ELSE Catenate ${cmd}
527 ${cmd}= Run Keyword If '${ethertype}'!='None' Catenate ${cmd} --ethertype ${ethertype}
528 ... ELSE Catenate ${cmd}
529 ${cmd}= Run Keyword If '${port_range_max}'!='None' Catenate ${cmd} --port_range_max ${port_range_max}
530 ... ELSE Catenate ${cmd}
531 ${cmd}= Run Keyword If '${port_range_min}'!='None' Catenate ${cmd} --port_range_min ${port_range_min}
532 ... ELSE Catenate ${cmd}
533 ${cmd}= Run Keyword If '${protocol}'!='None' Catenate ${cmd} --protocol ${protocol}
534 ... ELSE Catenate ${cmd}
535 ${cmd}= Run Keyword If '${remote_group_id}'!='None' Catenate ${cmd} --remote_group_id ${remote_group_id}
536 ... ELSE Catenate ${cmd}
537 ${cmd}= Run Keyword If '${remote_ip_prefix}'!='None' Catenate ${cmd} --remote_ip_prefix ${remote_ip_prefix}
538 ... ELSE Catenate ${cmd}
539 ${output}= Write Commands Until Prompt ${cmd} 30s
540 ${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}
542 Should Contain ${output} Created a new security_group_rule
544 [Return] ${output} ${rule_id}
546 Create Neutron Port With Additional Params
547 [Arguments] ${network_name} ${port_name} ${additional_args}=${EMPTY}
548 [Documentation] Create Port With given additional parameters
549 ${devstack_conn_id}= Get ControlNode Connection
550 Switch Connection ${devstack_conn_id}
551 ${cmd}= Set Variable neutron -v port-create ${network_name} --name ${port_name} ${additional_args}
553 ${OUTPUT}= Write Commands Until Prompt ${cmd} 30s
555 Should Contain ${output} Created a new port
556 ${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}
559 [Return] ${OUTPUT} ${port_id}