VTN - Additional Debug Dumps
[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 Resource          ./vtn.robot
14
15 *** Variables ***
16 ${vlan_topo_10}    --custom vlan_vtn_test.py --topo vlantopo
17 ${vlan_topo_13}    --custom vlan_vtn_test.py --topo vlantopo --switch ovsk,protocols=OpenFlow13
18 ${VERSION_VTN}    controller/nb/v2/vtn/version
19 ${VTN_INVENTORY}    restconf/operational/vtn-inventory:vtn-nodes
20 ${ENTITY_OWNERS}    restconf/operational/entity-owners:entity-owners
21 ${DUMPFLOWS_OF10}    dpctl dump-flows -OOpenFlow10
22 ${DUMPFLOWS_OF13}    dpctl dump-flows -OOpenFlow13
23 ${FF_DUMPFLOWS_OF10}    sh ovs-ofctl dump-flows -OOpenFlow10 s3
24 ${FF_DUMPFLOWS_OF13}    sh ovs-ofctl dump-flows -OOpenFlow13 s3
25 ${DROP_DUMPFLOWS_OF10}    sh ovs-ofctl dump-flows -OOpenFlow10 s2
26 ${DROP_DUMPFLOWS_OF13}    sh ovs-ofctl dump-flows -OOpenFlow13 s2
27 ${DROP_OUT_DUMPFLOWS_OF10}    sh ovs-ofctl dump-flows -OOpenFlow10 s3
28 ${DROP_OUT_DUMPFLOWS_OF13}    sh ovs-ofctl dump-flows -OOpenFlow13 s3
29 ${FF_OUT_DUMPFLOWS_OF10}    sh ovs-ofctl dump-flows -OOpenFlow10 s2
30 ${FF_OUT_DUMPFLOWS_OF13}    sh ovs-ofctl dump-flows -OOpenFlow13 s2
31 ${index}          7
32 @{inet_actions}    mod_nw_src:192.0.0.1    mod_nw_dst:192.0.0.2
33 @{BRIDGE1_DATAFLOW}    "reason":"PORTMAPPED"    "tenant-name":"Tenant1"    "bridge-name":"vBridge1"    "interface-name":"if2"
34 @{BRIDGE2_DATAFLOW}    "reason":"PORTMAPPED"    "tenant-name":"Tenant1"    "bridge-name":"vBridge2"    "interface-name":"if3"
35 ${vlanmap_bridge1}    200
36 ${vlanmap_bridge2}    300
37 @{VLANMAP_BRIDGE1_DATAFLOW}    "reason":"VLANMAPPED"    "tenant-name":"Tenant1"    "bridge-name":"vBridge1_vlan"
38 @{VLANMAP_BRIDGE2_DATAFLOW}    "reason":"VLANMAPPED"    "tenant-name":"Tenant1"    "bridge-name":"vBridge2_vlan"
39 ${out_before_pathpolicy}    output:2
40 ${out_after_pathpolicy}    output:3
41 ${pathpolicy_topo_13}    --custom topo-3sw-2host_multipath.py --topo pathpolicytopo --switch ovsk,protocols=OpenFlow13
42 ${pathpolicy_topo_10}    --custom topo-3sw-2host_multipath.py --topo pathpolicytopo --switch ovsk,protocols=OpenFlow10
43 @{PATHMAP_ATTR}    "index":"1"    "condition":"flowcond_path"    "policy":"1"
44 ${policy_id}      1
45 ${in_port}        1
46 ${filter_index}    1
47 @{inet_action}    set_field:192.0.0.1->ip_src    set_field:192.0.0.2->ip_dst
48 ${dscp_action}    set_field:32->ip_dscp
49 ${dscp_be_action}    set_field:32->nw_tos_shifted
50 ${dscp_flow}      mod_nw_tos:128
51 @{icmp_action}    mod_tp_dst:1    mod_tp_src:3
52 ${drop_action}    actions=drop
53 ${vlanpcp_action}    mod_vlan_pcp:6
54 ${vlanpcp_actions}    set_field:6->vlan_pcp
55 ${dlsrc_action}    mod_dl_src:00:00:00:00:00:11
56 ${dlsrc_actions}    set_field:00:00:00:00:00:11->eth_src
57 @{PATHPOLICY_ATTR}    "id":1    "port-desc":"openflow:4,2,s4-eth2"
58 ${custom}         ${CURDIR}/${CREATE_PATHPOLICY_TOPOLOGY_FILE_PATH}
59
60 *** Keywords ***
61 Start SuiteVtnMa
62     [Documentation]    Start VTN Manager Rest Config Api Test Suite, and enabling karaf loglevel as TRACE for VTN.
63     #Issue Command On Karaf Console    log:set TRACE org.opendaylight.vtn
64     ${vtn_mgr_id}=    SSHLibrary.Open Connection    ${ODL_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=30s
65     Set Suite Variable    ${vtn_mgr_id}
66     SSHLibrary.Login_With_Public_Key    ${ODL_SYSTEM_USER}    ${USER_HOME}/.ssh/${SSH_KEY}    any
67     SSHLibrary.Execute Command    sudo sed -i "$ i log4j.logger.org.opendaylight.vtn = TRACE" ${WORKSPACE}/${BUNDLEFOLDER}/etc/org.ops4j.pax.logging.cfg
68     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_YANG_JSON}
69     BuiltIn.Wait_Until_Keyword_Succeeds    30    3    Fetch vtn list
70     Start Mininet
71
72 Start SuiteVtnMaTest
73     [Documentation]    Start VTN Manager Test Suite
74     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_YANG_JSON}
75
76 Stop SuiteVtnMa
77     [Documentation]    Stop VTN Manager Test Suite
78     Delete All Sessions
79
80 Stop SuiteVtnMaTest
81     [Documentation]    Stop VTN Manager Test Suite
82     Delete All Sessions
83
84 Fetch vtn list
85     [Documentation]    Check if VTN Manager is up.
86     ${resp}=    RequestsLibrary.Get Request    session    restconf/operational/vtn:vtns
87     Should Be Equal As Strings    ${resp.status_code}    200
88
89 Fetch vtn switch inventory
90     [Arguments]    ${sw_name}
91     [Documentation]    Check if Switch is detected.
92     ${resp}=    RequestsLibrary.Get Request    session    restconf/operational/vtn-inventory:vtn-nodes/vtn-node/${sw_name}
93     Should Be Equal As Strings    ${resp.status_code}    200
94
95 Collect Debug Info
96     [Documentation]    Check if Switch is detected.
97     write    ${DUMPFLOWS_OF10}
98     ${result}    Read Until    mininet>
99     write    ${DUMPFLOWS_OF13}
100     ${result}    Read Until    mininet>
101     Get Model Dump    ${ODL_SYSTEM_IP}
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     MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_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     MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_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     MininetKeywords.Stop Mininet And Exit
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'    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_IP}    ${vlan_topo_13}    ${CURDIR}/${CREATE_VLAN_TOPOLOGY_FILE_PATH}
255     ...    ELSE IF    '${OF}' == 'OF10'    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_IP}    ${vlan_topo_10}
256     ...    ${CURDIR}/${CREATE_VLAN_TOPOLOGY_FILE_PATH}
257
258 Get flow
259     [Arguments]    ${vtn_name}
260     [Documentation]    Get data flow.
261     ${resp}=    RequestsLibrary.Get Request    session    restconf/operational/vtn-flow-impl:vtn-flows/vtn-flow-table/${vtn_name}
262     Should Be Equal As Strings    ${resp.status_code}    200
263
264 Remove a portmap
265     [Arguments]    ${vtn_name}    ${vBridge_name}    ${interface_name}
266     [Documentation]    Remove a portmap for a interface of a vbridge
267     ${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}}}
268     Should Be Equal As Strings    ${resp.status_code}    200
269
270 Verify FlowMacAddress
271     [Arguments]    ${host1}    ${host2}    ${OF_VERSION}
272     [Documentation]    Verify the source and destination mac address.
273     Run Keyword If    '${OF_VERSION}' == 'OF10'    Verify Flows On OpenFlow    ${host1}    ${host2}    ${FF_DUMPFLOWS_OF10}
274     ...    ELSE    VerifyFlowsOnOpenFlow    ${host1}    ${host2}    ${FF_DUMPFLOWS_OF13}
275
276 Verify Flows On OpenFlow
277     [Arguments]    ${host1}    ${host2}    ${DUMPFLOWS}
278     [Documentation]    Verify the mac addresses on the specified open flow.
279     ${booleanValue}=    Run Keyword And Return Status    Verify macaddress    ${host1}    ${host2}    ${DUMPFLOWS}
280     Should Be Equal As Strings    ${booleanValue}    True
281
282 Verify RemovedFlowMacAddress
283     [Arguments]    ${host1}    ${host2}    ${OF_VERSION}
284     [Documentation]    Verify the removed source and destination mac address.
285     Run Keyword If    '${OF_VERSION}' == 'OF10'    Verify Removed Flows On OpenFlow    ${host1}    ${host2}    ${FF_DUMPFLOWS_OF10}
286     ...    ELSE    Verify Removed Flows On OpenFlow    ${host1}    ${host2}    ${FF_DUMPFLOWS_OF13}
287
288 Verify Removed Flows On OpenFlow
289     [Arguments]    ${host1}    ${host2}    ${DUMPFLOWS}
290     [Documentation]    Verify the removed mac addresses on the specified open flow.
291     ${booleanValue}=    Run Keyword And Return Status    Verify macaddress    ${host1}    ${host2}    ${DUMPFLOWS}
292     Should Not Be Equal As Strings    ${booleanValue}    True
293
294 Verify macaddress
295     [Arguments]    ${host1}    ${host2}    ${DUMPFLOWS}
296     [Documentation]    Verify the source and destination mac address after ping in the dumpflows
297     write    ${host1} ifconfig -a | grep HWaddr
298     ${sourcemacaddr}    Read Until    mininet>
299     ${macaddress}=    Split String    ${sourcemacaddr}    ${SPACE}
300     ${sourcemacaddr}=    Get from List    ${macaddress}    ${index}
301     ${sourcemacaddress}=    Convert To Lowercase    ${sourcemacaddr}
302     write    ${host2} ifconfig -a | grep HWaddr
303     ${destmacaddr}    Read Until    mininet>
304     ${macaddress}=    Split String    ${destmacaddr}    ${SPACE}
305     ${destmacaddr}=    Get from List    ${macaddress}    ${index}
306     ${destmacaddress}=    Convert To Lowercase    ${destmacaddr}
307     write    ${DUMPFLOWS}
308     ${result}    Read Until    mininet>
309     Should Contain    ${result}    ${sourcemacaddress}
310     Should Contain    ${result}    ${destmacaddress}
311
312 Verify flowactions
313     [Arguments]    ${actions}    ${DUMPFLOWS}
314     [Documentation]    Verify the flowfilter actions after ping in the dumpflows
315     write    ${DUMPFLOWS}
316     ${result}    Read Until    mininet>
317     Run Keyword If    '${actions}' == 'set_field:32->ip_dscp' and '${ODL_STREAM}' == 'beryllium'    Should Contain    ${result}    ${dscp_be_action}
318     ...    ELSE    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