Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / csit / suites / sxp / cluster-binding / 010_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 Library           ../../../libraries/Sxp.py
6 Resource          ../../../libraries/ClusterManagement.robot
7 Resource          ../../../libraries/SxpClusterLib.robot
8 Resource          ../../../libraries/SxpLib.robot
9
10 *** Variables ***
11 ${RUNNING_MEMBER}    ${EMPTY}
12
13 *** Test Cases ***
14 Isolation of SXP service follower Test Speaker Part
15     [Documentation]    Test SXP binding propagation from device to cluster after cluster owner is isolated
16     [Setup]    Setup Custom SXP Cluster    speaker
17     ${controller_index} =    SxpClusterLib.Get Owner Controller
18     BuiltIn.Wait Until Keyword Succeeds    120x    1s    Check Bindings    ${INADDR_ANY}    ClusterManagement__session_${controller_index}
19     Isolate SXP Controller    ${controller_index}    ${INADDR_ANY}
20     BuiltIn.Wait Until Keyword Succeeds    120x    1s    Check Bindings    ${INADDR_ANY}    ClusterManagement__session_${RUNNING_MEMBER}
21     UnIsolate SXP Controller    ${controller_index}
22     BuiltIn.Wait Until Keyword Succeeds    120x    1s    Check Bindings    ${INADDR_ANY}    ClusterManagement__session_${controller_index}
23     [Teardown]    SxpClusterLib.Clean SXP Cluster
24
25 Isolation of SXP noservice follower Test Speaker Part
26     [Documentation]    Test SXP binding propagation from device to cluster after cluster (not owner) node is isolated
27     [Setup]    Setup Custom SXP Cluster    speaker
28     ${controller_index} =    SxpClusterLib.Get Not Owner Controller
29     BuiltIn.Wait Until Keyword Succeeds    120x    1s    Check Bindings    ${INADDR_ANY}    ClusterManagement__session_${controller_index}
30     Isolate SXP Controller    ${controller_index}    ${INADDR_ANY}
31     BuiltIn.Wait Until Keyword Succeeds    120x    1s    Check Bindings    ${INADDR_ANY}    ClusterManagement__session_${RUNNING_MEMBER}
32     UnIsolate SXP Controller    ${controller_index}
33     BuiltIn.Wait Until Keyword Succeeds    120x    1s    Check Bindings    ${INADDR_ANY}    ClusterManagement__session_${controller_index}
34     [Teardown]    SxpClusterLib.Clean SXP Cluster
35
36 Isolation of SXP service follower Test Listener Part
37     [Documentation]    Test SXP binding propagation from cluster to device after cluster owner is isolated
38     [Setup]    Setup Custom SXP Cluster    listener    ${INADDR_ANY}    ${CONTROLLER_SESSION}
39     ${controller_index} =    SxpClusterLib.Get Owner Controller
40     BuiltIn.Wait Until Keyword Succeeds    120x    1s    Check Bindings    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
41     Isolate SXP Controller    ${controller_index}    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
42     BuiltIn.Wait Until Keyword Succeeds    120x    1s    Check Bindings    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
43     UnIsolate SXP Controller    ${controller_index}
44     BuiltIn.Wait Until Keyword Succeeds    120x    1s    Check Bindings    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
45     [Teardown]    SxpClusterLib.Clean SXP Cluster
46
47 Isolation of SXP noservice follower Test Listener Part
48     [Documentation]    Test SXP binding propagation from cluster to device after cluster (not owner) node is isolated
49     [Setup]    Setup Custom SXP Cluster    listener    ${INADDR_ANY}    ${CONTROLLER_SESSION}
50     ${controller_index} =    SxpClusterLib.Get Not Owner Controller
51     BuiltIn.Wait Until Keyword Succeeds    120x    1s    Check Bindings    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
52     Isolate SXP Controller    ${controller_index}    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
53     BuiltIn.Wait Until Keyword Succeeds    120x    1s    Check Bindings    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
54     UnIsolate SXP Controller    ${controller_index}
55     BuiltIn.Wait Until Keyword Succeeds    120x    1s    Check Bindings    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
56     [Teardown]    SxpClusterLib.Clean SXP Cluster
57
58 *** Keywords ***
59 Setup Custom SXP Cluster
60     [Arguments]    ${mode}    ${node}=${DEVICE_NODE_ID}    ${session}=${DEVICE_SESSION}
61     [Documentation]    Setup custom SXP cluster topology with ${NUM_ODL_SYSTEM} nodes and one device
62     SxpClusterLib.Check Shards Status
63     SxpClusterLib.Setup SXP Cluster    ${mode}
64     FOR    ${i}    IN RANGE    1    25
65         SxpLib.Add Bindings    ${i}0    ${i}.${i}.${i}.${i}/32    node=${node}    session=${session}
66     END
67
68 Isolate SXP Controller
69     [Arguments]    ${controller_index}    ${node}    ${session}=ClusterManagement__session_${controller_index}
70     [Documentation]    Isolate one of cluster nodes and perform check that device is connected
71     @{running_members} =    ClusterManagement.Isolate_Member_From_List_Or_All    ${controller_index}
72     BuiltIn.Wait Until Keyword Succeeds    120x    1s    ClusterManagement.Verify_Members_Are_Ready    member_index_list=${running_members}    verify_cluster_sync=True    verify_restconf=True
73     ...    verify_system_status=False    service_list=${EMPTY_LIST}
74     ${running_member} =    Collections.Get From List    ${running_members}    0
75     BuiltIn.Set Test Variable    ${RUNNING_MEMBER}    ${running_member}
76     BuiltIn.Wait Until Keyword Succeeds    240x    1s    ClusterManagement.Sync_Status_Should_Be_False    ${controller_index}
77     BuiltIn.Wait Until Keyword Succeeds    120x    1s    SxpClusterLib.Check Device is Connected    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
78
79 UnIsolate SXP Controller
80     [Arguments]    ${controller_index}
81     [Documentation]    Un-Isolate one of cluster nodes and perform check that device is connected
82     ClusterManagement.Flush_Iptables_From_List_Or_All
83     BuiltIn.Wait Until Keyword Succeeds    120x    1s    ClusterManagement.Verify_Members_Are_Ready    member_index_list=${EMPTY}    verify_cluster_sync=True    verify_restconf=True
84     ...    verify_system_status=False    service_list=${EMPTY_LIST}
85     BuiltIn.Wait Until Keyword Succeeds    120x    1s    SxpClusterLib.Check Device is Connected    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
86
87 Check Bindings
88     [Arguments]    ${node}    ${session}
89     [Documentation]    Checks that bindings were propagated to Peer
90     ${resp} =    SxpLib.Get Bindings    node=${node}    session=${session}
91     FOR    ${i}    IN RANGE    1    25
92         SxpLib.Should Contain Binding    ${resp}    ${i}0    ${i}.${i}.${i}.${i}/32
93     END