Testsuite for Service Recovery
[integration/test.git] / csit / suites / genius / Service_Recovery.robot
1 *** Settings ***
2 Documentation     Test Suite for Service Recovery.
3 ...               Find detailed test plan here, http://docs.opendaylight.org/en/latest/submodules/genius/docs/testplans/service-recovery.html
4 Suite Setup       Genius.SRM Start Suite
5 Suite Teardown    Genius.SRM Stop Suite
6 Test Teardown     Genius Test Teardown    ${data_models}
7 Library           re
8 Resource          ../../libraries/DataModels.robot
9 Resource          ../../libraries/Genius.robot
10 Resource          ../../libraries/OVSDB.robot
11 Resource          ../../libraries/Utils.robot
12 Resource          ../../libraries/VpnOperations.robot
13 Resource          ../../variables/Variables.robot
14 Variables         ../../variables/genius/Modules.py
15
16 *** Test Cases ***
17 ITM TZ Recovery
18     [Documentation]    This test case recovers the tunnels using transportzone name.
19     Delete Tunnel on OVS
20     KarafKeywords.Issue Command On Karaf Console    srm:recover INSTANCE ITM-TZ TZA
21     BuiltIn.Wait Until Keyword Succeeds    60s    5s    Genius.Verify Tunnel Status as UP    TZA
22
23 ITM TEP Recovery
24     [Documentation]    This test case recovers the tunnels using transportzone name and tunnel's ip address.
25     Delete Tunnel on OVS
26     KarafKeywords.Issue Command On Karaf Console    srm:recover INSTANCE ITM-TEP TZA:${TOOLS_SYSTEM_IP}
27     BuiltIn.Wait Until Keyword Succeeds    60s    5s    Genius.Verify Tunnel Status as UP    TZA
28
29 ITM Service Recovery
30     [Documentation]    This test case recovers ITM Service.
31     ${tunnel} =    Get Tunnel name
32     Utils.Remove All Elements At URI And Verify    ${CONFIG_API}/ietf-interfaces:interfaces/interface/${tunnel}
33     BuiltIn.Wait Until Keyword Succeeds    60s    5s    Genius.Verify Tunnel Delete on DS    ${tunnel}
34     KarafKeywords.Issue Command On Karaf Console    srm:recover SERVICE ITM
35     BuiltIn.Wait Until Keyword Succeeds    60s    5s    Genius.Verify Tunnel Status as UP    TZA
36
37 IFM Instance Recovery
38     [Documentation]    This test case recovers tunnel interface instance using interface name.
39     ${tunnel} =    Get Tunnel name
40     Delete Tunnel on OVS
41     KarafKeywords.Issue Command On Karaf Console    srm:recover INSTANCE IFM-IFACE ${tunnel}
42     BuiltIn.Wait Until Keyword Succeeds    60s    5s    Genius.Verify Tunnel Status as UP    TZA
43
44 IFM Service Recovery
45     [Documentation]    This test case recovers IFM Service.
46     ${tunnel} =    Get Tunnel name
47     SSHLibrary.Switch Connection    ${conn_id_1}
48     ${uuid}    ${bridge} =    OVSDB.Get Bridge Data
49     ${resp} =    RequestsLibrary.Delete Request    session    ${SOUTHBOUND_CONFIG_API}uuid%2F${uuid}%2Fbridge%2F${bridge}
50     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
51     BuiltIn.Wait Until Keyword Succeeds    60s    5s    Genius.Verify Tunnel Delete on DS    ${tunnel}
52     KarafKeywords.Issue Command On Karaf Console    srm:recover SERVICE IFM
53     BuiltIn.Wait Until Keyword Succeeds    60s    5s    Genius.Verify Tunnel Status as UP    TZA
54
55 *** Keywords ***
56 Delete Tunnel on OVS
57     [Documentation]    Deletes a tunnel interface on switch and verify deletion on OVS.
58     ${dpn_Id_1} =    Genius.Get Dpn Ids    ${conn_id_1}
59     ${dpn_Id_2} =    Genius.Get Dpn Ids    ${conn_id_2}
60     ${tunnel} =    Wait Until Keyword Succeeds    40    20    Genius.Get Tunnel    ${dpn_Id_1}    ${dpn_Id_2}
61     ...    odl-interface:tunnel-type-vxlan
62     SSHLibrary.Switch Connection    ${conn_id_1}
63     SSHLibrary.Execute Command    sudo ovs-vsctl del-port ${tunnel}
64     BuiltIn.Wait Until Keyword Succeeds    60s    5s    Genius.Verify Tunnel Delete on DS    ${tunnel}
65
66 Get Tunnel name
67     [Documentation]    This keyword returns tunnel interface name.
68     ${dpn_id_1}=    Genius.Get Dpn Ids    ${conn_id_1}
69     ${dpn_id_2}=    Genius.Get Dpn Ids    ${conn_id_2}
70     ${tunnel}=    BuiltIn.Wait Until Keyword Succeeds    40    20    Genius.Get Tunnel    ${dpn_id_1}    ${dpn_id_2}
71     ...    odl-interface:tunnel-type-vxlan
72     [Return]    ${tunnel}