Updated SXP CSIT with new feature PeerSequence filter,
[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     ${peers}    Add Peers    127.0.0.3    127.0.0.5
34     Add PeerGroup    GROUP    ${peers}
35     ${entry1}    Get Filter Entry    10    permit    sgt=30    acl=10.10.10.0,0.0.0.255
36     ${entry2}    Get Filter Entry    20    permit    sgt=50    acl=10.0.0.0,0.254.0.0
37     ${entries}    Combine Strings    ${entry1}    ${entry2}
38     Add Filter    GROUP    inbound-discarding    ${entries}
39     Setup Nodes
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     ${peers}    Add Peers    127.0.0.3    127.0.0.5
60     Add PeerGroup    GROUP    ${peers}
61     ${entry1}    Get Filter Entry    10    permit    sgt=30    pl=10.10.10.0/24
62     ${entry2}    Get Filter Entry    20    permit    pl=10.50.0.0/16
63     ${entries}    Combine Strings    ${entry1}    ${entry2}
64     Add Filter    GROUP    inbound-discarding    ${entries}
65     Setup Nodes
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     ${peers}    Add Peers    127.0.0.3    127.0.0.5
86     Add PeerGroup    GROUP    ${peers}
87     ${entry1}    Get Filter Entry    10    permit    sgt=30    acl=10.10.10.0,0.0.0.255
88     ${entry2}    Get Filter Entry    20    permit    sgt=50    acl=10.0.0.0,0.254.0.0
89     ${entries}    Combine Strings    ${entry1}    ${entry2}
90     Add Filter    GROUP    inbound-discarding    ${entries}
91     Setup Nodes Legacy Par One
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     ${peers}    Add Peers    127.0.0.3    127.0.0.5
112     Add PeerGroup    GROUP    ${peers}
113     ${entry1}    Get Filter Entry    10    permit    sgt=30    pl=10.10.10.0/24
114     ${entry2}    Get Filter Entry    20    permit    pl=10.50.0.0/16
115     ${entries}    Combine Strings    ${entry1}    ${entry2}
116     Add Filter    GROUP    inbound-discarding    ${entries}
117     Setup Nodes Legacy Par One
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    1    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     Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    both    127.0.0.5
139     ...    64999    127.0.0.3
140     Add Binding    50    10.10.10.50/32    127.0.0.5
141     Add Binding    50    10.10.50.0/24    127.0.0.5
142     Add Binding    50    10.50.0.0/16    127.0.0.5
143     Add Binding    50    50.0.0.0/8    127.0.0.5
144     Add Binding    10    10.10.10.10/32    127.0.0.1
145     Add Binding    10    10.10.10.0/24    127.0.0.1
146     Add Binding    10    10.10.0.0/16    127.0.0.1
147     Add Binding    10    10.0.0.0/8    127.0.0.1
148
149 Setup Nodes Legacy Par One
150     [Arguments]    ${version}=version3    ${password}=none
151     : FOR    ${node}    IN RANGE    1    6
152     \    Add Binding    ${node}0    10.10.10.${node}0/32    127.0.0.${node}
153     \    Add Binding    ${node}0    10.10.${node}0.0/24    127.0.0.${node}
154     \    Add Binding    ${node}0    10.${node}0.0.0/16    127.0.0.${node}
155     \    Add Binding    ${node}0    ${node}0.0.0.0/8    127.0.0.${node}
156     Add Connection    ${version}    listener    127.0.0.1    64999    127.0.0.2    ${password}
157     Add Connection    ${version}    speaker    127.0.0.2    64999    127.0.0.1    ${password}
158     Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    speaker    127.0.0.2
159     Add Connection    ${version}    listener    127.0.0.1    64999    127.0.0.4    ${password}
160     Add Connection    ${version}    speaker    127.0.0.4    64999    127.0.0.1    ${password}
161     Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    speaker    127.0.0.4
162     Add Connection    ${version}    speaker    127.0.0.1    64999    127.0.0.3    ${password}
163     Add Connection    ${version}    listener    127.0.0.3    64999    127.0.0.1    ${password}
164     Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    listener    127.0.0.3
165     Add Connection    ${version}    listener    127.0.0.5    64999    127.0.0.3    ${password}
166     Add Connection    ${version}    speaker    127.0.0.3    64999    127.0.0.5    ${password}
167     Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    listener    127.0.0.5
168     ...    64999    127.0.0.3
169
170 Setup Nodes Legacy Par Two
171     [Arguments]    ${version}=version3    ${password}=none
172     : FOR    ${node}    IN RANGE    1    6
173     \    Add Binding    ${node}0    10.10.10.${node}0/32    127.0.0.${node}
174     \    Add Binding    ${node}0    10.10.${node}0.0/24    127.0.0.${node}
175     \    Add Binding    ${node}0    10.${node}0.0.0/16    127.0.0.${node}
176     \    Add Binding    ${node}0    ${node}0.0.0.0/8    127.0.0.${node}
177     Add Connection    ${version}    speaker    127.0.0.1    64999    127.0.0.2    ${password}
178     Add Connection    ${version}    listener    127.0.0.2    64999    127.0.0.1    ${password}
179     Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    listener    127.0.0.2
180     Add Connection    ${version}    speaker    127.0.0.1    64999    127.0.0.4    ${password}
181     Add Connection    ${version}    listener    127.0.0.4    64999    127.0.0.1    ${password}
182     Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    listener    127.0.0.4
183     Add Connection    ${version}    listener    127.0.0.1    64999    127.0.0.3    ${password}
184     Add Connection    ${version}    speaker    127.0.0.3    64999    127.0.0.1    ${password}
185     Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    speaker    127.0.0.3
186     Add Connection    ${version}    speaker    127.0.0.5    64999    127.0.0.3    ${password}
187     Add Connection    ${version}    listener    127.0.0.3    64999    127.0.0.5    ${password}
188     Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    speaker    127.0.0.5
189     ...    64999    127.0.0.3
190
191 Check One Group 4-2
192     [Documentation]    Check if only bindings matching filter from node 4 and 2 are propagated to SXP-DB of other nodes
193     ...    Database should contains only Bindings regarding to these matches:
194     ...    permit ACL 10.10.10.0 0.0.0.255
195     ...    permit ACL 10.0.0.0 0.254.0.0
196     ...    Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
197     ${resp}    Get Bindings    127.0.0.5
198     Should Contain Binding    ${resp}    10    10.10.10.10/32    sxp
199     Should Contain Binding    ${resp}    10    10.10.10.0/24    sxp
200     Should Contain Binding    ${resp}    10    10.10.0.0/16    sxp
201     Should Contain Binding    ${resp}    10    10.0.0.0/8    sxp
202     Should Contain Binding    ${resp}    20    10.10.10.20/32    sxp
203     Should Not Contain Binding    ${resp}    20    10.10.20.0/24    sxp
204     Should Contain Binding    ${resp}    20    10.20.0.0/16    sxp
205     Should Not Contain Binding    ${resp}    20    20.0.0.0/8    sxp
206     Should Contain Binding    ${resp}    30    10.10.10.30/32    sxp
207     Should Contain Binding    ${resp}    30    10.10.30.0/24    sxp
208     Should Contain Binding    ${resp}    30    10.30.0.0/16    sxp
209     Should Contain Binding    ${resp}    30    30.0.0.0/8    sxp
210     Should Contain Binding    ${resp}    40    10.10.10.40/32    sxp
211     Should Not Contain Binding    ${resp}    40    10.10.40.0/24    sxp
212     Should Contain Binding    ${resp}    40    10.40.0.0/16    sxp
213     Should Not Contain Binding    ${resp}    40    40.0.0.0/8    sxp
214
215 Check One Group 5-3
216     [Documentation]    Check if only bindings matching filter from node 5 and 3 are propagated to SXP-DB of other nodes
217     ...    Database should contains only Bindings regarding to these matches:
218     ...    permit SGT 30 ACL 10.10.10.0 0.0.0.255
219     ...    permit SGT 50 ACL 10.0.0.0 0.254.0.0
220     ...    Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
221     ${resp}    Get Bindings    127.0.0.4
222     Should Contain Binding    ${resp}    10    10.10.10.10/32    sxp
223     Should Contain Binding    ${resp}    10    10.10.10.0/24    sxp
224     Should Contain Binding    ${resp}    10    10.10.0.0/16    sxp
225     Should Contain Binding    ${resp}    10    10.0.0.0/8    sxp
226     Should Contain Binding    ${resp}    30    10.10.10.30/32    sxp
227     Should Not Contain Binding    ${resp}    30    10.10.30.0/24    sxp
228     Should Not Contain Binding    ${resp}    30    10.30.0.0/16    sxp
229     Should Not Contain Binding    ${resp}    30    30.0.0.0/8    sxp
230     Should Not Contain Binding    ${resp}    50    10.10.10.50/32    sxp
231     Should Not Contain Binding    ${resp}    50    10.10.50.0/24    sxp
232     Should Contain Binding    ${resp}    50    10.50.0.0/16    sxp
233     Should Not Contain Binding    ${resp}    50    50.0.0.0/8    sxp
234
235 Clean Nodes
236     Clean Connections    127.0.0.1
237     Clean Connections    127.0.0.2
238     Clean Connections    127.0.0.3
239     Clean Connections    127.0.0.4
240     Clean Connections    127.0.0.5
241     Clean Peer Groups    127.0.0.1
242     Clean Bindings    127.0.0.1
243     Clean Bindings    127.0.0.2
244     Clean Bindings    127.0.0.3
245     Clean Bindings    127.0.0.4
246     Clean Bindings    127.0.0.5