Add Cluster routing tests
[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/SxpLib.robot
9 Resource          ../../../libraries/ClusterManagement.robot
10 Resource          ../../../libraries/SxpClusterLib.robot
11
12 *** Variables ***
13 ${SAMPLES}        1
14
15 *** Test Cases ***
16 Isolation of RCP service Test
17     [Documentation]    Test SXP RPC functionality only if Controller with SCS is isolated
18     Check Shards Status
19     : FOR    ${i}    IN RANGE    0    ${SAMPLES}
20     \    ${controller_index}    Get Active Controller
21     \    Isolate SXP Controller    ${controller_index}
22
23 Isolation of RPC noservice Test
24     [Documentation]    Test SXP RPC functionality only if Controller without SCS are isolated
25     Check Shards Status
26     : FOR    ${i}    IN RANGE    0    ${SAMPLES}
27     \    ${controller_index}    Get Inactive Controller
28     \    Isolate SXP Controller    ${controller_index}
29
30 *** Keywords ***
31 Isolate SXP Controller
32     [Arguments]    ${controller_index}
33     [Documentation]    Isolate one of cluster nodes and perform check that RPC changes were performed afterwards reverts isolation
34     ${active_controller}    Get Active Controller
35     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
36     \    Add Binding    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32    node=${CLUSTER_NODE_ID}    session=controller${active_controller}
37     Isolate_Member_From_List_Or_All    ${controller_index}
38     Wait Until Keyword Succeeds    240    1    Sync_Status_Should_Be_False    ${controller_index}
39     Wait Until Keyword Succeeds    30    1    Check Bindings Exist
40     ${active_controller}    Get Active Controller
41     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
42     \    Delete Binding    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32    node=${CLUSTER_NODE_ID}    session=controller${active_controller}
43     Flush_Iptables_From_List_Or_All
44     Wait Until Keyword Succeeds    240    1    Sync_Status_Should_Be_True    ${controller_index}
45     Wait Until Keyword Succeeds    30    1    Check Bindings Does Not Exist
46
47 Check Bindings Exist
48     [Documentation]    Check that bindings exists in Cluster datastore
49     ${controller_index}    Get Active Controller
50     ${resp}    Get Bindings    node=${CLUSTER_NODE_ID}    session=controller${controller_index}
51     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
52     \    Should Contain Binding    ${resp}    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32
53
54 Check Bindings Does Not Exist
55     [Documentation]    Check that bindings does not exist in Cluster datastore
56     ${controller_index}    Get Active Controller
57     ${resp}    Get Bindings    node=${CLUSTER_NODE_ID}    session=controller${controller_index}
58     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
59     \    Should Not Contain Binding    ${resp}    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32