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