Support only Fluorine+ distributions
[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/SxpBindingOriginsLib.robot
6 Resource            ../../../libraries/SxpClusterLib.robot
7 Resource            ../../../libraries/SxpLib.robot
8
9 Suite Setup         SxpClusterLib.Setup SXP Cluster Session
10 Suite Teardown      SxpClusterLib.Clean SXP Cluster Session
11
12
13 *** Test Cases ***
14 Test Add/Delete Node
15     [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).
16     [Tags]    sxp clustering redirecting
17     SxpLib.Add Node    ${INADDR_ANY}    session=ClusterManagement__session_1
18     BuiltIn.Wait Until Keyword Succeeds
19     ...    20x
20     ...    10s
21     ...    SxpClusterLib.Check Cluster Node started
22     ...    ${INADDR_ANY}
23     ...    ip=${EMPTY}
24     SxpLib.Delete Node    ${INADDR_ANY}    session=ClusterManagement__session_2
25     BuiltIn.Wait Until Keyword Succeeds
26     ...    12x
27     ...    10s
28     ...    SxpClusterLib.Check Cluster Node stopped
29     ...    ${INADDR_ANY}
30     ...    ip=${EMPTY}
31
32 Test Add/Delete Binding
33     [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).
34     [Tags]    sxp clustering redirecting
35     Add Node And Check It Is Started
36     SxpLib.Add Bindings    1100    1.1.1.1/32    node=${INADDR_ANY}    session=ClusterManagement__session_2
37     SxpLib.Delete Bindings    1100    1.1.1.1/32    node=${INADDR_ANY}    session=ClusterManagement__session_3
38     [Teardown]    Delete Node And Check It Is Stopped
39
40 Test Add/Delete Domain
41     [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).
42     [Tags]    sxp clustering redirecting
43     Add Node And Check It Is Started
44     SxpLib.Add Domain    cluster    node=${INADDR_ANY}    session=ClusterManagement__session_2
45     SxpLib.Delete Domain    cluster    node=${INADDR_ANY}    session=ClusterManagement__session_3
46     [Teardown]    Delete Node And Check It Is Stopped
47
48 Test Add/Delete Connection
49     [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).
50     [Tags]    sxp clustering redirecting
51     Add Node And Check It Is Started
52     SxpLib.Add Connection
53     ...    version4
54     ...    listener
55     ...    ${INADDR_ANY}
56     ...    64999
57     ...    node=${INADDR_ANY}
58     ...    session=ClusterManagement__session_1
59     SxpLib.Delete Connections    ${INADDR_ANY}    64999    node=${INADDR_ANY}    session=ClusterManagement__session_2
60     [Teardown]    Delete Node And Check It Is Stopped
61
62 Test Add/Delete Peer Group
63     [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).
64     [Tags]    sxp clustering redirecting
65     [Setup]    Add Node And Check It Is Started
66     SxpLib.Add PeerGroup    GROUP    peers=${EMPTY}    node=${INADDR_ANY}    session=ClusterManagement__session_1
67     ${resp} =    SxpLib.Get Peer Groups    ${INADDR_ANY}    session=ClusterManagement__session_2
68     @{groups} =    Sxp.Parse Peer Groups    ${resp}
69     FOR    ${group}    IN    @{groups}
70         SxpLib.Delete Peer Group    ${group['name']}    node=${INADDR_ANY}    session=ClusterManagement__session_3
71     END
72     [Teardown]    Delete Node And Check It Is Stopped
73
74 Test Add/Delete Domain Filter
75     [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).
76     [Tags]    sxp clustering redirecting
77     [Setup]    Add Node And Check It Is Started
78     ${domain_1_xml} =    Sxp.Add Domains    domain-1
79     ${domain_2_xml} =    Sxp.Add Domains    domain-2
80     ${domains} =    Common.Combine Strings    ${domain_1_xml}    ${domain_2_xml}
81     ${entry} =    Sxp.Get Filter Entry    10    permit    pl=20.0.0.0/8
82     ${entries} =    Common.Combine Strings    ${entry}
83     SxpLib.Add Domain Filter
84     ...    global
85     ...    ${domains}
86     ...    ${entries}
87     ...    node=${INADDR_ANY}
88     ...    session=ClusterManagement__session_1
89     SxpLib.Delete Domain Filter    global    node=${INADDR_ANY}    session=ClusterManagement__session_2
90     [Teardown]    Delete Node And Check It Is Stopped
91
92 Test Add/Delete Filter
93     [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).
94     [Tags]    sxp clustering redirecting
95     [Setup]    Add Node And Check It Is Started
96     ${entry1} =    Sxp.Get Filter Entry    10    deny    pl=10.10.20.0/24
97     ${entry2} =    Sxp.Get Filter Entry    20    permit    epl=10.10.0.0/16,le,24
98     ${entry3} =    Sxp.Get Filter Entry    30    permit    sgt=30    pl=10.10.10.0/24
99     ${entries} =    Common.Combine Strings    ${entry1}    ${entry2}    ${entry3}
100     SxpLib.Add PeerGroup    GROUP    peers=${EMPTY}    node=${INADDR_ANY}    session=${CONTROLLER_SESSION}
101     SxpLib.Add Filter
102     ...    GROUP
103     ...    outbound
104     ...    ${entries}
105     ...    node=${INADDR_ANY}
106     ...    policy=manual-update
107     ...    session=ClusterManagement__session_1
108     SxpLib.Update Filter
109     ...    GROUP
110     ...    outbound
111     ...    ${entries}
112     ...    node=${INADDR_ANY}
113     ...    policy=manual-update
114     ...    session=ClusterManagement__session_2
115     SxpLib.Delete Filter    GROUP    outbound    node=${INADDR_ANY}    session=ClusterManagement__session_3
116     [Teardown]    Delete Node And Check It Is Stopped
117
118 Test Add/Update/Delete Binding Origin
119     [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).
120     [Tags]    sxp clustering redirecting
121     SxpBindingOriginsLib.Add Binding Origin    CLUSTER    0    session=ClusterManagement__session_1
122     SxpBindingOriginsLib.Update Binding Origin    CLUSTER    3    session=ClusterManagement__session_2
123     SxpBindingOriginsLib.Delete Binding Origin    CLUSTER    session=ClusterManagement__session_3
124     [Teardown]    SxpBindingOriginsLib.Revert To Default Binding Origins Configuration    session=${CONTROLLER_SESSION}
125
126
127 *** Keywords ***
128 Add Node And Check It Is Started
129     [Documentation]    Send add-node RPC to the first cluster member and check if node has been started.
130     SxpLib.Add Node    ${INADDR_ANY}    session=ClusterManagement__session_1
131     BuiltIn.Wait Until Keyword Succeeds
132     ...    20x
133     ...    10s
134     ...    SxpClusterLib.Check Cluster Node started
135     ...    ${INADDR_ANY}
136     ...    ip=${EMPTY}
137
138 Delete Node And Check It Is Stopped
139     [Documentation]    Send delete-node RPC to the first cluster member and check if node has been stopped.
140     SxpLib.Delete Node    ${INADDR_ANY}    session=ClusterManagement__session_1
141     BuiltIn.Wait Until Keyword Succeeds
142     ...    20x
143     ...    10s
144     ...    SxpClusterLib.Check Cluster Node stopped
145     ...    ${INADDR_ANY}
146     ...    ip=${EMPTY}