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