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