2 Documentation Test suite to verify Outbound filtering functionality
3 Suite Setup Setup SXP Environment
4 Suite Teardown Clean SXP Environment
5 Test Teardown Clean Nodes
6 Library RequestsLibrary
8 Library ../../../libraries/Sxp.py
9 Library ../../../libraries/Common.py
10 Resource ../../../libraries/SxpLib.robot
11 Resource ../../../libraries/Utils.robot
12 Resource ../../../libraries/KarafKeywords.robot
13 Resource ../../../variables/Variables.py
18 Peer Sequence Filtering
19 [Documentation] Test PeerSequence filter behaviour
20 ${peers} Add Peers 127.0.0.2
21 Add PeerGroup GROUP ${peers}
22 ${entry1} Get Filter Entry 10 permit ps=le,0
23 ${entries} Combine Strings ${entry1}
24 Add Filter GROUP outbound ${entries}
26 Wait Until Keyword Succeeds 4 1 Check PeerSequence One
27 Delete Filter GROUP outbound
28 ${peers} Add Peers 127.0.0.2
29 Add PeerGroup GROUP ${peers}
30 ${entry1} Get Filter Entry 10 permit ps=le,1
31 ${entries} Combine Strings ${entry1}
32 Add Filter GROUP outbound ${entries}
33 Wait Until Keyword Succeeds 4 1 Check PeerSequence Two
34 Delete Filter GROUP outbound
35 ${peers} Add Peers 127.0.0.2
36 Add PeerGroup GROUP ${peers}
37 ${entry1} Get Filter Entry 10 permit ps=le,2
38 ${entries} Combine Strings ${entry1}
39 Add Filter GROUP outbound ${entries}
40 Wait Until Keyword Succeeds 4 1 Check PeerSequence Three
41 Delete Filter GROUP outbound
42 ${peers} Add Peers 127.0.0.2
43 Add PeerGroup GROUP ${peers}
44 ${entry1} Get Filter Entry 10 deny ps=eq,1
45 ${entry2} Get Filter Entry 20 permit ps=ge,0
46 ${entries} Combine Strings ${entry1} ${entry2}
47 Add Filter GROUP outbound ${entries}
48 Wait Until Keyword Succeeds 4 1 Check PeerSequence Mix
49 Delete Filter GROUP outbound
51 Inbound PL Combinations Filtering
52 [Documentation] Test PeerSequence filter combined with PrefixList filter
53 @{scopes} Create List inbound inbound-discarding
54 : FOR ${scope} IN @{scopes}
56 \ ${entry1} Get Filter Entry 10 permit ps=le,1
57 \ ${entries} Combine Strings ${entry1}
58 \ Add Filter GROUP ${scope} ${entries}
59 \ Setup Nodes Inbound Test
60 \ ${peers} Add Peers 127.0.0.2
61 \ Add PeerGroup GROUP2 ${peers}
62 \ ${entry1} Get Filter Entry 10 permit pl=1.1.0.0/16
63 \ ${entries} Combine Strings ${entry1}
64 \ Add Filter GROUP2 ${scope} ${entries}
65 \ Wait Until Keyword Succeeds 4 1 Check Inbound PL Combinations Filtering
68 Inbound ACL Combinations Filtering
69 [Documentation] Test PeerSequence filter combined with ACL filter
70 @{scopes} Create List inbound inbound-discarding
71 : FOR ${scope} IN @{scopes}
72 \ ${peers} Add Peers 127.0.0.2
73 \ Add PeerGroup GROUP2 ${peers}
74 \ ${entry1} Get Filter Entry 10 permit ps=le,2
75 \ ${entries} Combine Strings ${entry1}
76 \ Add Filter GROUP2 ${scope} ${entries}
77 \ Setup Nodes Inbound Test
78 \ ${entry1} Get Filter Entry 10 permit acl=1.1.1.0,0.0.0.255
79 \ ${entries} Combine Strings ${entry1}
80 \ Add Filter GROUP2 ${scope} ${entries}
81 \ ${peers} Add Peers 127.0.0.5
82 \ Add PeerGroup GROUP5 ${peers}
83 \ ${entry1} Get Filter Entry 10 permit sgt=40
84 \ ${entries} Combine Strings ${entry1}
85 \ Add Filter GROUP5 ${scope} ${entries}
86 \ Wait Until Keyword Succeeds 4 1 Check Inbound ACL Combinations Filtering
89 Outbound PL Combinations Filtering
90 [Documentation] Test PeerSequence filter combined with PrefixList filter
92 ${entry1} Get Filter Entry 10 permit pl=1.1.1.0/24
93 ${entries} Combine Strings ${entry1}
94 Add Filter GROUP outbound ${entries}
95 Setup Nodes Outbound Test
96 ${peers} Add Peers 127.0.0.2
97 Add PeerGroup GROUP2 ${peers}
98 ${entry1} Get Filter Entry 10 permit ps=le,1
99 ${entries} Combine Strings ${entry1}
100 Add Filter GROUP2 outbound ${entries}
101 Wait Until Keyword Succeeds 4 1 Check Outbound PL Combinations Filtering
103 Outbound ACL Combinations Filtering
104 [Documentation] Test PeerSequence filter combined with ACL filter
106 ${entry1} Get Filter Entry 10 permit ps=eq,0
107 ${entry2} Get Filter Entry 20 permit ps=ge,2
108 ${entries} Combine Strings ${entry1} ${entry2}
109 Add Filter GROUP outbound ${entries}
110 Setup Nodes Outbound Test
111 ${peers} Add Peers 127.0.0.2
112 Add PeerGroup GROUP2 ${peers}
113 ${entry1} Get Filter Entry 10 permit acl=1.1.0.0,0.0.255.255
114 ${entries} Combine Strings ${entry1}
115 Add Filter GROUP2 outbound ${entries}
116 Wait Until Keyword Succeeds 4 1 Check Outbound ACL Combinations Filtering
120 [Arguments] ${version}=version4 ${password}=none
121 [Documentation] Setup Topology for PeerSequence tests
122 Add Binding 10 10.10.10.10/32 127.0.0.1
123 Add Binding 10 10.10.10.0/24 127.0.0.1
124 Add Binding 10 10.10.0.0/16 127.0.0.1
125 Add Binding 10 10.0.0.0/8 127.0.0.1
126 : FOR ${node} IN RANGE 2 6
127 \ Add Binding ${node}0 10.10.10.${node}0/32 127.0.0.${node}
128 \ Add Binding ${node}0 10.10.${node}0.0/24 127.0.0.${node}
129 \ Add Binding ${node}0 10.${node}0.0.0/16 127.0.0.${node}
130 \ Add Binding ${node}0 ${node}0.0.0.0/8 127.0.0.${node}
131 Add Connection ${version} listener 127.0.0.1 64999 127.0.0.2 ${password}
132 Add Connection ${version} speaker 127.0.0.2 64999 127.0.0.1 ${password}
133 Wait Until Keyword Succeeds 15 1 Verify Connection ${version} speaker 127.0.0.2
134 Add Connection ${version} speaker 127.0.0.1 64999 127.0.0.3 ${password}
135 Add Connection ${version} listener 127.0.0.3 64999 127.0.0.1 ${password}
136 Wait Until Keyword Succeeds 15 1 Verify Connection ${version} listener 127.0.0.3
137 Add Connection ${version} speaker 127.0.0.3 64999 127.0.0.4 ${password}
138 Add Connection ${version} listener 127.0.0.4 64999 127.0.0.3 ${password}
139 Wait Until Keyword Succeeds 15 1 Verify Connection ${version} listener 127.0.0.4
141 Add Connection ${version} speaker 127.0.0.4 64999 127.0.0.5 ${password}
142 Add Connection ${version} listener 127.0.0.5 64999 127.0.0.4 ${password}
143 Wait Until Keyword Succeeds 15 1 Verify Connection ${version} listener 127.0.0.5
146 Setup Nodes Inbound Test
147 [Arguments] ${version}=version4 ${password}=none
148 [Documentation] Setup Topology for inbound PeerSequence and other filters tests
149 : FOR ${node} IN RANGE 2 6
150 \ Add Binding ${node}0 1.1.1.${node}/32 127.0.0.${node}
151 \ Add Binding ${node}0 1.1.${node}.0/24 127.0.0.${node}
152 \ Add Binding ${node}0 1.${node}.0.0/16 127.0.0.${node}
153 \ Add Binding ${node}0 ${node}.0.0.0/8 127.0.0.${node}
154 Add Connection ${version} speaker 127.0.0.1 64999 127.0.0.2 ${password}
155 Add Connection ${version} listener 127.0.0.2 64999 127.0.0.1 ${password}
156 Wait Until Keyword Succeeds 15 1 Verify Connection ${version} listener 127.0.0.2
157 Add Connection ${version} speaker 127.0.0.1 64999 127.0.0.5 ${password}
158 Add Connection ${version} listener 127.0.0.5 64999 127.0.0.1 ${password}
159 Wait Until Keyword Succeeds 15 1 Verify Connection ${version} listener 127.0.0.5
160 Add Connection ${version} both 127.0.0.3 64999 127.0.0.2 ${password}
161 Add Connection ${version} both 127.0.0.2 64999 127.0.0.3 ${password}
162 Wait Until Keyword Succeeds 15 1 Verify Connection ${version} both 127.0.0.2
164 Add Connection ${version} both 127.0.0.3 64999 127.0.0.4 ${password}
165 Add Connection ${version} both 127.0.0.4 64999 127.0.0.3 ${password}
166 Wait Until Keyword Succeeds 15 1 Verify Connection ${version} both 127.0.0.4
168 Add Connection ${version} both 127.0.0.4 64999 127.0.0.5 ${password}
169 Add Connection ${version} both 127.0.0.5 64999 127.0.0.4 ${password}
170 Wait Until Keyword Succeeds 15 1 Verify Connection ${version} both 127.0.0.5
173 Setup Nodes Outbound Test
174 [Arguments] ${version}=version4 ${password}=none
175 [Documentation] Setup Topology for outbound PeerSequence and other filters tests
176 Add Binding 10 1.1.1.1/32 127.0.0.1
177 Add Binding 10 1.1.1.0/24 127.0.0.1
178 Add Binding 10 1.1.0.0/16 127.0.0.1
179 Add Binding 10 1.0.0.0/8 127.0.0.1
180 : FOR ${node} IN RANGE 3 6
181 \ Add Binding ${node}0 1.1.1.${node}/32 127.0.0.${node}
182 \ Add Binding ${node}0 1.1.${node}.0/24 127.0.0.${node}
183 \ Add Binding ${node}0 1.${node}.0.0/16 127.0.0.${node}
184 \ Add Binding ${node}0 ${node}.0.0.0/8 127.0.0.${node}
185 Add Connection ${version} listener 127.0.0.1 64999 127.0.0.2 ${password}
186 Add Connection ${version} speaker 127.0.0.2 64999 127.0.0.1 ${password}
187 Wait Until Keyword Succeeds 15 1 Verify Connection ${version} speaker 127.0.0.2
188 Add Connection ${version} speaker 127.0.0.1 64999 127.0.0.3 ${password}
189 Add Connection ${version} listener 127.0.0.3 64999 127.0.0.1 ${password}
190 Wait Until Keyword Succeeds 15 1 Verify Connection ${version} listener 127.0.0.3
191 Add Connection ${version} speaker 127.0.0.1 64999 127.0.0.4 ${password}
192 Add Connection ${version} listener 127.0.0.4 64999 127.0.0.1 ${password}
193 Wait Until Keyword Succeeds 15 1 Verify Connection ${version} listener 127.0.0.4
194 Add Connection ${version} both 127.0.0.4 64999 127.0.0.5 ${password}
195 Add Connection ${version} both 127.0.0.5 64999 127.0.0.4 ${password}
196 Wait Until Keyword Succeeds 15 1 Verify Connection ${version} both 127.0.0.5
199 Check PeerSequence One
200 [Documentation] Node 127.0.0.2 should contain only bindings with peer sequence lower or equals 1
201 ${resp} Get Bindings 127.0.0.2
202 Should Contain Binding ${resp} 10 10.10.10.10/32 sxp
203 Should Contain Binding ${resp} 10 10.10.10.0/24 sxp
204 Should Contain Binding ${resp} 10 10.10.0.0/16 sxp
205 Should Contain Binding ${resp} 10 10.0.0.0/8 sxp
206 : FOR ${node} IN RANGE 3 6
207 \ Should Not Contain Binding ${resp} ${node}0 10.10.10.${node}0/32
208 \ Should Not Contain Binding ${resp} ${node}0 10.10.${node}0.0/24
209 \ Should Not Contain Binding ${resp} ${node}0 10.${node}0.0.0/16
210 \ Should Not Contain Binding ${resp} ${node}0 ${node}0.0.0.0/8
212 Check PeerSequence Two
213 [Documentation] Node 127.0.0.2 should contain only bindings with peer sequence lower or equals 2
214 ${resp} Get Bindings 127.0.0.2
215 Should Contain Binding ${resp} 10 10.10.10.10/32 sxp
216 Should Contain Binding ${resp} 10 10.10.10.0/24 sxp
217 Should Contain Binding ${resp} 10 10.10.0.0/16 sxp
218 Should Contain Binding ${resp} 10 10.0.0.0/8 sxp
219 Should Contain Binding ${resp} 30 10.10.10.30/32 sxp
220 Should Contain Binding ${resp} 30 10.10.30.0/24 sxp
221 Should Contain Binding ${resp} 30 10.30.0.0/16 sxp
222 Should Contain Binding ${resp} 30 30.0.0.0/8 sxp
223 : FOR ${node} IN RANGE 4 6
224 \ Should Not Contain Binding ${resp} ${node}0 10.10.10.${node}0/32
225 \ Should Not Contain Binding ${resp} ${node}0 10.10.${node}0.0/24
226 \ Should Not Contain Binding ${resp} ${node}0 10.${node}0.0.0/16
227 \ Should Not Contain Binding ${resp} ${node}0 ${node}0.0.0.0/8
229 Check PeerSequence Three
230 [Documentation] Node 127.0.0.2 should contain only bindings with peer sequence lower or equals 3
231 ${resp} Get Bindings 127.0.0.2
232 Should Contain Binding ${resp} 10 10.10.10.10/32 sxp
233 Should Contain Binding ${resp} 10 10.10.10.0/24 sxp
234 Should Contain Binding ${resp} 10 10.10.0.0/16 sxp
235 Should Contain Binding ${resp} 10 10.0.0.0/8 sxp
236 Should Contain Binding ${resp} 30 10.10.10.30/32 sxp
237 Should Contain Binding ${resp} 30 10.10.30.0/24 sxp
238 Should Contain Binding ${resp} 30 10.30.0.0/16 sxp
239 Should Contain Binding ${resp} 30 30.0.0.0/8 sxp
240 Should Contain Binding ${resp} 40 10.10.10.40/32 sxp
241 Should Contain Binding ${resp} 40 10.10.40.0/24 sxp
242 Should Contain Binding ${resp} 40 10.40.0.0/16 sxp
243 Should Contain Binding ${resp} 40 40.0.0.0/8 sxp
244 Should Not Contain Binding ${resp} 50 10.10.10.50/32
245 Should Not Contain Binding ${resp} 50 10.10.50.0/24
246 Should Not Contain Binding ${resp} 50 10.50.0.0/16
247 Should Not Contain Binding ${resp} 50 50.0.0.0/8
249 Check PeerSequence Mix
250 [Documentation] Node 127.0.0.2 should not contain bindings with peer sequence 1
251 ${resp} Get Bindings 127.0.0.2
252 Should Contain Binding ${resp} 10 10.10.10.10/32 sxp
253 Should Contain Binding ${resp} 10 10.10.10.0/24 sxp
254 Should Contain Binding ${resp} 10 10.10.0.0/16 sxp
255 Should Contain Binding ${resp} 10 10.0.0.0/8 sxp
256 Should Not Contain Binding ${resp} 30 10.10.10.30/32 sxp
257 Should Not Contain Binding ${resp} 30 10.10.30.0/24 sxp
258 Should Not Contain Binding ${resp} 30 10.30.0.0/16 sxp
259 Should Not Contain Binding ${resp} 30 30.0.0.0/8 sxp
260 Should Contain Binding ${resp} 40 10.10.10.40/32 sxp
261 Should Contain Binding ${resp} 40 10.10.40.0/24 sxp
262 Should Contain Binding ${resp} 40 10.40.0.0/16 sxp
263 Should Contain Binding ${resp} 40 40.0.0.0/8 sxp
264 Should Contain Binding ${resp} 50 10.10.10.50/32
265 Should Contain Binding ${resp} 50 10.10.50.0/24
266 Should Contain Binding ${resp} 50 10.50.0.0/16
267 Should Contain Binding ${resp} 50 50.0.0.0/8
269 Check Inbound PL Combinations Filtering
270 [Documentation] Node 127.0.0.1 should containt bindings with peer sequence lower than 1 and pl 1.1.0.0/16
271 ${resp} Get Bindings 127.0.0.1
272 Should Contain Binding ${resp} 20 1.1.1.2/32 sxp
273 Should Contain Binding ${resp} 20 1.1.2.0/24 sxp
274 Should Not Contain Binding ${resp} 20 1.2.0.0/16 sxp
275 Should Not Contain Binding ${resp} 20 2.0.0.0/8 sxp
276 Should Not Contain Binding ${resp} 30 1.1.1.3/32 sxp
277 Should Not Contain Binding ${resp} 30 1.1.3.0/24 sxp
278 Should Not Contain Binding ${resp} 30 1.3.0.0/16 sxp
279 Should Not Contain Binding ${resp} 30 3.0.0.0/8 sxp
280 Should Not Contain Binding ${resp} 40 1.1.1.4/32 sxp
281 Should Not Contain Binding ${resp} 40 1.1.4.0/24 sxp
282 Should Not Contain Binding ${resp} 40 1.4.0.0/16 sxp
283 Should Not Contain Binding ${resp} 40 4.0.0.0/8 sxp
284 Should Contain Binding ${resp} 50 1.1.1.5/32 sxp
285 Should Contain Binding ${resp} 50 1.1.5.0/24 sxp
286 Should Contain Binding ${resp} 50 1.5.0.0/16 sxp
287 Should Contain Binding ${resp} 50 5.0.0.0/8 sxp
289 Check Inbound ACL Combinations Filtering
290 [Documentation] Node 127.0.0.1 should containt bindings with peer sequence lower than 2 and acl 1.1.1.0 0.0.0.255
291 ${resp} Get Bindings 127.0.0.1
292 Should Contain Binding ${resp} 20 1.1.1.2/32 sxp
293 Should Not Contain Binding ${resp} 20 1.1.2.0/24 sxp
294 Should Not Contain Binding ${resp} 20 1.2.0.0/16 sxp
295 Should Not Contain Binding ${resp} 20 2.0.0.0/8 sxp
296 Should Contain Binding ${resp} 30 1.1.1.3/32 sxp
297 Should Not Contain Binding ${resp} 30 1.1.3.0/24 sxp
298 Should Not Contain Binding ${resp} 30 1.3.0.0/16 sxp
299 Should Not Contain Binding ${resp} 30 3.0.0.0/8 sxp
300 Should Contain Binding ${resp} 40 1.1.1.4/32 sxp
301 Should Contain Binding ${resp} 40 1.1.4.0/24 sxp
302 Should Contain Binding ${resp} 40 1.4.0.0/16 sxp
303 Should Contain Binding ${resp} 40 4.0.0.0/8 sxp
304 Should Not Contain Binding ${resp} 50 1.1.1.5/32 sxp
305 Should Not Contain Binding ${resp} 50 1.1.5.0/24 sxp
306 Should Not Contain Binding ${resp} 50 1.5.0.0/16 sxp
307 Should Not Contain Binding ${resp} 50 5.0.0.0/8 sxp
309 Check Outbound PL Combinations Filtering
310 [Documentation] Node 127.0.0.2 should containt bindings with peer sequence lower than 1 and pl 1.1.1.0/24
311 ${resp} Get Bindings 127.0.0.2
312 Should Contain Binding ${resp} 10 1.1.1.1/32 sxp
313 Should Contain Binding ${resp} 10 1.1.1.0/24 sxp
314 Should Not Contain Binding ${resp} 10 1.1.0.0/16 sxp
315 Should Not Contain Binding ${resp} 10 1.0.0.0/8 sxp
316 Should Contain Binding ${resp} 30 1.1.1.3/32 sxp
317 Should Not Contain Binding ${resp} 30 1.1.3.0/24 sxp
318 Should Not Contain Binding ${resp} 30 1.3.0.0/16 sxp
319 Should Not Contain Binding ${resp} 30 3.0.0.0/8 sxp
320 Should Contain Binding ${resp} 40 1.1.1.4/32 sxp
321 Should Not Contain Binding ${resp} 40 1.1.4.0/24 sxp
322 Should Not Contain Binding ${resp} 40 1.4.0.0/16 sxp
323 Should Not Contain Binding ${resp} 40 4.0.0.0/8 sxp
324 Should Not Contain Binding ${resp} 50 1.1.1.5/32 sxp
325 Should Not Contain Binding ${resp} 50 1.1.5.0/24 sxp
326 Should Not Contain Binding ${resp} 50 1.5.0.0/16 sxp
327 Should Not Contain Binding ${resp} 50 5.0.0.0/8 sxp
329 Check Outbound ACL Combinations Filtering
330 [Documentation] Node 127.0.0.2 should containt bindings with peer sequence equals to 0 or greter than 2 and acl 1.1.0.0 0.0.255.255
331 ${resp} Get Bindings 127.0.0.2
332 Should Contain Binding ${resp} 10 1.1.1.1/32 sxp
333 Should Contain Binding ${resp} 10 1.1.1.0/24 sxp
334 Should Contain Binding ${resp} 10 1.1.0.0/16 sxp
335 Should Not Contain Binding ${resp} 10 1.0.0.0/8 sxp
336 Should Not Contain Binding ${resp} 30 1.1.1.3/32 sxp
337 Should Not Contain Binding ${resp} 30 1.1.3.0/24 sxp
338 Should Not Contain Binding ${resp} 30 1.3.0.0/16 sxp
339 Should Not Contain Binding ${resp} 30 3.0.0.0/8 sxp
340 Should Not Contain Binding ${resp} 40 1.1.1.4/32 sxp
341 Should Not Contain Binding ${resp} 40 1.1.4.0/24 sxp
342 Should Not Contain Binding ${resp} 40 1.4.0.0/16 sxp
343 Should Not Contain Binding ${resp} 40 4.0.0.0/8 sxp
344 Should Contain Binding ${resp} 50 1.1.1.5/32 sxp
345 Should Contain Binding ${resp} 50 1.1.5.0/24 sxp
346 Should Not Contain Binding ${resp} 50 1.5.0.0/16 sxp
347 Should Not Contain Binding ${resp} 50 5.0.0.0/8 sxp
350 Clean Connections 127.0.0.1
351 Clean Connections 127.0.0.2
352 Clean Connections 127.0.0.3
353 Clean Connections 127.0.0.4
354 Clean Connections 127.0.0.5
355 Clean Peer Groups 127.0.0.1
356 Clean Bindings 127.0.0.1
357 Clean Bindings 127.0.0.2
358 Clean Bindings 127.0.0.3
359 Clean Bindings 127.0.0.4
360 Clean Bindings 127.0.0.5