Testsuite for Service Recovery 62/70162/62
authorenidadh <nidhi.adhvaryu@ericsson.com>
Fri, 6 Apr 2018 12:07:30 +0000 (05:07 -0700)
committerJamo Luhrsen <jluhrsen@redhat.com>
Mon, 18 Jun 2018 23:04:22 +0000 (23:04 +0000)
Change-Id: I7af786e53d8c6793cdfb8cba16e73bcd26ee0712
Signed-off-by: Nidhi Adhvaryu <nidhi.adhvaryu@ericsson.com>
csit/libraries/Genius.robot
csit/libraries/OVSDB.robot
csit/suites/genius/Service_Recovery.robot [new file with mode: 0644]
csit/testplans/genius-genius.txt
csit/testplans/genius-verify.txt

index af4341c32198eb45a376fd8f8f36ebd6c4f76900..584a06fff4f17e96f37fc47e0ac47739e6f3f25d 100644 (file)
@@ -12,6 +12,7 @@ Resource          ../variables/Variables.robot
 Resource          OVSDB.robot
 Resource          ../variables/netvirt/Variables.robot
 Resource          VpnOperations.robot
+Resource          DataModels.robot
 
 *** Variables ***
 @{itm_created}    TZA
@@ -20,6 +21,8 @@ ${Bridge-1}       BR1
 ${Bridge-2}       BR2
 ${DEFAULT_MONITORING_INTERVAL}    Tunnel Monitoring Interval (for VXLAN tunnels): 1000
 @{GENIUS_DIAG_SERVICES}    OPENFLOW    IFM    ITM    DATASTORE
+${vlan}           0
+${gateway-ip}     0.0.0.0
 
 *** Keywords ***
 Genius Suite Setup
@@ -153,13 +156,10 @@ BFD Suite Stop
 Delete All Vteps
     [Documentation]    This will delete vtep.
     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_API}/itm:transport-zones/    data=${vtep_body}
-    Log    ${resp.status_code}
     Should Be Equal As Strings    ${resp.status_code}    200
     Log    "Before disconnecting CSS with controller"
-    ${output}=    Issue Command On Karaf Console    ${TEP_SHOW}
-    Log    ${output}
-    ${output}=    Issue Command On Karaf Console    ${TEP_SHOW_STATE}
-    Log    ${output}
+    ${output} =    Issue Command On Karaf Console    ${TEP_SHOW}
+    BuiltIn.Wait Until Keyword Succeeds    30    5    Verify All Tunnel Delete on DS
 
 Genius Test Teardown
     [Arguments]    ${data_models}
@@ -205,10 +205,10 @@ Get ITM
 
 Check Tunnel Delete On OVS
     [Arguments]    ${connection-id}    ${tunnel}
-    [Documentation]    Verifies the Tunnel is deleted from OVS
+    [Documentation]    Verifies the Tunnel is deleted from OVS.
     Switch Connection    ${connection-id}
-    ${return}    Execute Command    sudo ovs-vsctl show
-    Log    ${return}
+    ${return}    Execute Command    sudo ovs-vsctl show
+    log    ${return}
     Should Not Contain    ${return}    ${tunnel}
     [Return]    ${return}
 
@@ -270,3 +270,45 @@ Get Tunnels On OVS
     \    Collections.Append To List    ${tunnel_names}    ${tun_list}
     ${items_in_list} =    BuiltIn.Get Length    ${tunnel_names}
     [Return]    ${Tunnel_Names}
+
+Get Tunnel
+    [Arguments]    ${src}    ${dst}    ${type}
+    [Documentation]    This keyword returns tunnel interface name between source DPN and destination DPN.
+    ${resp} =    RequestsLibrary.Get Request    session    ${CONFIG_API}/itm-state:tunnel-list/internal-tunnel/${src}/${dst}/${type}/
+    BuiltIn.Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
+    BuiltIn.Should Contain    ${resp.content}    ${src}
+    BuiltIn.Should Contain    ${resp.content}    ${dst}
+    ${json} =    Utils.Json Parse From String    ${resp.content}
+    ${tunnel} =    BuiltIn.Run Keyword If    "tunnel-interface-names" in "${json}"    Get Tunnel Interface Name    ${json["internal-tunnel"][0]}    tunnel-interface-names
+    [Return]    ${tunnel}
+
+Get Tunnel Interface Name
+    [Arguments]    ${json}    ${expected_tunnel_interface_name}
+    [Documentation]    This keyword extracts tunnel interface name from json given as input.
+    ${tunnels} =    Collections.Get From Dictionary    ${json}    ${expected_tunnel_interface_name}
+    [Return]    ${tunnels[0]}
+
+Verify All Tunnel Delete on DS
+    [Documentation]    This keyword confirms that tunnels are not present by giving command from karaf console.
+    Verify Tunnel Delete on DS    tun
+
+Verify Tunnel Delete on DS
+    [Arguments]    ${tunnel}
+    [Documentation]    This keyword confirms that specified tunnel is not present by giving command from karaf console.
+    ${output} =    KarafKeywords.Issue Command On Karaf Console    ${TEP_SHOW_STATE}
+    BuiltIn.Should Not Contain    ${output}    ${tunnel}
+
+SRM Start Suite
+    [Documentation]    Start suite for service recovery.
+    Genius Suite Setup
+    ${dpn_Id_1} =    Genius.Get Dpn Ids    ${conn_id_1}
+    ${dpn_Id_2} =    Genius.Get Dpn Ids    ${conn_id_2}
+    Genius.Create Vteps    ${dpn_Id_1}    ${dpn_Id_2}    ${TOOLS_SYSTEM_IP}    ${TOOLS_SYSTEM_2_IP}    ${vlan}    ${gateway-ip}
+    ${tunnel} =    BuiltIn.Wait Until Keyword Succeeds    40    20    Genius.Get Tunnel    ${dpn_Id_1}    ${dpn_Id_2}
+    ...    odl-interface:tunnel-type-vxlan
+    BuiltIn.Wait Until Keyword Succeeds    60s    5s    Genius.Verify Tunnel Status as UP    TZA
+
+SRM Stop Suite
+    [Documentation]    Stop suite for service recovery.
+    Delete All Vteps
+    Genius Suite Teardown
index 485b8cd616f35a0a00751280831caf3f9e499732..e1db8fd375d3ffc541b09d12c067b38132be8857 100644 (file)
@@ -375,3 +375,10 @@ Stop OVS
     [Documentation]    Stop the OVS node.
     ${output} =    Utils.Run Command On Mininet    ${ovs_ip}    sudo /usr/share/openvswitch/scripts/ovs-ctl stop
     BuiltIn.Log    ${output}
+
+Get Bridge Data
+    [Documentation]    This keyword returns first bridge name and UUID from list of bridges.
+    ${result} =    SSHLibrary.Execute Command    sudo ovs-vsctl show
+    ${uuid} =    String.Get Line    ${result}    0
+    ${line}    ${bridge_name}    Builtin.Should Match Regexp    ${result}    Bridge "(\\w+)"
+    [Return]    ${uuid}    ${bridge_name}
diff --git a/csit/suites/genius/Service_Recovery.robot b/csit/suites/genius/Service_Recovery.robot
new file mode 100644 (file)
index 0000000..8e4fffb
--- /dev/null
@@ -0,0 +1,72 @@
+*** Settings ***
+Documentation     Test Suite for Service Recovery.
+...               Find detailed test plan here, http://docs.opendaylight.org/en/latest/submodules/genius/docs/testplans/service-recovery.html
+Suite Setup       Genius.SRM Start Suite
+Suite Teardown    Genius.SRM Stop Suite
+Test Teardown     Genius Test Teardown    ${data_models}
+Library           re
+Resource          ../../libraries/DataModels.robot
+Resource          ../../libraries/Genius.robot
+Resource          ../../libraries/OVSDB.robot
+Resource          ../../libraries/Utils.robot
+Resource          ../../libraries/VpnOperations.robot
+Resource          ../../variables/Variables.robot
+Variables         ../../variables/genius/Modules.py
+
+*** Test Cases ***
+ITM TZ Recovery
+    [Documentation]    This test case recovers the tunnels using transportzone name.
+    Delete Tunnel on OVS
+    KarafKeywords.Issue Command On Karaf Console    srm:recover INSTANCE ITM-TZ TZA
+    BuiltIn.Wait Until Keyword Succeeds    60s    5s    Genius.Verify Tunnel Status as UP    TZA
+
+ITM TEP Recovery
+    [Documentation]    This test case recovers the tunnels using transportzone name and tunnel's ip address.
+    Delete Tunnel on OVS
+    KarafKeywords.Issue Command On Karaf Console    srm:recover INSTANCE ITM-TEP TZA:${TOOLS_SYSTEM_IP}
+    BuiltIn.Wait Until Keyword Succeeds    60s    5s    Genius.Verify Tunnel Status as UP    TZA
+
+ITM Service Recovery
+    [Documentation]    This test case recovers ITM Service.
+    ${tunnel} =    Get Tunnel name
+    Utils.Remove All Elements At URI And Verify    ${CONFIG_API}/ietf-interfaces:interfaces/interface/${tunnel}
+    BuiltIn.Wait Until Keyword Succeeds    60s    5s    Genius.Verify Tunnel Delete on DS    ${tunnel}
+    KarafKeywords.Issue Command On Karaf Console    srm:recover SERVICE ITM
+    BuiltIn.Wait Until Keyword Succeeds    60s    5s    Genius.Verify Tunnel Status as UP    TZA
+
+IFM Instance Recovery
+    [Documentation]    This test case recovers tunnel interface instance using interface name.
+    ${tunnel} =    Get Tunnel name
+    Delete Tunnel on OVS
+    KarafKeywords.Issue Command On Karaf Console    srm:recover INSTANCE IFM-IFACE ${tunnel}
+    BuiltIn.Wait Until Keyword Succeeds    60s    5s    Genius.Verify Tunnel Status as UP    TZA
+
+IFM Service Recovery
+    [Documentation]    This test case recovers IFM Service.
+    ${tunnel} =    Get Tunnel name
+    SSHLibrary.Switch Connection    ${conn_id_1}
+    ${uuid}    ${bridge} =    OVSDB.Get Bridge Data
+    ${resp} =    RequestsLibrary.Delete Request    session    ${SOUTHBOUND_CONFIG_API}uuid%2F${uuid}%2Fbridge%2F${bridge}
+    BuiltIn.Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
+    BuiltIn.Wait Until Keyword Succeeds    60s    5s    Genius.Verify Tunnel Delete on DS    ${tunnel}
+    KarafKeywords.Issue Command On Karaf Console    srm:recover SERVICE IFM
+    BuiltIn.Wait Until Keyword Succeeds    60s    5s    Genius.Verify Tunnel Status as UP    TZA
+
+*** Keywords ***
+Delete Tunnel on OVS
+    [Documentation]    Deletes a tunnel interface on switch and verify deletion on OVS.
+    ${dpn_Id_1} =    Genius.Get Dpn Ids    ${conn_id_1}
+    ${dpn_Id_2} =    Genius.Get Dpn Ids    ${conn_id_2}
+    ${tunnel} =    Wait Until Keyword Succeeds    40    20    Genius.Get Tunnel    ${dpn_Id_1}    ${dpn_Id_2}
+    ...    odl-interface:tunnel-type-vxlan
+    SSHLibrary.Switch Connection    ${conn_id_1}
+    SSHLibrary.Execute Command    sudo ovs-vsctl del-port ${tunnel}
+    BuiltIn.Wait Until Keyword Succeeds    60s    5s    Genius.Verify Tunnel Delete on DS    ${tunnel}
+
+Get Tunnel name
+    [Documentation]    This keyword returns tunnel interface name.
+    ${dpn_id_1}=    Genius.Get Dpn Ids    ${conn_id_1}
+    ${dpn_id_2}=    Genius.Get Dpn Ids    ${conn_id_2}
+    ${tunnel}=    BuiltIn.Wait Until Keyword Succeeds    40    20    Genius.Get Tunnel    ${dpn_id_1}    ${dpn_id_2}
+    ...    odl-interface:tunnel-type-vxlan
+    [Return]    ${tunnel}
index 0d4f525683c9ad320ad3d59cacf2583ac495a787..3fb431f2526377ce808c0150a93e37a630c22fab 100644 (file)
@@ -3,5 +3,4 @@ integration/test/csit/suites/genius/Interface_manager.robot
 integration/test/csit/suites/genius/ID_manager.robot
 integration/test/csit/suites/genius/Configure_ITM.robot
 integration/test/csit/suites/genius/BFD_monitoring.robot
-
-# Add new suites for oxygen or higher here:
+integration/test/csit/suites/genius/Service_Recovery.robot
index 0d4f525683c9ad320ad3d59cacf2583ac495a787..3fb431f2526377ce808c0150a93e37a630c22fab 100644 (file)
@@ -3,5 +3,4 @@ integration/test/csit/suites/genius/Interface_manager.robot
 integration/test/csit/suites/genius/ID_manager.robot
 integration/test/csit/suites/genius/Configure_ITM.robot
 integration/test/csit/suites/genius/BFD_monitoring.robot
-
-# Add new suites for oxygen or higher here:
+integration/test/csit/suites/genius/Service_Recovery.robot