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