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