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