Fix VTN test file to collect debug info all the time
[integration/test.git] / csit / suites / vtn / VTN_Mgr_OF13 / 010__vtn_manager_flowfilter.robot
1 *** Settings ***
2 Documentation     Test suite for VTN Manager using OF13
3 Suite Setup       Start SuiteVtnMaTest
4 Suite Teardown    Stop SuiteVtnMaTest
5 Resource          ../../../libraries/VtnMaKeywords.robot
6 Resource          ../../../libraries/Utils.robot
7
8 *** Variables ***
9 ${flowconditiondata}    "vtn-flow-match":[{"vtn-inet-match":{"source-network":"10.0.0.1/32","destination-network":"10.0.0.3/32"},"index":"1"}]
10 ${flowfilterInetdata}    "vtn-flow-filter":[{"condition":"cond_1","vtn-pass-filter":{},"vtn-flow-action":[{"order": "1","vtn-set-inet-src-action":{"ipv4-address":"192.0.0.1/32"}},{"order": "2","vtn-set-inet-dst-action":{"ipv4-address":"192.0.0.2/32"}}],"index": "1"}]
11 ${flowfilterInetdropdata}    "vtn-flow-filter":[{"condition":"cond_1","vtn-drop-filter":{},"vtn-flow-action":[{"order": "1","vtn-set-inet-src-action":{"ipv4-address":"10.0.0.2/32"}},{"order": "2","vtn-set-inet-dst-action":{"ipv4-address":"10.0.0.4/32"}}],"index": "1"}]
12 ${flowfilterIcmpCodedata}    "vtn-flow-filter": [{"condition": "cond_1","index": "1", "vtn-pass-filter": {}, "vtn-flow-action": [{ "order": "1", "vtn-set-icmp-code-action":{"code": "1"}},{"order": "2","vtn-set-icmp-type-action": {"type": "3"}}]}]
13 ${flowfilterTpsrcTpdstdata}    "vtn-flow-filter": [{"condition": "cond_1","vtn-pass-filter": {},"vtn-flow-action": [{"order": "1","vtn-set-port-src-action": {"port": "5"}},{"order": "2","vtn-set-port-dst-action": {"port": "10"}}],"index": "1"}]
14 ${flowfilterDscpdata}    "vtn-flow-filter":[{"condition": "cond_1","vtn-pass-filter": {},"vtn-flow-action": [{"order": "1","vtn-set-inet-dscp-action": {"dscp":"32"}}],"index":"1"}]
15 ${flowfilterdlsrc}    "vtn-flow-filter":[{"condition": "cond_1","vtn-pass-filter": {},"vtn-flow-action": [{"order": "1","vtn-set-dl-src-action": {"address":"00:00:00:00:00:11"}}],"index":"1"}]
16 ${flowfiltervlanpcp}    "vtn-flow-filter":[{"condition":"cond_1","vtn-pass-filter":{},"vtn-flow-action":[{"order":"3","vtn-set-icmp-code-action":{"code":"1"}},{"order":"4","vtn-set-vlan-pcp-action":{"vlan-pcp":"3"}}],"index":"1"}]
17
18 *** Test Cases ***
19 Check if switch1 detected
20     [Documentation]    Check if openflow:1 is detected
21     BuiltIn.Wait_Until_Keyword_Succeeds    12    3    Fetch vtn switch inventory    openflow:1
22
23 Check if switch2 detected
24     [Documentation]    Check if openflow:2 is detected
25     BuiltIn.Wait_Until_Keyword_Succeeds    3    1    Fetch vtn switch inventory    openflow:2
26
27 Check if switch3 detected
28     [Documentation]    Check if openflow:3 is detected
29     BuiltIn.Wait_Until_Keyword_Succeeds    3    1    Fetch vtn switch inventory    openflow:3
30
31 Add a vtn Tenant1
32     [Documentation]    Add a vtn Tenant1
33     Add a vtn    Tenant1
34
35 Add a vBridge vBridge1
36     [Documentation]    Add a vBridge vBridge1 in vtn Tenant1
37     Add a vBridge    Tenant1    vBridge1
38
39 Add a interface If1
40     [Documentation]    Add a interface if1 into vBridge vBridge1
41     Add a interface    Tenant1    vBridge1    if1
42
43 Add a interface if2
44     [Documentation]    Add a interface if2 into vBridge vBridge1
45     Add a interface    Tenant1    vBridge1    if2
46
47 Add a portmap for interface if1
48     [Documentation]    Create a portmap on Interface if1 of vBridge1
49     Add a portmap    Tenant1    vBridge1    if1    openflow:2    s2-eth1
50
51 Add a portmap for interface if2
52     [Documentation]    Create a portmap on Interface if2 of vBridge1
53     Add a portmap    Tenant1    vBridge1    if2    openflow:3    s3-eth1
54
55 Ping h1 to h3
56     [Documentation]    Ping h1 to h3, verify no packet loss
57     Wait_Until_Keyword_Succeeds    20s    1s    Mininet Ping Should Succeed    h1    h3
58
59 Add a vBridge vBridge2
60     [Documentation]    Add a vBridge vBridge2 in vtn Tenant1
61     Add a vBridge    Tenant1    vBridge2
62
63 Add a interface If3
64     [Documentation]    Add a interface if3 into vBrdige vBridge2
65     Add a interface    Tenant1    vBridge2    if3
66
67 Add a interface if4
68     [Documentation]    Add a interface if4 into vBrdige vBridge2
69     Add a interface    Tenant1    vBridge2    if4
70
71 Add a portmap for interface if3
72     [Documentation]    Create a portmap on Interface if3 of vBridge2
73     Add a portmap    Tenant1    vBridge2    if3    openflow:2    s2-eth2
74
75 Add a portmap for interface if4
76     [Documentation]    Create a portmap on Interface if4 of vBridge2
77     Add a portmap    Tenant1    vBridge2    if4    openflow:3    s3-eth2
78
79 Ping h2 to h4
80     [Documentation]    Ping h2 to h4, verify no packet loss
81     Wait_Until_Keyword_Succeeds    20s    1s    Mininet Ping Should Succeed    h2    h4
82
83 Add a flowcondition
84     [Documentation]    Create a flowcondition cond_1 using restconfig api
85     Add a flowcondition    cond_1    ${flowconditiondata}
86
87 Add a vtn flowfilter with inet4src and inet4dst
88     [Documentation]    Create a flowfilter with inet4 and Verify ping
89     Add a vtn flowfilter    Tenant1    ${flowfilterInetdata}
90     Wait_Until_Keyword_Succeeds    20s    1s    Mininet Ping Should Not Succeed    h1    h3
91
92 Verify inet4src and inet4dst of vtn flowfilter
93     [Documentation]    Verify vtn flowfilter actions in Flow Enties for inet4src and inet4dst
94     Wait_Until_Keyword_Succeeds    20s    1s    Verify Flow Entries for Flowfilter    ${FF_DUMPFLOWS_OF13}    @{inet_action}
95     [Teardown]    Run Keywords    Report_Failure_Due_To_Bug    6643
96     ...    AND    Collect Debug Info
97
98 Remove vtn Flowfilter index
99     [Documentation]    Remove a index of vtn flowfilter
100     Remove a vtn flowfilter    Tenant1    ${filter_index}
101
102 Add a vbr flowfilter with inet4src and inet4dst
103     [Documentation]    Create a flowfilter with inet4 and Verify ping
104     Add a vbr flowfilter    Tenant1    vBridge1    ${flowfilterInetdata}
105     Wait_Until_Keyword_Succeeds    20s    1s    Mininet Ping Should Not Succeed    h1    h3
106
107 Verify inet4src and inet4dst of vbr flowfilter
108     [Documentation]    Verify actions in Flow Enties for inet4src and inet4dst
109     Wait_Until_Keyword_Succeeds    20s    1s    Verify Flow Entries for Flowfilter    ${FF_DUMPFLOWS_OF13}    @{inet_action}
110
111 Remove vbr Flowfilter index
112     [Documentation]    Remove a index of vbr flowfilter
113     Remove a vbr flowfilter    Tenant1    vBridge1    ${filter_index}
114
115 Add a vbrif flowfilter with inet4src and inet4dst
116     [Documentation]    Create a flowfilter with inet4 and Verify ping
117     Add a vbrif flowfilter    Tenant1    vBridge1    if1    ${flowfilterInetdata}
118     Wait_Until_Keyword_Succeeds    20s    1s    Mininet Ping Should Not Succeed    h1    h3
119
120 Verify inet4src and inet4dst of vbrif flowfilter
121     [Documentation]    Verify actions in Flow Enties for inet4src and inet4dst
122     Wait_Until_Keyword_Succeeds    20s    1s    Verify Flow Entries for Flowfilter    ${FF_DUMPFLOWS_OF13}    @{inet_action}
123
124 Remove vbrif Flowfilter index
125     [Documentation]    Remove a index of vbrif flowfilter
126     Remove a vbrif flowfilter    Tenant1    vBridge1    if1    ${filter_index}
127
128 Add a vtn flowfilter with Icmp code
129     [Documentation]    Create a flowfilter with icmp code and Verify ping
130     Add a vtn flowfilter    Tenant1    ${flowfilterIcmpCodedata}
131     Wait_Until_Keyword_Succeeds    20s    1s    Mininet Ping Should Not Succeed    h1    h3
132
133 Verify icmp action for vtn flowfilter
134     [Documentation]    Verify actions in Flow Enties for icmp code and type
135     [Tags]    exclude
136     Wait_Until_Keyword_Succeeds    20s    1s    Verify Flow Entries for Flowfilter    ${FF_DUMPFLOWS_OF13}    @{icmp_action}
137
138 Remove vtn Flowfilter index which has ICMP
139     [Documentation]    Remove a index of vtn flowfilter which have ICMP
140     Remove a vtn flowfilter    Tenant1    ${filter_index}
141
142 Add a vbr flowfilter with Icmp code
143     [Documentation]    Create a flowfilter with icmp code and Verify ping
144     Add a vbr flowfilter    Tenant1    vBridge1    ${flowfilterIcmpCodedata}
145     Wait_Until_Keyword_Succeeds    20s    1s    Mininet Ping Should Not Succeed    h1    h3
146
147 Verify icmp action for vbr flowfilter
148     [Documentation]    Verify actions in Flow Enties for icmp code and type
149     [Tags]    exclude
150     Wait_Until_Keyword_Succeeds    20s    1s    Verify Flow Entries for Flowfilter    ${FF_DUMPFLOWS_OF13}    @{icmp_action}
151
152 Remove vbr Flowfilter index which has ICMP
153     [Documentation]    Remove a index of vbr flowfilter which have ICMP
154     Remove a vbr flowfilter    Tenant1    vBridge1    ${filter_index}
155
156 Add a vbrif flowfilter with Icmp code
157     [Documentation]    Create a flowfilter with icmp code and Verify ping
158     Add a vbrif flowfilter    Tenant1    vBridge1    if1    ${flowfilterIcmpCodedata}
159     Wait_Until_Keyword_Succeeds    20s    1s    Mininet Ping Should Not Succeed    h1    h3
160
161 Verify icmp action for vbrif flowfilter
162     [Documentation]    Verify actions in Flow Enties for icmp code and type
163     [Tags]    exclude
164     Wait_Until_Keyword_Succeeds    20s    1s    Verify Flow Entries for Flowfilter    ${FF_DUMPFLOWS_OF13}    @{icmp_action}
165
166 Remove vbrif Flowfilter index which has ICMP
167     [Documentation]    Remove a index of vbrif flowfilter which have ICMP
168     Remove a vbrif flowfilter    Tenant1    vBridge1    if1    ${filter_index}
169
170 Add a vtn flowfilter with dscp
171     [Documentation]    Create a flowfilter with dscp and Verify ping
172     Add a vtn flowfilter    Tenant1    ${flowfilterDscpdata}
173     Wait_Until_Keyword_Succeeds    20s    1s    Mininet Ping Should Succeed    h1    h3
174
175 Verify dscp action for vtn flowfilter
176     [Documentation]    Verify actions in Flow Enties for dscp
177     Wait_Until_Keyword_Succeeds    20s    1s    Verify flowactions    ${dscp_action}    ${FF_DUMPFLOWS_OF13}
178
179 Remove vtn Flowfilter index which have dscp
180     [Documentation]    Remove a index of vtn flowfilter which have DSCP
181     Remove a vtn flowfilter    Tenant1    ${filter_index}
182
183 Add a vbr flowfilter with dscp
184     [Documentation]    Create a flowfilter with dscp and Verify ping
185     Add a vbr flowfilter    Tenant1    vBridge1    ${flowfilterDscpdata}
186     Wait_Until_Keyword_Succeeds    20s    1s    Mininet Ping Should Succeed    h1    h3
187
188 Verify dscp action for vbr flowfilter
189     [Documentation]    Verify actions in Flow Enties for dscp
190     Wait_Until_Keyword_Succeeds    20s    1s    Verify flowactions    ${dscp_action}    ${FF_DUMPFLOWS_OF13}
191
192 Remove vbr Flowfilter index which have dscp
193     [Documentation]    Remove a index of vbr flowfilter which have DSCP
194     Remove a vbr flowfilter    Tenant1    vBridge1    ${filter_index}
195
196 Add a vbrif flowfilter with dscp
197     [Documentation]    Create a flowfilter with dscp and Verify ping
198     Add a vbrif flowfilter    Tenant1    vBridge1    if1    ${flowfilterDscpdata}
199     Wait_Until_Keyword_Succeeds    20s    1s    Mininet Ping Should Succeed    h1    h3
200
201 Verify dscp action for vbrif flowfilter
202     [Documentation]    Verify actions in Flow Enties for dscp
203     Wait_Until_Keyword_Succeeds    20s    1s    Verify flowactions    ${dscp_action}    ${FF_DUMPFLOWS_OF13}
204
205 Remove vbrif Flowfilter index which have dscp
206     [Documentation]    Remove a index of vbrif flowfilter which have DSCP
207     Remove a vbrif flowfilter    Tenant1    vBridge1    if1    ${filter_index}
208
209 Add a vtn flowfilter with dl-src
210     [Documentation]    Create a flowfilter with dl-src and Verify ping
211     Add a vtn flowfilter    Tenant1    ${flowfilterdlsrc}
212     Wait_Until_Keyword_Succeeds    20s    1s    Mininet Ping Should Succeed    h1    h3
213
214 Verify dl-src action for vtn flowfilter
215     [Documentation]    Verify actions in Flow Enties for dl-src
216     Wait_Until_Keyword_Succeeds    20s    1s    Verify flowactions    ${dlsrc_actions}    ${FF_DUMPFLOWS_OF13}
217
218 Remove vtn Flowfilter index which have dl-src
219     [Documentation]    Remove a index of vtn flowfilter which have DL_SRC
220     Remove a vtn flowfilter    Tenant1    ${filter_index}
221
222 Add a vbr flowfilter with dl-src
223     [Documentation]    Create a flowfilter with dl-src and Verify ping
224     Add a vbr flowfilter    Tenant1    vBridge1    ${flowfilterdlsrc}
225     Wait_Until_Keyword_Succeeds    20s    1s    Mininet Ping Should Succeed    h1    h3
226
227 Verify dl-src action for vbr flowfilter
228     [Documentation]    Verify actions in Flow Enties for dl-src
229     Wait_Until_Keyword_Succeeds    20s    1s    Verify flowactions    ${dlsrc_actions}    ${FF_DUMPFLOWS_OF13}
230
231 Remove vbr Flowfilter index which have dl-src
232     [Documentation]    Remove a index of vbr flowfilter which have DL_SRC
233     Remove a vbr flowfilter    Tenant1    vBridge1    ${filter_index}
234
235 Add a vbrif flowfilter with dl-src
236     [Documentation]    Create a flowfilter with dl-src and Verify ping
237     Add a vbrif flowfilter    Tenant1    vBridge1    if1    ${flowfilterdlsrc}
238     Wait_Until_Keyword_Succeeds    20s    1s    Mininet Ping Should Succeed    h1    h3
239
240 Verify dl-src action for vbrif flowfilter
241     [Documentation]    Verify actions in Flow Enties for dl-src
242     Wait_Until_Keyword_Succeeds    20s    1s    Verify flowactions    ${dlsrc_actions}    ${FF_DUMPFLOWS_OF13}
243
244 Remove vbrif Flowfilter index which have dl-src
245     [Documentation]    Remove a index of vbrif flowfilter which have DL_SRC
246     Remove a vbrif flowfilter    Tenant1    vBridge1    if1    ${filter_index}
247
248 Add a flowfilter with inet4 for drop
249     [Documentation]    Create a flowfilter with inet4 for drop action and Verify no pinging
250     Add a vbrif flowfilter    Tenant1    vBridge1    if1    ${flowfilterInetdropdata}
251     Wait_Until_Keyword_Succeeds    20s    1s    Mininet Ping Should Not Succeed    h1    h3
252
253 Verify Removed Flow Entry For Inet After Drop Action
254     [Documentation]    Verify no flows between the hosts after drop
255     Wait_Until_Keyword_Succeeds    20s    1s    Verify flowactions    ${drop_action}    ${DROP_DUMPFLOWS_OF13}
256
257 Delete a flowcondition
258     [Documentation]    Delete a flowcondition
259     Remove flowcondition    cond_1
260
261 Delete a vtn Tenant1
262     [Documentation]    Delete vtn Tenant1
263     Delete a vtn    Tenant1