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