SXP: Check cluster is in sync
[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    240    1    ClusterManagement.Sync_Status_Should_Be_False    ${controller_index}
34     ${running_member} =    Collections.Get From List    ${running_members}    0
35     ${owner_controller} =    SxpClusterLib.Get Owner Controller    ${running_member}
36     BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings Exist    ${owner_controller}
37     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
38     \    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}
39     ClusterManagement.Flush_Iptables_From_List_Or_All
40     BuiltIn.Wait Until Keyword Succeeds    240    1    ClusterManagement.Check_Cluster_Is_In_Sync
41     BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings Does Not Exist    ${owner_controller}
42
43 Check Bindings Exist
44     [Arguments]    ${owner_controller}
45     [Documentation]    Check that bindings exists in Cluster datastore
46     ${resp} =    SxpLib.Get Bindings    node=${INADDR_ANY}    session=ClusterManagement__session_${owner_controller}
47     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
48     \    SxpLib.Should Contain Binding    ${resp}    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32
49
50 Check Bindings Does Not Exist
51     [Arguments]    ${owner_controller}
52     [Documentation]    Check that bindings does not exist in Cluster datastore
53     ${resp} =    SxpLib.Get Bindings    node=${INADDR_ANY}    session=ClusterManagement__session_${owner_controller}
54     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
55     \    SxpLib.Should Not Contain Binding    ${resp}    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32