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