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