64ac0953493d9fcd09ce41fdaf2336c97ea1b208
[integration/test.git] / csit / suites / sxp / clustering / 020_RPC_Redirecting.robot
1 *** Settings ***
2 Documentation       SXP holds active SXP nodes only on the cluster owner node. Active SXP node holds its master database and datastore access. This implies that all RPC operation logic must be executed only on cluster owner node. In case RPC is send to another cluster node it must be redirected to owner to be properly executed. This suite contains tests for SxpControllerService and SxpConfigControllerService RPCs.
3
4 Library             ../../../libraries/Common.py
5 Resource            ../../../libraries/CompareStream.robot
6 Resource            ../../../libraries/SxpBindingOriginsLib.robot
7 Resource            ../../../libraries/SxpClusterLib.robot
8 Resource            ../../../libraries/SxpLib.robot
9
10 Suite Setup         SxpClusterLib.Setup SXP Cluster Session
11 Suite Teardown      SxpClusterLib.Clean SXP Cluster Session
12
13
14 *** Test Cases ***
15 Test Add/Delete Node
16     [Documentation]    Adding and then deleting SXP node is sucessfull only if all operations are done on cluster owner node. To verify that all RPCs are redirected to cluster owner send add-node RPC to the first cluster node and delete-node RPC to the second cluster node (requires datastore access).
17     [Tags]    sxp clustering redirecting
18     SxpLib.Add Node    ${INADDR_ANY}    session=ClusterManagement__session_1
19     BuiltIn.Wait Until Keyword Succeeds
20     ...    20x
21     ...    10s
22     ...    SxpClusterLib.Check Cluster Node started
23     ...    ${INADDR_ANY}
24     ...    ip=${EMPTY}
25     SxpLib.Delete Node    ${INADDR_ANY}    session=ClusterManagement__session_2
26     BuiltIn.Wait Until Keyword Succeeds
27     ...    12x
28     ...    10s
29     ...    SxpClusterLib.Check Cluster Node stopped
30     ...    ${INADDR_ANY}
31     ...    ip=${EMPTY}
32
33 Test Add/Delete Binding
34     [Documentation]    Adding and then deleting binding from a SXP node is sucessfull only if all operations are done on cluster owner node. To verify that all RPCs are redirected to cluster owner send add-node RPC to the first cluster node, add-bindings RPC to the second cluster node (requires master database) and delete-bindings RPC to the third cluster node (requires master database).
35     [Tags]    sxp clustering redirecting
36     Add Node And Check It Is Started
37     SxpLib.Add Bindings    1100    1.1.1.1/32    node=${INADDR_ANY}    session=ClusterManagement__session_2
38     SxpLib.Delete Bindings    1100    1.1.1.1/32    node=${INADDR_ANY}    session=ClusterManagement__session_3
39     [Teardown]    Delete Node And Check It Is Stopped
40
41 Test Add/Delete Domain
42     [Documentation]    Adding and then deleting domain from a SXP node is sucessfull only if all operations are done on cluster owner node. To verify that all RPCs are redirected to cluster owner send add-node RPC to the first cluster node, add-domain RPC to the second cluster node (requires datastore access and master database) and delete-domain RPC to the third cluster node (requires datastore access).
43     [Tags]    sxp clustering redirecting
44     Add Node And Check It Is Started
45     SxpLib.Add Domain    cluster    node=${INADDR_ANY}    session=ClusterManagement__session_2
46     SxpLib.Delete Domain    cluster    node=${INADDR_ANY}    session=ClusterManagement__session_3
47     [Teardown]    Delete Node And Check It Is Stopped
48
49 Test Add/Delete Connection
50     [Documentation]    Adding and then deleting connection from a SXP node is sucessfull only if all operations are done on cluster owner node. To verify that all RPCs are redirected to cluster owner send add-node RPC to the first cluster node, add-connection RPC to the second cluster node (requires datastore access) and delete-connection RPC to the third cluster node (requires datastore access).
51     [Tags]    sxp clustering redirecting
52     Add Node And Check It Is Started
53     SxpLib.Add Connection
54     ...    version4
55     ...    listener
56     ...    ${INADDR_ANY}
57     ...    64999
58     ...    node=${INADDR_ANY}
59     ...    session=ClusterManagement__session_1
60     SxpLib.Delete Connections    ${INADDR_ANY}    64999    node=${INADDR_ANY}    session=ClusterManagement__session_2
61     [Teardown]    Delete Node And Check It Is Stopped
62
63 Test Add/Delete Peer Group
64     [Documentation]    Adding and then deleting peer group from a SXP node is sucessfull only if all operations are done on cluster owner node. To verify that all RPCs are redirected to cluster owner send add-peer-group RPC to the first cluster node, get-peer-groups RPC to the second cluster node (requires datastore access) and delete-peer-group RPC to the third cluster node (requires datastore access).
65     [Tags]    sxp clustering redirecting
66     [Setup]    Add Node And Check It Is Started
67     SxpLib.Add PeerGroup    GROUP    peers=${EMPTY}    node=${INADDR_ANY}    session=ClusterManagement__session_1
68     ${resp} =    SxpLib.Get Peer Groups    ${INADDR_ANY}    session=ClusterManagement__session_2
69     @{groups} =    Sxp.Parse Peer Groups    ${resp}
70     FOR    ${group}    IN    @{groups}
71         SxpLib.Delete Peer Group    ${group['name']}    node=${INADDR_ANY}    session=ClusterManagement__session_3
72     END
73     [Teardown]    Delete Node And Check It Is Stopped
74
75 Test Add/Delete Domain Filter
76     [Documentation]    Adding and then deleting domain filter from a SXP node is sucessfull only if all operations are done on cluster owner node. To verify that all RPCs are redirected to cluster owner send add-domain-filter RPC to the first cluster node and delete-domain-filter RPC to the second cluster node (requires datastore access).
77     [Tags]    sxp clustering redirecting
78     [Setup]    Add Node And Check It Is Started
79     ${domain_1_xml} =    Sxp.Add Domains    domain-1
80     ${domain_2_xml} =    Sxp.Add Domains    domain-2
81     ${domains} =    Common.Combine Strings    ${domain_1_xml}    ${domain_2_xml}
82     ${entry} =    Sxp.Get Filter Entry    10    permit    pl=20.0.0.0/8
83     ${entries} =    Common.Combine Strings    ${entry}
84     SxpLib.Add Domain Filter
85     ...    global
86     ...    ${domains}
87     ...    ${entries}
88     ...    node=${INADDR_ANY}
89     ...    session=ClusterManagement__session_1
90     SxpLib.Delete Domain Filter    global    node=${INADDR_ANY}    session=ClusterManagement__session_2
91     [Teardown]    Delete Node And Check It Is Stopped
92
93 Test Add/Delete Filter
94     [Documentation]    Adding, updating and then deleting filter from a SXP node is sucessfull only if all operations are done on cluster owner node. To verify that all RPCs are redirected to cluster owner send add-filter RPC to the first cluster node, update-filter RPC to the second cluster node (requires datastore access) and delete-filter RPC to the third cluster node (requires datastore access).
95     [Tags]    sxp clustering redirecting
96     [Setup]    Add Node And Check It Is Started
97     ${entry1} =    Sxp.Get Filter Entry    10    deny    pl=10.10.20.0/24
98     ${entry2} =    Sxp.Get Filter Entry    20    permit    epl=10.10.0.0/16,le,24
99     ${entry3} =    Sxp.Get Filter Entry    30    permit    sgt=30    pl=10.10.10.0/24
100     ${entries} =    Common.Combine Strings    ${entry1}    ${entry2}    ${entry3}
101     SxpLib.Add PeerGroup    GROUP    peers=${EMPTY}    node=${INADDR_ANY}    session=${CONTROLLER_SESSION}
102     SxpLib.Add Filter
103     ...    GROUP
104     ...    outbound
105     ...    ${entries}
106     ...    node=${INADDR_ANY}
107     ...    policy=manual-update
108     ...    session=ClusterManagement__session_1
109     SxpLib.Update Filter
110     ...    GROUP
111     ...    outbound
112     ...    ${entries}
113     ...    node=${INADDR_ANY}
114     ...    policy=manual-update
115     ...    session=ClusterManagement__session_2
116     SxpLib.Delete Filter    GROUP    outbound    node=${INADDR_ANY}    session=ClusterManagement__session_3
117     [Teardown]    Delete Node And Check It Is Stopped
118
119 Test Add/Update/Delete Binding Origin
120     [Documentation]    Binding origin operations need to be executed on cluster owner because they rely on static map which is present solely on cluster owner. To test that binding origin RPCs are redirected to cluster owner first add binding origin to the first node then update it on the second node (requires up-to date binding origin map) and update it on the third node (requires up-to date binding origin map).
121     [Tags]    sxp clustering redirecting
122     CompareStream.Run_Keyword_If_Less_Than
123     ...    fluorine
124     ...    BuiltIn.Pass Execution
125     ...    Binding origins are not supported before Fluorine
126     SxpBindingOriginsLib.Add Binding Origin    CLUSTER    0    session=ClusterManagement__session_1
127     SxpBindingOriginsLib.Update Binding Origin    CLUSTER    3    session=ClusterManagement__session_2
128     SxpBindingOriginsLib.Delete Binding Origin    CLUSTER    session=ClusterManagement__session_3
129     [Teardown]    SxpBindingOriginsLib.Revert To Default Binding Origins Configuration    session=${CONTROLLER_SESSION}
130
131
132 *** Keywords ***
133 Add Node And Check It Is Started
134     [Documentation]    Send add-node RPC to the first cluster member and check if node has been started.
135     SxpLib.Add Node    ${INADDR_ANY}    session=ClusterManagement__session_1
136     BuiltIn.Wait Until Keyword Succeeds
137     ...    20x
138     ...    10s
139     ...    SxpClusterLib.Check Cluster Node started
140     ...    ${INADDR_ANY}
141     ...    ip=${EMPTY}
142
143 Delete Node And Check It Is Stopped
144     [Documentation]    Send delete-node RPC to the first cluster member and check if node has been stopped.
145     SxpLib.Delete Node    ${INADDR_ANY}    session=ClusterManagement__session_1
146     BuiltIn.Wait Until Keyword Succeeds
147     ...    20x
148     ...    10s
149     ...    SxpClusterLib.Check Cluster Node stopped
150     ...    ${INADDR_ANY}
151     ...    ip=${EMPTY}