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