SXP cluster tests: declare variables in one place
[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       Setup SXP Cluster Session
4 Suite Teardown    Clean SXP Cluster Session
5 Test Setup        Setup SXP Cluster
6 Test Teardown     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     Check Shards Status
16     ${controller_index} =    Get Active 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     Check Shards Status
22     ${controller_index} =    Get Inactive 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     ${active_controller} =    Get Active Controller
30     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
31     \    Add Bindings    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32    node=${CLUSTER_NODE_ID}    session=controller${active_controller}
32     Isolate_Member_From_List_Or_All    ${controller_index}
33     Wait Until Keyword Succeeds    240    1    Sync_Status_Should_Be_False    ${controller_index}
34     Wait Until Keyword Succeeds    30    1    Check Bindings Exist
35     ${active_controller} =    Get Active Controller
36     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
37     \    Delete Bindings    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32    node=${CLUSTER_NODE_ID}    session=controller${active_controller}
38     Flush_Iptables_From_List_Or_All
39     Wait Until Keyword Succeeds    240    1    Sync_Status_Should_Be_True    ${controller_index}
40     Wait Until Keyword Succeeds    30    1    Check Bindings Does Not Exist
41
42 Check Bindings Exist
43     [Documentation]    Check that bindings exists in Cluster datastore
44     ${controller_index} =    Get Active Controller
45     ${resp} =    Get Bindings    node=${CLUSTER_NODE_ID}    session=controller${controller_index}
46     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
47     \    Should Contain Binding    ${resp}    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32
48
49 Check Bindings Does Not Exist
50     [Documentation]    Check that bindings does not exist in Cluster datastore
51     ${controller_index} =    Get Active Controller
52     ${resp} =    Get Bindings    node=${CLUSTER_NODE_ID}    session=controller${controller_index}
53     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
54     \    Should Not Contain Binding    ${resp}    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32