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