d89df9d32107b5afe091427bd48aafd27cd0ce18
[integration/test.git] / csit / suites / sxp / clustering / 020_Bindings_consistency.robot
1 *** Settings ***
2 Documentation     Test suite to test cluster binding propagation
3 Suite Setup       SxpClusterLib.Setup SXP Cluster Session With Device
4 Suite Teardown    SxpClusterLib.Clean SXP Cluster Session
5 Test Teardown     SxpClusterLib.Clean SXP Cluster
6 Library           ../../../libraries/Sxp.py
7 Resource          ../../../libraries/ClusterManagement.robot
8 Resource          ../../../libraries/SxpClusterLib.robot
9 Resource          ../../../libraries/SxpLib.robot
10
11 *** Test Cases ***
12 Isolation of SXP service follower Test Listener Part
13     [Documentation]    Test SXP binding propagation only if Controller with SCS is isolated
14     SxpClusterLib.Check Shards Status
15     Setup Custom SXP Cluster    listener    ${INADDR_ANY}    ${CONTROLLER_SESSION}
16     ${controller_index} =    SxpClusterLib.Get Owner Controller
17     Isolate SXP Controller    ${controller_index}    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
18
19 Isolation of SXP service follower Test Speaker Part
20     [Documentation]    Test SXP binding propagation only if Controller with SCS is isolated
21     SxpClusterLib.Check Shards Status
22     Setup Custom SXP Cluster    speaker
23     ${controller_index} =    SxpClusterLib.Get Owner Controller
24     Isolate SXP Controller    ${controller_index}    ${INADDR_ANY}
25
26 Isolation of SXP noservice follower Test Listener Part
27     [Documentation]    Test SXP binding propagation only if Controller without SCS are isolated
28     SxpClusterLib.Check Shards Status
29     Setup Custom SXP Cluster    listener    ${INADDR_ANY}    ${CONTROLLER_SESSION}
30     ${controller_index} =    SxpClusterLib.Get Not Owner Controller
31     Isolate SXP Controller    ${controller_index}    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
32
33 Isolation of SXP noservice follower Test Speaker Part
34     [Documentation]    Test SXP binding propagation only if Controller without SCS are isolated
35     SxpClusterLib.Check Shards Status
36     Setup Custom SXP Cluster    speaker
37     ${controller_index} =    SxpClusterLib.Get Not Owner Controller
38     Isolate SXP Controller    ${controller_index}    ${INADDR_ANY}
39
40 *** Keywords ***
41 Setup Custom SXP Cluster
42     [Arguments]    ${mode}    ${node}=${DEVICE_NODE_ID}    ${session}=${DEVICE_SESSION}
43     [Documentation]    Setup custom SXP cluster topology
44     SxpClusterLib.Setup SXP Cluster    ${mode}
45     : FOR    ${i}    IN RANGE    1    25
46     \    SxpLib.Add Bindings    ${i}0    ${i}.${i}.${i}.${i}/32    node=${node}    session=${session}
47
48 Isolate SXP Controller
49     [Arguments]    ${controller_index}    ${node}    ${session}=ClusterManagement__session_${controller_index}
50     [Documentation]    Isolate one of cluster nodes and perform check that bindings were propagated afterwards reverts isolation
51     @{running_members} =    ClusterManagement.Isolate_Member_From_List_Or_All    ${controller_index}
52     BuiltIn.Wait Until Keyword Succeeds    240    1    ClusterManagement.Sync_Status_Should_Be_False    ${controller_index}
53     BuiltIn.Wait Until Keyword Succeeds    60    1    SxpClusterLib.Check Device is Connected    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
54     ${running_member} =    Collections.Get From List    ${running_members}    0
55     ${owner_controller} =    SxpClusterLib.Get Owner Controller    ${running_member}
56     BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings    ${node}    ${session}
57     ClusterManagement.Flush_Iptables_From_List_Or_All
58     BuiltIn.Wait Until Keyword Succeeds    240    1    ClusterManagement.Sync_Status_Should_Be_True    ${controller_index}
59     BuiltIn.Wait Until Keyword Succeeds    60    1    SxpClusterLib.Check Device is Connected    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
60     BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings    ${node}    ${session}
61
62 Check Bindings
63     [Arguments]    ${node}    ${session}
64     [Documentation]    Checks that bindings were propagated to Peer
65     ${resp} =    SxpLib.Get Bindings    node=${node}    session=${session}
66     : FOR    ${i}    IN RANGE    1    25
67     \    SxpLib.Should Contain Binding    ${resp}    ${i}0    ${i}.${i}.${i}.${i}/32