Upgrade RF syntax for v3.2 compatibility
[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 Suite Setup       SxpClusterLib.Setup SXP Cluster Session
4 Suite Teardown    SxpClusterLib.Clean SXP Cluster Session
5 Library           ../../../libraries/Common.py
6 Resource          ../../../libraries/CompareStream.robot
7 Resource          ../../../libraries/SxpBindingOriginsLib.robot
8 Resource          ../../../libraries/SxpClusterLib.robot
9 Resource          ../../../libraries/SxpLib.robot
10
11 *** Test Cases ***
12 Test Add/Delete Node
13     [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).
14     [Tags]    SXP Clustering Redirecting
15     SxpLib.Add Node    ${INADDR_ANY}    session=ClusterManagement__session_1
16     BuiltIn.Wait Until Keyword Succeeds    20x    10s    SxpClusterLib.Check Cluster Node started    ${INADDR_ANY}    ip=${EMPTY}
17     SxpLib.Delete Node    ${INADDR_ANY}    session=ClusterManagement__session_2
18     BuiltIn.Wait Until Keyword Succeeds    12x    10s    SxpClusterLib.Check Cluster Node stopped    ${INADDR_ANY}    ip=${EMPTY}
19
20 Test Add/Delete Binding
21     [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).
22     [Tags]    SXP Clustering Redirecting
23     Add Node And Check It Is Started
24     SxpLib.Add Bindings    1100    1.1.1.1/32    node=${INADDR_ANY}    session=ClusterManagement__session_2
25     SxpLib.Delete Bindings    1100    1.1.1.1/32    node=${INADDR_ANY}    session=ClusterManagement__session_3
26     [Teardown]    Delete Node And Check It Is Stopped
27
28 Test Add/Delete Domain
29     [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).
30     [Tags]    SXP Clustering Redirecting
31     Add Node And Check It Is Started
32     SxpLib.Add Domain    cluster    node=${INADDR_ANY}    session=ClusterManagement__session_2
33     SxpLib.Delete Domain    cluster    node=${INADDR_ANY}    session=ClusterManagement__session_3
34     [Teardown]    Delete Node And Check It Is Stopped
35
36 Test Add/Delete Connection
37     [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).
38     [Tags]    SXP Clustering Redirecting
39     Add Node And Check It Is Started
40     SxpLib.Add Connection    version4    listener    ${INADDR_ANY}    64999    node=${INADDR_ANY}    session=ClusterManagement__session_1
41     SxpLib.Delete Connections    ${INADDR_ANY}    64999    node=${INADDR_ANY}    session=ClusterManagement__session_2
42     [Teardown]    Delete Node And Check It Is Stopped
43
44 Test Add/Delete Peer Group
45     [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).
46     [Tags]    SXP Clustering Redirecting
47     [Setup]    Add Node And Check It Is Started
48     SxpLib.Add PeerGroup    GROUP    peers=${EMPTY}    node=${INADDR_ANY}    session=ClusterManagement__session_1
49     ${resp} =    SxpLib.Get Peer Groups    ${INADDR_ANY}    session=ClusterManagement__session_2
50     @{groups} =    Sxp.Parse Peer Groups    ${resp}
51     FOR    ${group}    IN    @{groups}
52         SxpLib.Delete Peer Group    ${group['name']}    node=${INADDR_ANY}    session=ClusterManagement__session_3
53     END
54     [Teardown]    Delete Node And Check It Is Stopped
55
56 Test Add/Delete Domain Filter
57     [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).
58     [Tags]    SXP Clustering Redirecting
59     [Setup]    Add Node And Check It Is Started
60     ${domain_1_xml} =    Sxp.Add Domains    domain-1
61     ${domain_2_xml} =    Sxp.Add Domains    domain-2
62     ${domains} =    Common.Combine Strings    ${domain_1_xml}    ${domain_2_xml}
63     ${entry} =    Sxp.Get Filter Entry    10    permit    pl=20.0.0.0/8
64     ${entries} =    Common.Combine Strings    ${entry}
65     SxpLib.Add Domain Filter    global    ${domains}    ${entries}    node=${INADDR_ANY}    session=ClusterManagement__session_1
66     SxpLib.Delete Domain Filter    global    node=${INADDR_ANY}    session=ClusterManagement__session_2
67     [Teardown]    Delete Node And Check It Is Stopped
68
69 Test Add/Delete Filter
70     [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).
71     [Tags]    SXP Clustering Redirecting
72     [Setup]    Add Node And Check It Is Started
73     ${entry1} =    Sxp.Get Filter Entry    10    deny    pl=10.10.20.0/24
74     ${entry2} =    Sxp.Get Filter Entry    20    permit    epl=10.10.0.0/16,le,24
75     ${entry3} =    Sxp.Get Filter Entry    30    permit    sgt=30    pl=10.10.10.0/24
76     ${entries} =    Common.Combine Strings    ${entry1}    ${entry2}    ${entry3}
77     SxpLib.Add PeerGroup    GROUP    peers=${EMPTY}    node=${INADDR_ANY}    session=${CONTROLLER_SESSION}
78     SxpLib.Add Filter    GROUP    outbound    ${entries}    node=${INADDR_ANY}    policy=manual-update    session=ClusterManagement__session_1
79     SxpLib.Update Filter    GROUP    outbound    ${entries}    node=${INADDR_ANY}    policy=manual-update    session=ClusterManagement__session_2
80     SxpLib.Delete Filter    GROUP    outbound    node=${INADDR_ANY}    session=ClusterManagement__session_3
81     [Teardown]    Delete Node And Check It Is Stopped
82
83 Test Add/Update/Delete Binding Origin
84     [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).
85     [Tags]    SXP Clustering Redirecting
86     CompareStream.Run_Keyword_If_Less_Than    fluorine    BuiltIn.Pass Execution    Binding origins are not supported before Fluorine
87     SxpBindingOriginsLib.Add Binding Origin    CLUSTER    0    session=ClusterManagement__session_1
88     SxpBindingOriginsLib.Update Binding Origin    CLUSTER    3    session=ClusterManagement__session_2
89     SxpBindingOriginsLib.Delete Binding Origin    CLUSTER    session=ClusterManagement__session_3
90     [Teardown]    SxpBindingOriginsLib.Revert To Default Binding Origins Configuration    session=${CONTROLLER_SESSION}
91
92 *** Keywords ***
93 Add Node And Check It Is Started
94     [Documentation]    Send add-node RPC to the first cluster member and check if node has been started.
95     SxpLib.Add Node    ${INADDR_ANY}    session=ClusterManagement__session_1
96     BuiltIn.Wait Until Keyword Succeeds    20x    10s    SxpClusterLib.Check Cluster Node started    ${INADDR_ANY}    ip=${EMPTY}
97
98 Delete Node And Check It Is Stopped
99     [Documentation]    Send delete-node RPC to the first cluster member and check if node has been stopped.
100     SxpLib.Delete Node    ${INADDR_ANY}    session=ClusterManagement__session_1
101     BuiltIn.Wait Until Keyword Succeeds    20x    10s    SxpClusterLib.Check Cluster Node stopped    ${INADDR_ANY}    ip=${EMPTY}