Add Cluster routing tests
[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       Setup SXP Cluster Session
4 Suite Teardown    Clean SXP Cluster Session
5 Test Teardown     Clean SXP Cluster
6 Library           ../../../libraries/Sxp.py
7 Resource          ../../../libraries/SxpLib.robot
8 Resource          ../../../libraries/ClusterManagement.robot
9 Resource          ../../../libraries/SxpClusterLib.robot
10
11 *** Variables ***
12 ${SAMPLES}        1
13
14 *** Test Cases ***
15 Isolation of SXP service follower Test Listener Part
16     [Documentation]    Test SXP binding propagation only if Controller with SCS is isolated
17     Check Shards Status
18     Setup Custom SXP Cluster    listener    ${CLUSTER_NODE_ID}    controller1
19     : FOR    ${i}    IN RANGE    0    ${SAMPLES}
20     \    ${controller_index}    Get Active Controller
21     \    Isolate SXP Controller    ${controller_index}    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
22
23 Isolation of SXP service follower Test Speaker Part
24     [Documentation]    Test SXP binding propagation only if Controller with SCS is isolated
25     Check Shards Status
26     Setup Custom SXP Cluster    speaker
27     : FOR    ${i}    IN RANGE    0    ${SAMPLES}
28     \    ${controller_index}    Get Active Controller
29     \    Isolate SXP Controller    ${controller_index}    ${CLUSTER_NODE_ID}
30
31 Isolation of SXP noservice follower Test Listener Part
32     [Documentation]    Test SXP binding propagation only if Controller without SCS are isolated
33     Check Shards Status
34     Setup Custom SXP Cluster    listener    ${CLUSTER_NODE_ID}    controller1
35     : FOR    ${i}    IN RANGE    0    ${SAMPLES}
36     \    ${controller_index}    Get Inactive Controller
37     \    Isolate SXP Controller    ${controller_index}    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
38
39 Isolation of SXP noservice follower Test Speaker Part
40     [Documentation]    Test SXP binding propagation only if Controller without SCS are isolated
41     Check Shards Status
42     Setup Custom SXP Cluster    speaker
43     : FOR    ${i}    IN RANGE    0    ${SAMPLES}
44     \    ${controller_index}    Get Inactive Controller
45     \    Isolate SXP Controller    ${controller_index}    ${CLUSTER_NODE_ID}
46
47 *** Keywords ***
48 Setup Custom SXP Cluster
49     [Arguments]    ${mode}    ${node}=${DEVICE_NODE_ID}    ${session}=${DEVICE_SESSION}
50     [Documentation]    Setup custom SXP cluster topology
51     Setup SXP Cluster    ${mode}
52     : FOR    ${i}    IN RANGE    1    25
53     \    Add Binding    ${i}0    ${i}.${i}.${i}.${i}/32    node=${node}    session=${session}
54
55 Check Bindings
56     [Arguments]    ${node}    ${session}
57     [Documentation]    Checks that bindings were propagated to Peer
58     ${resp}    Get Bindings    node=${node}    session=${session}
59     : FOR    ${i}    IN RANGE    1    25
60     \    Should Contain Binding    ${resp}    ${i}0    ${i}.${i}.${i}.${i}/32
61
62 Isolate SXP Controller
63     [Arguments]    ${controller_index}    ${node}    ${session}=${EMPTY}
64     [Documentation]    Isolate one of cluster nodes and perform check that bindings were propagated afterwards reverts isolation
65     ${find_session}    Set Variable If    '${session}' == ''    ${True}    ${False}
66     ${session}    Set Variable If    ${find_session}    controller${controller_index}    ${session}
67     Isolate_Member_From_List_Or_All    ${controller_index}
68     Wait Until Keyword Succeeds    240    1    Sync_Status_Should_Be_False    ${controller_index}
69     Wait Until Keyword Succeeds    60    1    Check Device is Connected    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
70     ${active_controller}    Get Active Controller
71     ${session}    Set Variable If    ${find_session}    controller${active_controller}    ${session}
72     Wait Until Keyword Succeeds    30    1    Check Bindings    ${node}    ${session}
73     Flush_Iptables_From_List_Or_All
74     Wait Until Keyword Succeeds    240    1    Sync_Status_Should_Be_True    ${controller_index}
75     Wait Until Keyword Succeeds    60    1    Check Device is Connected    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
76     Wait Until Keyword Succeeds    30    1    Check Bindings    ${node}    ${session}