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] ${network_name}
10 [Documentation] Create Network with neutron request.
11 ${output}= Write Commands Until Prompt cd /opt/stack/new/devstack && cat localrc
13 ${output}= Write Commands Until Prompt source openrc admin admin
15 ${output}= Write Commands Until Prompt neutron -v net-create ${network_name}
17 Should Contain ${output} Created a new network
20 [Arguments] ${network_name}
21 [Documentation] Delete Network with neutron request.
22 ${output}= Write Commands Until Prompt neutron -v net-delete ${network_name}
24 Should Contain ${output} Deleted network: ${network_name}
27 [Arguments] ${network_name} ${subnet} ${range_ip}
28 [Documentation] Create SubNet for the Network with neutron request.
29 ${output}= Write Commands Until Prompt neutron -v subnet-create ${network_name} ${range_ip} --name ${subnet}
31 Should Contain ${output} Created a new subnet
34 [Documentation] Verifies the Gateway Ips with dump flow.
35 ${output}= Write Commands Until Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
37 : FOR ${GatewayIpElement} IN @{GATEWAY_IPS}
38 \ Should Contain ${output} ${GatewayIpElement}
41 [Documentation] Verifies the Dhcp Ips with dump flow.
42 ${output}= Write Commands Until Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
44 : FOR ${DhcpIpElement} IN @{DHCP_IPS}
45 \ Should Contain ${output} ${DhcpIpElement}
48 [Documentation] Verifies the Dhcp Ips with dump flow.
49 ${output}= Write Commands Until Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
51 : FOR ${DhcpIpElement} IN @{DHCP_IPS}
52 \ Should Not Contain ${output} ${DhcpIpElement}
56 [Documentation] Delete SubNet for the Network with neutron request.
58 ${output}= Write Commands Until Prompt neutron -v subnet-delete ${subnet}
60 Should Contain ${output} Deleted subnet: ${subnet}
63 [Documentation] Verifies the Gateway Ips removed with dump flow.
64 ${output}= Write Commands Until Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
66 : FOR ${GatewayIpElement} IN @{GATEWAY_IPS}
67 \ Should Not Contain ${output} ${GatewayIpElement}
70 [Arguments] ${net_id} ${network_name}
71 [Documentation] Create Vm Instance with the net id of the Netowrk.
72 ${VmElement}= Set Variable If "${network_name}"=="net1_network" MyFirstInstance MySecondInstance
73 ${output}= Write Commands Until Prompt nova boot --image cirros-0.3.4-x86_64-uec --flavor m1.tiny --nic net-id=${net_id} ${VmElement}
77 [Arguments] ${vm_name}
78 [Documentation] Delete Vm instances using instance names.
79 ${output}= Write Commands Until Prompt nova delete ${vm_name}
83 [Arguments] ${network_name}
84 [Documentation] Retrieve the net id for the given network name to create specific vm instance
85 ${output}= Write Commands Until Prompt neutron net-list | grep "${network_name}" | get_field 1
87 ${splitted_output}= Split String ${output} ${EMPTY}
88 ${net_id}= Get from List ${splitted_output} 0
93 [Arguments] ${net_id} ${vm_instance_names} ${image}=cirros-0.3.4-x86_64-uec ${flavor}=m1.tiny
94 [Documentation] Create Four Vm Instance with the net id of the Netowrk.
95 : FOR ${VmElement} IN @{vm_instance_names}
96 \ ${output}= Write Commands Until Prompt nova boot --image ${image} --flavor ${flavor} --nic net-id=${net_id} ${VmElement}
100 [Arguments] ${vm_instance_names}
101 [Documentation] View Console log of the created vm instances using nova show.
102 : FOR ${VmElement} IN @{vm_instance_names}
103 \ ${output}= Write Commands Until Prompt nova show ${VmElement}
105 \ ${output}= Write Commands Until Prompt nova console-log ${VmElement}
108 Ping Vm From DHCP Namespace
109 [Arguments] ${net_id} ${vm_ip}
110 [Documentation] Reach all Vm Instance with the net id of the Netowrk.
112 ${output}= Write Commands Until Prompt sudo ip netns exec qdhcp-${net_id} ping -c 3 ${vm_ip} 20s
117 [Arguments] ${dest_vm}
118 [Documentation] Ping to the expected destination ip.
119 ${output}= Write Commands Until Expected Prompt ping -c 3 ${dest_vm} $
124 [Documentation] Ping to the expected destination ip.
125 ${output}= Write Commands Until Expected Prompt curl http://169.254.169.254 $
129 [Documentation] Exit the vm instance.
130 ${output}= Write Commands Until Prompt exit
134 [Arguments] ${net_id} ${vm_ip} ${user}=cirros ${password}=cubswin:)
135 [Documentation] Login to the vm instance using ssh in the network.
136 ${output}= Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ssh -i test.pem ${user}@${vm_ip} (yes/no)?
138 ${output}= Write Commands Until Expected Prompt yes d:
140 ${output}= Write Commands Until Expected Prompt ${password} $
142 ${output}= Write Commands Until Expected Prompt ifconfig $
144 ${output}= Write Commands Until Expected Prompt route $
148 [Documentation] Create Router and Add Interface to the subnets.
149 ${output}= Write Commands Until Prompt neutron -v router-create router_1
151 : FOR ${SubnetElement} IN @{SUBNETS_NAME}
152 \ ${output}= Write Commands Until Prompt neutron -v router-interface-add router_1 ${SubnetElement}
156 [Documentation] Remove Interface to the subnets.
157 : FOR ${SubnetElement} IN @{SUBNETS_NAME}
158 \ ${output}= Write Commands Until Prompt neutron -v router-interface-delete router_1 ${SubnetElement}
162 [Documentation] Delete Router and Interface to the subnets.
163 ${output}= Write Commands Until Prompt neutron -v router-delete router_1