2 Documentation Test suite for Tunnel Monitoring. More test cases to be added in subsequent patches.
3 Suite Setup Start Suite
4 Suite Teardown Stop Suite
5 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
6 Test Teardown Run Keyword If Test Failed Get OvsDebugInfo
7 Library OperatingSystem
8 Library RequestsLibrary
9 Resource ../../../libraries/OpenStackOperations.robot
10 Resource ../../../libraries/DevstackUtils.robot
11 Resource ../../../libraries/VpnOperations.robot
12 Resource ../../../libraries/SetupUtils.robot
13 Resource ../../../libraries/KarafKeywords.robot
14 Resource ../../../libraries/OVSDB.robot
15 Resource ../../../variables/netvirt/Variables.robot
16 Resource ../../../variables/Variables.robot
21 ${STATE_ENABLE} ENABLED
22 ${STATE_DISABLE} DISABLE
23 ${BFD_ENABLED_FALSE} false
24 ${BFD_ENABLED_TRUE} true
25 ${PING_REGEXP} , 0% packet loss
26 ${VAR_BASE} ${CURDIR}/../../../variables/netvirt
29 TC00 Verify Tunnels Are Present
30 [Documentation] Verify if tunnels are present. If not then create new tunnel.
31 ${output}= ITM Get Tunnels
33 ${count}= Get Count ${output} tunnel_port
35 Run Keyword If ${count} == 0 Create Tunnel
37 TC01 Verify That Default Tunnel Type Is Set To BFD
38 [Documentation] Verify that the default tunnel type is set to BFD if both the devices support BFD
39 Log Verifying ITM tunnel through REST
40 ${output}= ITM Get Tunnels
42 Log Verifying the BFD based tunnel configuration
43 ${output}= Issue Command On Karaf Console ${TEP_SHOW}
45 Should Contain ${output} ${TUNNEL_MONITOR_ON}
46 Should Contain ${output} ${MONITORING_INTERVAL}
47 Should Contain ${output} ${INTERVAL_1000}
48 Log Verifying the tunnel state with show state command
49 Wait Until Keyword Succeeds 30s 5s Verify Tunnel Status as UP
50 Log Verifying the default configuration i.e BFD, tunnel monitoring enabled
51 ${resp} RequestsLibrary.Get Request session ${TUNNEL_MONITOR_URL}
52 Should Be Equal As Strings ${resp.status_code} ${RESP_CODE}
54 Should Contain ${resp.content} ${BFD}
55 Should Contain ${resp.content} ${BFD_ENABLED_TRUE}
56 Log Verifying the default monitor interval
57 ${resp} RequestsLibrary.Get Request session ${MONITOR_INTERVAL_URL}
58 Should Be Equal As Strings ${resp.status_code} ${RESP_CODE}
60 Should Contain ${resp.content} ${TMI_1000}
61 Log Verifying the VXLAN Interface
62 Wait Until Keyword Succeeds 180s 10s Verify VXLAN interface
63 Log Verify Flows are present
64 Wait Until Keyword Succeeds 30s 5s Verify Flows Are Present ${OS_COMPUTE_1_IP}
65 Wait Until Keyword Succeeds 30s 5s Verify Flows Are Present ${OS_COMPUTE_2_IP}
66 Log Verify Ping Between VMs on different Compute Nodes
67 Wait Until Keyword Succeeds 30s 5s Verify Ping
71 [Documentation] Run before the suite execution
72 DevstackUtils.Devstack Suite Setup
73 SetupUtils.Setup_Utils_For_Setup_And_Teardown
79 [Documentation] Run after the tests execution
85 [Documentation] Uses log:set TRACE org.opendaylight.netvirt to enable log
86 Log "Enabled ODL Karaf log for org.opendaylight.netvirt"
87 ${output}= Issue Command On Karaf Console log:set TRACE org.opendaylight.netvirt
91 [Documentation] Uses log:set TRACE org.opendaylight.netvirt to enable log
92 Log "Enabled ODL Karaf log for org.opendaylight.netvirt"
93 ${output}= Issue Command On Karaf Console log:set INFO org.opendaylight.netvirt
97 [Documentation] Clean the already existing tunnels and tep interfaces
98 ${resp} RequestsLibrary.Delete Request session ${TUNNEL_TRANSPORTZONE}
100 ${resp} RequestsLibrary.Delete Request session ${TUNNEL_INTERFACES}
104 [Documentation] Create Two Networks, Two Subnets, Four Ports And Four VMs
105 Log Create two networks
106 Create Network ${NETWORKS[0]}
107 Create Network ${NETWORKS[1]}
108 ${NET_LIST} List Networks
109 Should Contain ${NET_LIST} ${NETWORKS[0]}
110 Should Contain ${NET_LIST} ${NETWORKS[1]}
111 Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${NETWORK_URL} ${NETWORKS}
112 Log Create two subnets for previously created networks
113 Create SubNet ${NETWORKS[0]} ${SUBNETS[0]} ${SUBNET_CIDR[0]}
114 Create SubNet ${NETWORKS[1]} ${SUBNETS[1]} ${SUBNET_CIDR[1]}
115 ${SUB_LIST} List Subnets
116 Should Contain ${SUB_LIST} ${SUBNETS[0]}
117 Should Contain ${SUB_LIST} ${SUBNETS[1]}
118 Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${SUBNETWORK_URL} ${SUBNETS}
119 Log Create four ports under previously created subnets
120 Create Port ${NETWORKS[0]} ${PORT_LIST[0]} sg=sg-vpnservice
121 Create Port ${NETWORKS[0]} ${PORT_LIST[1]} sg=sg-vpnservice
122 Create Port ${NETWORKS[1]} ${PORT_LIST[2]} sg=sg-vpnservice
123 Create Port ${NETWORKS[1]} ${PORT_LIST[3]} sg=sg-vpnservice
124 Wait Until Keyword Succeeds 3s 1s Check For Elements At URI ${PORT_URL} ${PORT_LIST}
125 Log Create VM Instances
126 Create Vm Instance With Port On Compute Node ${PORT_LIST[0]} ${VM_INSTANCES_NET1[0]} ${OS_COMPUTE_1_IP} sg=sg-vpnservice
127 Create Vm Instance With Port On Compute Node ${PORT_LIST[1]} ${VM_INSTANCES_NET1[1]} ${OS_COMPUTE_2_IP} sg=sg-vpnservice
128 Create Vm Instance With Port On Compute Node ${PORT_LIST[2]} ${VM_INSTANCES_NET2[0]} ${OS_COMPUTE_1_IP} sg=sg-vpnservice
129 Create Vm Instance With Port On Compute Node ${PORT_LIST[3]} ${VM_INSTANCES_NET2[1]} ${OS_COMPUTE_2_IP} sg=sg-vpnservice
130 : FOR ${VM} IN @{VM_INSTANCES_NET1} @{VM_INSTANCES_NET2}
131 \ Wait Until Keyword Succeeds 25s 5s Verify VM Is ACTIVE ${VM}
132 ${VM_IP_NET1} ${VM_IP_NET2} Wait Until Keyword Succeeds 180s 10s Verify VMs received IP
133 Set Suite Variable ${VM_IP_NET2}
134 Set Suite Variable ${VM_IP_NET1}
136 Verify VMs received IP
137 [Documentation] Verify VM received IP
138 ${VM_IP_NET1} ${DHCP_IP1} Verify VMs Received DHCP Lease @{VM_INSTANCES_NET1}
140 ${VM_IP_NET2} ${DHCP_IP2} Verify VMs Received DHCP Lease @{VM_INSTANCES_NET2}
142 Should Not Contain ${VM_IP_NET2} None
143 Should Not Contain ${VM_IP_NET1} None
144 [Return] ${VM_IP_NET1} ${VM_IP_NET2}
147 [Documentation] Verify Ping among VMs
148 ${output}= Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET1[0]} ping -c 3 ${VM_IP_NET1[1]}
149 Should Contain ${output} ${PING_REGEXP}
150 ${output}= Execute Command on VM Instance @{NETWORKS}[1] ${VM_IP_NET2[0]} ping -c 3 ${VM_IP_NET2[1]}
151 Should Contain ${output} ${PING_REGEXP}
152 ${output}= Execute Command on VM Instance @{NETWORKS}[0] ${VM_IP_NET1[1]} ping -c 3 ${VM_IP_NET1[0]}
153 Should Contain ${output} ${PING_REGEXP}
154 ${output}= Execute Command on VM Instance @{NETWORKS}[1] ${VM_IP_NET2[1]} ping -c 3 ${VM_IP_NET2[0]}
155 Should Contain ${output} ${PING_REGEXP}
157 Verify Flows Are Present
159 [Documentation] Verify Flows Are Present
160 ${flow_output}= Run Command On Remote System ${ip} sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
162 ${resp}= Should Contain ${flow_output} table=50
164 ${resp}= Should Match regexp ${flow_output} table=0.*goto_table:36
165 ${resp}= Should Match regexp ${flow_output} table=0.*goto_table:17
166 ${table51_output} = Get Lines Containing String ${flow_output} table=51
167 Log ${table51_output}
168 @{table51_output}= Split To Lines ${table51_output} 0 -1
169 : FOR ${line} IN @{table51_output}
171 \ ${resp}= Should Match Regexp ${line} ${MAC_REGEX}
173 Verify Tunnel Status as UP
174 [Documentation] Verify that the tunnels are UP
175 ${output}= Issue Command On Karaf Console ${TEP_SHOW_STATE}
177 Should Contain ${output} ${STATE_UP}
178 Should Not Contain ${output} ${STATE_DOWN}
180 Verify Tunnel Status as DOWN
181 [Documentation] Verify that the tunnels are DOWN
182 ${output}= Issue Command On Karaf Console ${TEP_SHOW_STATE}
184 Should Contain ${output} ${STATE_DOWN}
186 Verify VXLAN interface
187 [Documentation] Verify that the VXLAN interfaces are Enabled
188 ${output}= Issue Command On Karaf Console ${VXLAN_SHOW}
190 Should Contain ${output} ${STATE_UP}
191 Should Contain ${output} ${STATE_ENABLE}
192 Should Not Contain ${output} ${STATE_DISABLE}
195 [Documentation] Create tunnels betwee the 2 compute nodes and Openstack controller.
196 Log If ODL version is Boron or higher then ITM tunnel should be auto configured. If not then the suite should fail. For ODL version Beryllium or lower, ITM tunnel should be created.
197 Should Not Match Regexp ${ODL_STREAM} boron|carbon
198 ${node_1_dpid}= Get DPID ${OS_COMPUTE_1_IP}
199 ${node_2_dpid}= Get DPID ${OS_COMPUTE_2_IP}
200 ${node_3_dpid}= Get DPID ${OS_CONTROL_NODE_IP}
201 ${node_1_adapter}= Get Ethernet Adapter ${OS_COMPUTE_1_IP}
202 ${node_2_adapter}= Get Ethernet Adapter ${OS_COMPUTE_2_IP}
203 ${node_3_adapter}= Get Ethernet Adapter ${OS_CONTROL_NODE_IP}
204 ${first_two_octets} ${third_octet} ${last_octet}= Split String From Right ${OS_COMPUTE_1_IP} . 2
205 ${subnet}= Set Variable ${first_two_octets}.0.0/16
206 ${gateway}= Get Default Gateway ${OS_COMPUTE_1_IP}
207 ${gateway1}= Get Default Gateway ${OS_CONTROL_NODE_IP}
208 ${gateway2}= Get Default Gateway ${OS_COMPUTE_2_IP}
209 Issue Command On Karaf Console tep:add ${node_1_dpid} ${node_1_adapter} 0 ${OS_COMPUTE_1_IP} ${subnet} null TZA
210 Issue Command On Karaf Console tep:add ${node_2_dpid} ${node_2_adapter} 0 ${OS_COMPUTE_2_IP} ${subnet} null TZA
211 Issue Command On Karaf Console tep:add ${node_3_dpid} ${node_3_adapter} 0 ${OS_CONTROL_NODE_IP} ${subnet} null TZA
212 Issue Command On Karaf Console tep:commit
213 ${output}= Issue Command On Karaf Console ${TEP_SHOW}
215 Wait Until Keyword Succeeds 30s 5s Verify Tunnel Status as UP
218 [Documentation] Delete the created VMs, ports, subnet and networks
219 Log Delete the VM instances
220 ${VM_INSTANCES} = Create List @{VM_INSTANCES_NET1} @{VM_INSTANCES_NET2}
221 : FOR ${VmInstance} IN @{VM_INSTANCES}
222 \ Delete Vm Instance ${VmInstance}
223 Log Delete neutron ports
224 : FOR ${Port} IN @{PORT_LIST}
225 \ Delete Port ${Port}
227 : FOR ${Subnet} IN @{SUBNETS}
228 \ Delete SubNet ${Subnet}
230 : FOR ${Network} IN @{NETWORKS}
231 \ Delete Network ${Network}