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