Replace BR1 and BR2 with br-int in Genius-CSIT
[integration/test.git] / csit / suites / genius / ITM_Direct_Tunnels.robot
index 5af43ca2121ae84e3bb6333abd602bcd4fac28e7..6e14385576481168a454233041dfbbc5dfada51a 100644 (file)
@@ -2,6 +2,7 @@
 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.
 Suite Setup       ITM Direct Tunnels Start Suite
 Suite Teardown    ITM Direct Tunnels Stop Suite
+Test Setup        Genius Test Setup
 Test Teardown     Genius Test Teardown    ${data_models}
 Library           OperatingSystem
 Library           String
@@ -16,20 +17,21 @@ Resource          ../../libraries/ClusterManagement.robot
 Resource          ../../libraries/KarafKeywords.robot
 Resource          ../../libraries/Utils.robot
 Resource          ../../libraries/Genius.robot
+Resource          ../../variables/netvirt/Variables.robot
 Resource          ../../variables/Variables.robot
 Resource          ../../libraries/OVSDB.robot
 
 *** Variables ***
+${VLAN}           0
 
 *** Test Cases ***
 Create and Verify VTEP
     [Documentation]    This testcase creates a Internal Transport Manager - ITM tunnel between 2 DPNs
     ${Dpn_id_1}    Genius.Get Dpn Ids    ${conn_id_1}
     ${Dpn_id_2}    Genius.Get Dpn Ids    ${conn_id_2}
-    ${vlan}=    Set Variable    0
     ${gateway-ip}=    Set Variable    0.0.0.0
-    Genius.Create Vteps    ${Dpn_id_1}    ${Dpn_id_2}    ${TOOLS_SYSTEM_IP}    ${TOOLS_SYSTEM_2_IP}    ${vlan}    ${gateway-ip}
-    Wait Until Keyword Succeeds    40    10    Get ITM    ${itm_created[0]}    ${subnet}    ${vlan}
+    Genius.Create Vteps    ${Dpn_id_1}    ${Dpn_id_2}    ${TOOLS_SYSTEM_IP}    ${TOOLS_SYSTEM_2_IP}    ${VLAN}    ${gateway-ip}
+    Wait Until Keyword Succeeds    40    10    Get ITM    ${itm_created[0]}    ${subnet}    ${VLAN}
     ...    ${Dpn_id_1}    ${TOOLS_SYSTEM_IP}    ${Dpn_id_2}    ${TOOLS_SYSTEM_2_IP}
     ${type}    Set Variable    odl-interface:tunnel-type-vxlan
     ${tunnel-1}    Wait Until Keyword Succeeds    40    20    Get_Tunnel    ${Dpn_id_1}    ${Dpn_id_2}
@@ -46,32 +48,36 @@ Create and Verify VTEP
     Should Be Equal As Strings    ${resp.status_code}    200
     Should Contain    ${resp.content}    ${Dpn_id_1}    ${tunnel-1}
     Should Contain    ${resp.content}    ${Dpn_id_2}    ${tunnel-2}
-    ${Port_num1}    Get Port Number    ${conn_id_1}    ${Bridge-1}    ${tunnel-1}
-    ${Port_num2}    Get Port Number    ${conn_id_2}    ${Bridge-2}    ${tunnel-2}
-    ${check-3}    Wait Until Keyword Succeeds    40    10    Genius.Check Table0 Entry For 2 Dpn    ${conn_id_1}    ${Bridge-1}
+    ${Port_num1}    Get Port Number    ${conn_id_1}    ${Bridge}    ${tunnel-1}
+    ${Port_num2}    Get Port Number    ${conn_id_2}    ${Bridge}    ${tunnel-2}
+    ${check-3}    Wait Until Keyword Succeeds    40    10    Genius.Check Table0 Entry For 2 Dpn    ${conn_id_1}    ${Bridge}
     ...    ${Port_num1}
-    ${check-4}    Wait Until Keyword Succeeds    40    10    Genius.Check Table0 Entry For 2 Dpn    ${conn_id_2}    ${Bridge-2}
+    ${check-4}    Wait Until Keyword Succeeds    40    10    Genius.Check Table0 Entry For 2 Dpn    ${conn_id_2}    ${Bridge}
     ...    ${Port_num2}
 
 Verify VTEP After Restarting OVS
     [Documentation]    Verify Testcase, Verifying tunnel state by restarting OVS
-    Genius.Verify Tunnel Status as UP    TZA
+    Wait Until Keyword Succeeds    20    2    Genius.Verify Tunnel Status as UP    TZA
     OVSDB.Restart OVSDB    ${TOOLS_SYSTEM_IP}
-    Wait Until Keyword Succeeds    30    3    Genius.Verify Tunnel Status as UP    TZA
+    Wait Until Keyword Succeeds    20    2    Genius.Verify Tunnel Status as UP    TZA
 
 Verify VTEP After Restarting Controller
     [Documentation]    Verify Testcase, Verifying tunnel state by restarting CONTROLLER
     Genius.Verify Tunnel Status as UP    TZA
     ClusterManagement.Stop_Members_From_List_Or_All
     ClusterManagement.Start_Members_From_List_Or_All
-    Wait Until Keyword Succeeds    60    3    Check Service Status    ACTIVE    OPERATIONAL
+    Wait Until Keyword Succeeds    60    3    ClusterManagement.Check Status Of Services Is OPERATIONAL
     Wait Until Keyword Succeeds    30    3    Genius.Verify Tunnel Status as UP    TZA
 
 Verify Tunnels By Disabling BFD
-    [Documentation]    This test case will verify tunnels after disabling BFD.
-    ${result}    Run Keyword And Return Status    Verify Tunnel Monitoring is on
+    [Documentation]    This test case will verify tunnels after disabling BFD and verifies tunnel status as unknown after stopping OVS.
+    ${result}    Run Keyword And Return Status    Verify Tunnel Monitoring is on
     Run Keyword If    '${result}' == 'True'    Disable_Tunnel_Monitoring
-    Genius.Verify Tunnel Status as UP    TZA
+    ${tunnels_on_OVS} =    Genius.Get Tunnels On OVS    ${conn_id_1}
+    OVSDB.Stop OVS    ${TOOLS_SYSTEM_IP}
+    Genius.Verify Tunnel Status    ${tunnels_on_OVS}    UNKNOWN
+    OVSDB.Start OVS    ${TOOLS_SYSTEM_IP}
+    Wait Until Keyword Succeeds    20    2    Genius.Verify Tunnel Status as UP    TZA
 
 Verify Tunnels By Enabling BFD
     [Documentation]    This test case will check the tunnel exists by bringing up/down a switch and check tunnels exist by enabling BFD
@@ -86,11 +92,23 @@ Delete and Verify VTEP
     ${Dpn_id_2}    Genius.Get Dpn Ids    ${conn_id_2}
     ${tunnel-1}    Get_Tunnel    ${Dpn_id_1}    ${Dpn_id_2}
     ${tunnel-2}    Get_Tunnel    ${Dpn_id_2}    ${Dpn_id_1}
-    Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
+    ${cmd1}    Set Variable    tep:delete ${Dpn_id_1} ${port_name} ${VLAN} ${TOOLS_SYSTEM_IP} ${subnet}/24 null ${itm_created[0]}
+    ${cmd2}    Set Variable    tep:delete ${Dpn_id_2} ${port_name} ${VLAN} ${TOOLS_SYSTEM_2_IP} ${subnet}/24 null ${itm_created[0]}
+    KarafKeywords.Issue Command On Karaf Console    ${cmd1}
+    KarafKeywords.Issue Command On Karaf Console    tep:commit
+    KarafKeywords.Issue Command On Karaf Console    ${cmd2}
+    KarafKeywords.Issue Command On Karaf Console    tep:commit
+    ${output}    KarafKeywords.Issue Command On Karaf Console    ${TEP_SHOW}
+    BuiltIn.Should Not Contain    ${output}    ${itm_created[0]}
+    BuiltIn.Run Keyword And Ignore Error    Remove All Elements At URI And Verify    ${CONFIG_API}/itm:transport-zones/transport-zone/${itm_created[0]}/
     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/itm-state:tunnels_state/
     Should Not Contain    ${resp}    ${tunnel-1}    ${tunnel-2}
     ${Ovs-del-1}    Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${conn_id_1}    ${tunnel-1}
     ${Ovs-del-2}    Wait Until Keyword Succeeds    40    10    Genius.Check Tunnel Delete On OVS    ${conn_id_2}    ${tunnel-2}
+    ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/itm:not-hosted-transport-zones/
+    ${respjson}    RequestsLibrary.To Json    ${resp.content}    pretty_print=True
+    Log    ${respjson}
+    BuiltIn.Should Not Contain    ${resp.content}    ${itm_created[0]}
 
 *** Keywords ***
 Get_Tunnel
@@ -128,7 +146,7 @@ Verify Tunnel State After OVS Restart
 
 Verify Tunnel Down
     [Documentation]    In this we will check whether tunnel is in down or not
-    ${output}=    Issue Command On Karaf Console    ${TEP_SHOW_STATE}
+    ${output}=    KarafKeywords.Issue Command On Karaf Console    ${TEP_SHOW_STATE}
     Should Contain    ${output}    DOWN
 
 Get Port Number