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