Migrate Get Requests invocations(libraries)
[integration/test.git] / csit / suites / sxp / clustering / 030_RPC_functionality.robot
1 *** Settings ***
2 Documentation       Test suite to verify RPC funcionality on cluster
3
4 Library             ../../../libraries/Sxp.py
5 Resource            ../../../libraries/ClusterManagement.robot
6 Resource            ../../../libraries/SxpClusterLib.robot
7 Resource            ../../../libraries/SxpLib.robot
8
9 Suite Setup         SxpClusterLib.Setup SXP Cluster Session With Device
10 Suite Teardown      SxpClusterLib.Clean SXP Cluster Session
11 Test Setup          SxpClusterLib.Setup SXP Cluster
12 Test Teardown       SxpClusterLib.Clean SXP Cluster
13
14
15 *** Test Cases ***
16 Isolation of RCP service Test
17     [Documentation]    Test SXP RPC functionality only if Controller with SCS is isolated
18     SxpClusterLib.Check Shards Status
19     ${controller_index} =    SxpClusterLib.Get Owner Controller
20     Isolate SXP Controller    ${controller_index}
21
22 Isolation of RPC noservice Test
23     [Documentation]    Test SXP RPC functionality only if Controller without SCS are isolated
24     SxpClusterLib.Check Shards Status
25     ${controller_index} =    SxpClusterLib.Get Not Owner Controller
26     Isolate SXP Controller    ${controller_index}
27
28
29 *** Keywords ***
30 Isolate SXP Controller
31     [Documentation]    Isolate one of cluster nodes and perform check that RPC changes were performed afterwards reverts isolation
32     [Arguments]    ${controller_index}
33     ${owner_controller} =    SxpClusterLib.Get Owner Controller
34     FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
35         SxpLib.Add Bindings
36         ...    ${i+1}0
37         ...    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32
38         ...    node=${INADDR_ANY}
39         ...    session=ClusterManagement__session_${owner_controller}
40     END
41     @{running_members} =    ClusterManagement.Isolate_Member_From_List_Or_All    ${controller_index}
42     BuiltIn.Wait Until Keyword Succeeds
43     ...    120x
44     ...    1s
45     ...    ClusterManagement.Verify_Members_Are_Ready
46     ...    member_index_list=${running_members}
47     ...    verify_cluster_sync=True
48     ...    verify_restconf=True
49     ...    verify_system_status=False
50     ...    service_list=${EMPTY_LIST}
51     BuiltIn.Wait Until Keyword Succeeds
52     ...    240x
53     ...    1s
54     ...    ClusterManagement.Sync_Status_Should_Be_False
55     ...    ${controller_index}
56     ${running_member} =    Collections.Get From List    ${running_members}    0
57     ${owner_controller} =    SxpClusterLib.Get Owner Controller    ${running_member}
58     BuiltIn.Wait Until Keyword Succeeds    60x    1s    Check Bindings Exist    ${owner_controller}
59     FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
60         SxpLib.Delete Bindings
61         ...    ${i+1}0
62         ...    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32
63         ...    node=${INADDR_ANY}
64         ...    session=ClusterManagement__session_${owner_controller}
65     END
66     ClusterManagement.Flush_Iptables_From_List_Or_All
67     BuiltIn.Wait Until Keyword Succeeds
68     ...    120x
69     ...    1s
70     ...    ClusterManagement.Verify_Members_Are_Ready
71     ...    member_index_list=${EMPTY}
72     ...    verify_cluster_sync=True
73     ...    verify_restconf=True
74     ...    verify_system_status=False
75     ...    service_list=${EMPTY_LIST}
76     BuiltIn.Wait Until Keyword Succeeds    60x    1s    Check Bindings Does Not Exist    ${owner_controller}
77
78 Check Bindings Exist
79     [Documentation]    Check that bindings exists in Cluster datastore
80     [Arguments]    ${owner_controller}
81     ${resp} =    SxpLib.Get Bindings    node=${INADDR_ANY}    session=ClusterManagement__session_${owner_controller}
82     FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
83         SxpLib.Should Contain Binding    ${resp}    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32
84     END
85
86 Check Bindings Does Not Exist
87     [Documentation]    Check that bindings does not exist in Cluster datastore
88     [Arguments]    ${owner_controller}
89     ${resp} =    SxpLib.Get Bindings    node=${INADDR_ANY}    session=ClusterManagement__session_${owner_controller}
90     FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
91         SxpLib.Should Not Contain Binding    ${resp}    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32
92     END