692b71b4c802cdea72a125a70f8ce768c5850307
[integration/test.git] / csit / suites / sxp / filtering / 010_Inbound_Filtering.robot
1 *** Settings ***
2 Documentation     Test suite to verify Inbound filtering functionality
3 Suite Setup       Setup SXP Environment
4 Suite Teardown    Clean SXP Environment
5 Test Setup        Setup Topology Complex
6 Test Teardown     Clean Nodes
7 Library           RequestsLibrary
8 Library           SSHLibrary
9 Library           ../../../libraries/Sxp.py
10 Library           ../../../libraries/Common.py
11 Resource          ../../../libraries/SxpLib.robot
12 Resource          ../../../libraries/Utils.robot
13 Resource          ../../../libraries/KarafKeywords.robot
14 Resource          ../../../variables/Variables.py
15
16 *** Variables ***
17
18 *** Test Cases ***
19 Access List Filtering
20     [Documentation]    Test ACL filter behaviour during filter update
21     ${peers}    Add Peers    127.0.0.2    127.0.0.4
22     Add PeerGroup    GROUP    ${peers}
23     ${entry1}    Get Filter Entry    10    permit    acl=10.10.10.0,0.0.0.255
24     ${entry2}    Get Filter Entry    20    permit    acl=10.0.0.0,0.254.0.0
25     ${entries}    Combine Strings    ${entry1}    ${entry2}
26     Add Filter    GROUP    inbound    ${entries}
27     Wait Until Keyword Succeeds    4    1    Check One Group 4-2
28     Delete Filter    GROUP    inbound
29     ${entries}    Get Filter Entry    10    permit    acl=10.0.0.0,0.255.255.255
30     Add Filter    GROUP    inbound    ${entries}
31     Wait Until Keyword Succeeds    4    1    Check Two Group 4-2
32     Delete Filter    GROUP    inbound
33     ${entries}    Get Filter Entry    10    deny    acl=10.0.0.0,0.255.255.255
34     Add Filter    GROUP    inbound    ${entries}
35     Wait Until Keyword Succeeds    4    1    Check Three Group 4-2
36
37 Access List Sgt Filtering
38     [Documentation]    Test ACL and SGT filter behaviour during filter update
39     ${peers}    Add Peers    127.0.0.3    127.0.0.5
40     Add PeerGroup    GROUP    ${peers}
41     ${entry1}    Get Filter Entry    10    permit    sgt=30    acl=10.10.10.0,0.0.0.255
42     ${entry2}    Get Filter Entry    20    permit    sgt=50    acl=10.0.0.0,0.254.0.0
43     ${entries}    Combine Strings    ${entry1}    ${entry2}
44     Add Filter    GROUP    inbound    ${entries}
45     Wait Until Keyword Succeeds    4    1    Check One Group 5-3
46     Delete Filter    GROUP    inbound
47     ${entries}    Get Filter Entry    10    permit    esgt=20,40    acl=10.0.0.0,0.255.255.255
48     Add Filter    GROUP    inbound    ${entries}
49     Wait Until Keyword Succeeds    4    1    Check Two Group 5-3
50
51 Prefix List Filtering
52     [Documentation]    Test Prefix List filter behaviour during filter update
53     ${peers}    Add Peers    127.0.0.2    127.0.0.4
54     Add PeerGroup    GROUP    ${peers}
55     ${entry1}    Get Filter Entry    10    permit    pl=10.10.10.0/24
56     ${entry2}    Get Filter Entry    20    permit    epl=10.0.0.0/8,le,16
57     ${entries}    Combine Strings    ${entry1}    ${entry2}
58     Add Filter    GROUP    inbound    ${entries}
59     Wait Until Keyword Succeeds    4    1    Check One Group 4-2
60     Delete Filter    GROUP    inbound
61     ${entries}    Get Filter Entry    10    permit    pl=10.0.0.0/8
62     Add Filter    GROUP    inbound    ${entries}
63     Wait Until Keyword Succeeds    4    1    Check Two Group 4-2
64     Delete Filter    GROUP    inbound
65     ${entries}    Get Filter Entry    10    deny    pl=10.0.0.0/8
66     Add Filter    GROUP    inbound    ${entries}
67     Wait Until Keyword Succeeds    4    1    Check Three Group 4-2
68
69 Prefix List Sgt Filtering
70     [Documentation]    Test Prefix List and SGT filter behaviour during filter update
71     ${peers}    Add Peers    127.0.0.3    127.0.0.5
72     Add PeerGroup    GROUP    ${peers}
73     ${entry1}    Get Filter Entry    10    permit    sgt=30    pl=10.10.10.0/24
74     ${entry2}    Get Filter Entry    20    permit    pl=10.50.0.0/16
75     ${entries}    Combine Strings    ${entry1}    ${entry2}
76     Add Filter    GROUP    inbound    ${entries}
77     Wait Until Keyword Succeeds    4    1    Check One Group 5-3
78     Delete Filter    GROUP    inbound
79     ${entries}    Get Filter Entry    10    permit    esgt=20,40    pl=10.0.0.0/8
80     Add Filter    GROUP    inbound    ${entries}
81     Wait Until Keyword Succeeds    4    1    Check Two Group 5-3
82
83 *** Keywords ***
84 Check One Group 4-2
85     [Documentation]    Check if only bindings matching filter from node 4 and 2 are propagated to SXP-DB other nodes
86     ...    Database should contains only Bindings regarding to these matches:
87     ...    permit ACL 10.10.10.0 0.0.0.255
88     ...    permit ACL 10.0.0.0 0.254.0.0
89     ...    Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
90     ${resp}    Get Bindings Master Database    127.0.0.5
91     Should Contain Binding    ${resp}    10    10.10.10.10/32    sxp
92     Should Contain Binding    ${resp}    10    10.10.10.0/24    sxp
93     Should Contain Binding    ${resp}    10    10.10.0.0/16    sxp
94     Should Contain Binding    ${resp}    10    10.0.0.0/8    sxp
95     Should Contain Binding    ${resp}    20    10.10.10.20/32    sxp
96     Should Not Contain Binding    ${resp}    20    10.10.20.0/24    sxp
97     Should Contain Binding    ${resp}    20    10.20.0.0/16    sxp
98     Should Not Contain Binding    ${resp}    20    20.0.0.0/8    sxp
99     Should Contain Binding    ${resp}    30    10.10.10.30/32    sxp
100     Should Contain Binding    ${resp}    30    10.10.30.0/24    sxp
101     Should Contain Binding    ${resp}    30    10.30.0.0/16    sxp
102     Should Contain Binding    ${resp}    30    30.0.0.0/8    sxp
103     Should Contain Binding    ${resp}    40    10.10.10.40/32    sxp
104     Should Not Contain Binding    ${resp}    40    10.10.40.0/24    sxp
105     Should Contain Binding    ${resp}    40    10.40.0.0/16    sxp
106     Should Not Contain Binding    ${resp}    40    40.0.0.0/8    sxp
107     ${resp}    Get Bindings Master Database    127.0.0.3
108     Should Contain Binding    ${resp}    50    10.10.10.50/32    sxp
109     Should Contain Binding    ${resp}    50    10.10.50.0/24    sxp
110     Should Contain Binding    ${resp}    50    10.50.0.0/16    sxp
111     Should Contain Binding    ${resp}    50    50.0.0.0/8    sxp
112
113 Check Two Group 4-2
114     [Documentation]    Check if only bindings matching filter from node 4 and 2 are propagated to SXP-DB of other nodes
115     ...    Database should contains only Bindings regarding to these matches:
116     ...    permit ACL 10.0.0.0 0.255.255.255
117     ...    Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
118     ${resp}    Get Bindings Master Database    127.0.0.5
119     Should Contain Binding    ${resp}    10    10.10.10.10/32    sxp
120     Should Contain Binding    ${resp}    10    10.10.10.0/24    sxp
121     Should Contain Binding    ${resp}    10    10.10.0.0/16    sxp
122     Should Contain Binding    ${resp}    10    10.0.0.0/8    sxp
123     Should Contain Binding    ${resp}    20    10.10.10.20/32    sxp
124     Should Contain Binding    ${resp}    20    10.10.20.0/24    sxp
125     Should Contain Binding    ${resp}    20    10.20.0.0/16    sxp
126     Should Not Contain Binding    ${resp}    20    20.0.0.0/8    sxp
127     Should Contain Binding    ${resp}    30    10.10.10.30/32    sxp
128     Should Contain Binding    ${resp}    30    10.10.30.0/24    sxp
129     Should Contain Binding    ${resp}    30    10.30.0.0/16    sxp
130     Should Contain Binding    ${resp}    30    30.0.0.0/8    sxp
131     Should Contain Binding    ${resp}    40    10.10.10.40/32    sxp
132     Should Contain Binding    ${resp}    40    10.10.40.0/24    sxp
133     Should Contain Binding    ${resp}    40    10.40.0.0/16    sxp
134     Should Not Contain Binding    ${resp}    40    40.0.0.0/8    sxp
135     ${resp}    Get Bindings Master Database    127.0.0.3
136     Should Contain Binding    ${resp}    50    10.10.10.50/32    sxp
137     Should Contain Binding    ${resp}    50    10.10.50.0/24    sxp
138     Should Contain Binding    ${resp}    50    10.50.0.0/16    sxp
139     Should Contain Binding    ${resp}    50    50.0.0.0/8    sxp
140
141 Check Three Group 4-2
142     [Documentation]    Check if only bindings matching filter from node 4 and 2 are propagated to SXP-DB of other nodes
143     ...    Database should contains only Bindings regarding to these matches:
144     ...    deny ACL 10.0.0.0 0.255.255.255
145     ...    Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
146     ${resp}    Get Bindings Master Database    127.0.0.5
147     Should Contain Binding    ${resp}    10    10.10.10.10/32    sxp
148     Should Contain Binding    ${resp}    10    10.10.10.0/24    sxp
149     Should Contain Binding    ${resp}    10    10.10.0.0/16    sxp
150     Should Contain Binding    ${resp}    10    10.0.0.0/8    sxp
151     Should Not Contain Binding    ${resp}    20    10.10.10.20/32    sxp
152     Should Not Contain Binding    ${resp}    20    10.10.20.0/24    sxp
153     Should Not Contain Binding    ${resp}    20    10.20.0.0/16    sxp
154     Should Not Contain Binding    ${resp}    20    20.0.0.0/8    sxp
155     Should Contain Binding    ${resp}    30    10.10.10.30/32    sxp
156     Should Contain Binding    ${resp}    30    10.10.30.0/24    sxp
157     Should Contain Binding    ${resp}    30    10.30.0.0/16    sxp
158     Should Contain Binding    ${resp}    30    30.0.0.0/8    sxp
159     Should Not Contain Binding    ${resp}    40    10.10.10.40/32    sxp
160     Should Not Contain Binding    ${resp}    40    10.10.40.0/24    sxp
161     Should Not Contain Binding    ${resp}    40    10.40.0.0/16    sxp
162     Should Not Contain Binding    ${resp}    40    40.0.0.0/8    sxp
163
164 Check One Group 5-3
165     [Documentation]    Check if only bindings matching filter from node 5 and 3 are propagated to SXP-DB of other nodes
166     ...    Database should contains only Bindings regarding to these matches:
167     ...    permit SGT 30 ACL 10.10.10.0 0.0.0.255
168     ...    permit SGT 50 ACL 10.0.0.0 0.254.0.0
169     ...    Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
170     ${resp}    Get Bindings Master Database    127.0.0.4
171     Should Contain Binding    ${resp}    10    10.10.10.10/32    sxp
172     Should Contain Binding    ${resp}    10    10.10.10.0/24    sxp
173     Should Contain Binding    ${resp}    10    10.10.0.0/16    sxp
174     Should Contain Binding    ${resp}    10    10.0.0.0/8    sxp
175     Should Contain Binding    ${resp}    20    10.10.10.20/32    sxp
176     Should Contain Binding    ${resp}    20    10.10.20.0/24    sxp
177     Should Contain Binding    ${resp}    20    10.20.0.0/16    sxp
178     Should Contain Binding    ${resp}    20    20.0.0.0/8    sxp
179     Should Contain Binding    ${resp}    30    10.10.10.30/32    sxp
180     Should Not Contain Binding    ${resp}    30    10.10.30.0/24    sxp
181     Should Not Contain Binding    ${resp}    30    10.30.0.0/16    sxp
182     Should Not Contain Binding    ${resp}    30    30.0.0.0/8    sxp
183     Should Not Contain Binding    ${resp}    50    10.10.10.50/32    sxp
184     Should Not Contain Binding    ${resp}    50    10.10.50.0/24    sxp
185     Should Contain Binding    ${resp}    50    10.50.0.0/16    sxp
186     Should Not Contain Binding    ${resp}    50    50.0.0.0/8    sxp
187     ${resp}    Get Bindings Master Database    127.0.0.2
188     Should Contain Binding    ${resp}    40    10.10.10.40/32    sxp
189     Should Contain Binding    ${resp}    40    10.10.40.0/24    sxp
190     Should Contain Binding    ${resp}    40    10.40.0.0/16    sxp
191     Should Contain Binding    ${resp}    40    40.0.0.0/8    sxp
192
193 Check Two Group 5-3
194     [Documentation]    Check if only bindings matching filter from node 5 and 3 are propagated to SXP-DB of other nodes
195     ...    Database should contains only Bindings regarding to these matches:
196     ...    permit ESGT 20,40 ACL 10.0.0.0 0.255.255.255
197     ...    Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
198     ${resp}    Get Bindings Master Database    127.0.0.4
199     Should Contain Binding    ${resp}    10    10.10.10.10/32    sxp
200     Should Contain Binding    ${resp}    10    10.10.10.0/24    sxp
201     Should Contain Binding    ${resp}    10    10.10.0.0/16    sxp
202     Should Contain Binding    ${resp}    10    10.0.0.0/8    sxp
203     Should Contain Binding    ${resp}    20    10.10.10.20/32    sxp
204     Should Contain Binding    ${resp}    20    10.10.20.0/24    sxp
205     Should Contain Binding    ${resp}    20    10.20.0.0/16    sxp
206     Should Contain Binding    ${resp}    20    20.0.0.0/8    sxp
207     Should Contain Binding    ${resp}    30    10.10.10.30/32    sxp
208     Should Contain Binding    ${resp}    30    10.10.30.0/24    sxp
209     Should Contain Binding    ${resp}    30    10.30.0.0/16    sxp
210     Should Not Contain Binding    ${resp}    30    30.0.0.0/8    sxp
211     Should Not Contain Binding    ${resp}    50    10.10.10.50/32    sxp
212     Should Not Contain Binding    ${resp}    50    10.10.50.0/24    sxp
213     Should Not Contain Binding    ${resp}    50    10.50.0.0/16    sxp
214     Should Not Contain Binding    ${resp}    50    50.0.0.0/8    sxp
215     ${resp}    Get Bindings Master Database    127.0.0.2
216     Should Contain Binding    ${resp}    40    10.10.10.40/32    sxp
217     Should Contain Binding    ${resp}    40    10.10.40.0/24    sxp
218     Should Contain Binding    ${resp}    40    10.40.0.0/16    sxp
219     Should Contain Binding    ${resp}    40    40.0.0.0/8    sxp
220
221 Clean Nodes
222     Clean Connections    127.0.0.1
223     Clean Connections    127.0.0.2
224     Clean Connections    127.0.0.3
225     Clean Connections    127.0.0.4
226     Clean Connections    127.0.0.5
227     Clean Peer Groups    127.0.0.1
228     Clean Bindings    127.0.0.1
229     Clean Bindings    127.0.0.2
230     Clean Bindings    127.0.0.3
231     Clean Bindings    127.0.0.4
232     Clean Bindings    127.0.0.5