Library FlowLib.py
Library XmlComparator.py
Library Common.py
-Variables ../variables/Variables.py
+Resource CompareStream.robot
Resource ../variables/openflowplugin/Variables.robot
+Variables ../variables/Variables.py
*** Keywords ***
Check No Switches In Inventory
Should Contain ${resp.text} "source-tp":"openflow:${switch}:2"
Should Contain ${resp.text} "dest-tp":"openflow:${switch}:2"
${edge} Evaluate ${switch}==1 or ${switch}==${switches}
- Run Keyword Unless ${edge} Should Contain ${resp.text} "tp-id":"openflow:${switch}:3"
- Run Keyword Unless ${edge} Should Contain ${resp.text} "source-tp":"openflow:${switch}:3"
- Run Keyword Unless ${edge} Should Contain ${resp.text} "dest-tp":"openflow:${switch}:3"
+ Run Keyword If not ${edge} Should Contain ${resp.text} "tp-id":"openflow:${switch}:3"
+ Run Keyword If not ${edge} Should Contain ${resp.text} "source-tp":"openflow:${switch}:3"
+ Run Keyword If not ${edge} Should Contain ${resp.text} "dest-tp":"openflow:${switch}:3"
END
Check Flows Operational Datastore
Check Flow Stats Are Available
[Arguments] ${node_id} ${flows}
[Documentation] A GET on the /node=${node_id} inventory API is made and flow stats string is checked for existence.
- ${resp} RequestsLibrary.Get Request session ${RFC8040_NODES_API}/node=${node_id}/table=2
+ ${resp} RequestsLibrary.Get Request session ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:table=2
Log ${resp.text}
Should Be Equal As Strings ${resp.status_code} 200
Should Contain X Times ${resp.text} priority ${flows}
${switches}= Convert To Integer ${switches}
${data}= OperatingSystem.Get File ${CURDIR}/../variables/openflowplugin/table_miss_flow.json
FOR ${switch} IN RANGE 1 ${switches+1}
- TemplatedRequests.Put As Json To Uri ${RFC8040_NODES_API}/node=openflow%3A${switch}/table=0/flow=default ${data} session
+ TemplatedRequests.Put As Json To Uri ${RFC8040_NODES_API}/node=openflow%3A${switch}/flow-node-inventory:table=0/flow=default ${data} session
END
Check Table Miss Flows
[Documentation] Check table miss flows in switches.
${switches}= Convert To Integer ${switches}
FOR ${switch} IN RANGE 1 ${switches+1}
- TemplatedRequests.Get As Json From Uri ${RFC8040_NODES_API}/node=openflow%3A${switch}/table=0/flow=default session
+ TemplatedRequests.Get As Json From Uri ${RFC8040_NODES_API}/node=openflow%3A${switch}/flow-node-inventory:table=0/flow=default session
END
Create Inventory Flow
Add Group To Controller And Verify
[Arguments] ${group_body} ${node_id} ${group_id}
[Documentation] Push group through REST-API and verify in data-store
- ${resp} RequestsLibrary.Put Request session ${RFC8040_NODES_API}/node=${node_id}/group=${group_id} headers=${HEADERS_XML} data=${group_body}
+ ${resp} RequestsLibrary.Put Request session ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:group=${group_id} headers=${HEADERS_XML} data=${group_body}
Log ${resp.text}
BuiltIn.Should_Match "${resp.status_code}" "20?"
- ${resp} RequestsLibrary.Get Request session ${RFC8040_NODES_API}/node=${node_id}/group=${group_id}?content=config headers=${ACCEPT_XML}
+ ${resp} RequestsLibrary.Get Request session ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:group=${group_id}?content=config headers=${ACCEPT_XML}
Log ${resp.text}
Should Be Equal As Strings ${resp.status_code} 200
Compare Xml ${group_body} ${resp.text}
Add Flow To Controller And Verify
[Arguments] ${flow_body} ${node_id} ${table_id} ${flow_id}
[Documentation] Push flow through REST-API and verify in data-store
- ${resp} RequestsLibrary.Put Request session ${RFC8040_NODES_API}/node=${node_id}/table=${table_id}/flow=${flow_id} headers=${HEADERS_XML} data=${flow_body}
+ ${resp} RequestsLibrary.Put Request session ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id} headers=${HEADERS_XML} data=${flow_body}
Log ${resp.text}
BuiltIn.Should_Match "${resp.status_code}" "20?"
- ${resp} RequestsLibrary.Get Request session ${RFC8040_NODES_API}/node=${node_id}/table=${table_id}/flow=${flow_id}?content=config headers=${ACCEPT_XML}
+ ${resp} RequestsLibrary.Get Request session ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id}?content=config headers=${ACCEPT_XML}
Log ${resp.text}
Should Be Equal As Strings ${resp.status_code} 200
Compare Xml ${flow_body} ${resp.text}
Remove Group From Controller And Verify
[Arguments] ${node_id} ${group_id}
[Documentation] Remove group and verify
- ${resp} RequestsLibrary.Delete Request session ${RFC8040_NODES_API}/node=${node_id}/group=${group_id}
+ ${resp} RequestsLibrary.Delete Request session ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:group=${group_id}
Log ${resp.text}
Should Be Equal As Strings ${resp.status_code} 204
- ${resp} RequestsLibrary.Get Request session ${RFC8040_NODES_API}/node=${node_id}/group=${group_id}?content=config
+ ${resp} RequestsLibrary.Get Request session ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:group=${group_id}?content=config
Builtin.Return_From_Keyword_If ${resp.status_code} == 404 or ${resp.status_code} == 409
Builtin.Log ${resp.text}
Builtin.Fail The request failed with code ${resp.status_code}
Remove Flow From Controller And Verify
[Arguments] ${node_id} ${table_id} ${flow_id}
[Documentation] Remove flow and verify
- ${resp} RequestsLibrary.Delete Request session ${RFC8040_NODES_API}/node=${node_id}/table=${table_id}/flow=${flow_id}
+ ${resp} RequestsLibrary.Delete Request session ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id}
Log ${resp.text}
Should Be Equal As Strings ${resp.status_code} 204
- ${resp} RequestsLibrary.Get Request session ${RFC8040_NODES_API}/node=${node_id}/table=${table_id}/flow=${flow_id}?content=config
+ ${resp} RequestsLibrary.Get Request session ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id}?content=config
Builtin.Return_From_Keyword_If ${resp.status_code} == 404 or ${resp.status_code} == 409
Builtin.Log ${resp.text}
Builtin.Fail The request failed with code ${resp.status_code}
[Documentation] Checks the config store for given flow. Returns True if present, otherwise returns False
... This keyword assumes that the global/suite variables are available (${table_id}, ${flow_id} and ${switch_idx}
${headers}= Create Dictionary Accept=application/xml
- ${resp}= RequestsLibrary.Get Request session ${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/table=${table_id}/flow=${flow_id}?content=config headers=${headers}
+ ${resp}= RequestsLibrary.Get Request session ${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}/flow=${flow_id}?content=config headers=${headers}
Log ${resp}
Log ${resp.text}
Return From Keyword If ${resp.status_code}!=200 ${False} ${EMPTY}
[Documentation] Checks the operational store for given flow. Returns True if present, otherwise returns False
... This keyword assumes that the global/suite variables are available (${table_id}, ${flow_id} and ${switch_idx}
${headers}= Create Dictionary Accept=application/xml
- ${resp}= RequestsLibrary.Get Request session ${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/table=${table_id} headers=${headers}
+ ${resp}= RequestsLibrary.Get Request session ${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id} headers=${headers}
Log ${resp}
Log ${resp.text}
Return From Keyword If ${resp.status_code}!=200 ${False} ${EMPTY}
${strxml}= Element To String ${req}
${resp}= RequestsLibrary.Post Request session /rests/operations/sal-flow:add-flow data=${strxml}
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
+ ${expected_status_code}= CompareStream.Set_Variable_If_At_Least_Phosphorus 204 200
+ Log ${expected_status_code}
+ Should Be Equal As Strings ${resp.status_code} ${expected_status_code}
Add Flow Via Restconf
[Arguments] ${node_id} ${table_id} ${flow_body}
[Documentation] Configures a flow specified by given flow details (${node_id}, ${table_id}, ${flow_body}) using POST method
Log ${flow_body}
- ${resp}= RequestsLibrary.Post Request session ${RFC8040_NODES_API}/node=openflow%3A${node_id}/table=${table_id} data=${flow_body}
+ ${resp}= RequestsLibrary.Post Request session ${RFC8040_NODES_API}/node=openflow%3A${node_id}/flow-node-inventory:table=${table_id} data=${flow_body}
Log ${resp.text}
- ${msg}= Set Variable Adding flow for ${RFC8040_NODES_API}/node=openflow%3A${node_id}/table=${table_id} failed, http response ${resp.status_code} received.
+ ${msg}= Set Variable Adding flow for ${RFC8040_NODES_API}/node=openflow%3A${node_id}/flow-node-inventory:table=${table_id} failed, http response ${resp.status_code} received.
Should Be Equal As Strings ${resp.status_code} 201 msg=${msg}
Update Flow Via RPC
${strxml}= Element To String ${xml}
${resp}= RequestsLibrary.Post Request session /rests/operations/sal-flow:update-flow data=${strxml}
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
+ ${expected_status_code}= CompareStream.Set_Variable_If_At_Least_Phosphorus 204 200
+ Log ${expected_status_code}
+ Should Be Equal As Strings ${resp.status_code} ${expected_status_code}
Update Flow Via Restconf
[Arguments] ${node_id} ${table_id} ${flow_id} ${flow_body}
[Documentation] Updates a flow configuration by given flow details (${node_id}, ${table_id}, ${flow_body}) using PUT method
Log ${flow_body}
- ${resp}= RequestsLibrary.Put Request session ${RFC8040_NODES_API}/node=openflow%3A${node_id}/table=${table_id}/flow=${flow_id} data=${flow_body}
+ ${resp}= RequestsLibrary.Put Request session ${RFC8040_NODES_API}/node=openflow%3A${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id} data=${flow_body}
Log ${resp.text}
- ${msg}= Set Variable Updating flow for ${RFC8040_NODES_API}/node=openflow%3A${node_id}/table=${table_id}/flow=${flow_id} failed, http response ${resp.status_code} received.
+ ${msg}= Set Variable Updating flow for ${RFC8040_NODES_API}/node=openflow%3A${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id} failed, http response ${resp.status_code} received.
Should Be Equal As Strings ${resp.status_code} 204 msg=${msg}
Delete Flow Via RPC
${strxml}= Element To String ${req}
${resp}= RequestsLibrary.Post Request session /rests/operations/sal-flow:remove-flow data=${strxml}
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
+ ${expected_status_code}= CompareStream.Set_Variable_If_At_Least_Phosphorus 204 200
+ Log ${expected_status_code}
+ Should Be Equal As Strings ${resp.status_code} ${expected_status_code}
Delete Flow Via Restconf
[Arguments] ${node_id} ${table_id} ${flow_id}
[Documentation] Deletes a flow from configuration datastore specified by given flow details (${node_id}, ${table_id}, ${flow_body}) using DELETE method
- ${resp}= RequestsLibrary.Delete Request session ${RFC8040_NODES_API}/node=openflow%3A${node_id}/table=${table_id}/flow=${flow_id}
+ ${resp}= RequestsLibrary.Delete Request session ${RFC8040_NODES_API}/node=openflow%3A${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id}
Log ${resp.text}
- ${msg}= Set Variable Delete flow for ${RFC8040_NODES_API}/node=openflow%3A${node_id}/table=${table_id}/flow=${flow_id} failed, http response ${resp.status_code} received.
+ ${msg}= Set Variable Delete flow for ${RFC8040_NODES_API}/node=openflow%3A${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id} failed, http response ${resp.status_code} received.
Should Be Equal As Strings ${resp.status_code} 204 msg=${msg}
Get Flow Id
[Arguments] ${dpnid} ${table_id} ${flow_element}
[Documentation] This verifies specific flow-id for particular table-id matching from the flow element
- ${resp} = RequestsLibrary.Get Request session ${RFC8040_NODES_API}/node=openflow%3A${dpnid}/table=${table_id}?content=config
+ ${resp} = RequestsLibrary.Get Request session ${RFC8040_NODES_API}/node=openflow%3A${dpnid}/flow-node-inventory:table=${table_id}?content=config
BuiltIn.Log ${resp.text}
@{flow_id} = String.Get Regexp Matches ${resp.text} id\":\"(\\d+${flow_element}) 1
[Return] @{flow_id}[0]