Qualify Keywords in Genius Suite
[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]}    ${SUBNET}    ${NO_VLAN}
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     \    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     ${output} =    KarafKeywords.Issue Command On Karaf Console    ${TEP_SHOW}
65     BuiltIn.Should Not Contain    ${output}    ${itm_created[0]}
66     Utils.Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
67     ${resp} =    Utils.Get Data From URI    session    ${CONFIG_API}/itm:transport-zones/
68     BuiltIn.Should Not Contain    ${resp}    ${itm_created[0]}
69     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Verify Deleted Tunnels On OVS    ${tunnel_list}    ${resp}
70     BuiltIn.Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${tunnel_list}
71
72 *** Keywords ***
73 Enable_Tunnel_Monitoring
74     [Documentation]    In this we will enable tunnel monitoring by tep:enable command running in karaf console
75     KarafKeywords.Issue_Command_On_Karaf_Console    tep:enable-tunnel-monitor true
76
77 Verify Tunnel State After OVS Restart
78     [Arguments]    ${TOOLS_SYSTEM_IP}
79     [Documentation]    In this we will Verify Tunnel State by Stopping/Starting Switch
80     OVSDB.Stop OVS    ${TOOLS_SYSTEM_IP}
81     BuiltIn.Wait Until Keyword Succeeds    2min    20 sec    Verify Tunnel Down
82     OVSDB.Start OVS    ${TOOLS_SYSTEM_IP}
83     BuiltIn.Wait Until Keyword Succeeds    2min    20 sec    Genius.Verify Tunnel Status As Up
84
85 Verify Tunnel Down
86     [Documentation]    In this we will check whether tunnel is in down or not
87     ${output}=    KarafKeywords.Issue_Command_On_Karaf_Console    ${TEP_SHOW_STATE}
88     BuiltIn.Should Contain    ${output}    DOWN
89
90 Disable_Tunnel_Monitoring
91     [Documentation]    In this we will disable tunnel monitoring by tep:enable command running in karaf console
92     KarafKeywords.Issue_Command_On_Karaf_Console    tep:enable-tunnel-monitor false
93
94 Verify Tunnels By Enabling BFD
95     [Documentation]    Verify tunnel creation by enabling BFD monitoring.
96     ${result} =    BuiltIn.Run Keyword And Return Status    Genius.Verify Tunnel Monitoring Status    ${TUNNEL_MONITOR_ON}
97     BuiltIn.Run Keyword If    '${result}' == 'False'    Enable_Tunnel_monitoring
98     : FOR    ${tools_ip}    IN    @{TOOLS_SYSTEM_ALL_IPS}
99     \    Verify Tunnel State After OVS Restart    ${tools_ip}
100
101 Verify Tunnels By Disabling BFD
102     [Documentation]    Verify tunnel creation by disabling BFD monitoring.
103     ${result} =    Run Keyword And Return Status    Genius.Verify Tunnel Monitoring Status    ${TUNNEL_MONITOR_ON}
104     BuiltIn.Run Keyword If    '${result}' == 'True'    Disable_Tunnel_Monitoring
105     ${tunnels_on_OVS} =    Genius.Get Tunnels On OVS    ${TOOLS_SYSTEM_ALL_CONN_IDS[0]}
106     OVSDB.Stop OVS    ${TOOLS_SYSTEM_IP}
107     Genius.Verify Tunnel Status    UNKNOWN    ${tunnels_on_OVS}
108     OVSDB.Start OVS    ${TOOLS_SYSTEM_IP}
109     BuiltIn.Wait Until Keyword Succeeds    10s    1s    Genius.Verify Tunnel Status As Up