b5bd17422e09845d2f49f2936345281cf6db49ad
[integration/test.git] / csit / suites / sxp / binding-origin / 020_Binding_Origins_Checks.robot
1 *** Settings ***
2 Documentation     Test suite to verify binding origins checks are performed in master database
3 Suite Setup       SxpLib.Setup SXP Environment
4 Suite Teardown    SxpLib.Clean SXP Environment
5 Test Setup        Clean Bindings
6 Library           RequestsLibrary
7 Resource          ../../../libraries/SxpLib.robot
8
9 *** Test Cases ***
10 Test Add Lower Priority Binding
11     [Documentation]    Test that incoming binding with lower priority does not override already existing
12     ...    higher priority binding in master database for the same IP prefix
13     [Tags]    Binding Origins Checks    SXP
14     BuiltIn.Comment    Add binding
15     SxpLib.Add Bindings    10    1.1.1.1/32    origin=LOCAL
16     BuiltIn.Comment    Try to add binding with lower priority
17     BuiltIn.Run Keyword And Expect Error    RPC result is False    SxpLib.Add Bindings    20    1.1.1.1/32    origin=NETWORK
18     BuiltIn.Comment    Verify that new binding is not added and previous binding is preserved
19     Verify Bindings Content    10    20    1.1.1.1/32
20
21 Test Add Higher Priority Binding
22     [Documentation]    Test that incoming binding with higher priority overrides already existing
23     ...    lower priority binding in master database for the same IP prefix
24     [Tags]    Binding Origins Checks    SXP
25     BuiltIn.Comment    Add binding
26     SxpLib.Add Bindings    10    1.1.1.1/32    origin=NETWORK
27     BuiltIn.Comment    Add binding with higher priority
28     SxpLib.Add Bindings    20    1.1.1.1/32    origin=LOCAL
29     BuiltIn.Comment    Verify that new binding replaced previous binding
30     Verify Bindings Content    20    10    1.1.1.1/32
31
32 Test Add Unknown Priority Binding
33     [Documentation]    Test that incoming binding with unknown priority cannot be added to master database
34     [Tags]    Binding Origins Checks    SXP
35     BuiltIn.Comment    Try to add binding with unknown origin priority
36     BuiltIn.Run Keyword And Expect Error    400 != 200    SxpLib.Add Bindings    10    1.1.1.1/32    origin=CLUSTER
37     BuiltIn.Comment    Verify that binding is not in master database
38     SxpLib.Bindings Should Not Contain    10    1.1.1.1/32
39
40 Test Add Lower Priority Binding To Domain
41     [Documentation]    Test that incoming binding with lower priority does not override already existing
42     ...    higher priority binding in master database for the same IP prefix
43     [Tags]    Binding Origins Checks    SXP
44     BuiltIn.Comment    Create custom domain with binding
45     SxpLib.Add Domain    guest    10    1.1.1.1/32    origin=LOCAL
46     BuiltIn.Comment    Try add binding to custom domain with lower priority
47     BuiltIn.Run Keyword And Expect Error    RPC result is False    SxpLib.Add Bindings    20    1.1.1.1/32    domain=guest    origin=NETWORK
48     BuiltIn.Comment    Verify that new binding is not added and previous binding is preserved
49     Verify Bindings Content    10    20    1.1.1.1/32    guest
50
51 Test Add Higher Priority Binding To Domain
52     [Documentation]    Test that incoming binding with lower priority does not override already existing
53     ...    higher priority binding in master database for the same IP prefix
54     [Tags]    Binding Origins Checks    SXP
55     BuiltIn.Comment    Create custom domain with binding
56     SxpLib.Add Domain    guest    10    1.1.1.1/32    origin=NETWORK
57     BuiltIn.Comment    Add binding to custom domain with higher priority
58     SxpLib.Add Bindings    20    1.1.1.1/32    domain=guest    origin=LOCAL
59     BuiltIn.Comment    Verify that new binding replaced previous binding
60     Verify Bindings Content    20    10    1.1.1.1/32    guest
61
62 Test Get Bindings
63     [Documentation]    Test that when requesting for LOCAL bindings then only LOCAL bindings are returned
64     [Tags]    Binding Origins Checks    SXP
65     BuiltIn.Comment    Add LOCAL binding
66     SxpLib.Add Bindings    10    1.1.1.1/32    origin=LOCAL
67     BuiltIn.Comment    Add NETWORK binding
68     SxpLib.Add Bindings    20    2.2.2.2/32    origin=NETWORK
69     BuiltIn.Comment    Verify request for LOCAL bindings
70     Verify Local Bindings Content    10    1.1.1.1/32    20    2.2.2.2/32
71     BuiltIn.Comment    Verify request for ALL bindings
72     Verify All Bindings Content    10    1.1.1.1/32    20    2.2.2.2/32
73
74 *** Keywords ***
75 Clean Bindings
76     SxpLib.Clean Bindings    scope=all
77     SxpLib.Clean Bindings    domain=guest    scope=all
78
79 Verify Bindings Content
80     [Arguments]    ${should_contains_sgt}    ${should_not_contains_sgt}    ${prefix}    ${domain}=global
81     ${bindings} =    SxpLib.Get Bindings    domain=${domain}    scope=all
82     SxpLib.Should Contain Binding    ${bindings}    ${should_contains_sgt}    ${prefix}
83     SxpLib.Should Not Contain Binding    ${bindings}    ${should_not_contains_sgt}    ${prefix}
84
85 Verify Local Bindings Content
86     [Arguments]    ${local_sgt}    ${local_prefix}    ${network_sgt}    ${network_prefix}
87     ${bindings} =    SxpLib.Get Bindings    scope=local
88     SxpLib.Should Contain Binding    ${bindings}    ${local_sgt}    ${local_prefix}
89     SxpLib.Should Not Contain Binding    ${bindings}    ${network_sgt}    ${network_prefix}
90
91 Verify All Bindings Content
92     [Arguments]    ${local_sgt}    ${local_prefix}    ${network_sgt}    ${network_prefix}
93     ${bindings} =    SxpLib.Get Bindings
94     SxpLib.Should Contain Binding    ${bindings}    ${local_sgt}    ${local_prefix}
95     SxpLib.Should Contain Binding    ${bindings}    ${network_sgt}    ${network_prefix}