2 Documentation Test suite with independent flow tests
3 Library OperatingSystem
8 Library ../../../../csit/libraries/XmlComparator.py
9 Variables ../../../../csit/variables/Variables.py
10 Library ../../../../csit/libraries/RequestsLibrary.py
11 Library ../../../../csit/libraries/Common.py
12 Suite Setup Init Phase 3
13 Suite Teardown Stop Phase
16 ${XmlsDir}= ${CURDIR}/../../../../csit/variables/xmls
18 ${switch_name}= s${switch_idx}
22 [Documentation] Adding flow with barrier set to true
23 [Teardown] Delete Flow
24 Init Flow Variables f1.xml
25 ${data}= Replace String ${data} <barrier>false</barrier> <barrier>true</barrier>
26 Set Suite Variable ${data}
30 Check Config Flow ${True} ${data}
31 Check Operational Table ${True} ${data}
32 Update With Delete And Add
33 [Documentation] Updates a flow by changing priority which causes delete and add flow reaction
34 [Teardown] Delete Flow
35 Init Flow Variables f2.xml
39 Check Config Flow ${True} ${data}
40 Check Operational Table ${True} ${data}
41 ${upddata}= Replace String ${data} <priority>2</priority> <priority>3</priority>
42 Set Suite Variable ${upddata}
46 Check Config Flow ${True} ${upddata}
47 Check Operational Table ${True} ${upddata}
50 Init Phase [Arguments] ${swnr}
51 [Documentation] Starts mininet with requested number of switches (${swnr})
52 Log Starting mininet with ${swnr} switches
53 Open Connection ${MININET} prompt=>
54 Login With Public Key ${MININET_USER} ${USER_HOME}/.ssh/id_rsa any
55 Set Client Configuration timeout=600
56 Write sudo ovs-vsctl set-manager ptcp:6644
59 Write sudo mn --controller=remote,ip=${CONTROLLER} --topo linear,${swnr} --switch ovsk,protocols=OpenFlow13
61 Create Session session http://${CONTROLLER}:${PORT} auth=${AUTH} headers=${HEADERS_XML}
63 [Documentation] Stops mininet
71 Init Flow Variables [Arguments] ${file}
72 ${data}= OperatingSystem.Get File ${XmlsDir}/${file}
73 ${xmlroot}= Parse Xml ${XmlsDir}/${file}
74 ${table_id}= Get Element Text ${xmlroot} table_id
75 ${flow_id}= Get Element Text ${xmlroot} id
76 ${flow_priority}= Get Element Text ${xmlroot} priority
77 ${upddata}= Get Data For Flow Put Update ${data}
78 Set Suite Variable ${table_id}
79 Set Suite Variable ${flow_id}
80 Set Suite Variable ${flow_priority}
81 Set Suite Variable ${data}
82 Set Suite Variable ${upddata}
83 Set Suite Variable ${xmlroot}
84 Check Config Flow [Arguments] ${expected} ${expvalue}
85 ${presence_flow} ${msg}= Flow Presence Config Flow ${expvalue}
86 ${msgf}= Get Presence Failure Message config ${expected} ${presence_flow} ${msg}
87 Should Be Equal ${expected} ${presence_flow} msg=${msgf}
88 Flow Presence Config Flow [Arguments] ${expvalue}
89 ${headers}= Create Dictionary Accept application/xml
90 ${resp}= Get session /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} headers=${headers}
93 Return From Keyword If ${resp.status_code}!=200 ${False} ${EMPTY}
94 ${pres} ${msg}= Is Flow Configured ${expvalue} ${resp.content}
95 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
96 Return From Keyword ${pres} ${msg}
97 Check Operational Table [Arguments] ${expected} ${expvalue}
98 ${presence_table} ${msg}= Flow Presence Operational Table ${expvalue}
99 ${msgf}= Get Presence Failure Message operational ${expected} ${presence_table} ${msg}
100 Should Be Equal ${expected} ${presence_table} msg=${msgf}
101 Flow Presence Operational Table [Arguments] ${expvalue}
102 ${headers}= Create Dictionary Accept application/xml
103 ${resp}= Get session /restconf/operational/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id} headers=${headers}
106 Return From Keyword If ${resp.status_code}!=200 ${False} ${EMPTY}
107 ${pres} ${msg}= Is Flow Operational2 ${expvalue} ${resp.content}
108 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
109 Return From Keyword ${pres} ${msg}
112 ${resp}= Post session /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id} data=${data}
114 ${msg}= Set Variable Adding flow for /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received.
115 Should Be Equal As Strings ${resp.status_code} 204 msg=${msg}
118 ${resp}= Putxml session /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} data=${upddata}
120 ${msg}= Set Variable Updating flow for /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received.
121 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
123 ${resp}= Delete session /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id}
125 ${msg}= Set Variable Delete flow for /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received.
126 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
127 Get Presence Failure Message [Arguments] ${ds} ${expected} ${presence} ${diffmsg}
128 Return From Keyword If '''${diffmsg}'''!='${EMPTY}' Flow found in ${ds} data store but: ${diffmsg}
129 ${msgf}= Set Variable If ${expected}==${True} The flow is expected in ${ds} data store, but The flow is not expected in ${ds} data store, but
130 ${msgp}= Set Variable If ${presence}==${True} it is present. it is not present.
131 Return From Keyword ${msgf} ${msgp}
133 Write dpctl dump-flows -O OpenFlow13