Add testcase for Vswitch Hosting Subnet Route Restart
[integration/test.git] / csit / suites / sxp / clustering / 030_RPC_functionality.robot
1 *** Settings ***
2 Documentation     Test suite to verify RPC funcionality on cluster
3 Suite Setup       SxpClusterLib.Setup SXP Cluster Session With Device
4 Suite Teardown    SxpClusterLib.Clean SXP Cluster Session
5 Test Setup        SxpClusterLib.Setup SXP Cluster
6 Test Teardown     SxpClusterLib.Clean SXP Cluster
7 Library           ../../../libraries/Sxp.py
8 Resource          ../../../libraries/ClusterManagement.robot
9 Resource          ../../../libraries/SxpClusterLib.robot
10 Resource          ../../../libraries/SxpLib.robot
11
12 *** Test Cases ***
13 Isolation of RCP service Test
14     [Documentation]    Test SXP RPC functionality only if Controller with SCS is isolated
15     SxpClusterLib.Check Shards Status
16     ${controller_index} =    SxpClusterLib.Get Owner Controller
17     Isolate SXP Controller    ${controller_index}
18
19 Isolation of RPC noservice Test
20     [Documentation]    Test SXP RPC functionality only if Controller without SCS are isolated
21     SxpClusterLib.Check Shards Status
22     ${controller_index} =    SxpClusterLib.Get Not Owner Controller
23     Isolate SXP Controller    ${controller_index}
24
25 *** Keywords ***
26 Isolate SXP Controller
27     [Arguments]    ${controller_index}
28     [Documentation]    Isolate one of cluster nodes and perform check that RPC changes were performed afterwards reverts isolation
29     ${owner_controller} =    SxpClusterLib.Get Owner Controller
30     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
31     \    SxpLib.Add Bindings    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32    node=${INADDR_ANY}    session=ClusterManagement__session_${owner_controller}
32     @{running_members} =    ClusterManagement.Isolate_Member_From_List_Or_All    ${controller_index}
33     BuiltIn.Wait Until Keyword Succeeds    120x    1s    ClusterManagement.Verify_Members_Are_Ready    member_index_list=${running_members}    verify_cluster_sync=True    verify_restconf=True
34     ...    verify_system_status=False    service_list=${EMPTY_LIST}
35     BuiltIn.Wait Until Keyword Succeeds    240x    1s    ClusterManagement.Sync_Status_Should_Be_False    ${controller_index}
36     ${running_member} =    Collections.Get From List    ${running_members}    0
37     ${owner_controller} =    SxpClusterLib.Get Owner Controller    ${running_member}
38     BuiltIn.Wait Until Keyword Succeeds    60x    1s    Check Bindings Exist    ${owner_controller}
39     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
40     \    SxpLib.Delete Bindings    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32    node=${INADDR_ANY}    session=ClusterManagement__session_${owner_controller}
41     ClusterManagement.Flush_Iptables_From_List_Or_All
42     BuiltIn.Wait Until Keyword Succeeds    120x    1s    ClusterManagement.Verify_Members_Are_Ready    member_index_list=${EMPTY}    verify_cluster_sync=True    verify_restconf=True
43     ...    verify_system_status=False    service_list=${EMPTY_LIST}
44     BuiltIn.Wait Until Keyword Succeeds    60x    1s    Check Bindings Does Not Exist    ${owner_controller}
45
46 Check Bindings Exist
47     [Arguments]    ${owner_controller}
48     [Documentation]    Check that bindings exists in Cluster datastore
49     ${resp} =    SxpLib.Get Bindings    node=${INADDR_ANY}    session=ClusterManagement__session_${owner_controller}
50     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
51     \    SxpLib.Should Contain Binding    ${resp}    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32
52
53 Check Bindings Does Not Exist
54     [Arguments]    ${owner_controller}
55     [Documentation]    Check that bindings does not exist in Cluster datastore
56     ${resp} =    SxpLib.Get Bindings    node=${INADDR_ANY}    session=ClusterManagement__session_${owner_controller}
57     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
58     \    SxpLib.Should Not Contain Binding    ${resp}    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32