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 Match Regexp ${output} Deleted network: ${network_name}|Deleted network\\(s\\): ${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} ${sg}=default
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} --security-group ${sg} 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 Match Regexp ${output} Deleted subnet: ${subnet}|Deleted subnet\\(s\\): ${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
198 Create Vm Instance With Port On Compute Node
199 [Arguments] ${port_name} ${vm_instance_name} ${compute_node} ${image}=cirros-0.3.4-x86_64-uec ${flavor}=m1.nano ${sg}=default
200 [Documentation] Create One VM instance using given ${port_name} and for given ${compute_node}
201 ${devstack_conn_id}= Get ControlNode Connection
202 Switch Connection ${devstack_conn_id}
203 ${port_id}= Get Port Id ${port_name} ${devstack_conn_id}
204 ${hostname_compute_node}= Run Command On Remote System ${compute_node} hostname
205 ${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
207 Wait Until Keyword Succeeds 25s 5s Verify VM Is ACTIVE ${vm_instance_name}
210 [Arguments] ${vm_name}
211 [Documentation] Run these commands to check whether the created vm instance is active or not.
212 ${devstack_conn_id}= Get ControlNode Connection
213 Switch Connection ${devstack_conn_id}
214 ${output}= Write Commands Until Prompt nova show ${vm_name} | grep OS-EXT-STS:vm_state 30s
216 Should Contain ${output} active
218 Verify VMs Received DHCP Lease
219 [Arguments] @{vm_list}
220 [Documentation] Using nova console-log on the provided ${vm_name} to search for the string "obtained" which
221 ... correlates to the instance receiving it's IP address via DHCP. This should provide a good indication
222 ... that the instance is fully up and ready.
223 ${devstack_conn_id}= Get ControlNode Connection
224 Switch Connection ${devstack_conn_id}
225 ${ip_list} Create List
226 : FOR ${vm} IN @{vm_list}
227 \ ${output}= Write Commands Until Prompt nova console-log ${vm} | grep -i "obtained" 30s
228 \ ${dhcp_ip_line}= Write Commands Until Prompt nova console-log ${vm} | grep "^nameserver" 30s
230 \ @{output_words} Split String ${output}
231 \ @{dhcp_output_words} Split String ${dhcp_ip_line}
232 \ Should Contain ${output} obtained
233 \ Append To List ${ip_list} @{output_words}[2]
234 [Return] ${ip_list} @{dhcp_output_words}[1]
237 [Arguments] ${vm_instance_names}
238 [Documentation] View Console log of the created vm instances using nova show.
239 : FOR ${VmElement} IN @{vm_instance_names}
240 \ ${output}= Write Commands Until Prompt nova show ${VmElement}
242 \ ${output}= Write Commands Until Prompt nova console-log ${VmElement}
245 Ping Vm From DHCP Namespace
246 [Arguments] ${net_name} ${vm_ip}
247 [Documentation] Reach all Vm Instance with the net id of the Netowrk.
249 ${devstack_conn_id}= Get ControlNode Connection
250 Switch Connection ${devstack_conn_id}
251 ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
253 ${output}= Write Commands Until Prompt sudo ip netns exec qdhcp-${net_id} ping -c 3 ${vm_ip} 20s
256 Should Contain ${output} 64 bytes
258 Ping From DHCP Should Not Succeed
259 [Arguments] ${net_name} ${vm_ip}
260 [Documentation] Should Not Reach Vm Instance with the net id of the Netowrk.
262 ${devstack_conn_id}= Get ControlNode Connection
263 Switch Connection ${devstack_conn_id}
264 ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
266 ${output}= Write Commands Until Prompt sudo ip netns exec qdhcp-${net_id} ping -c 3 ${vm_ip} 20s
269 Should Not Contain ${output} 64 bytes
272 [Arguments] ${dest_vm_ip}
273 [Documentation] Ping to the expected destination ip.
274 ${output}= Write Commands Until Expected Prompt ping -c 3 ${dest_vm_ip} ${OS_SYSTEM_PROMPT}
279 [Documentation] Ping to the expected destination ip.
280 ${output}= Write Commands Until Expected Prompt curl -i http://169.254.169.254 ${OS_SYSTEM_PROMPT}
281 Write Commands Until Prompt exit
282 Should Contain ${output} 200
285 [Documentation] Exit the vm instance.
286 ${output}= Write Commands Until Prompt exit
289 Check If Console Is VmInstance
290 [Arguments] ${console}=cirros
291 [Documentation] Check if the session has been able to login to the VM instance
292 ${output}= Write Commands Until Expected Prompt id ${OS_SYSTEM_PROMPT}
293 Should Contain ${output} ${console}
296 [Documentation] Check if the session has been able to login to the VM instance and exit the instance
297 ${rcode}= Run Keyword And Return Status Check If Console Is VmInstance cirros
298 Run Keyword If ${rcode} Write Commands Until Prompt exit
302 [Arguments] ${ip_address}
303 [Documentation] Run Ping command on the IP available as argument
304 ${output}= Write Commands Until Expected Prompt ping -c 3 ${ip_address} ${OS_SYSTEM_PROMPT}
305 Should Contain ${output} 64 bytes
307 Check Metadata Access
308 [Documentation] Try curl on the Metadataurl and check if it is okay
309 ${output}= Write Commands Until Expected Prompt curl -i http://169.254.169.254 ${OS_SYSTEM_PROMPT}
310 Should Contain ${output} 200
312 Execute Command on VM Instance
313 [Arguments] ${net_name} ${vm_ip} ${cmd} ${user}=cirros ${password}=cubswin:)
314 [Documentation] Login to the vm instance using ssh in the network, executes a command inside the VM and returns the ouput.
315 ${devstack_conn_id} = Get ControlNode Connection
316 Switch Connection ${devstack_conn_id}
317 ${net_id} = Get Net Id ${net_name} ${devstack_conn_id}
319 ${output} = Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ssh ${user}@${vm_ip} -o ConnectTimeout=10 -o StrictHostKeyChecking=no d:
321 ${output} = Write Commands Until Expected Prompt ${password} ${OS_SYSTEM_PROMPT}
323 ${rcode} = Run Keyword And Return Status Check If Console Is VmInstance
324 ${output} = Run Keyword If ${rcode} Write Commands Until Expected Prompt ${cmd} ${OS_SYSTEM_PROMPT}
325 [Teardown] Exit From Vm Console
328 Test Operations From Vm Instance
329 [Arguments] ${net_name} ${src_ip} ${dest_ips} ${user}=cirros ${password}=cubswin:)
330 [Documentation] Login to the vm instance using ssh in the network.
331 ${devstack_conn_id}= Get ControlNode Connection
332 Switch Connection ${devstack_conn_id}
334 ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
335 ${output}= Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no ${user}@${src_ip} d:
337 ${output}= Write Commands Until Expected Prompt ${password} ${OS_SYSTEM_PROMPT}
339 ${rcode}= Run Keyword And Return Status Check If Console Is VmInstance
340 Run Keyword If ${rcode} Write Commands Until Expected Prompt ifconfig ${OS_SYSTEM_PROMPT}
341 Run Keyword If ${rcode} Write Commands Until Expected Prompt route ${OS_SYSTEM_PROMPT}
342 Run Keyword If ${rcode} Write Commands Until Expected Prompt arp -an ${OS_SYSTEM_PROMPT}
343 : FOR ${dest_ip} IN @{dest_ips}
345 \ ${string_empty}= Run Keyword And Return Status Should Be Empty ${dest_ip}
346 \ Run Keyword If ${string_empty} Continue For Loop
347 \ Run Keyword If ${rcode} Check Ping ${dest_ip}
348 Run Keyword If ${rcode} Check Metadata Access
349 [Teardown] Exit From Vm Console
352 [Arguments] ${list_of_external_dst_ips}
353 [Documentation] Check reachability with other network's instances.
354 ${rcode}= Run Keyword And Return Status Check If Console Is VmInstance
355 : FOR ${dest_ip} IN @{list_of_external_dst_ips}
357 \ Check Ping ${dest_ip}
360 [Arguments] ${router_name}
361 [Documentation] Create Router and Add Interface to the subnets.
362 ${devstack_conn_id}= Get ControlNode Connection
363 Switch Connection ${devstack_conn_id}
364 ${output}= Write Commands Until Prompt neutron -v router-create ${router_name} 30s
366 Should Contain ${output} Created a new router
369 [Arguments] ${router_name} ${interface_name}
370 ${devstack_conn_id}= Get ControlNode Connection
371 Switch Connection ${devstack_conn_id}
372 ${output}= Write Commands Until Prompt neutron -v router-interface-add ${router_name} ${interface_name}
374 Should Contain ${output} Added interface
377 [Arguments] ${router_name} ${interface_name}
378 [Documentation] Remove Interface to the subnets.
379 ${devstack_conn_id}= Get ControlNode Connection
380 Switch Connection ${devstack_conn_id}
381 ${output}= Write Commands Until Prompt neutron -v router-interface-delete ${router_name} ${interface_name}
383 Should Contain ${output} Removed interface from router
386 [Arguments] ${router_name} ${cmd}
387 [Documentation] Update the router with the command. Router name and command should be passed as argument.
388 ${devstack_conn_id} = Get ControlNode Connection
389 Switch Connection ${devstack_conn_id}
390 ${output} = Write Commands Until Prompt neutron router-update ${router_name} ${cmd} 30s
392 Should Contain ${output} Updated
395 [Arguments] ${router_name} ${options}
396 [Documentation] Show information of a given router. Router name and optional fields should be sent as arguments.
397 ${devstack_conn_id} = Get ControlNode Connection
398 Switch Connection ${devstack_conn_id}
399 ${output} = Write Commands Until Prompt neutron router-show ${router_name} ${options} 30s
404 [Arguments] ${router_name}
405 [Documentation] Delete Router and Interface to the subnets.
406 ${devstack_conn_id}= Get ControlNode Connection
407 Switch Connection ${devstack_conn_id}
408 ${output}= Write Commands Until Prompt neutron -v router-delete ${router_name} 60s
410 Should Contain ${output} Deleted router:
412 Get DumpFlows And Ovsconfig
413 [Arguments] ${openstack_node_ip}
414 [Documentation] Get the OvsConfig and Flow entries from OVS from the Openstack Node
415 Log ${openstack_node_ip}
416 SSHLibrary.Open Connection ${openstack_node_ip} prompt=${DEFAULT_LINUX_PROMPT}
417 Utils.Flexible SSH Login ${OS_USER} ${DEVSTACK_SYSTEM_PASSWORD}
418 SSHLibrary.Set Client Configuration timeout=${default_devstack_prompt_timeout}
419 Write Commands Until Expected Prompt ip -o link ]>
420 Write Commands Until Expected Prompt ip -o addr ]>
421 Write Commands Until Expected Prompt ip route ]>
422 Write Commands Until Expected Prompt arp -an ]>
423 ${nslist}= Write Commands Until Expected Prompt ip netns list | awk '{print $1}' ]>
424 @{lines} Split To Lines ${nslist}
425 : FOR ${line} IN @{lines}
426 \ Write Commands Until Expected Prompt sudo ip netns exec ${line} ip -o link ]>
427 \ Write Commands Until Expected Prompt sudo ip netns exec ${line} ip -o addr ]>
428 \ Write Commands Until Expected Prompt sudo ip netns exec ${line} ip route ]>
429 Write Commands Until Expected Prompt sudo ovs-vsctl show ]>
430 Write Commands Until Expected Prompt sudo ovs-vsctl list Open_vSwitch ]>
431 Write Commands Until Expected Prompt sudo ovs-ofctl show br-int -OOpenFlow13 ]>
432 Write Commands Until Expected Prompt sudo ovs-ofctl dump-flows br-int -OOpenFlow13 ]>
433 Write Commands Until Expected Prompt sudo ovs-ofctl dump-groups br-int -OOpenFlow13 ]>
434 Write Commands Until Expected Prompt sudo ovs-ofctl dump-group-stats br-int -OOpenFlow13 ]>
436 Get ControlNode Connection
437 ${control_conn_id}= SSHLibrary.Open Connection ${OS_CONTROL_NODE_IP} prompt=${DEFAULT_LINUX_PROMPT_STRICT}
438 Utils.Flexible SSH Login ${OS_USER} ${DEVSTACK_SYSTEM_PASSWORD}
439 SSHLibrary.Set Client Configuration timeout=30s
440 Source Password force=yes
441 [Return] ${control_conn_id}
444 [Documentation] Get the OvsConfig and Flow entries from all Openstack nodes
445 Run Keyword If 0 < ${NUM_OS_SYSTEM} Get DumpFlows And Ovsconfig ${OS_CONTROL_NODE_IP}
446 Run Keyword If 1 < ${NUM_OS_SYSTEM} Get DumpFlows And Ovsconfig ${OS_COMPUTE_1_IP}
447 Run Keyword If 2 < ${NUM_OS_SYSTEM} Get DumpFlows And Ovsconfig ${OS_COMPUTE_2_IP}
450 [Arguments] ${vm_indices}
451 [Documentation] Run these commands for debugging, it can list state of VM instances and ip information in control node
452 ${devstack_conn_id}= Get ControlNode Connection
453 Switch Connection ${devstack_conn_id}
454 ${output}= Write Commands Until Prompt sudo ip netns list
456 : FOR ${index} IN @{vm_indices}
457 \ ${output}= Write Commands Until Prompt nova show ${index} 30s
464 Create Security Group
465 [Arguments] ${sg_name} ${desc}
466 ${devstack_conn_id}= Get ControlNode Connection
467 Switch Connection ${devstack_conn_id}
468 ${output}= Write Commands Until Prompt nova secgroup-create ${sg_name} ${desc} 40s
472 [Arguments] ${direction} ${protocol} ${min_port} ${max_port} ${remote_ip} ${sg_name}
473 ${devstack_conn_id}= Get ControlNode Connection
474 Switch Connection ${devstack_conn_id}
475 ${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}
478 Neutron Security Group Show
479 [Arguments] ${SecurityGroupRuleName} ${additional_args}=${EMPTY}
480 [Documentation] Displays the neutron security group configurations that belongs to a given neutron security group name
481 ${devstack_conn_id}= Get ControlNode Connection
482 Switch Connection ${devstack_conn_id}
483 ${cmd}= Set Variable neutron security-group-show ${SecurityGroupRuleName} ${additional_args}
485 ${output}= Write Commands Until Prompt ${cmd} 30s
491 [Arguments] ${PortName} ${additional_args}=${EMPTY}
492 [Documentation] Display the port configuration that belong to a given neutron port
493 ${devstack_conn_id}= Get ControlNode Connection
494 Switch Connection ${devstack_conn_id}
495 ${cmd}= Set Variable neutron port-show ${PortName} ${additional_args}
497 ${output}= Write Commands Until Prompt ${cmd} 30s
502 Neutron Security Group Create
503 [Arguments] ${SecurityGroupName} ${additional_args}=${EMPTY}
504 [Documentation] Create a security group with specified name ,description & protocol value according to security group template
505 ${devstack_conn_id}= Get ControlNode Connection
506 Switch Connection ${devstack_conn_id}
507 ${cmd}= Set Variable neutron security-group-create ${SecurityGroupName} ${additional_args}
509 ${output}= Write Commands Until Prompt ${cmd} 30s
511 Should Contain ${output} Created a new security_group
512 ${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}
515 [Return] ${output} ${sgp_id}
517 Neutron Security Group Update
518 [Arguments] ${SecurityGroupName} ${additional_args}=${EMPTY}
519 [Documentation] Updating security groups
520 ${devstack_conn_id}= Get ControlNode Connection
521 Switch Connection ${devstack_conn_id}
522 ${cmd}= Set Variable neutron security-group-update ${SecurityGroupName} ${additional_args}
524 ${output}= Write Commands Until Prompt ${cmd} 30s
529 Neutron Security Group Rule Create
530 [Arguments] ${Security_group_name} &{Kwargs}
531 [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]} ..."
532 ${devstack_conn_id}= Get ControlNode Connection
533 Switch Connection ${devstack_conn_id}
534 Run Keyword If ${Kwargs} Log ${Kwargs}
535 ${description} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} description default=${None}
536 ${direction} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} direction default=${None}
537 ${ethertype} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} ethertype default=${None}
538 ${port_range_max} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} port_range_max default=${None}
539 ${port_range_min} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} port_range_min default=${None}
540 ${protocol} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} protocol default=${None}
541 ${remote_group_id} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} remote_group_id default=${None}
542 ${remote_ip_prefix} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} remote_ip_prefix default=${None}
543 ${cmd}= Set Variable neutron security-group-rule-create ${Security_group_name}
544 ${cmd}= Run Keyword If '${description}'!='None' Catenate ${cmd} --description ${description}
545 ... ELSE Catenate ${cmd}
546 ${cmd}= Run Keyword If '${direction}'!='None' Catenate ${cmd} --direction ${direction}
547 ... ELSE Catenate ${cmd}
548 ${cmd}= Run Keyword If '${ethertype}'!='None' Catenate ${cmd} --ethertype ${ethertype}
549 ... ELSE Catenate ${cmd}
550 ${cmd}= Run Keyword If '${port_range_max}'!='None' Catenate ${cmd} --port_range_max ${port_range_max}
551 ... ELSE Catenate ${cmd}
552 ${cmd}= Run Keyword If '${port_range_min}'!='None' Catenate ${cmd} --port_range_min ${port_range_min}
553 ... ELSE Catenate ${cmd}
554 ${cmd}= Run Keyword If '${protocol}'!='None' Catenate ${cmd} --protocol ${protocol}
555 ... ELSE Catenate ${cmd}
556 ${cmd}= Run Keyword If '${remote_group_id}'!='None' Catenate ${cmd} --remote_group_id ${remote_group_id}
557 ... ELSE Catenate ${cmd}
558 ${cmd}= Run Keyword If '${remote_ip_prefix}'!='None' Catenate ${cmd} --remote_ip_prefix ${remote_ip_prefix}
559 ... ELSE Catenate ${cmd}
560 ${output}= Write Commands Until Prompt ${cmd} 30s
561 ${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}
563 Should Contain ${output} Created a new security_group_rule
565 [Return] ${output} ${rule_id}
567 Create Neutron Port With Additional Params
568 [Arguments] ${network_name} ${port_name} ${additional_args}=${EMPTY}
569 [Documentation] Create Port With given additional parameters
570 ${devstack_conn_id}= Get ControlNode Connection
571 Switch Connection ${devstack_conn_id}
572 ${cmd}= Set Variable neutron -v port-create ${network_name} --name ${port_name} ${additional_args}
574 ${OUTPUT}= Write Commands Until Prompt ${cmd} 30s
576 Should Contain ${output} Created a new port
577 ${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}
580 [Return] ${OUTPUT} ${port_id}