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