119b642ac1ebcbe1236a5b11db86bbf33a597815
[integration/test.git] / csit / suites / netvirt / Netvirt_Vpnservice / BFD_Monitoring.robot
1 *** Settings ***
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     Get Test Teardown Debugs
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
18
19 *** Variables ***
20 ${BFD_ENABLED_FALSE}    false
21 ${BFD_ENABLED_TRUE}    true
22 ${PING_REGEXP}    , 0% packet loss
23 ${VAR_BASE}       ${CURDIR}/../../../variables/netvirt
24 ${SECURITY_GROUP}    sg-vpnservice-bfd
25
26 *** Test Cases ***
27 TC00 Verify Setup
28     [Documentation]    Verify if tunnels are present. If not then create new tunnel.
29     : FOR    ${VM}    IN    @{VM_INSTANCES_NET1}    @{VM_INSTANCES_NET2}
30     \    Poll VM Is ACTIVE    ${VM}
31     ${VM_IP_NET1}    ${VM_IP_NET2}    Wait Until Keyword Succeeds    180s    10s    Verify VMs received IP
32     Set Suite Variable    ${VM_IP_NET2}
33     Set Suite Variable    ${VM_IP_NET1}
34     ${output}=    ITM Get Tunnels
35     Log    ${output}
36     ${count}=    Get Count    ${output}    tunnel_port
37     Log    ${count}
38     Run Keyword If    ${count} == 0    Create Tunnel
39     [Teardown]    Run Keywords    Show Debugs    @{VM_INSTANCES_NET1}    @{VM_INSTANCES_NET2}
40     ...    AND    Get Test Teardown Debugs
41
42 TC01 Verify That Default Tunnel Type Is Set To BFD
43     [Documentation]    Verify that the default tunnel type is set to BFD if both the devices support BFD
44     Log    Verifying ITM tunnel through REST
45     ${output}=    ITM Get Tunnels
46     Log    ${output}
47     Log    Verifying the BFD based tunnel configuration
48     ${output}=    Issue Command On Karaf Console    ${TEP_SHOW}
49     Log    ${output}
50     Should Contain    ${output}    ${TUNNEL_MONITOR_ON}
51     Should Contain    ${output}    ${MONITORING_INTERVAL}
52     Should Contain    ${output}    ${INTERVAL_1000}
53     Log    Verifying the tunnel state with show state command
54     Wait Until Keyword Succeeds    30s    5s    Verify Tunnel Status as UP
55     Log    Verifying the default configuration i.e BFD, tunnel monitoring enabled
56     ${resp}    RequestsLibrary.Get Request    session    ${TUNNEL_MONITOR_URL}
57     Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
58     Log    ${resp.content}
59     Should Contain    ${resp.content}    ${BFD}
60     Should Contain    ${resp.content}    ${BFD_ENABLED_TRUE}
61     Log    Verifying the default monitor interval
62     ${resp}    RequestsLibrary.Get Request    session    ${MONITOR_INTERVAL_URL}
63     Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
64     Log    ${resp.content}
65     Should Contain    ${resp.content}    ${TMI_1000}
66     Log    Verifying the VXLAN Interface
67     Wait Until Keyword Succeeds    180s    10s    Verify VXLAN interface
68     Log    Verify Flows are present
69     Wait Until Keyword Succeeds    30s    5s    Verify Flows Are Present    ${OS_COMPUTE_1_IP}
70     Wait Until Keyword Succeeds    30s    5s    Verify Flows Are Present    ${OS_COMPUTE_2_IP}
71     Log    Verify Ping Between VMs on different Compute Nodes
72     Wait Until Keyword Succeeds    30s    5s    Verify Ping
73
74 TC02 Verify that Tunnel Monitoring can be disabled and monitor interval can be configured through REST
75     [Documentation]    Verify that Tunnel Monitoring can be disabled and monitor interval can be configured through REST
76     Log    Verifying ITM tunnel are present and tunnel status
77     ${output}=    ITM Get Tunnels
78     Log    ${output}
79     Wait Until Keyword Succeeds    10s    5s    Verify Tunnel Status as UP
80     Log    Verifying the BFD based tunnel configuration is on
81     ${output}=    Issue Command On Karaf Console    ${TEP_SHOW}
82     Log    ${output}
83     Should Contain    ${output}    ${TUNNEL_MONITOR_ON}
84     Log    Disabling the tunnel monitoring from REST
85     TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/disable_tunnel_monitoring    session=session
86     Wait Until Keyword Succeeds    10s    1s    Verify Tunnel Monitoring    ${BFD_ENABLED_FALSE}    ${BFD}
87     Log    Verifying the default tunnel monitoring is off
88     ${output}=    Issue Command On Karaf Console    ${TEP_SHOW}
89     Log    ${output}
90     Should Contain    ${output}    ${TUNNEL_MONITOR_OFF}
91     Wait Until Keyword Succeeds    10s    5s    Verify Tunnel Status as UP
92     Log    Verifying the default monitoring interval i.e 1000ms via REST
93     ${resp}=    RequestsLibrary.Get Request    session    ${MONITOR_INTERVAL_URL}
94     Log    ${resp.content}
95     Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
96     Should Contain    ${resp.content}    ${TMI_1000}
97     Log    Change and verify the default tunnel monitoring interval after monitoring is disabled
98     TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/monitor_interval    mapping={"int":"2000"}    session=session
99     ${resp}=    RequestsLibrary.Get Request    session    ${MONITOR_INTERVAL_URL}
100     Log    ${resp.content}
101     Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
102     Should Contain    ${resp.content}    ${TMI_2000}
103
104 TC03 Verify that the monitoring interval value boundaries with Monitoring Enabled
105     [Documentation]    Verify that the monitoring interval value boundaries with Monitoring Enabled
106     Log    Verifying ITM tunnel are present and tunnel status
107     ${output}=    ITM Get Tunnels
108     Log    ${output}
109     Wait Until Keyword Succeeds    10s    5s    Verify Tunnel Status as UP
110     Log    Enabling the tunnel monitoring from REST
111     TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/enable_tunnel_monitoring    session=session
112     Wait Until Keyword Succeeds    10s    1s    Verify Tunnel Monitoring    ${BFD_ENABLED_TRUE}    ${BFD}
113     Log    Verifying the tunnel status
114     ${output}=    Issue Command On Karaf Console    ${TEP_SHOW}
115     Log    ${output}
116     Should Contain    ${output}    ${TUNNEL_MONITOR_ON}
117     Log    Changing and verifying the tunnel monitoring interval to 1000ms
118     TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/monitor_interval    mapping={"int":"1000"}    session=session
119     ${resp}=    RequestsLibrary.Get Request    session    ${MONITOR_INTERVAL_URL}
120     Log    ${resp.content}
121     Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
122     Should Contain    ${resp.content}    ${TMI_1000}
123     Log    Setting the tunnel monitoring interval to 30000ms
124     TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/monitor_interval    mapping={"int":"30000"}    session=session
125     Log    Verifying the tunnel monitoring interval to 30000ms
126     Wait Until Keyword Succeeds    10s    1s    Check Tunnel Monitoring Interval    ${TMI_30000}
127     Log    Verifying the tunnel monitoring interval to greater than 30000ms cannot be set
128     ${resp}=    RequestsLibrary.Put Request    session    ${MONITOR_INTERVAL_NEW}    data=${INTERVAL_31000}
129     Should Be Equal As Strings    ${resp.status_code}    ${RESP_ERROR_CODE}
130     Wait Until Keyword Succeeds    10s    1s    Check Tunnel Monitoring Interval    ${TMI_30000}
131     Log    Verifying the tunnel monitoring interval to 50ms cannot be set
132     ${resp}=    RequestsLibrary.Put Request    session    ${MONITOR_INTERVAL_NEW}    data=${INTERVAL_50}
133     Should Be Equal As Strings    ${resp.status_code}    ${RESP_ERROR_CODE}
134     Wait Until Keyword Succeeds    10s    1s    Check Tunnel Monitoring Interval    ${TMI_30000}
135     Log    Verifying the tunnel monitoring interval to 0ms cannot be set
136     ${resp}=    RequestsLibrary.Put Request    session    ${MONITOR_INTERVAL_NEW}    data=${INTERVAL_0}
137     Should Be Equal As Strings    ${resp.status_code}    ${RESP_ERROR_CODE}
138     Wait Until Keyword Succeeds    10s    1s    Check Tunnel Monitoring Interval    ${TMI_30000}
139     Log    Verifying the tunnel monitoring interval to a negative value cannot be set
140     ${resp}=    RequestsLibrary.Put Request    session    ${MONITOR_INTERVAL_NEW}    data=${INTERVAL_NEG}
141     Should Be Equal As Strings    ${resp.status_code}    ${RESP_ERROR_CODE}
142     Wait Until Keyword Succeeds    10s    1s    Check Tunnel Monitoring Interval    ${TMI_30000}
143     Log    Restoring back to default moitor interval
144     TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/monitor_interval    mapping={"int":"1000"}    session=session
145     ${resp}    RequestsLibrary.Get Request    session    ${MONITOR_INTERVAL_URL}
146     Log    ${resp.content}
147     Should Contain    ${resp.content}    ${TMI_1000}
148
149 TC04 Verify that the tunnel monitoring protocol can be configured to LLDP
150     [Documentation]    Verify that the tunnel monitoring protocol can be configured to LLDP
151     ${output} =    ITM Get Tunnels
152     Log    ${output}
153     Wait Until Keyword Succeeds    30s    5s    Verify Tunnel Status as UP
154     Log    Disabling the tunnel monitoring from REST in order to change the protocol
155     TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/disable_tunnel_monitoring    session=session
156     Wait Until Keyword Succeeds    10s    1s    Verify Tunnel Monitoring    ${BFD_ENABLED_FALSE}    ${BFD}
157     Log    Changing the tunnel monitoring to LLDP and verify
158     TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/disablemonitor_lldp    session=session
159     Wait Until Keyword Succeeds    10s    1s    Verify Tunnel Monitoring    ${BFD_ENABLED_FALSE}    ${LLDP}
160     ${output}=    Issue Command On Karaf Console    ${TEP_SHOW}
161     Log    ${output}
162     Should Contain    ${output}    ${TUNNEL_MONITOR_OFF}
163     Log    Enabling tunnel monitoring
164     TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/enablemonitor_lldp    session=session
165     Wait Until Keyword Succeeds    10s    1s    Verify Tunnel Monitoring    ${BFD_ENABLED_TRUE}    ${LLDP}
166     Wait Until Keyword Succeeds    30s    5s    Verify Tunnel Status as UP
167     Wait Until Keyword Succeeds    30s    5s    Verify Ping
168     Log    Verifying the monitoring interval
169     ${resp}    RequestsLibrary.Get Request    session    ${MONITOR_INTERVAL_URL}
170     Log    ${resp.content}
171     Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
172     Should Contain    ${resp.content}    ${TMI_1000}
173     Log    Changing the tunnel monitoring interval
174     TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/monitor_interval    mapping={"int":"20000"}    session=session
175     Log    Verifying the monitoring interval got changed
176     ${resp}    RequestsLibrary.Get Request    session    ${MONITOR_INTERVAL_URL}
177     Log    ${resp.content}
178     Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
179     Should Contain    ${resp.content}    ${TMI_20000}
180     Log    Changing the tunnel monitoring back to bfd and verify
181     TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/disablemonitor_lldp    session=session
182     Wait Until Keyword Succeeds    10s    1s    Verify Tunnel Monitoring    ${BFD_ENABLED_FALSE}    ${LLDP}
183     TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/disable_tunnel_monitoring    session=session
184     Wait Until Keyword Succeeds    10s    1s    Verify Tunnel Monitoring    ${BFD_ENABLED_FALSE}    ${BFD}
185     TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/enable_tunnel_monitoring    session=session
186     Wait Until Keyword Succeeds    10s    1s    Verify Tunnel Monitoring    ${BFD_ENABLED_TRUE}    ${BFD}
187     Wait Until Keyword Succeeds    90s    5s    Verify Tunnel Status as UP
188     Wait Until Keyword Succeeds    60s    5s    Verify Ping
189
190 TC05 Disconnect And Reconnect Compute Nodes
191     [Documentation]    Verify that when compute nodes are disconnected from controller tunnel goes to unknown state.
192     ${output} =    ITM Get Tunnels
193     Log    ${output}
194     Wait Until Keyword Succeeds    90s    5s    Verify Tunnel Status as UP
195     Log    Disconnect Compute Nodes
196     Disconnect Compute Nodes    ${OS_COMPUTE_1_IP}    ${ODL_SYSTEM_IP}
197     Disconnect Compute Nodes    ${OS_COMPUTE_2_IP}    ${ODL_SYSTEM_IP}
198     Disconnect Compute Nodes    ${OS_CONTROL_NODE_IP}    ${ODL_SYSTEM_IP}
199     Wait Until Keyword Succeeds    120s    5s    Verify Tunnel Status as UNKNOWN
200     Wait Until Keyword Succeeds    60s    5s    Verify Ping
201     Log    Reconect Compute Nodes
202     Reconnect Compute Nodes    ${OS_COMPUTE_1_IP}    ${ODL_SYSTEM_IP}
203     Reconnect Compute Nodes    ${OS_COMPUTE_2_IP}    ${ODL_SYSTEM_IP}
204     Reconnect Compute Nodes    ${OS_CONTROL_NODE_IP}    ${ODL_SYSTEM_IP}
205     Wait Until Keyword Succeeds    120s    5s    Verify Tunnel Status as UP
206     Log    Verifying Tunnel Monitoring
207     ${resp}    RequestsLibrary.Get Request    session    ${TUNNEL_MONITOR_URL}
208     Log    ${resp.content}
209     Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
210     Should Contain    ${resp.content}    ${BFD_ENABLED_TRUE}
211     Should Contain    ${resp.content}    ${BFD}
212     Wait Until Keyword Succeeds    30s    5s    Verify Flows Are Present    ${OS_COMPUTE_1_IP}
213     Wait Until Keyword Succeeds    30s    5s    Verify Flows Are Present    ${OS_COMPUTE_2_IP}
214     Wait Until Keyword Succeeds    30s    5s    Verify Ping
215
216 *** Keywords ***
217 Start Suite
218     [Documentation]    Run before the suite execution
219     DevstackUtils.Devstack Suite Setup
220     SetupUtils.Setup_Utils_For_Setup_And_Teardown
221     Presuite Cleanup
222     Create Setup
223
224 Stop Suite
225     [Documentation]    Run after the tests execution
226     Delete Setup
227     Close All Connections
228
229 Presuite Cleanup
230     [Documentation]    Clean the already existing tunnels and tep interfaces
231     ${resp}    RequestsLibrary.Delete Request    session    ${TUNNEL_TRANSPORTZONE}
232     Log    ${resp.content}
233     ${resp}    RequestsLibrary.Delete Request    session    ${TUNNEL_INTERFACES}
234     Log    ${resp.content}
235
236 Create Setup
237     [Documentation]    Create Two Networks, Two Subnets, Four Ports And Four VMs
238     Log    Create two networks
239     Create Network    ${NETWORKS[0]}
240     Create Network    ${NETWORKS[1]}
241     ${NET_LIST}    List Networks
242     Should Contain    ${NET_LIST}    ${NETWORKS[0]}
243     Should Contain    ${NET_LIST}    ${NETWORKS[1]}
244     Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${NETWORK_URL}    ${NETWORKS}
245     Log    Create two subnets for previously created networks
246     Create SubNet    ${NETWORKS[0]}    ${SUBNETS[0]}    ${SUBNET_CIDR[0]}
247     Create SubNet    ${NETWORKS[1]}    ${SUBNETS[1]}    ${SUBNET_CIDR[1]}
248     ${SUB_LIST}    List Subnets
249     Should Contain    ${SUB_LIST}    ${SUBNETS[0]}
250     Should Contain    ${SUB_LIST}    ${SUBNETS[1]}
251     Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${SUBNETWORK_URL}    ${SUBNETS}
252     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
253     Log    Create four ports under previously created subnets
254     Create Port    ${NETWORKS[0]}    ${PORT_LIST[0]}    sg=${SECURITY_GROUP}
255     Create Port    ${NETWORKS[0]}    ${PORT_LIST[1]}    sg=${SECURITY_GROUP}
256     Create Port    ${NETWORKS[1]}    ${PORT_LIST[2]}    sg=${SECURITY_GROUP}
257     Create Port    ${NETWORKS[1]}    ${PORT_LIST[3]}    sg=${SECURITY_GROUP}
258     Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${PORT_URL}    ${PORT_LIST}
259     Log    Create VM Instances
260     Create Vm Instance With Port On Compute Node    ${PORT_LIST[0]}    ${VM_INSTANCES_NET1[0]}    ${OS_COMPUTE_1_IP}    sg=${SECURITY_GROUP}
261     Create Vm Instance With Port On Compute Node    ${PORT_LIST[1]}    ${VM_INSTANCES_NET1[1]}    ${OS_COMPUTE_2_IP}    sg=${SECURITY_GROUP}
262     Create Vm Instance With Port On Compute Node    ${PORT_LIST[2]}    ${VM_INSTANCES_NET2[0]}    ${OS_COMPUTE_1_IP}    sg=${SECURITY_GROUP}
263     Create Vm Instance With Port On Compute Node    ${PORT_LIST[3]}    ${VM_INSTANCES_NET2[1]}    ${OS_COMPUTE_2_IP}    sg=${SECURITY_GROUP}
264
265 Verify VMs received IP
266     [Documentation]    Verify VMs received IP
267     ${status}    ${message}    Run Keyword And Ignore Error    Wait Until Keyword Succeeds    60s    5s    Collect VM IP Addresses
268     ...    true    @{VM_INSTANCES_NET1}
269     ${status}    ${message}    Run Keyword And Ignore Error    Wait Until Keyword Succeeds    60s    5s    Collect VM IP Addresses
270     ...    true    @{VM_INSTANCES_NET2}
271     ${VM_IP_NET1}    ${NET1_DHCP_IP}    Collect VM IP Addresses    false    @{VM_INSTANCES_NET1}
272     ${VM_IP_NET2}    ${NET2_DHCP_IP}    Collect VM IP Addresses    false    @{VM_INSTANCES_NET2}
273     ${VM_INSTANCES}=    Collections.Combine Lists    ${VM_INSTANCES_NET1}    ${VM_INSTANCES_NET2}
274     ${VM_IPS}=    Collections.Combine Lists    ${VM_IP_NET1}    ${VM_IP_NET2}
275     ${LOOP_COUNT}    Get Length    ${VM_INSTANCES_NET1}
276     : FOR    ${index}    IN RANGE    0    ${LOOP_COUNT}
277     \    ${status}    ${message}    Run Keyword And Ignore Error    Should Not Contain    @{VM_IPS}[${index}]    None
278     \    Run Keyword If    '${status}' == 'FAIL'    Write Commands Until Prompt    openstack console log show @{VM_INSTANCES}[${index}]    30s
279     Log    ${VM_IP_NET1}
280     Log    ${VM_IP_NET2}
281     Should Not Contain    ${VM_IP_NET2}    None
282     Should Not Contain    ${VM_IP_NET1}    None
283     [Return]    ${VM_IP_NET1}    ${VM_IP_NET2}
284
285 Verify Ping
286     [Documentation]    Verify Ping among VMs
287     ${output}=    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET1[0]}    ping -c 3 ${VM_IP_NET1[1]}
288     Should Contain    ${output}    ${PING_REGEXP}
289     ${output}=    Execute Command on VM Instance    @{NETWORKS}[1]    ${VM_IP_NET2[0]}    ping -c 3 ${VM_IP_NET2[1]}
290     Should Contain    ${output}    ${PING_REGEXP}
291     ${output}=    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET1[1]}    ping -c 3 ${VM_IP_NET1[0]}
292     Should Contain    ${output}    ${PING_REGEXP}
293     ${output}=    Execute Command on VM Instance    @{NETWORKS}[1]    ${VM_IP_NET2[1]}    ping -c 3 ${VM_IP_NET2[0]}
294     Should Contain    ${output}    ${PING_REGEXP}
295
296 Verify Flows Are Present
297     [Arguments]    ${ip}
298     [Documentation]    Verify Flows Are Present
299     ${flow_output}=    Run Command On Remote System    ${ip}    sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
300     Log    ${flow_output}
301     ${resp}=    Should Contain    ${flow_output}    table=50
302     Log    ${resp}
303     ${resp}=    Should Match regexp    ${flow_output}    table=0.*goto_table:36
304     ${resp}=    Should Match regexp    ${flow_output}    table=0.*goto_table:17
305     ${table51_output} =    Get Lines Containing String    ${flow_output}    table=51
306     Log    ${table51_output}
307     @{table51_output}=    Split To Lines    ${table51_output}    0    -1
308     : FOR    ${line}    IN    @{table51_output}
309     \    Log    ${line}
310     \    ${resp}=    Should Match Regexp    ${line}    ${MAC_REGEX}
311
312 Disconnect Compute Nodes
313     [Arguments]    ${Compute_node_ip}    ${Controller_ip}
314     ${current_ssh_connection}=    SSHLibrary.Get Connection
315     ${conn_id}=    SSHLibrary.Open Connection    ${Compute_node_ip}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=${DEFAULT_TIMEOUT}
316     Flexible SSH Login    ${DEFAULT_USER}    ${EMPTY}
317     ${cmd}=    BuiltIn.Set Variable    sudo ovs-vsctl set Controller br-int target="tcp\\:${Controller_ip}\\:6654"
318     ${cntlstdout}    Write Commands Until Prompt    ${cmd}
319     Log    ${cntlstdout}
320     ${output}=    Write Commands Until Prompt    sudo ovs-vsctl show
321     Log    ${output}
322     SSHLibrary.Close Connection
323
324 Reconnect Compute Nodes
325     [Arguments]    ${Compute_node_ip}    ${Controller_ip}
326     ${current_ssh_connection}=    SSHLibrary.Get Connection
327     ${conn_id}=    SSHLibrary.Open Connection    ${Compute_node_ip}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=${DEFAULT_TIMEOUT}
328     Flexible SSH Login    ${DEFAULT_USER}    ${EMPTY}
329     ${cmd}=    BuiltIn.Set Variable    sudo ovs-vsctl set Controller br-int target="tcp\\:${Controller_ip}\\:6653"
330     ${cntlstdout}    Write Commands Until Prompt    ${cmd}
331     Log    ${cntlstdout}
332     ${output}=    Write Commands Until Prompt    sudo ovs-vsctl show
333     Log    ${output}
334     SSHLibrary.Close Connection
335
336 Check Tunnel Monitoring Interval
337     [Arguments]    ${TMI_INTERVAL}
338     [Documentation]    Check the tunnel monitoring interval through REST
339     ${resp}    RequestsLibrary.Get Request    session    ${MONITOR_INTERVAL_URL}
340     Log    ${resp.content}
341     Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
342     Should Contain    ${resp.content}    ${TMI_INTERVAL}
343
344 Verify Tunnel Monitoring
345     [Arguments]    ${BFD_STATUS}    ${PROTOCOL}
346     [Documentation]    Check the tunnel monitoring status
347     ${resp}=    RequestsLibrary.Get Request    session    ${TUNNEL_MONITOR_URL}
348     Log    ${resp.content}
349     Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
350     Should Contain    ${resp.content}    ${BFD_STATUS}
351     Should Contain    ${resp.content}    ${PROTOCOL}
352
353 Create Tunnel
354     [Documentation]    Create tunnels betwee the 2 compute nodes and Openstack controller.
355     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.
356     CompareStream.Run_Keyword_If_At_Least_Boron    BuiltIn.Fail    Tunnel should be auto configured for ${ODL_STREAM}
357     ${node_1_dpid}=    Get DPID    ${OS_COMPUTE_1_IP}
358     ${node_2_dpid}=    Get DPID    ${OS_COMPUTE_2_IP}
359     ${node_3_dpid}=    Get DPID    ${OS_CONTROL_NODE_IP}
360     ${node_1_adapter}=    Get Ethernet Adapter    ${OS_COMPUTE_1_IP}
361     ${node_2_adapter}=    Get Ethernet Adapter    ${OS_COMPUTE_2_IP}
362     ${node_3_adapter}=    Get Ethernet Adapter    ${OS_CONTROL_NODE_IP}
363     ${first_two_octets}    ${third_octet}    ${last_octet}=    Split String From Right    ${OS_COMPUTE_1_IP}    .    2
364     ${subnet}=    Set Variable    ${first_two_octets}.0.0/16
365     ${gateway}=    Get Default Gateway    ${OS_COMPUTE_1_IP}
366     ${gateway1}=    Get Default Gateway    ${OS_CONTROL_NODE_IP}
367     ${gateway2}=    Get Default Gateway    ${OS_COMPUTE_2_IP}
368     Issue Command On Karaf Console    tep:add ${node_1_dpid} ${node_1_adapter} 0 ${OS_COMPUTE_1_IP} ${subnet} null TZA
369     Issue Command On Karaf Console    tep:add ${node_2_dpid} ${node_2_adapter} 0 ${OS_COMPUTE_2_IP} ${subnet} null TZA
370     Issue Command On Karaf Console    tep:add ${node_3_dpid} ${node_3_adapter} 0 ${OS_CONTROL_NODE_IP} ${subnet} null TZA
371     Issue Command On Karaf Console    tep:commit
372     ${output}=    Issue Command On Karaf Console    ${TEP_SHOW}
373     Log    ${output}
374     Wait Until Keyword Succeeds    30s    5s    Verify Tunnel Status as UP
375
376 Delete Setup
377     [Documentation]    Delete the created VMs, ports, subnet and networks
378     Log    Delete the VM instances
379     ${VM_INSTANCES} =    Create List    @{VM_INSTANCES_NET1}    @{VM_INSTANCES_NET2}
380     : FOR    ${VmInstance}    IN    @{VM_INSTANCES}
381     \    Delete Vm Instance    ${VmInstance}
382     Log    Delete neutron ports
383     : FOR    ${Port}    IN    @{PORT_LIST}
384     \    Delete Port    ${Port}
385     Log    Delete subnets
386     : FOR    ${Subnet}    IN    @{SUBNETS}
387     \    Delete SubNet    ${Subnet}
388     Log    Delete networks
389     : FOR    ${Network}    IN    @{NETWORKS}
390     \    Delete Network    ${Network}
391     Delete SecurityGroup    ${SECURITY_GROUP}