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