*** Keywords ***
Source Password
- [Arguments] ${force}=no
+ [Arguments] ${force}=no ${source_pwd}=yes
[Documentation] Sourcing the Openstack PAsswords for neutron configurations
Run Keyword If '${source_pwd}' == 'yes' or '${force}' == 'yes' Write Commands Until Prompt cd ${DEVSTACK_DEPLOY_PATH}; source openrc admin admin
+Get Tenant ID From Security Group
+ [Documentation] Returns tenant ID by reading it from existing default security-group.
+ ${devstack_conn_id}= Get ControlNode Connection
+ Switch Connection ${devstack_conn_id}
+ ${output}= Write Commands Until Prompt
+ ... neutron security-group-show default | grep "| tenant_id" | awk '{print $4}'
+ Log ${output}
+ [Return] ${output}
+
Create Network
- [Arguments] ${network_name}
+ [Arguments] ${network_name} ${additional_args}=${EMPTY} ${verbose}=TRUE
[Documentation] Create Network with neutron request.
${devstack_conn_id}= Get ControlNode Connection
Switch Connection ${devstack_conn_id}
- ${output}= Write Commands Until Prompt neutron -v net-create ${network_name} 30s
- Close Connection
+ ${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}'
+ ${output}= Write Commands Until Prompt ${command} 30s
Log ${output}
- Should Contain ${output} Created a new network
+ [Return] ${output}
List Networks
[Documentation] List networks and return output with neutron client.
Log ${output}
[Return] ${output}
+List Subnets
+ [Documentation] List subnets and return output with neutron client.
+ ${devstack_conn_id}= Get ControlNode Connection
+ Switch Connection ${devstack_conn_id}
+ ${output}= Write Commands Until Prompt neutron subnet-list 30s
+ Close Connection
+ Log ${output}
+ [Return] ${output}
+
Delete Network
[Arguments] ${network_name}
[Documentation] Delete Network with neutron request.
Log ${output}
Should Contain ${output} Created a new subnet
+Create Port
+ [Arguments] ${network_name} ${port_name}
+ [Documentation] Create Port with neutron request.
+ ${devstack_conn_id}= Get ControlNode Connection
+ Switch Connection ${devstack_conn_id}
+ ${output}= Write Commands Until Prompt neutron -v port-create ${network_name} --name ${port_name} 30s
+ Close Connection
+ Log ${output}
+ Should Contain ${output} Created a new port
+
Verify Gateway Ips
[Documentation] Verifies the Gateway Ips with dump flow.
${output}= Write Commands Until Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
Close Connection
Get Net Id
- [Arguments] ${network_name}
+ [Arguments] ${network_name} ${devstack_conn_id}
[Documentation] Retrieve the net id for the given network name to create specific vm instance
- ${devstack_conn_id}= Get ControlNode Connection
Switch Connection ${devstack_conn_id}
${output}= Write Commands Until Prompt neutron net-list | grep "${network_name}" | get_field 1 30s
- Close Connection
Log ${output}
${splitted_output}= Split String ${output} ${EMPTY}
${net_id}= Get from List ${splitted_output} 0
Log ${net_id}
[Return] ${net_id}
+Get Port Id
+ [Arguments] ${port_name} ${devstack_conn_id}
+ [Documentation] Retrieve the port id for the given port name to attach specific vm instance to a particular port
+ Switch Connection ${devstack_conn_id}
+ ${port_id}= Write Commands Until Prompt neutron port-list | grep "${port_name} | awk '{print $2}' 30s
+ Log ${port_id}
+ [Return] ${port_id}
+
Create Vm Instances
[Arguments] ${net_name} ${vm_instance_names} ${image}=cirros-0.3.4-x86_64-uec ${flavor}=m1.nano
[Documentation] Create X Vm Instance with the net id of the Netowrk.
${devstack_conn_id}= Get ControlNode Connection
Switch Connection ${devstack_conn_id}
- ${net_id}= Get Net Id ${net_name}
+ ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
: FOR ${VmElement} IN @{vm_instance_names}
\ ${output}= Write Commands Until Prompt nova boot --image ${image} --flavor ${flavor} --nic net-id=${net_id} ${VmElement} 30s
\ Log ${output}
\ Wait Until Keyword Succeeds 25s 5s Verify VM Is ACTIVE ${VmElement}
+Create Vm Instance With Port On Compute Node
+ [Arguments] ${port_name} ${vm_instance_name} ${compute_node} ${image}=cirros-0.3.4-x86_64-uec ${flavor}=m1.nano
+ [Documentation] Create One VM instance using given ${port_name} and for given ${compute_node}
+ ${devstack_conn_id}= Get ControlNode Connection
+ Switch Connection ${devstack_conn_id}
+ ${port_id}= Get Port Id ${port_name} ${devstack_conn_id}
+ ${hostname_compute_node}= Run Command On Remote System ${compute_node} hostname
+ ${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
+ Log ${output}
+ Wait Until Keyword Succeeds 25s 5s Verify VM Is ACTIVE ${vm_instance_name}
+
Verify VM Is ACTIVE
[Arguments] ${vm_name}
[Documentation] Run these commands to check whether the created vm instance is active or not.
Log ${vm_ip}
${devstack_conn_id}= Get ControlNode Connection
Switch Connection ${devstack_conn_id}
- ${net_id}= Get Net Id ${net_name}
+ ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
Log ${net_id}
${output}= Write Commands Until Prompt sudo ip netns exec qdhcp-${net_id} ping -c 3 ${vm_ip} 20s
Log ${output}
Log ${vm_ip}
${devstack_conn_id}= Get ControlNode Connection
Switch Connection ${devstack_conn_id}
- ${net_id}= Get Net Id ${net_name}
+ ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
Log ${net_id}
${output}= Write Commands Until Prompt sudo ip netns exec qdhcp-${net_id} ping -c 3 ${vm_ip} 20s
Close Connection
[Documentation] Login to the vm instance using ssh in the network.
${devstack_conn_id}= Get ControlNode Connection
Switch Connection ${devstack_conn_id}
- ${net_id}= Get Net Id ${net_name}
+ ${net_id}= Get Net Id ${net_name} ${devstack_conn_id}
${output}= Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ssh ${user}@${src_ip} -o ConnectTimeout=10 -o StrictHostKeyChecking=no d:
Log ${output}
${output}= Write Commands Until Expected Prompt ${password} ${OS_SYSTEM_PROMPT}
: FOR ${index} IN @{vm_indices}
\ ${output}= Write Commands Until Prompt nova show ${index} 30s
\ Log ${output}
- Close Connection
\ No newline at end of file
+ Close Connection