2 Documentation OF1.3 Suite to cover TTL Actions
5 ... - Copy TTL outwards
8 ... - Decrement MPLS TTL
10 ... NOTE: for OVS, it appears that set_ttl, and both copy in/out are not supported, so need to skip those checks for now.
11 Suite Setup Create Session session http://${CONTROLLER}:8080 auth=${AUTH} headers=${HEADERS_XML}
12 Suite Teardown Delete All Sessions
13 Test Template Create And Remove Flow
16 Library OperatingSystem
19 Library ../../../libraries/RequestsLibrary.py
20 Library ../../../libraries/Common.py
21 Variables ../../../variables/Variables.py
24 ${REST_CON} /restconf/config/opendaylight-inventory:nodes
25 ${REST_OPR} /restconf/operational/opendaylight-inventory:nodes
26 ${GENERIC_ACTION_FLOW_FILE} ${CURDIR}/../../../variables/xmls/genericActionFlow.xml
27 ${MININET_CMD} sudo mn --controller=remote,ip=${CONTROLLER} --topo tree,1 --switch ovsk,protocols=OpenFlow13
29 *** Test Cases *** ODL flow action action XML tableID flowID verify OVS? OVS specific string?
30 Set_IP_TTL set-nw-ttl-action <nw-ttl>1</nw-ttl> 2 101 no set_ttl
32 Dec_TTL dec-nw-ttl none 3 305 yes dec_ttl
34 Copy_TTL_In copy-ttl-in none 9 202 no copy_ttl_in
36 Copy_TTL_Out copy-ttl-out none 8 909 no copy_ttl_out
38 Set_MPLS_TTL set-mpls-ttl-action <mpls-ttl>1</mpls-ttl> 4 505 yes set_mpls_ttl
40 Dec_MPLS_TTL dec-mpls-ttl none 2 1001 yes dec_mpls_ttl
43 Create And Remove Flow
44 [Arguments] ${flow_action} ${action_xml} ${table_id} ${flow_id} ${verify_switch_flag} ${additional_ovs_flowelements}
45 ${flow_body}= OperatingSystem.Get File ${GENERIC_ACTION_FLOW_FILE}
46 ${flow_body}= Replace String ${flow_body} FLOW_ACTION ${flow_action}
47 ${flow_body}= Replace String ${flow_body} FLOW_ID ${flow_id}
48 ${flow_body}= Replace String ${flow_body} TABLE_ID ${table_id}
50 ${flow_root}= Parse XML ${flow_body}
51 Run Keyword If "set" in "${flow_action}" Add Element ${flow_root} ${action_xml} xpath=instructions/instruction/apply-actions/action/${flow_action}
52 ${nw_src}= Get Element ${flow_root} match/ipv4-source
53 ${nw_dst}= Get Element ${flow_root} match/ipv4-destination
54 ${eth_src}= Get Element ${flow_root} match/ethernet-match/ethernet-source/address
55 ${eth_dst}= Get Element ${flow_root} match/ethernet-match/ethernet-destination/address
56 @{OVS_FLOWELEMENTS} Create List dl_dst=${eth_dst.text} table=${table_id} dl_src=${eth_src.text} nw_src=${nw_src.text} nw_dst=${nw_dst.text}
57 ... ${additional_ovs_flowelements}
58 ${flow_data}= Element To String ${flow_root}
60 Add Flow To Controller And Verify ${flow_data} ${table_id} ${flow_id}
61 Run Keyword If "${verify_switch_flag}" == "yes" Verify Flow On Switch ${OVS_FLOWELEMENTS}
62 Remove Flow From Controller And Verify ${flow_body} ${table_id} ${flow_id}
63 Run Keyword If "${verify_switch_flag}" == "yes" Verify Flow Does Not Exist On Switch ${OVS_FLOWELEMENTS}
65 Add Flow To Controller And Verify
66 [Arguments] ${flow_body} ${table_id} ${flow_id}
67 [Documentation] Push flow through REST-API and verify in data-store
68 ${resp} Put Xml session ${REST_CON}/node/openflow:1/table/${table_id}/flow/${flow_id} data=${flow_body}
70 Should Be Equal As Strings ${resp.status_code} 200
71 ${resp} get session ${REST_CON}/node/openflow:1/table/${table_id}/flow/${flow_id} headers=${ACCEPT_XML}
73 Should Be Equal As Strings ${resp.status_code} 200
74 compare xml ${flow_body} ${resp.content}
77 [Arguments] ${flow_elements}
78 [Documentation] Checking flow on switch
80 write dpctl dump-flows -O OpenFlow13
81 ${switchoutput} Read Until >
82 : FOR ${flowElement} IN @{flow_elements}
83 \ should Contain ${switchoutput} ${flowElement}
85 Remove Flow From Controller And Verify
86 [Arguments] ${flow_body} ${table_id} ${flow_id}
87 [Documentation] Remove flow
88 ${resp} Delete session ${REST_CON}/node/openflow:1/table/${table_id}/flow/${flow_id}
90 Should Be Equal As Strings ${resp.status_code} 200
91 ${resp} Get session ${REST_CON}/node/openflow:1/table/${table_id}
93 Should Not Contain ${resp.content} ${flow_id}
95 Verify Flow Does Not Exist On Switch
96 [Arguments] ${flow_elements}
97 [Documentation] Checking flow on switch is removed
99 write dpctl dump-flows -O OpenFlow13
100 ${switchoutput} Read Until >
101 : FOR ${flowElement} IN @{flow_elements}
102 \ should Not Contain ${switchoutput} ${flowElement}