Add new CSIT test cases for VTN Manager Flowfilter
[integration/test.git] / csit / libraries / VtnMaKeywords.robot
1 *** Settings ***
2 Library           SSHLibrary
3 Library           String
4 Library           DateTime
5 Library           Collections
6 Library           json
7 Library           RequestsLibrary
8 Variables         ../variables/Variables.py
9 Resource          ./Utils.robot
10 Resource          ./KarafKeywords.robot
11
12 *** Variables ***
13 ${vlan_topo_10}    sudo mn --controller=remote,ip=${ODL_SYSTEM_IP} --custom vlan_vtn_test.py --topo vlantopo
14 ${vlan_topo_13}    sudo mn --controller=remote,ip=${ODL_SYSTEM_IP} --custom vlan_vtn_test.py --topo vlantopo --switch ovsk,protocols=OpenFlow13
15 ${VERSION_VTN}    controller/nb/v2/vtn/version
16 ${VTN_INVENTORY}    restconf/operational/vtn-inventory:vtn-nodes
17 ${DUMPFLOWS_OF10}    dpctl dump-flows -OOpenFlow10
18 ${DUMPFLOWS_OF13}    dpctl dump-flows -OOpenFlow13
19 ${FF_DUMPFLOWS_OF10}    sh ovs-ofctl dump-flows -OOpenFlow10 s3
20 ${FF_DUMPFLOWS_OF13}    sh ovs-ofctl dump-flows -OOpenFlow13 s3
21 ${DROP_DUMPFLOWS_OF10}    sh ovs-ofctl dump-flows -OOpenFlow10 s2
22 ${DROP_DUMPFLOWS_OF13}    sh ovs-ofctl dump-flows -OOpenFlow13 s2
23 ${DROP_OUT_DUMPFLOWS_OF10}    sh ovs-ofctl dump-flows -OOpenFlow10 s3
24 ${DROP_OUT_DUMPFLOWS_OF13}    sh ovs-ofctl dump-flows -OOpenFlow13 s3
25 ${FF_OUT_DUMPFLOWS_OF10}    sh ovs-ofctl dump-flows -OOpenFlow10 s2
26 ${FF_OUT_DUMPFLOWS_OF13}    sh ovs-ofctl dump-flows -OOpenFlow13 s2
27 ${index}          7
28 @{inet_actions}    mod_nw_src:192.0.0.1    mod_nw_dst:192.0.0.2
29 @{BRIDGE1_DATAFLOW}    "reason":"PORTMAPPED"    "tenant-name":"Tenant1"    "bridge-name":"vBridge1"    "interface-name":"if2"
30 @{BRIDGE2_DATAFLOW}    "reason":"PORTMAPPED"    "tenant-name":"Tenant1"    "bridge-name":"vBridge2"    "interface-name":"if3"
31 ${vlanmap_bridge1}    200
32 ${vlanmap_bridge2}    300
33 @{VLANMAP_BRIDGE1_DATAFLOW}    "reason":"VLANMAPPED"    "tenant-name":"Tenant1"    "bridge-name":"vBridge1_vlan"
34 @{VLANMAP_BRIDGE2_DATAFLOW}    "reason":"VLANMAPPED"    "tenant-name":"Tenant1"    "bridge-name":"vBridge2_vlan"
35 ${out_before_pathpolicy}    output:2
36 ${out_after_pathpolicy}    output:3
37 ${pathpolicy_topo_13}    sudo mn --controller=remote,ip=${ODL_SYSTEM_IP} --custom topo-3sw-2host_multipath.py --topo pathpolicytopo --switch ovsk,protocols=OpenFlow13
38 ${pathpolicy_topo_10}    sudo mn --controller=remote,ip=${ODL_SYSTEM_IP} --custom topo-3sw-2host_multipath.py --topo pathpolicytopo --switch ovsk,protocols=OpenFlow10
39 @{PATHMAP_ATTR}    "index":"1"    "condition":"flowcond_path"    "policy":"1"
40 ${policy_id}      1
41 ${in_port}        1
42 ${filter_index}    1
43 @{inet_action}    set_field:192.0.0.1->ip_src    set_field:192.0.0.2->ip_dst
44 ${dscp_action}    set_field:32->nw_tos_shifted
45 ${dscp_flow}      mod_nw_tos:128
46 @{icmp_action}    mod_tp_dst:1    mod_tp_src:3
47 ${drop_action}    actions=drop
48 ${vlanpcp_action}    mod_vlan_pcp:6
49 ${vlanpcp_actions}    set_field:6->vlan_pcp
50 ${dlsrc_action}    mod_dl_src:00:00:00:00:00:11
51 ${dlsrc_actions}    set_field:00:00:00:00:00:11->eth_src
52 @{PATHPOLICY_ATTR}    "id":1    "port-desc":"openflow:4,2,s4-eth2"
53 ${custom}         ${CURDIR}/${CREATE_PATHPOLICY_TOPOLOGY_FILE_PATH}
54
55 *** Keywords ***
56 Start SuiteVtnMa
57     [Documentation]    Start VTN Manager Rest Config Api Test Suite, and enabling karaf loglevel as TRACE for VTN.
58     Issue Command On Karaf Console    log:set TRACE org.opendaylight.vtn
59     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_YANG_JSON}
60     BuiltIn.Wait_Until_Keyword_Succeeds    30    3    Fetch vtn list
61     Start Suite
62
63 Start SuiteVtnMaTest
64     [Documentation]    Start VTN Manager Test Suite
65     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_YANG_JSON}
66
67 Stop SuiteVtnMa
68     [Documentation]    Stop VTN Manager Test Suite
69     Delete All Sessions
70
71 Stop SuiteVtnMaTest
72     [Documentation]    Stop VTN Manager Test Suite
73     Delete All Sessions
74
75 Fetch vtn list
76     [Documentation]    Check if VTN Manager is up.
77     ${resp}=    RequestsLibrary.Get Request    session    restconf/operational/vtn:vtns
78     Should Be Equal As Strings    ${resp.status_code}    200
79
80 Fetch vtn switch inventory
81     [Arguments]    ${sw_name}
82     [Documentation]    Check if Switch is detected.
83     ${resp}=    RequestsLibrary.Get Request    session    restconf/operational/vtn-inventory:vtn-nodes/vtn-node/${sw_name}
84     Should Be Equal As Strings    ${resp.status_code}    200
85
86 Add a Vtn
87     [Arguments]    ${vtn_name}
88     [Documentation]    Create a vtn with specified parameters.
89     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn:update-vtn    data={"input": {"tenant-name":${vtn_name}, "update-mode": "CREATE","operation": "SET", "description": "creating vtn", "idle-timeout":300, "hard-timeout":0}}
90     Should Be Equal As Strings    ${resp.status_code}    200
91
92 Add a vBridge
93     [Arguments]    ${vtn_name}    ${vbr_name}
94     [Documentation]    Create a vBridge in a VTN
95     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-vbridge:update-vbridge    data={"input": {"update-mode": "CREATE","operation":"SET", "tenant-name":${vtn_name}, "bridge-name":${vbr_name}, "description": "vbrdige created"}}
96     Should Be Equal As Strings    ${resp.status_code}    200
97
98 Add a interface
99     [Arguments]    ${vtn_name}    ${vbr_name}    ${interface_name}
100     [Documentation]    Create a interface into a vBridge of a VTN
101     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-vinterface:update-vinterface    data={"input": {"update-mode":"CREATE","operation":"SET", "tenant-name":${vtn_name}, "bridge-name":${vbr_name}, "description": "vbrdige interfacecreated", "enabled":"true", "interface-name": ${interface_name}}}
102     Should Be Equal As Strings    ${resp.status_code}    200
103
104 Add a portmap
105     [Arguments]    ${vtn_name}    ${vbr_name}    ${interface_name}    ${node_id}    ${port_id}
106     [Documentation]    Create a portmap for a interface of a vbridge
107     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-port-map:set-port-map    data={"input": { "tenant-name":${vtn_name}, "bridge-name":${vbr_name}, "interface-name": ${interface_name}, "node":"${node_id}", "port-name":"${port_id}"}}
108     Should Be Equal As Strings    ${resp.status_code}    200
109
110 Delete a Vtn
111     [Arguments]    ${vtn_name}
112     [Documentation]    Delete a vtn with specified parameters.
113     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn:remove-vtn    data={"input": {"tenant-name":${vtn_name}}}
114     Should Be Equal As Strings    ${resp.status_code}    200
115
116 Add a vlanmap
117     [Arguments]    ${vtn_name}    ${vbr_name}    ${vlan_id}
118     [Documentation]    Create a vlanmap
119     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-vlan-map:add-vlan-map    data={"input": {"tenant-name":${vtn_name},"bridge-name":${vbr_name},"vlan-id":${vlan_id}}}
120     Should Be Equal As Strings    ${resp.status_code}    200
121
122 Verify Data Flows
123     [Arguments]    ${vtn_name}    ${vBridge_name}
124     [Documentation]    Verify the reason and physical data flows for the specified vtn and vbridge
125     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-flow:get-data-flow    data={"input":{"tenant-name":"${vtn_name}","mode":"UPDATESTATS"}}
126     Run Keyword If    '${vBridge_name}' == 'vBridge1'    DataFlowsForBridge    ${resp}    @{BRIDGE1_DATAFLOW}
127     ...    ELSE IF    '${vBridge_name}' == 'vBridge2'    DataFlowsForBridge    ${resp}    @{BRIDGE2_DATAFLOW}
128     ...    ELSE IF    '${vBridge_name}' == 'vBridge1_vlan'    DataFlowsForBridge    ${resp}    @{VLANMAP_BRIDGE1_DATAFLOW}
129     ...    ELSE    DataFlowsForBridge    ${resp}    @{VLANMAP_BRIDGE2_DATAFLOW}
130
131 Start PathSuiteVtnMaTest
132     [Documentation]    Start VTN Manager Test Suite and Mininet
133     Start SuiteVtnMaTest
134     Start Mininet    ${TOOLS_SYSTEM_IP}    ${pathpolicy_topo_13}    ${custom}
135
136 Start PathSuiteVtnMaTestOF10
137     [Documentation]    Start VTN Manager Test Suite and Mininet in Open Flow 10 Specification
138     Start SuiteVtnMaTest
139     Start Mininet    ${TOOLS_SYSTEM_IP}    ${pathpolicy_topo_10}    ${custom}
140
141 Stop PathSuiteVtnMaTest
142     [Documentation]    Cleanup/Shutdown work at the completion of all tests.
143     Delete All Sessions
144     Stop Mininet    ${mininet_conn_id}
145
146 DataFlowsForBridge
147     [Arguments]    ${resp}    @{BRIDGE_DATAFLOW}
148     [Documentation]    Verify whether the required attributes exists.
149     : FOR    ${dataflowElement}    IN    @{BRIDGE_DATAFLOW}
150     \    should Contain    ${resp.content}    ${dataflowElement}
151
152 Add a pathmap
153     [Arguments]    ${pathmap_data}
154     [Documentation]    Create a pathmap for a vtn
155     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-path-map:set-path-map    data=${pathmap_data}
156     Should Be Equal As Strings    ${resp.status_code}    200
157
158 Get a pathmap
159     [Documentation]    Get a pathmap for a vtn.
160     ${resp}=    RequestsLibrary.Get Request    session    restconf/operational/vtn-path-map:global-path-maps
161     : FOR    ${pathElement}    IN    @{PATHMAP_ATTR}
162     \    should Contain    ${resp.content}    ${pathElement}
163
164 Add a pathpolicy
165     [Arguments]    ${pathpolicy_data}
166     [Documentation]    Create a pathpolicy for a vtn
167     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-path-policy:set-path-policy    data=${pathpolicy_data}
168     Should Be Equal As Strings    ${resp.status_code}    200
169
170 Get a pathpolicy
171     [Arguments]    ${pathpolicy_id}
172     [Documentation]    Get a pathpolicy for a vtn.
173     ${resp}=    RequestsLibrary.Get Request    session    restconf/operational/vtn-path-policy:vtn-path-policies/vtn-path-policy/${pathpolicy_id}
174     : FOR    ${pathpolicyElement}    IN    @{PATHPOLICY_ATTR}
175     \    should Contain    ${resp.content}    ${pathpolicyElement}
176
177 Delete a pathmap
178     [Arguments]    ${tenant_path}
179     [Documentation]    Remove a pathmap for a vtn
180     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-path-map:remove-path-map    data={"input":{"tenant-name":"${tenant_path}","map-index":["${policy_id}"]}}
181     Should Be Equal As Strings    ${resp.status_code}    200
182
183 Delete a pathpolicy
184     [Arguments]    ${policy_id}
185     [Documentation]    Delete a pathpolicy for a vtn
186     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-path-policy:remove-path-policy    data={"input":{"id":"${policy_id}"}}
187     Should Be Equal As Strings    ${resp.status_code}    200
188
189 Verify flowEntryPathPolicy
190     [Arguments]    ${of_version}    ${port}    ${output}
191     [Documentation]    Checking Flows on switch S1 and switch S3 after applying path policy
192     ${DUMPFLOWS}=    Set Variable If    "${of_version}"=="OF10"    ${DUMPFLOWS_OF10}    ${DUMPFLOWS_OF13}
193     write    ${DUMPFLOWS}
194     ${result}    Read Until    mininet>
195     Should Contain    ${result}    in_port=${port}    actions=${output}
196
197 Add a macmap
198     [Arguments]    ${vtn_name}    ${vBridge_name}    ${src_add}    ${dst_add}
199     [Documentation]    Create a macmap for a vbridge
200     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-mac-map:set-mac-map    data={"input":{"operation":"SET","allowed-hosts":["${dst_add}@0","${src_add}@0"],"tenant-name":"${vtn_name}","bridge-name":"${vBridge_name}"}}
201     Should Be Equal As Strings    ${resp.status_code}    200
202
203 Get DynamicMacAddress
204     [Arguments]    ${h}
205     [Documentation]    Get Dynamic mac address of Host
206     write    ${h} ifconfig -a | grep HWaddr
207     ${source}    Read Until    mininet>
208     ${HWaddress}=    Split String    ${source}    ${SPACE}
209     ${sourceHWaddr}=    Get from List    ${HWaddress}    ${index}
210     ${sourceHWaddress}=    Convert To Lowercase    ${sourceHWaddr}
211     Return From Keyword    ${sourceHWaddress}    # Also [Return] would work here.
212
213 Mininet Ping Should Succeed
214     [Arguments]    ${host1}    ${host2}
215     [Documentation]    Ping hosts to check connectivity
216     Write    ${host1} ping -c 1 ${host2}
217     ${result}    Read Until    mininet>
218     Should Contain    ${result}    64 bytes
219
220 Mininet Ping Should Not Succeed
221     [Arguments]    ${host1}    ${host2}
222     [Documentation]    Ping hosts when there is no connectivity and check hosts is unreachable
223     Write    ${host1} ping -c 3 ${host2}
224     ${result}    Read Until    mininet>
225     Should Not Contain    ${result}    64 bytes
226
227 Start vlan_topo
228     [Arguments]    ${OF}
229     [Documentation]    Create custom topology for vlan functionality
230     Install Package On Ubuntu System    vlan
231     Run Keyword If    '${OF}' == 'OF13'    Start Mininet    ${TOOLS_SYSTEM_IP}    ${vlan_topo_13}    ${CURDIR}/${CREATE_VLAN_TOPOLOGY_FILE_PATH}
232     ...    ELSE IF    '${OF}' == 'OF10'    Start Mininet    ${TOOLS_SYSTEM_IP}    ${vlan_topo_10}    ${CURDIR}/${CREATE_VLAN_TOPOLOGY_FILE_PATH}
233
234 Get flow
235     [Arguments]    ${vtn_name}
236     [Documentation]    Get data flow.
237     ${resp}=    RequestsLibrary.Get Request    session    restconf/operational/vtn-flow-impl:vtn-flows/vtn-flow-table/${vtn_name}
238     Should Be Equal As Strings    ${resp.status_code}    200
239
240 Remove a portmap
241     [Arguments]    ${vtn_name}    ${vBridge_name}    ${interface_name}
242     [Documentation]    Remove a portmap for a interface of a vbridge
243     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-port-map:remove-port-map    data={"input": {"tenant-name":${vtn_name},"bridge-name":${vBridge_name},"interface-name":${interface_name}}}
244     Should Be Equal As Strings    ${resp.status_code}    200
245
246 Verify FlowMacAddress
247     [Arguments]    ${host1}    ${host2}    ${OF_VERSION}
248     [Documentation]    Verify the source and destination mac address.
249     Run Keyword If    '${OF_VERSION}' == 'OF10'    Verify Flows On OpenFlow    ${host1}    ${host2}    ${FF_DUMPFLOWS_OF10}
250     ...    ELSE    VerifyFlowsOnOpenFlow    ${host1}    ${host2}    ${FF_DUMPFLOWS_OF13}
251
252 Verify Flows On OpenFlow
253     [Arguments]    ${host1}    ${host2}    ${DUMPFLOWS}
254     [Documentation]    Verify the mac addresses on the specified open flow.
255     ${booleanValue}=    Run Keyword And Return Status    Verify macaddress    ${host1}    ${host2}    ${DUMPFLOWS}
256     Should Be Equal As Strings    ${booleanValue}    True
257
258 Verify RemovedFlowMacAddress
259     [Arguments]    ${host1}    ${host2}    ${OF_VERSION}
260     [Documentation]    Verify the removed source and destination mac address.
261     Run Keyword If    '${OF_VERSION}' == 'OF10'    Verify Removed Flows On OpenFlow    ${host1}    ${host2}    ${FF_DUMPFLOWS_OF10}
262     ...    ELSE    Verify Removed Flows On OpenFlow    ${host1}    ${host2}    ${FF_DUMPFLOWS_OF13}
263
264 Verify Removed Flows On OpenFlow
265     [Arguments]    ${host1}    ${host2}    ${DUMPFLOWS}
266     [Documentation]    Verify the removed mac addresses on the specified open flow.
267     ${booleanValue}=    Run Keyword And Return Status    Verify macaddress    ${host1}    ${host2}    ${DUMPFLOWS}
268     Should Not Be Equal As Strings    ${booleanValue}    True
269
270 Verify macaddress
271     [Arguments]    ${host1}    ${host2}    ${DUMPFLOWS}
272     [Documentation]    Verify the source and destination mac address after ping in the dumpflows
273     write    ${host1} ifconfig -a | grep HWaddr
274     ${sourcemacaddr}    Read Until    mininet>
275     ${macaddress}=    Split String    ${sourcemacaddr}    ${SPACE}
276     ${sourcemacaddr}=    Get from List    ${macaddress}    ${index}
277     ${sourcemacaddress}=    Convert To Lowercase    ${sourcemacaddr}
278     write    ${host2} ifconfig -a | grep HWaddr
279     ${destmacaddr}    Read Until    mininet>
280     ${macaddress}=    Split String    ${destmacaddr}    ${SPACE}
281     ${destmacaddr}=    Get from List    ${macaddress}    ${index}
282     ${destmacaddress}=    Convert To Lowercase    ${destmacaddr}
283     write    ${DUMPFLOWS}
284     ${result}    Read Until    mininet>
285     Should Contain    ${result}    ${sourcemacaddress}
286     Should Contain    ${result}    ${destmacaddress}
287
288 Verify flowactions
289     [Arguments]    ${actions}    ${DUMPFLOWS}
290     [Documentation]    Verify the flowfilter actions after ping in the dumpflows
291     write    ${DUMPFLOWS}
292     ${result}    Read Until    mininet>
293     Should Contain    ${result}    ${actions}
294
295 Add a vtn flowfilter
296     [Arguments]    ${vtn_name}    ${vtnflowfilter_data}
297     [Documentation]    Create a flowfilter for a vtn
298     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-flow-filter:set-flow-filter    data={"input": {"tenant-name": "${vtn_name}",${vtnflowfilter_data}}}
299     Should Be Equal As Strings    ${resp.status_code}    200
300
301 Remove a vtn flowfilter
302     [Arguments]    ${vtn_name}    ${filter_index}
303     [Documentation]    Delete a vtn flowfilter
304     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-flow-filter:remove-flow-filter    data={"input": {"indices": ["${filter_index}"], "tenant-name": "${vtn_name}"}}
305     Should Be Equal As Strings    ${resp.status_code}    200
306
307 Add a vbr flowfilter
308     [Arguments]    ${vtn_name}    ${vBridge_name}    ${vbrflowfilter_data}
309     [Documentation]    Create a flowfilter for a vbr
310     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-flow-filter:set-flow-filter    data={"input": {"tenant-name": "${vtn_name}", "bridge-name": "${vBridge_name}", ${vbrflowfilter_data}}}
311     Should Be Equal As Strings    ${resp.status_code}    200
312
313 Remove a vbr flowfilter
314     [Arguments]    ${vtn_name}    ${vBridge_name}    ${filter_index}
315     [Documentation]    Delete a vbr flowfilter
316     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-flow-filter:remove-flow-filter    data={"input": {"indices": ["${filter_index}"], "tenant-name": "${vtn_name}","bridge-name": "${vBridge_name}"}}
317     Should Be Equal As Strings    ${resp.status_code}    200
318
319 Add a vbrif flowfilter
320     [Arguments]    ${vtn_name}    ${vBridge_name}    ${interface_name}    ${vbrif_flowfilter_data}
321     [Documentation]    Create a flowfilter for a vbrif
322     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-flow-filter:set-flow-filter    data={"input": {"tenant-name": ${vtn_name}, "bridge-name": "${vBridge_name}","interface-name":"${interface_name}",${vbrif_flowfilter_data}}}
323     Should Be Equal As Strings    ${resp.status_code}    200
324
325 Remove a vbrif flowfilter
326     [Arguments]    ${vtn_name}    ${vBridge_name}    ${interface_name}    ${filter_index}
327     [Documentation]    Delete a vbrif flowfilter
328     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-flow-filter:remove-flow-filter    data={"input": {"indices": ["${filter_index}"], "tenant-name": "${vtn_name}","bridge-name": "${vBridge_name}","interface-name": "${interface_name}"}}
329     Should Be Equal As Strings    ${resp.status_code}    200
330
331 Add a vlan portmap
332     [Arguments]    ${vtn_name}    ${vbr_name}    ${interface_name}    ${id}    ${node_id}    ${port_id}
333     [Documentation]    Create a portmap for a interface of a vbridge
334     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-port-map:set-port-map    data={"input": { "tenant-name":${vtn_name}, "bridge-name":${vbr_name}, "interface-name": ${interface_name}, "vlan-id": ${id}, "node":"${node_id}", "port-name":"${port_id}"}}
335     Should Be Equal As Strings    ${resp.status_code}    200
336
337 Verify Flow Entries for Flowfilter
338     [Arguments]    ${dumpflows}    @{flowfilter_actions}
339     [Documentation]    Verify switch flow entry using flowfilter for a vtn
340     ${booleanValue}=    Run Keyword And Return Status    Verify Actions on Flow Entry    ${dumpflows}    @{flowfilter_actions}
341     Should Be Equal As Strings    ${booleanValue}    True
342
343 Verify Removed Flow Entry for Inet Drop Flowfilter
344     [Arguments]    ${dumpflows}    @{flowfilter_actions}
345     [Documentation]    Verify removed switch flow entry using flowfilter drop for a vtn
346     ${booleanValue}=    Run Keyword And Return Status    Verify Actions on Flow Entry    ${dumpflows}    @{flowfilter_actions}
347     Should Be Equal As Strings    ${booleanValue}    True
348
349 Verify Actions on Flow Entry
350     [Arguments]    ${dumpflows}    @{flowfilter_actions}
351     [Documentation]    check flow action elements by giving dumpflows in mininet
352     write    ${dumpflows}
353     ${result}    Read Until    mininet>
354     : FOR    ${flowElement}    IN    @{flowfilter_actions}
355     \    should Contain    ${result}    ${flowElement}
356
357 Add a flowcondition
358     [Arguments]    ${flowcond_name}    ${flowconditiondata}
359     [Documentation]    Create a flowcondition using Restconfig Api
360     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-flow-condition:set-flow-condition    data={"input":{"operation":"SET","present":"false","name":"${flowcond_name}",${flowconditiondata}}}
361     Should Be Equal As Strings    ${resp.status_code}    200
362
363 Get flowconditions
364     [Documentation]    Retrieve the list of flowconditions created
365     ${resp}=    RequestsLibrary.Get Request    session    restconf/operational/vtn-flow-condition:vtn-flow-conditions
366     Should Be Equal As Strings    ${resp.status_code}    200
367
368 Get flowcondition
369     [Arguments]    ${flowcond_name}    ${retrieve}
370     [Documentation]    Retrieve the flowcondition by name and to check the removed flowcondition we added "retrieve" argument to differentiate the status code,
371     ...    since after removing flowcondition name the status will be different compare to status code when the flowcondition name is present.
372     ${resp}=    RequestsLibrary.Get Request    session    restconf/operational/vtn-flow-condition:vtn-flow-conditions/vtn-flow-condition/${flowcond_name}
373     Run Keyword If    '${retrieve}' == 'retrieve'    Should Be Equal As Strings    ${resp.status_code}    200
374     ...    ELSE    Should Not Be Equal As Strings    ${resp.status_code}    200
375
376 Remove flowcondition
377     [Arguments]    ${flowcond_name}
378     [Documentation]    Remove the flowcondition by name
379     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-flow-condition:remove-flow-condition    data={"input":{"name":"${flowcond_name}"}}
380     Should Be Equal As Strings    ${resp.status_code}    200