Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / csit / suites / genius / ITM_Direct_Tunnels.robot
1 *** Settings ***
2 Documentation     This test suite is to by-pass interface manager and create/delete the tunnels between the switches directly inorder for ITM to scale and build mesh among more number of switches.
3 Suite Setup       ITM Direct Tunnels Start Suite
4 Suite Teardown    ITM Direct Tunnels Stop Suite
5 Test Setup        Genius Test Setup
6 Test Teardown     Genius Test Teardown    ${data_models}
7 Library           Collections
8 Library           OperatingSystem
9 Library           RequestsLibrary
10 Library           String
11 Resource          ../../libraries/ClusterManagement.robot
12 Resource          ../../libraries/DataModels.robot
13 Resource          ../../libraries/Genius.robot
14 Resource          ../../libraries/KarafKeywords.robot
15 Resource          ../../variables/netvirt/Variables.robot
16 Resource          ../../libraries/OVSDB.robot
17 Resource          ../../libraries/ToolsSystem.robot
18 Resource          ../../libraries/Utils.robot
19 Resource          ../../libraries/VpnOperations.robot
20 Resource          ../../variables/Variables.robot
21 Variables         ../../variables/genius/Modules.py
22
23 *** Variables ***
24
25 *** Test Cases ***
26 Create and Verify VTEP
27     [Documentation]    This testcase creates a Internal Transport Manager - ITM tunnel between 2 DPNs
28     Genius.Create Vteps    ${NO_VLAN}    ${gateway_ip}
29     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Get ITM    ${itm_created[0]}
30     ${type} =    BuiltIn.Set Variable    odl-interface:tunnel-type-vxlan
31     Genius.Update Dpn id list and get tunnels    ${type}    dpn-teps-state
32     Genius.Verify Response Code Of Dpn Endpointconfig API
33     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Ovs Interface Verification
34     ${resp} =    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/itm-state:tunnels_state/
35     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
36     BuiltIn.Wait Until Keyword Succeeds    60    5    Genius.Verify Tunnel Status As Up
37     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Verify Table0 Entry After fetching Port Number
38
39 Verify VTEP After Restarting OVS
40     [Documentation]    Verify Testcase, Verifying tunnel state by restarting OVS
41     BuiltIn.Wait Until Keyword Succeeds    20    2    Genius.Verify Tunnel Status As Up
42     OVSDB.Restart OVSDB    ${TOOLS_SYSTEM_IP}
43
44 Verify VTEP After Restarting Controller
45     [Documentation]    Verify Testcase, Verifying tunnel state by restarting CONTROLLER
46     BuiltIn.Wait Until Keyword Succeeds    30    3    Genius.Verify Tunnel Status As Up
47     ClusterManagement.Stop_Members_From_List_Or_All
48     ClusterManagement.Start_Members_From_List_Or_All
49     BuiltIn.Wait Until Keyword Succeeds    60    3    ClusterManagement.Check Status Of Services Is OPERATIONAL    @{GENIUS_DIAG_SERVICES}
50     BuiltIn.Wait Until Keyword Succeeds    30    3    Genius.Verify Tunnel Status As Up
51
52 Verify Tunnels By Enabling/Disabling BFD
53     [Documentation]    Verify tunnel creation by enabling and disabling BFD one after another with respect to the branch in such a way default value is retained at last.
54     CompareStream.Run_Keyword_If_At_Least_Neon    Verify Tunnels By Enabling BFD
55     CompareStream.Run_Keyword_If_At_Least_Neon    Verify Tunnels By Disabling BFD
56     CompareStream.Run_Keyword_If_Less_Than_Neon    Verify Tunnels By Disabling BFD
57     CompareStream.Run_Keyword_If_Less_Than_Neon    Verify Tunnels By Enabling BFD
58
59 Delete and Verify VTEP
60     [Documentation]    This Delete testcase , deletes the ITM tunnel created between 2 dpns.
61     ${tunnel_list} =    Genius.Get Tunnels List
62     FOR    ${dpn_id}    IN    @{DPN_ID_LIST}
63         CompareStream.Run_Keyword_If_Less_Than_Sodium    Utils.Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/subnets/${SUBNET}%2F16/vteps/${dpn_id}/${port_name}
64         CompareStream.Run_Keyword_If_At_Least_Sodium    Utils.Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/vteps/${dpn_id}
65     END
66     ${output} =    KarafKeywords.Issue Command On Karaf Console    ${TEP_SHOW}
67     BuiltIn.Should Not Contain    ${output}    ${itm_created[0]}
68     Utils.Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
69     ${resp} =    Utils.Get Data From URI    session    ${CONFIG_API}/itm:transport-zones/
70     BuiltIn.Should Not Contain    ${resp}    ${itm_created[0]}
71     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Verify Deleted Tunnels On OVS    ${tunnel_list}    ${resp}
72     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${tunnel_list}
73
74 *** Keywords ***
75 Enable_Tunnel_Monitoring
76     [Documentation]    In this we will enable tunnel monitoring by tep:enable command running in karaf console
77     KarafKeywords.Issue_Command_On_Karaf_Console    tep:enable-tunnel-monitor true
78
79 Verify Tunnel State After OVS Restart
80     [Arguments]    ${TOOLS_SYSTEM_IP}
81     [Documentation]    In this we will Verify Tunnel State by Stopping/Starting Switch
82     OVSDB.Stop OVS    ${TOOLS_SYSTEM_IP}
83     BuiltIn.Wait Until Keyword Succeeds    2min    20 sec    Verify Tunnel Down
84     OVSDB.Start OVS    ${TOOLS_SYSTEM_IP}
85     BuiltIn.Wait Until Keyword Succeeds    2min    20 sec    Genius.Verify Tunnel Status As Up
86
87 Verify Tunnel Down
88     [Documentation]    In this we will check whether tunnel is in down or not
89     ${output}=    KarafKeywords.Issue_Command_On_Karaf_Console    ${TEP_SHOW_STATE}
90     BuiltIn.Should Contain    ${output}    DOWN
91
92 Disable_Tunnel_Monitoring
93     [Documentation]    In this we will disable tunnel monitoring by tep:enable command running in karaf console
94     KarafKeywords.Issue_Command_On_Karaf_Console    tep:enable-tunnel-monitor false
95
96 Verify Tunnels By Enabling BFD
97     [Documentation]    Verify tunnel creation by enabling BFD monitoring.
98     ${result} =    BuiltIn.Run Keyword And Return Status    Genius.Verify Tunnel Monitoring Status    ${TUNNEL_MONITOR_ON}
99     BuiltIn.Run Keyword If    '${result}' == 'False'    Enable_Tunnel_monitoring
100     FOR    ${tools_ip}    IN    @{TOOLS_SYSTEM_ALL_IPS}
101         Verify Tunnel State After OVS Restart    ${tools_ip}
102     END
103
104 Verify Tunnels By Disabling BFD
105     [Documentation]    Verify tunnel creation by disabling BFD monitoring.
106     ${result} =    Run Keyword And Return Status    Genius.Verify Tunnel Monitoring Status    ${TUNNEL_MONITOR_ON}
107     BuiltIn.Run Keyword If    '${result}' == 'True'    Disable_Tunnel_Monitoring
108     ${tunnels_on_OVS} =    Genius.Get Tunnels On OVS    ${TOOLS_SYSTEM_ALL_CONN_IDS[0]}
109     OVSDB.Stop OVS    ${TOOLS_SYSTEM_IP}
110     Genius.Verify Tunnel Status    UNKNOWN    ${tunnels_on_OVS}
111     OVSDB.Start OVS    ${TOOLS_SYSTEM_IP}
112     BuiltIn.Wait Until Keyword Succeeds    10s    1s    Genius.Verify Tunnel Status As Up