Modification on SFC 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 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
174 Add a pathmap
175     [Arguments]    ${pathmap_data}
176     [Documentation]    Create a pathmap for a vtn
177     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-path-map:set-path-map    data=${pathmap_data}
178     Should Be Equal As Strings    ${resp.status_code}    200
179
180 Get a pathmap
181     [Documentation]    Get a pathmap for a vtn.
182     ${resp}=    RequestsLibrary.Get Request    session    restconf/operational/vtn-path-map:global-path-maps
183     : FOR    ${pathElement}    IN    @{PATHMAP_ATTR}
184     \    should Contain    ${resp.content}    ${pathElement}
185
186 Add a pathpolicy
187     [Arguments]    ${pathpolicy_data}
188     [Documentation]    Create a pathpolicy for a vtn
189     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-path-policy:set-path-policy    data=${pathpolicy_data}
190     Should Be Equal As Strings    ${resp.status_code}    200
191
192 Get a pathpolicy
193     [Arguments]    ${pathpolicy_id}
194     [Documentation]    Get a pathpolicy for a vtn.
195     ${resp}=    RequestsLibrary.Get Request    session    restconf/operational/vtn-path-policy:vtn-path-policies/vtn-path-policy/${pathpolicy_id}
196     : FOR    ${pathpolicyElement}    IN    @{PATHPOLICY_ATTR}
197     \    should Contain    ${resp.content}    ${pathpolicyElement}
198
199 Delete a pathmap
200     [Arguments]    ${tenant_path}
201     [Documentation]    Remove a pathmap for a vtn
202     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-path-map:remove-path-map    data={"input":{"tenant-name":"${tenant_path}","map-index":["${policy_id}"]}}
203     Should Be Equal As Strings    ${resp.status_code}    200
204
205 Delete a pathpolicy
206     [Arguments]    ${policy_id}
207     [Documentation]    Delete a pathpolicy for a vtn
208     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-path-policy:remove-path-policy    data={"input":{"id":"${policy_id}"}}
209     Should Be Equal As Strings    ${resp.status_code}    200
210
211 Verify flowEntryPathPolicy
212     [Arguments]    ${of_version}    ${port}    ${output}
213     [Documentation]    Checking Flows on switch S1 and switch S3 after applying path policy
214     ${DUMPFLOWS}=    Set Variable If    "${of_version}"=="OF10"    ${DUMPFLOWS_OF10}    ${DUMPFLOWS_OF13}
215     write    ${DUMPFLOWS}
216     ${result}    Read Until    mininet>
217     Should Contain    ${result}    in_port=${port}    actions=${output}
218
219 Add a macmap
220     [Arguments]    ${vtn_name}    ${vBridge_name}    ${src_add}    ${dst_add}
221     [Documentation]    Create a macmap for a vbridge
222     ${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}"}}
223     Should Be Equal As Strings    ${resp.status_code}    200
224
225 Get DynamicMacAddress
226     [Arguments]    ${h}
227     [Documentation]    Get Dynamic mac address of Host
228     write    ${h} ifconfig -a | grep HWaddr
229     ${source}    Read Until    mininet>
230     ${HWaddress}=    Split String    ${source}    ${SPACE}
231     ${sourceHWaddr}=    Get from List    ${HWaddress}    ${index}
232     ${sourceHWaddress}=    Convert To Lowercase    ${sourceHWaddr}
233     Return From Keyword    ${sourceHWaddress}    # Also [Return] would work here.
234
235 Mininet Ping Should Succeed
236     [Arguments]    ${host1}    ${host2}
237     [Documentation]    Ping hosts to check connectivity
238     Write    ${host1} ping -c 1 ${host2}
239     ${result}    Read Until    mininet>
240     Should Contain    ${result}    64 bytes
241
242 Mininet Ping Should Not Succeed
243     [Arguments]    ${host1}    ${host2}
244     [Documentation]    Ping hosts when there is no connectivity and check hosts is unreachable
245     Write    ${host1} ping -c 3 ${host2}
246     ${result}    Read Until    mininet>
247     Should Not Contain    ${result}    64 bytes
248
249 Start vlan_topo
250     [Arguments]    ${OF}
251     [Documentation]    Create custom topology for vlan functionality
252     Install Package On Ubuntu System    vlan
253     Run Keyword If    '${OF}' == 'OF13'    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_IP}    ${vlan_topo}    ${CURDIR}/${CREATE_VLAN_TOPOLOGY_FILE_PATH}
254     ...    ofversion=13
255     ...    ELSE IF    '${OF}' == 'OF10'    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_IP}    ${vlan_topo}
256     ...    ${CURDIR}/${CREATE_VLAN_TOPOLOGY_FILE_PATH}    ofversion=10
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     Should Contain    ${result}    ${actions}
318
319 Add a vtn flowfilter
320     [Arguments]    ${vtn_name}    ${vtnflowfilter_data}
321     [Documentation]    Create a flowfilter for a vtn
322     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-flow-filter:set-flow-filter    data={"input": {"tenant-name": "${vtn_name}",${vtnflowfilter_data}}}
323     Should Be Equal As Strings    ${resp.status_code}    200
324
325 Remove a vtn flowfilter
326     [Arguments]    ${vtn_name}    ${filter_index}
327     [Documentation]    Delete a vtn flowfilter
328     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-flow-filter:remove-flow-filter    data={"input": {"indices": ["${filter_index}"], "tenant-name": "${vtn_name}"}}
329     Should Be Equal As Strings    ${resp.status_code}    200
330
331 Add a vbr flowfilter
332     [Arguments]    ${vtn_name}    ${vBridge_name}    ${vbrflowfilter_data}
333     [Documentation]    Create a flowfilter for a vbr
334     ${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}}}
335     Should Be Equal As Strings    ${resp.status_code}    200
336
337 Remove a vbr flowfilter
338     [Arguments]    ${vtn_name}    ${vBridge_name}    ${filter_index}
339     [Documentation]    Delete a vbr flowfilter
340     ${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}"}}
341     Should Be Equal As Strings    ${resp.status_code}    200
342
343 Add a vbrif flowfilter
344     [Arguments]    ${vtn_name}    ${vBridge_name}    ${interface_name}    ${vbrif_flowfilter_data}
345     [Documentation]    Create a flowfilter for a vbrif
346     ${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}}}
347     Should Be Equal As Strings    ${resp.status_code}    200
348
349 Remove a vbrif flowfilter
350     [Arguments]    ${vtn_name}    ${vBridge_name}    ${interface_name}    ${filter_index}
351     [Documentation]    Delete a vbrif flowfilter
352     ${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}"}}
353     Should Be Equal As Strings    ${resp.status_code}    200
354
355 Add a vlan portmap
356     [Arguments]    ${vtn_name}    ${vbr_name}    ${interface_name}    ${id}    ${node_id}    ${port_id}
357     [Documentation]    Create a portmap for a interface of a vbridge
358     ${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}"}}
359     Should Be Equal As Strings    ${resp.status_code}    200
360
361 Verify Flow Entries for Flowfilter
362     [Arguments]    ${dumpflows}    @{flowfilter_actions}
363     [Documentation]    Verify switch flow entry using flowfilter for a vtn
364     ${booleanValue}=    Run Keyword And Return Status    Verify Actions on Flow Entry    ${dumpflows}    @{flowfilter_actions}
365     Should Be Equal As Strings    ${booleanValue}    True
366
367 Verify Removed Flow Entry for Inet Drop Flowfilter
368     [Arguments]    ${dumpflows}    @{flowfilter_actions}
369     [Documentation]    Verify removed switch flow entry using flowfilter drop for a vtn
370     ${booleanValue}=    Run Keyword And Return Status    Verify Actions on Flow Entry    ${dumpflows}    @{flowfilter_actions}
371     Should Be Equal As Strings    ${booleanValue}    True
372
373 Verify Actions on Flow Entry
374     [Arguments]    ${dumpflows}    @{flowfilter_actions}
375     [Documentation]    check flow action elements by giving dumpflows in mininet
376     write    ${dumpflows}
377     ${result}    Read Until    mininet>
378     : FOR    ${flowElement}    IN    @{flowfilter_actions}
379     \    should Contain    ${result}    ${flowElement}
380
381 Add a flowcondition
382     [Arguments]    ${flowcond_name}    ${flowconditiondata}
383     [Documentation]    Create a flowcondition using Restconfig Api
384     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-flow-condition:set-flow-condition    data={"input":{"operation":"SET","present":"false","name":"${flowcond_name}",${flowconditiondata}}}
385     Should Be Equal As Strings    ${resp.status_code}    200
386
387 Get flowconditions
388     [Documentation]    Retrieve the list of flowconditions created
389     ${resp}=    RequestsLibrary.Get Request    session    restconf/operational/vtn-flow-condition:vtn-flow-conditions
390     Should Be Equal As Strings    ${resp.status_code}    200
391
392 Get flowcondition
393     [Arguments]    ${flowcond_name}    ${retrieve}
394     [Documentation]    Retrieve the flowcondition by name and to check the removed flowcondition we added "retrieve" argument to differentiate the status code,
395     ...    since after removing flowcondition name the status will be different compare to status code when the flowcondition name is present.
396     ${resp}=    RequestsLibrary.Get Request    session    restconf/operational/vtn-flow-condition:vtn-flow-conditions/vtn-flow-condition/${flowcond_name}
397     Run Keyword If    '${retrieve}' == 'retrieve'    Should Be Equal As Strings    ${resp.status_code}    200
398     ...    ELSE    Should Not Be Equal As Strings    ${resp.status_code}    200
399
400 Remove flowcondition
401     [Arguments]    ${flowcond_name}
402     [Documentation]    Remove the flowcondition by name
403     ${resp}=    RequestsLibrary.Post Request    session    restconf/operations/vtn-flow-condition:remove-flow-condition    data={"input":{"name":"${flowcond_name}"}}
404     Should Be Equal As Strings    ${resp.status_code}    200