... with a single bulkomatic API we can trigger bulk flows in config datastore which eventually populates switches and operational datastore
... So far this library is only to be used by MD-SAL clustering and OpenFlowplugin clustering test as it is very specific for these tests
+Resource ClusterManagement.robot
Resource Utils.robot
Variables ../variables/Variables.py
[Documentation] Checks to see if read or write operation is successfull in controller node.
[Arguments] ${op_status_uri} ${controller_index}
${data}= ClusterManagement.Get From Member ${op_status_uri} ${controller_index}
- ${json}= To Json ${data}
+ ${json}= Utils.Json Parse From String ${data}
${value}= Get From Dictionary ${json} value
${value}= Convert to String ${value}
${two}= Convert to String 2
[Documentation] Verify Flow Count in member ${controller_index} matches ${flow_count}.
[Arguments] ${flow_count} ${controller_index}
${data}= Get Bulk Flow Count ${controller_index}
- ${json}= To Json ${data}
+ ${json}= Utils.Json Parse From String ${data}
${value}= Get From Dictionary ${json} value
Should Be Equal As Strings ${value} ${flow_count}
[Documentation] Check Linear topology.
[Arguments] ${switches} ${member_index}=1
${session}= Resolve_Http_Session_For_Member member_index=${member_index}
- ${resp}= RequestsLibrary.Get Request ${session} ${RFC8040_OPERATIONAL_TOPO_API}
+ ${resp}= RequestsLibrary.GET On Session
+ ... ${session}
+ ... url=${RFC8040_OPERATIONAL_TOPO_API}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
FOR ${switch} IN RANGE 1 ${switches+1}
Should Contain ${resp.text} "node-id":"openflow:${switch}"
Should Contain ${resp.text} "tp-id":"openflow:${switch}:1"
[Documentation] Check no switch is in topology
[Arguments] ${switches} ${member_index}=1
${session}= Resolve_Http_Session_For_Member member_index=${member_index}
- ${resp}= RequestsLibrary.Get Request ${session} ${RFC8040_OPERATIONAL_TOPO_API}
+ ${resp}= RequestsLibrary.GET On Session
+ ... ${session}
+ ... url=${RFC8040_OPERATIONAL_TOPO_API}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
FOR ${switch} IN RANGE 1 ${switches+1}
Should Not Contain ${resp.text} openflow:${switch}
END
[Documentation] Check number of flows in the inventory.
[Arguments] ${flows} ${member_index}=1
${session}= Resolve_Http_Session_For_Member member_index=${member_index}
- ${resp}= RequestsLibrary.Get Request ${session} ${RFC8040_OPERATIONAL_NODES_API}
+ ${resp}= RequestsLibrary.GET On Session
+ ... ${session}
+ ... url=${RFC8040_OPERATIONAL_NODES_API}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
${count}= Get Count ${resp.text} "priority"
Should Be Equal As Integers ${count} ${flows}
[Documentation] Check number of groups in the inventory.
[Arguments] ${groups} ${member_index}=1
${session}= Resolve_Http_Session_For_Member member_index=${member_index}
- ${resp}= RequestsLibrary.Get Request ${session} ${RFC8040_OPERATIONAL_NODES_API}
+ ${resp}= RequestsLibrary.GET On Session
+ ... ${session}
+ ... url=${RFC8040_OPERATIONAL_NODES_API}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
${group_count}= Get Count ${resp.text} "group-type"
Should Be Equal As Integers ${group_count} ${groups}
... debug a list of data models.
Library RequestsLibrary
+Resource Utils.robot
*** Variables ***
*** Keywords ***
Get Model Dump
[Documentation] Will output a list of mdsal models using ${data_models} list
- [Arguments] ${controller_ip} ${data_models}=@{internal_data_models} ${restconf_root}=restconf
+ [Arguments] ${controller_ip} ${data_models}=@{internal_data_models} ${restconf_root}=rests
# while feature request in bug 7892 is not done, we will quickly timeout and not retry the model dump get
# request. This is because when it's done in a failed cluster state, it could take 20s for the reesponse to
# to come back as the internal clustering times out waiting for a leader which will not come. When bug 7892
... timeout=1
... max_retries=0
FOR ${model} IN @{data_models}
- ${resp}= RequestsLibrary.Get Request model_dump_session ${restconf_root}/${model}
- ${pretty_output}= To Json ${resp.text} pretty_print=True
- Log ${pretty_output}
+ ${resp}= RequestsLibrary.GET On Session model_dump_session url=${restconf_root}/${model}
+ Utils.Log Content ${resp.text}
END
Verify No Ingress Dispatcher Non-Default Flow Entries
[Documentation] Verify the ingress dispatcher table has no non-default flows after neutron was cleaned up
[Arguments] ${ovs_ip}
- ${flow_output}= Run Command On Remote System
+ ${flow_output}= Utils.Run Command On Remote System
... ${ovs_ip}
... sudo ovs-ofctl -O OpenFlow13 dump-flows ${INTEGRATION_BRIDGE} table=${DISPATCHER_TABLE} | grep -v "priority=0"
Log ${flow_output}
... cookie and barrier fields, string formatted xml that can be used to push to
... controller). TODO: Remove hard dependency on controller HTTP "session".
-Library XML
-Library String
+Library OperatingSystem
Library RequestsLibrary
-Library ScaleClient.py
+Library String
+Library XML
+Library Common.py
Library FlowLib.py
+Library ScaleClient.py
Library XmlComparator.py
-Library Common.py
Resource CompareStream.robot
+Resource TemplatedRequests.robot
Resource ../variables/openflowplugin/Variables.robot
Variables ../variables/Variables.py
Check No Switches In Inventory
[Documentation] Check no switch is in inventory
[Arguments] ${switches}
- ${resp}= RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_NODES_API}
+ ${resp}= RequestsLibrary.GET On Session
+ ... session
+ ... url=${RFC8040_OPERATIONAL_NODES_API}
+ ... expected_status=200
Log ${resp.text}
FOR ${switch} IN RANGE 1 ${switches+1}
Should Not Contain ${resp.text} "openflow:${switch}"
Check No Switches In Topology
[Documentation] Check no switch is in topology
[Arguments] ${switches}
- ${resp}= RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_TOPO_API}
+ ${resp}= RequestsLibrary.GET On Session session url=${RFC8040_OPERATIONAL_TOPO_API} expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
FOR ${switch} IN RANGE 1 ${switches+1}
Should Not Contain ${resp.text} openflow:${switch}
END
[Documentation] Check all switches and stats in operational inventory
[Arguments] ${switches}
FOR ${switch} IN RANGE 1 ${switches+1}
- ${resp}= RequestsLibrary.Get Request session ${RFC8040_NODES_API}/node=openflow%3A${switch}
+ ${resp}= RequestsLibrary.GET On Session
+ ... session
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${switch}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.text} flow-capable-node-connector-statistics
Should Contain ${resp.text} flow-table-statistics
END
Check Switches In Topology
[Documentation] Check switches are in the topology.
[Arguments] ${switches}
- ${resp}= RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_TOPO_API}
+ ${resp}= RequestsLibrary.GET On Session session url=${RFC8040_OPERATIONAL_TOPO_API} expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
${count}= Get Count ${resp.text} "node-id":"openflow:
BuiltIn.Should Be Equal As Numbers ${count} ${switches}
Check Number Of Links
[Documentation] Check number of links in the topolgy.
[Arguments] ${links}
- ${resp}= RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_TOPO_API}
+ ${resp}= RequestsLibrary.GET On Session session url=${RFC8040_OPERATIONAL_TOPO_API} expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
${count}= Get Count ${resp.text} "link-id":"openflow:
Should Be Equal As Integers ${count} ${links}
Check Linear Topology
[Documentation] Check Linear topology.
[Arguments] ${switches}
- ${resp}= RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_TOPO_API}
+ ${resp}= RequestsLibrary.GET On Session session url=${RFC8040_OPERATIONAL_TOPO_API} expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
FOR ${switch} IN RANGE 1 ${switches+1}
Should Contain ${resp.text} "node-id":"openflow:${switch}"
Should Contain ${resp.text} "tp-id":"openflow:${switch}:1"
Check Number Of Flows
[Documentation] Check number of flows in the inventory.
[Arguments] ${flows}
- ${resp}= RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_NODES_API}
+ ${resp}= RequestsLibrary.GET On Session
+ ... session
+ ... url=${RFC8040_OPERATIONAL_NODES_API}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
${count}= Get Count ${resp.text} "priority"
Should Be Equal As Integers ${count} ${flows}
Check Number Of Groups
[Documentation] Check number of groups in the inventory.
[Arguments] ${groups}
- ${resp}= RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_NODES_API}
+ ${resp}= RequestsLibrary.GET On Session
+ ... session
+ ... url=${RFC8040_OPERATIONAL_NODES_API}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
${group_count}= Get Count ${resp.text} "group-type"
Should Be Equal As Integers ${group_count} ${groups}
Check Flow Stats Are Available
[Documentation] A GET on the /node=${node_id} inventory API is made and flow stats string is checked for existence.
[Arguments] ${node_id} ${flows}
- ${resp}= RequestsLibrary.Get Request
+ ${resp}= RequestsLibrary.GET On Session
... session
- ... ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:table=2
+ ... url=${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:table=2
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
Should Contain X Times ${resp.text} priority ${flows}
Check Number Of Hosts
[Documentation] Check number of hosts in topology
[Arguments] ${hosts}
- ${resp}= RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_TOPO_API}
+ ${resp}= RequestsLibrary.GET On Session session url=${RFC8040_OPERATIONAL_TOPO_API} expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
${count}= Get Count ${resp.text} "node-id":"host:
Should Be Equal As Integers ${count} ${hosts}
Check No Hosts
[Documentation] Check if all hosts are deleted from inventory
- ${resp}= RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_TOPO_API}
- Should Be Equal As Strings ${resp.status_code} 200
+ ${resp}= RequestsLibrary.GET On Session session url=${RFC8040_OPERATIONAL_TOPO_API} expected_status=200
Should Not Contain ${resp.text} "node-id":"host:
Add Table Miss Flows
Add Group To Controller And Verify
[Documentation] Push group through REST-API and verify in data-store
[Arguments] ${group_body} ${node_id} ${group_id}
- ${resp}= RequestsLibrary.Put Request
+ ${resp}= RequestsLibrary.PUT On Session
... session
- ... ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:group=${group_id}
+ ... url=${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
+ ${resp}= RequestsLibrary.GET On Session
... session
- ... ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:group=${group_id}?content=config
+ ... url=${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:group=${group_id}?content=config
... headers=${ACCEPT_XML}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
Compare Xml ${group_body} ${resp.text}
Add Flow To Controller And Verify
[Documentation] Push flow through REST-API and verify in data-store
[Arguments] ${flow_body} ${node_id} ${table_id} ${flow_id}
- ${resp}= RequestsLibrary.Put Request
+ ${resp}= RequestsLibrary.PUT On Session
... session
- ... ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id}
+ ... url=${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
+ ${resp}= RequestsLibrary.GET On Session
... session
- ... ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id}?content=config
+ ... url=${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id}?content=config
... headers=${ACCEPT_XML}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
Compare Xml ${flow_body} ${resp.text}
Verify Flow On Mininet Switch
Remove Group From Controller And Verify
[Documentation] Remove group and verify
[Arguments] ${node_id} ${group_id}
- ${resp}= RequestsLibrary.Delete Request
+ ${resp}= RequestsLibrary.DELETE On Session
... session
- ... ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:group=${group_id}
+ ... url=${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:group=${group_id}
+ ... expected_status=204
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 204
- ${resp}= RequestsLibrary.Get Request
+ ${resp}= RequestsLibrary.Get On Session
... session
- ... ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:group=${group_id}?content=config
+ ... url=${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:group=${group_id}?content=config
+ ... expected_status=anything
IF ${resp.status_code} == 404 or ${resp.status_code} == 409 RETURN
Builtin.Log ${resp.text}
Builtin.Fail The request failed with code ${resp.status_code}
Remove Flow From Controller And Verify
[Documentation] Remove flow and verify
[Arguments] ${node_id} ${table_id} ${flow_id}
- ${resp}= RequestsLibrary.Delete Request
+ ${resp}= RequestsLibrary.DELETE On Session
... session
- ... ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id}
+ ... url=${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id}
+ ... expected_status=204
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 204
- ${resp}= RequestsLibrary.Get Request
+ ${resp}= RequestsLibrary.Get On Session
... session
- ... ${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id}?content=config
+ ... url=${RFC8040_NODES_API}/node=${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id}?content=config
+ ... expected_status=anything
IF ${resp.status_code} == 404 or ${resp.status_code} == 409 RETURN
Builtin.Log ${resp.text}
Builtin.Fail The request failed with code ${resp.status_code}
write dpctl dump-flows -O OpenFlow13
${switchoutput}= Read Until >
${headers}= Create Dictionary Content-Type=application/yang-data+xml
- ${resp}= RequestsLibrary.Post Request
+ ${resp}= RequestsLibrary.POST On Session
... session
- ... rests/operations/sal-flow:remove-flow
+ ... url=rests/operations/sal-flow:remove-flow
... data=${flow.xml}
... headers=${headers}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
- ${resp}= RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_NODES_API}
+ ${resp}= RequestsLibrary.GET On Session session url=${RFC8040_OPERATIONAL_NODES_API}
Log ${resp.text}
Should Not Contain ${resp.text} "output-node-connector": "CONTROLLER",
${strings_to_check_for}= Create List CONTROLLER
... This keyword assumes that the global/suite variables are available (${table_id}, ${flow_id} and ${switch_idx}
[Arguments] ${expvalue}
${headers}= Create Dictionary Accept=application/xml
- ${resp}= RequestsLibrary.Get Request
+ ${resp}= RequestsLibrary.Get On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}/flow=${flow_id}?content=config
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}/flow=${flow_id}?content=config
... headers=${headers}
+ ... expected_status=anything
Log ${resp}
Log ${resp.text}
IF ${resp.status_code}!=200 RETURN ${False} ${EMPTY}
... This keyword assumes that the global/suite variables are available (${table_id}, ${flow_id} and ${switch_idx}
[Arguments] ${expvalue} ${check_id}=${False}
${headers}= Create Dictionary Accept=application/xml
- ${resp}= RequestsLibrary.Get Request
+ ${resp}= RequestsLibrary.Get On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}
... headers=${headers}
+ ... expected_status=anything
Log ${resp}
Log ${resp.text}
IF ${resp.status_code}!=200 RETURN ${False} ${EMPTY}
Set Element Attribute ${nodeelm} xmlns:inv urn:opendaylight:inventory
Log Element ${req}
${strxml}= Element To String ${req}
- ${resp}= RequestsLibrary.Post Request session /rests/operations/sal-flow:add-flow data=${strxml}
+ ${resp}= RequestsLibrary.POST On Session
+ ... session
+ ... url=/rests/operations/sal-flow:add-flow
+ ... data=${strxml}
+ ... expected_status=204
Log ${resp.text}
- ${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
[Documentation] Configures a flow specified by given flow details (${node_id}, ${table_id}, ${flow_body}) using POST method
[Arguments] ${node_id} ${table_id} ${flow_body}
Log ${flow_body}
- ${resp}= RequestsLibrary.Post Request
+ ${resp}= RequestsLibrary.POST On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${node_id}/flow-node-inventory:table=${table_id}
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${node_id}/flow-node-inventory:table=${table_id}
... data=${flow_body}
+ ... expected_status=201
Log ${resp.text}
- ${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
[Documentation] Updates a flow by using update-flow operation. ${xmlroot} is usually a variable created by
Set Element Attribute ${nodeelm} xmlns:inv urn:opendaylight:inventory
Log Element ${xml}
${strxml}= Element To String ${xml}
- ${resp}= RequestsLibrary.Post Request session /rests/operations/sal-flow:update-flow data=${strxml}
+ ${resp}= RequestsLibrary.POST On Session
+ ... session
+ ... url=/rests/operations/sal-flow:update-flow
+ ... data=${strxml}
+ ... expected_status=204
Log ${resp.text}
- ${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
[Documentation] Updates a flow configuration by given flow details (${node_id}, ${table_id}, ${flow_body}) using PUT method
[Arguments] ${node_id} ${table_id} ${flow_id} ${flow_body}
Log ${flow_body}
- ${resp}= RequestsLibrary.Put Request
+ ${resp}= RequestsLibrary.PUT On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id}
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id}
... data=${flow_body}
+ ... expected_status=204
Log ${resp.text}
- ${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
[Documentation] Deletes a flow by using remove-flow opearation. ${xmlroot} is usually a variable created by
Set Element Attribute ${nodeelm} xmlns:inv urn:opendaylight:inventory
Log Element ${req}
${strxml}= Element To String ${req}
- ${resp}= RequestsLibrary.Post Request session /rests/operations/sal-flow:remove-flow data=${strxml}
+ ${resp}= RequestsLibrary.POST On Session
+ ... session
+ ... url=/rests/operations/sal-flow:remove-flow
+ ... data=${strxml}
+ ... expected_status=204
Log ${resp.text}
- ${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
[Documentation] Deletes a flow from configuration datastore specified by given flow details (${node_id}, ${table_id}, ${flow_body}) using DELETE method
[Arguments] ${node_id} ${table_id} ${flow_id}
- ${resp}= RequestsLibrary.Delete Request
+ ${resp}= RequestsLibrary.DELETE On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id}
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${node_id}/flow-node-inventory:table=${table_id}/flow=${flow_id}
+ ... expected_status=204
Log ${resp.text}
- ${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
[Documentation] This verifies specific flow-id for particular table-id matching from the flow element
[Arguments] ${dpnid} ${table_id} ${flow_element}
- ${resp}= RequestsLibrary.Get Request
+ ${resp}= RequestsLibrary.GET On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${dpnid}/flow-node-inventory:table=${table_id}?content=config
+ ... url=${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]
*** Settings ***
+Library RequestsLibrary
Library SSHLibrary
Library Telnet
Verify Switch In Operational Data Store
[Documentation] Verifies the existence of the switch.datapath_id in the operational datastore.
[Arguments] ${switch}
- ${resp}= RequestsLibrary.Get Request session ${REST_CONTEXT}
+ ${resp}= RequestsLibrary.GET On Session session url=${REST_CONTEXT}
Log ${resp.text}
Should Match Regexp ${resp.text} openflow:${switch.datapath_id}
Verify Switch Not In Operational Data Store
[Documentation] Verifies that the given switch.datapath_id is not in the operational datastore.
[Arguments] ${switch}
- ${resp}= RequestsLibrary.Get Request session ${REST_CONTEXT}
+ ${resp}= RequestsLibrary.GET On Session session url=${REST_CONTEXT}
Log ${resp.text}
Should Not Match Regexp ${resp.text} openflow:${switch.datapath_id}
Log Content
[Arguments] ${resp_content}
IF '''${resp_content}''' != '${EMPTY}'
- ${resp_json}= RequestsLibrary.To Json ${resp_content} pretty_print=True
+ ${resp_json}= BuiltIn.Evaluate
+ ... json.dumps(json.loads('''${resp_content}'''), sort_keys=True, indent=4, separators=(',', ': '))
+ ... modules=json
ELSE
${resp_json}= BuiltIn.Set Variable ${EMPTY}
END
Extract Value From Content
[Documentation] Will take the given response content and return the value at the given index as a string
[Arguments] ${content} ${index}
- ${JSON}= Evaluate json.loads('''${content}''') json
+ ${JSON}= BuiltIn.Evaluate json.loads('''${content}''') modules=json
${value}= Set Variable ${JSON${index}}
RETURN ${value}
Workflow Teardown
[Documentation] Cleanup when workflow is interrupt
- Run Keyword And Ignore Error RequestsLibrary.Delete Request session ${RFC8040_NODES_API}
+ Run Keyword And Ignore Error
+ ... RequestsLibrary.DELETE On Session
+ ... session
+ ... url=${RFC8040_NODES_API}
+ ... expected_status=anything
Utils.Clean Mininet System
RequestsLibrary.Delete All Sessions
... ${False}
... ${True}
Sleep 8
- [Teardown] BuiltIn.Run Keyword And Ignore Error RequestsLibrary.Delete Request session ${RFC8040_NODES_API}
+ [Teardown] BuiltIn.Run Keyword And Ignore Error RequestsLibrary.DELETE On Session session url=${RFC8040_NODES_API}
Final Phase
[Documentation] Stops mininet.
- BuiltIn.Run Keyword And Ignore Error RequestsLibrary.Delete Request session ${RFC8040_NODES_API}
+ BuiltIn.Run Keyword And Ignore Error RequestsLibrary.DELETE On Session session url=${RFC8040_NODES_API}
MininetKeywords.Stop Mininet And Exit ${mininet_conn_id}
RequestsLibrary.Delete All Sessions
Final Phase
[Documentation] Stops mininet.
- BuiltIn.Run Keyword And Ignore Error RequestsLibrary.Delete Request session ${RFC8040_NODES_API}
+ BuiltIn.Run Keyword And Ignore Error RequestsLibrary.DELETE On Session session url=${RFC8040_NODES_API}
MininetKeywords.Stop Mininet And Exit ${mininet_conn_id}
RequestsLibrary.Delete All Sessions
Final Phase
[Documentation] Stops mininet.
- BuiltIn.Run Keyword And Ignore Error RequestsLibrary.Delete Request session ${RFC8040_NODES_API}
+ BuiltIn.Run Keyword And Ignore Error RequestsLibrary.DELETE On Session session url=${RFC8040_NODES_API}
MininetKeywords.Stop Mininet And Exit ${mininet_conn_id}
RequestsLibrary.Delete All Sessions
Final Phase
[Documentation] Stops mininet.
- BuiltIn.Run Keyword And Ignore Error RequestsLibrary.Delete Request session ${RFC8040_NODES_API}
+ BuiltIn.Run Keyword And Ignore Error RequestsLibrary.DELETE On Session session url=${RFC8040_NODES_API}
MininetKeywords.Stop Mininet And Exit ${mininet_conn_id}
RequestsLibrary.Delete All Sessions
End Suite
[Documentation] Run at end of the suite
- RequestsLibrary.Delete Request session ${RFC8040_NODES_API}
+ BuiltIn.Run Keyword And Ignore Error RequestsLibrary.DELETE On Session session url=${RFC8040_NODES_API}
KarafKeywords.Issue_Command_On_Karaf_Console
... log:set INFO org.opendaylight.openflowplugin.applications.frm.impl.FlowNodeReconciliationImpl
SSHLibrary.Close All Connections
[Documentation] Delete all sessions.
${command}= BuiltIn.Set Variable sudo iptables -v -F
BuiltIn.Run Keyword And Ignore Error ClusterManagement.Run_Bash_Command_On_List_Or_All ${command}
- BuiltIn.Run Keyword And Ignore Error RequestsLibrary.Delete Request session ${RFC8040_NODES_API}
+ BuiltIn.Run Keyword And Ignore Error RequestsLibrary.DELETE On Session session url=${RFC8040_NODES_API}
RequestsLibrary.Delete All Sessions
Add Groups And Flows On Member
[Arguments] ${member_index}=1
${session}= Resolve_Http_Session_For_Member member_index=${member_index}
FOR ${switch} IN RANGE 1 ${switches+1}
- RequestsLibrary.Delete Request
+ RequestsLibrary.DELETE On Session
... ${session}
- ... ${RFC8040_NODES_API}/node=openflow%3A${switch}/flow-node-inventory:table=0/flow=1
- RequestsLibrary.Delete Request
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${switch}/flow-node-inventory:table=0/flow=1
+ RequestsLibrary.DELETE On Session
... ${session}
- ... ${RFC8040_NODES_API}/node=openflow%3A${switch}/flow-node-inventory:group=1
- RequestsLibrary.Delete Request
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${switch}/flow-node-inventory:group=1
+ RequestsLibrary.DELETE On Session
... ${session}
- ... ${RFC8040_NODES_API}/node=openflow%3A${switch}/flow-node-inventory:group=1000
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${switch}/flow-node-inventory:group=1000
END
Check Flow Stats Are Not Frozen
[Documentation] Extract duration for flow 1 in switch 1.
[Arguments] ${member_index}
${session}= Resolve_Http_Session_For_Member member_index=${member_index}
- ${resp}= RequestsLibrary.Get Request
+ ${resp}= RequestsLibrary.GET On Session
... ${session}
- ... ${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=0/flow=1?content=nonconfig
+ ... url=${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=0/flow=1?content=nonconfig
... headers=${headers}
Log ${resp.content}
- ${json_resp}= RequestsLibrary.To_Json ${resp.content}
+ ${json_resp}= Utils.Json Parse From String ${resp.content}
${flow_list}= Collections.Get_From_Dictionary ${json_resp} flow-node-inventory:flow
${flow_stats}= Collections.Get_From_Dictionary
... ${flow_list}[0]
*** Test Cases ***
Sending Barrier
[Documentation] Test to send barrier
- ${resp}= RequestsLibrary.Post Request
+ ${resp}= RequestsLibrary.POST On Session
... session
- ... ${send_barrier_url}
+ ... url=${send_barrier_url}
... data=${RPC_SEND_BARRIER_DATA}
... headers=${HEADERS_XML}
+ ... expected_status=200
Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} 200
Sending Echo
[Documentation] Test to send echo
- ${resp}= RequestsLibrary.Post Request
+ ${resp}= RequestsLibrary.POST On Session
... session
- ... ${send_echo_url}
+ ... url=${send_echo_url}
... data=${RPC_SEND_ECHO_DATA}
... headers=${HEADERS_XML}
+ ... expected_status=200
Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} 200
*** Keywords ***
*** Test Cases ***
Sending Update Table
[Documentation] Test to send table update request
- ${resp}= RequestsLibrary.Post Request
+ ${resp}= RequestsLibrary.POST On Session
... session
- ... ${send_update_table_url}
+ ... url=${send_update_table_url}
... data=${RPC_SEND_UPDATE_TABLE_DATA}
... headers=${HEADERS_XML}
+ ... expected_status=200
Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} 200
*** Keywords ***
Delete Flow
[Documentation] Removes used flow
- ${resp}= RequestsLibrary.Delete Request
+ ${resp}= RequestsLibrary.DELETE On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}/flow=${flow_id}
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}/flow=${flow_id}
+ ... expected_status=200
Log ${resp.content}
- ${msg}= Set Variable
- ... Delete flow for ${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}/flow=${flow_id} failed, http response ${resp.status_code} received.
- Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
Flow Presence Config Flow
${headers}= Create Dictionary Accept=application/xml
- ${resp}= RequestsLibrary.Get Request
+ ${resp}= RequestsLibrary.GET On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}/flow=${flow_id}
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}/flow=${flow_id}
... headers=${headers}
+ ... expected_status=anything
Log ${resp}
Log ${resp.content}
IF ${resp.status_code}!=200 RETURN ${False} ${EMPTY}
Flow Presence Operational Table
${headers}= Create Dictionary Accept=application/xml
- ${resp}= RequestsLibrary.Get Request
+ ${resp}= RequestsLibrary.GET On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}?${RFC8040_OPERATIONAL_CONTENT}
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}?${RFC8040_OPERATIONAL_CONTENT}
... headers=${headers}
+ ... expected_status=anything
Log ${resp}
Log ${resp.content}
IF ${resp.status_code}!=200 RETURN ${False} ${EMPTY}
Add Flow
Log ${data}
- ${resp}= RequestsLibrary.Put Request
+ ${resp}= RequestsLibrary.PUT On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}/flow=${flow_id}
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}/flow=${flow_id}
... headers=${HEADERS_XML}
... data=${data}
- ${msg}= Set Variable
- ... Adding flow for ${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}/flow=${flow_id} failed, http response ${resp.status_code} received.
- Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
+ ... expected_status=200
Delete Flow
- ${resp}= RequestsLibrary.Delete Request
+ ${resp}= RequestsLibrary.DELETE On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}/flow=${flow_id}
- ${msg}= Set Variable
- ... Delete flow for ${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}/flow=${flow_id} failed, http response ${resp.status_code} received.
- Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}/flow=${flow_id}
+ ... expected_status=200
Delete All Flows
[Documentation] Deletes all flows
[Tags] push
${body} OperatingSystem.Get File ${GROUP}
Set Suite Variable ${body}
- ${resp} RequestsLibrary.Put Request
+ ${resp} RequestsLibrary.PUT On Session
... session
- ... ${REST_CONTEXT}/flow-node-inventory:group=1
+ ... url=${REST_CONTEXT}/flow-node-inventory:group=1
... headers=${HEADERS_XML}
... data=${body}
Log ${resp.content}
- BuiltIn.Should_Match "${resp.status_code}" "20?"
Verify after adding group config
[Documentation] Get the group stat in config
- ${resp} RequestsLibrary.Get Request
+ ${resp} RequestsLibrary.GET On Session
... session
... ${REST_CONTEXT}/flow-node-inventory:group=1?${RFC8040_CONFIG_CONTENT}
+ ... expected_status=200
Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} ${GROUP_NAME}
Verify after adding group operational
[Tags] push
${body} OperatingSystem.Get File ${FLOW}
Set Suite Variable ${body}
- ${resp} RequestsLibrary.Put Request
+ ${resp} RequestsLibrary.PUT On Session
... session
- ... ${REST_CONTEXT}/flow-node-inventory:table=0/flow=1
+ ... url=${REST_CONTEXT}/flow-node-inventory:table=0/flow=1
... headers=${HEADERS_XML}
... data=${body}
Log ${resp.content}
- BuiltIn.Should_Match "${resp.status_code}" "20?"
Verify after adding flow config
[Documentation] Verify the flow
[Tags] get
- ${resp} RequestsLibrary.Get Request
+ ${resp} RequestsLibrary.GET On Session
... session
- ... ${REST_CONTEXT}/flow-node-inventory:table=0/flow=1?${RFC8040_CONFIG_CONTENT}
+ ... url=${REST_CONTEXT}/flow-node-inventory:table=0/flow=1?${RFC8040_CONFIG_CONTENT}
+ ... expected_status=200
Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} ${FLOW_NAME}
Verify after adding flow operational
Remove the flow
[Documentation] Remove the flow
- ${resp} RequestsLibrary.Delete Request session ${REST_CONTEXT}/flow-node-inventory:table=0/flow=1
- Should Be Equal As Strings ${resp.status_code} 200
+ ${resp} RequestsLibrary.DELETE On Session
+ ... session
+ ... url=${REST_CONTEXT}/flow-node-inventory:table=0/flow=1
+ ... expected_status=200
Verify after deleting flow
[Documentation] Verify the flow removal
[Tags] get
- ${resp} RequestsLibrary.Get Request
+ ${resp} RequestsLibrary.GET On Session
... session
- ... ${REST_CONTEXT}/flow-node-inventory:table=0/flow=1?${RFC8040_CONFIG_CONTENT}
+ ... url=${REST_CONTEXT}/flow-node-inventory:table=0/flow=1?${RFC8040_CONFIG_CONTENT}
Should Not Contain ${resp.content} ${FLOW_NAME}
Delete the group
[Documentation] Remove the group
[Tags] delete
- ${resp} RequestsLibrary.Delete Request session ${REST_CONTEXT}/flow-node-inventory:group=1
+ ${resp} RequestsLibrary.DELETE On Session
+ ... session
+ ... url=${REST_CONTEXT}/flow-node-inventory:group=1
+ ... expected_status=200
Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} 200
Verify after deleting group
[Documentation] Verify the flow removal
[Tags] get
- ${resp} RequestsLibrary.Get Request
+ ${resp} RequestsLibrary.GET On Session
... session
- ... ${REST_CONTEXT}/flow-node-inventory:group=1?${RFC8040_CONFIG_CONTENT}
+ ... url=${REST_CONTEXT}/flow-node-inventory:group=1?${RFC8040_CONFIG_CONTENT}
Should Not Contain ${resp.content} ${GROUP_NAME}
[Tags] push
${body} OperatingSystem.Get File ${METER}
Set Suite Variable ${body}
- ${resp} RequestsLibrary.Put Request
+ ${resp} RequestsLibrary.PUT On Session
... session
- ... ${REST_CONTEXT}/meter=1
+ ... url=${REST_CONTEXT}/meter=1
... headers=${HEADERS_XML}
... data=${body}
Log ${resp.content}
- BuiltIn.Should_Match "${resp.status_code}" "20?"
Verify after adding meter config
[Documentation] Get the meter stat in config
- ${resp} RequestsLibrary.Get Request session ${REST_CONTEXT}/meter=1?${RFC8040_CONFIG_CONTENT}
+ ${resp} RequestsLibrary.GET On Session
+ ... session
+ ... url=${REST_CONTEXT}/meter=1?${RFC8040_CONFIG_CONTENT}
+ ... expected_status=200
Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} ${METER_NAME}
Verify after adding meter operational
[Tags] push
${body} OperatingSystem.Get File ${FLOW}
Set Suite Variable ${body}
- ${resp} RequestsLibrary.Put Request
+ ${resp} RequestsLibrary.PUT On Session
... session
- ... ${REST_CONTEXT}/flow-node-inventory:table=0/flow=2
+ ... url=${REST_CONTEXT}/flow-node-inventory:table=0/flow=2
... headers=${HEADERS_XML}
... data=${body}
Log ${resp.content}
- BuiltIn.Should_Match "${resp.status_code}" "20?"
Verify after adding flow config
[Documentation] Verify the flow
[Tags] get
- ${resp} RequestsLibrary.Get Request
+ ${resp} RequestsLibrary.GET On Session
... session
- ... ${REST_CONTEXT}/flow-node-inventory:table=0/flow=2?${RFC8040_CONFIG_CONTENT}
+ ... url=${REST_CONTEXT}/flow-node-inventory:table=0/flow=2?${RFC8040_CONFIG_CONTENT}
+ ... expected_status=200
Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} ${FLOW_NAME}
Verify after adding flow operational
Remove the flow
[Documentation] Remove the flow
- ${resp} RequestsLibrary.Delete Request session ${REST_CONTEXT}/flow-node-inventory:table=0/flow=2
- Should Be Equal As Strings ${resp.status_code} 200
+ ${resp} RequestsLibrary.DELETE On Session
+ ... session
+ ... url=${REST_CONTEXT}/flow-node-inventory:table=0/flow=2
+ ... expected_status=200
Verify after deleting flow
[Documentation] Verify the flow removal
[Tags] get
- ${resp} RequestsLibrary.Get Request
+ ${resp} RequestsLibrary.GET On Session
... session
- ... ${REST_CONTEXT}/flow-node-inventory:table=0/flow=2?${RFC8040_CONFIG_CONTENT}
+ ... url=${REST_CONTEXT}/flow-node-inventory:table=0/flow=2?${RFC8040_CONFIG_CONTENT}
Should Not Contain ${resp.content} ${FLOW_NAME}
Delete the meter
[Documentation] Remove the meter
[Tags] delete
- ${resp} RequestsLibrary.Delete Request session ${REST_CONTEXT}/meter=1
+ ${resp} RequestsLibrary.DELETE On Session session url=${REST_CONTEXT}/meter=1 expected_status=200
Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} 200
Verify after deleting meter
[Documentation] Verify the flow removal
[Tags] get
- ${resp} RequestsLibrary.Get Request session ${REST_CONTEXT}/meter=1?${RFC8040_CONFIG_CONTENT}
+ ${resp} RequestsLibrary.GET On Session session url=${REST_CONTEXT}/meter=1?${RFC8040_CONFIG_CONTENT}
Should Not Contain ${resp.content} ${METER_NAME}
Get nodeconnector for the root node
[Documentation] Get the inventory for the root node
${TOPO_TREE_FANOUT} Convert To Integer ${TOPO_TREE_FANOUT}
- ${resp} RequestsLibrary.Get Request
+ ${resp} RequestsLibrary.GET On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A1?${RFC8040_OPERATIONAL_CONTENT}
+ ... url=${RFC8040_NODES_API}/node=openflow%3A1?${RFC8040_OPERATIONAL_CONTENT}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
Wait Until Keyword Succeeds 30s 2s Check conn loop ${TOPO_TREE_FANOUT} 1 ${resp.text}
Get nodeconnector for a node
*** Keywords ***
Check Every Nodes
[Arguments] ${numnodes}
- ${resp} RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_NODES_API}
- Should Be Equal As Strings ${resp.status_code} 200
+ ${resp} RequestsLibrary.GET On Session session url=${RFC8040_OPERATIONAL_NODES_API} expected_status=200
FOR ${IND} IN RANGE 1 ${numnodes+1}
Should Contain ${resp.text} openflow:${IND}
END
Check Every Nodes Stats
[Arguments] ${numnodes}
FOR ${IND} IN RANGE 1 ${numnodes+1}
- ${resp} RequestsLibrary.Get Request
+ ${resp} RequestsLibrary.GET On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${IND}?${RFC8040_OPERATIONAL_CONTENT}
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${IND}?${RFC8040_OPERATIONAL_CONTENT}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.text} flow-capable-node-connector-statistics
Should Contain ${resp.text} flow-table-statistics
END
Check Every Nodes Nodeconnector
[Arguments] ${numnodes}
FOR ${IND} IN RANGE 2 ${numnodes+1}
- ${resp} RequestsLibrary.Get Request
+ ${resp} RequestsLibrary.GET On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${IND}?${RFC8040_OPERATIONAL_CONTENT}
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${IND}?${RFC8040_OPERATIONAL_CONTENT}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
Check conn loop ${TOPO_TREE_FANOUT+1} ${IND} ${resp.text}
END
*** Keywords ***
Verify Element Count
[Arguments] ${URI} ${xpath_location} ${expected_count}
- ${resp} RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_TOPO_FLOW1_API} headers=${ACCEPT_XML}
+ ${resp} RequestsLibrary.GET On Session
+ ... session
+ ... url=${RFC8040_OPERATIONAL_TOPO_FLOW1_API}
+ ... headers=${ACCEPT_XML}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
${count} Get Element Count ${resp.text} xpath=${xpath_location}
Should Be Equal As Numbers ${count} ${expected_count}
Get nodeconnector for the root node
[Documentation] Get the inventory for the root node
${TOPO_TREE_FANOUT} Convert To Integer ${TOPO_TREE_FANOUT}
- ${resp} RequestsLibrary.Get Request
+ ${resp} RequestsLibrary.GET On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A1?${RFC8040_OPERATIONAL_CONTENT}
+ ... url=${RFC8040_NODES_API}/node=openflow%3A1?${RFC8040_OPERATIONAL_CONTENT}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
Wait Until Keyword Succeeds 30s 2s Check conn loop ${TOPO_TREE_FANOUT} 1 ${resp.text}
Get nodeconnector for a node
*** Keywords ***
Check Every Nodes
[Arguments] ${numnodes}
- ${resp} RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_NODES_API}
- Should Be Equal As Strings ${resp.status_code} 200
+ ${resp} RequestsLibrary.GET On Session session url=${RFC8040_OPERATIONAL_NODES_API} expected_status=200
FOR ${IND} IN RANGE 1 ${numnodes+1}
Should Contain ${resp.text} openflow:${IND}
END
Check Every Nodes Stats
[Arguments] ${numnodes}
FOR ${IND} IN RANGE 1 ${numnodes+1}
- ${resp} RequestsLibrary.Get Request
+ ${resp} RequestsLibrary.GET On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${IND}?${RFC8040_OPERATIONAL_CONTENT}
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${IND}?${RFC8040_OPERATIONAL_CONTENT}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.text} flow-capable-node-connector-statistics
Should Contain ${resp.text} flow-table-statistics
END
Check Every Nodes Nodeconnector
[Arguments] ${numnodes}
FOR ${IND} IN RANGE 2 ${numnodes+1}
- ${resp} RequestsLibrary.Get Request
+ ${resp} RequestsLibrary.GET On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${IND}?${RFC8040_OPERATIONAL_CONTENT}
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${IND}?${RFC8040_OPERATIONAL_CONTENT} expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
Check conn loop ${TOPO_TREE_FANOUT+1} ${IND} ${resp.text}
END
*** Keywords ***
Verify Element Count
[Arguments] ${URI} ${xpath_location} ${expected_count}
- ${resp} RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_TOPO_FLOW1_API} headers=${ACCEPT_XML}
+ ${resp} RequestsLibrary.GET On Session
+ ... session
+ ... url=${RFC8040_OPERATIONAL_TOPO_FLOW1_API}
+ ... headers=${ACCEPT_XML}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
${count} Get Element Count ${resp.text} xpath=${xpath_location}
Should Be Equal As Numbers ${count} ${expected_count}
... Check For Elements At URI
... ${RFC8040_OPERATIONAL_TOPO_API}
... ${node_list}
- ${resp} RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_TOPO_API}
+ ${resp} RequestsLibrary.GET On Session session url=${RFC8040_OPERATIONAL_TOPO_API}
Log ${resp.text}
List all the links
*** Keywords ***
Verify Links
[Arguments] ${expected_links}
- ${resp} RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_TOPO_FLOW1_API}
+ ${resp} RequestsLibrary.GET On Session
+ ... session
+ ... url=${RFC8040_OPERATIONAL_TOPO_FLOW1_API}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
- ${result} To JSON ${resp.text}
+ ${result} Utils.Json Parse From String ${resp.text}
Log ${result}
${content} Get From Dictionary ${result} network-topology:topology
${topology} Get From List ${content} 0
*** Test Cases ***
Add a flow - Output to physical port#
[Documentation] Push a flow through REST-API
- ${resp} RequestsLibrary.Put Request
+ ${resp} RequestsLibrary.PUT On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=0/flow=152
+ ... url=${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=0/flow=152
... headers=${HEADERS_XML}
... data=${BODY2}
- BuiltIn.Should_Match "${resp.status_code}" "20?"
Verify after adding flow config - Output to physical port#
[Documentation] Verify the flow
- ${resp} RequestsLibrary.Get Request
+ ${resp} RequestsLibrary.GET On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=0?content=config
- Should Be Equal As Strings ${resp.status_code} 200
+ ... url=${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=0?content=config
+ ... expected_status=200
Should Contain ${resp.text} 152
Verify after adding flow operational - Output to physical port#
Remove a flow - Output to physical port#
[Documentation] Remove a flow
- ${resp} RequestsLibrary.Delete Request
+ ${resp} RequestsLibrary.DELETE On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=0/flow=152
- Should Be Equal As Strings ${resp.status_code} 204
+ ... url=${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=0/flow=152
+ ... expected_status=204
Verify after deleting flow config - Output to physical port#
[Documentation] Verify the flow
- ${resp} RequestsLibrary.Get Request
+ ${resp} RequestsLibrary.GET On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=0?content=config
- Should Be Equal As Strings ${resp.status_code} 200
+ ... url=${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=0?content=config
+ ... expected_status=200
Should Not Contain ${resp.text} 152
# Standing bug #368 - This has been fixed
... Check For Elements At URI
... ${RFC8040_OPERATIONAL_TOPO_API}
... ${node_list}
- ${resp} RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_TOPO_API}
+ ${resp} RequestsLibrary.GET On Session session url=${RFC8040_OPERATIONAL_TOPO_API}
Log ${resp.text}
List all the links
*** Keywords ***
Verify Links
[Arguments] ${expected_links}
- ${resp} RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_TOPO_FLOW1_API}
+ ${resp} RequestsLibrary.GET On Session
+ ... session
+ ... url=${RFC8040_OPERATIONAL_TOPO_FLOW1_API}
+ ... expected_status=200
Log ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
- ${result} To JSON ${resp.text}
+ ${result} Utils.Json Parse From String ${resp.text}
Log ${result}
${content} Get From Dictionary ${result} network-topology:topology
${topology} Get From List ${content} 0
*** Test Cases ***
Add a flow - Sending IPv4 Dest Address and Eth type
[Documentation] Push a flow through REST-API
- ${resp} RequestsLibrary.Put Request
+ ${resp} RequestsLibrary.PUT On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=2/flow=139
+ ... url=${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=2/flow=139
... headers=${HEADERS_XML}
... data=${BODY1}
- BuiltIn.Should_Match "${resp.status_code}" "20?"
Verify after adding flow config - Sending IPv4 Dest Address and Eth type
[Documentation] Verify the flow
- ${resp} RequestsLibrary.Get Request
+ ${resp} RequestsLibrary.GET On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=2?content=config
- Should Be Equal As Strings ${resp.status_code} 200
+ ... url=${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=2?content=config
+ ... expected_status=200
Should Contain ${resp.text} 139
Verify after adding flow operational - Sending IPv4 Dest Address and Eth type
Modify a flow - Output to physical port#
[Documentation] Push a flow through REST-API
- ${resp} RequestsLibrary.Put Request
+ ${resp} RequestsLibrary.PUT On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=2/flow=139
+ ... url=${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=2/flow=139
... headers=${HEADERS_XML}
... data=${BODY2}
- Should Be Equal As Strings ${resp.status_code} 204
+ ... expected_status=204
Verify after modifying flow config - Output to physical port#
[Documentation] Verify the flow
- ${resp} RequestsLibrary.Get Request
+ ${resp} RequestsLibrary.GET On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=2?content=config
- Should Be Equal As Strings ${resp.status_code} 200
+ ... url=${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=2?content=config
+ ... expected_status=200
Should Contain ${resp.text} 10.0.20.1
Verify after modifying flow operational - Output to physical port#
Remove a flow - Output to physical port#
[Documentation] Remove a flow
- ${resp} RequestsLibrary.Delete Request
+ ${resp} RequestsLibrary.DELETE On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=2/flow=139
- Should Be Equal As Strings ${resp.status_code} 204
+ ... url=${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=2/flow=139
+ ... expected_status=204
Verify after deleting flow config - Output to physical port#
[Documentation] Verify the flow
- ${resp} RequestsLibrary.Get Request
+ ${resp} RequestsLibrary.GET On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=2?content=config
- Should Be Equal As Strings ${resp.status_code} 200
+ ... url=${RFC8040_NODES_API}/node=openflow%3A1/flow-node-inventory:table=2?content=config
+ ... expected_status=200
Should Not Contain ${resp.text} 139
Verify after deleting flow operational - Output to physical port#
Are Switches Connected
[Documentation] Checks Topology Contains a fix number ${switches} of switces.
[Arguments] ${switches}
- ${resp}= RequestsLibrary.Get Request
+ ${resp}= RequestsLibrary.GET On Session
... tcsession
- ... ${RFC8040_OPERATIONAL_TOPO_FLOW1_API}
+ ... url=${RFC8040_OPERATIONAL_TOPO_FLOW1_API}
... headers=${ACCEPT_XML}
Log ${resp.content}
${count}= XML.Get Element Count ${resp.content} xpath=node
Are Switches Connected Topo
[Documentation] Checks wheather switches are connected to controller
- ${resp}= Get Request session ${RFC8040_OPERATIONAL_TOPO_FLOW1_API} headers=${ACCEPT_XML}
+ ${resp}= GET On Session session url=${RFC8040_OPERATIONAL_TOPO_FLOW1_API} headers=${ACCEPT_XML}
Log ${resp.content}
${count}= Get Element Count ${resp.content} xpath=node
Should Be Equal As Numbers ${count} ${swnr}
Are Switches Connected Topo
[Documentation] Checks wheather switches are connected to controller
- ${resp}= Get Request session ${RFC8040_OPERATIONAL_TOPO_FLOW1_API} headers=${ACCEPT_XML}
+ ${resp}= GET On Session session url=${RFC8040_OPERATIONAL_TOPO_FLOW1_API} headers=${ACCEPT_XML}
Log ${resp.content}
${count}= Get Element Count ${resp.content} xpath=node
Should Be Equal As Numbers ${count} ${swnr}
Are Switches Connected Topo
[Documentation] Checks wheather switches are connected to controller
- ${resp}= Get Request session ${RFC8040_OPERATIONAL_TOPO_FLOW1_API} headers=${ACCEPT_XML}
+ ${resp}= GET On Session session url=${RFC8040_OPERATIONAL_TOPO_FLOW1_API} headers=${ACCEPT_XML}
Log ${resp.content}
${count}= Get Element Count ${resp.content} xpath=node
Should Be Equal As Numbers ${count} ${swnr}
Are Switches Connected Topo
[Documentation] Checks wheather switches are connected to controller
- ${resp}= Get Request session ${RFC8040_OPERATIONAL_TOPO_FLOW1_API} headers=${ACCEPT_XML}
+ ${resp}= GET On Session session url=${RFC8040_OPERATIONAL_TOPO_FLOW1_API} headers=${ACCEPT_XML}
Log ${resp.content}
${count}= Get Element Count ${resp.content} xpath=node
Should Be Equal As Numbers ${count} ${swnr}
Are Switches Connected Topo
[Documentation] Checks wheather switches are connected to controller
- ${resp}= Get Request session ${RFC8040_OPERATIONAL_TOPO_FLOW1_API} headers=${ACCEPT_XML}
+ ${resp}= GET On Session session url=${RFC8040_OPERATIONAL_TOPO_FLOW1_API} headers=${ACCEPT_XML}
Log ${resp.content}
${count}= Get Element Count ${resp.content} xpath=node
Should Be Equal As Numbers ${count} ${swnr}
Should Be True ${res}
Check No Switches Inventory
- ${resp}= Get Request session ${RFC8040_OPERATIONAL_NODES_API}
+ ${resp}= GET On Session session ${RFC8040_OPERATIONAL_NODES_API}
Log ${resp.content}
Should Be Equal As Strings '${resp.content}' '{"nodes":{}}'
Deconfigure Flows
[Documentation] Flows deconfiguration
- ${resp}= Delete Request session ${RFC8040_NODES_API}
- Should Be Equal As Numbers ${resp.status_code} 204
+ ${resp}= DELETE On Session session url=${RFC8040_NODES_API} expected_status=204
Check No Flows In Operational Last
[Documentation] Operational datastore to be without any flows
Are Switches Connected Topo
[Documentation] Checks wheather switches are connected to controller
- ${resp}= Get Request session ${RFC8040_OPERATIONAL_TOPO_FLOW1_API} headers=${ACCEPT_XML}
+ ${resp}= GET On Session session url=${RFC8040_OPERATIONAL_TOPO_FLOW1_API} headers=${ACCEPT_XML}
Log ${resp.content}
${count}= Get Element Count ${resp.content} xpath=node
Should Be Equal As Numbers ${count} ${swnr}
Are Switches Connected Topo
[Documentation] Checks wheather switches are connected to controller
- ${resp}= Get Request session ${RFC8040_OPERATIONAL_TOPO_FLOW1_API} headers=${ACCEPT_XML}
+ ${resp}= GET On Session session url=${RFC8040_OPERATIONAL_TOPO_FLOW1_API} headers=${ACCEPT_XML}
Log ${resp.content}
${count}= Get Element Count ${resp.content} xpath=node
Should Be Equal As Numbers ${count} ${swnr}
Are Switches Connected Topo
[Documentation] Checks wheather switches are connected to controller
- ${resp}= Get Request session ${OPERATIONAL_TOPO_API}/topology/flow:1 headers=${ACCEPT_XML}
+ ${resp}= GET On Session session url=${OPERATIONAL_TOPO_API}/topology/flow:1 headers=${ACCEPT_XML}
Log ${resp.content}
${count}= Get Element Count ${resp.content} xpath=node
Should Be Equal As Numbers ${count} ${swnr}
Remove Flows And Groups After Mininet Reconnects
[Documentation] Remove some groups and flows while network is down.
FOR ${switch} IN RANGE 1 ${switches+1}
- RequestsLibrary.Delete Request
+ RequestsLibrary.DELETE On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${switch}/flow-node-inventory:table=0/flow=1
- RequestsLibrary.Delete Request
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${switch}/flow-node-inventory:table=0/flow=1
+ RequestsLibrary.DELETE On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${switch}/flow-node-inventory:group=1
- RequestsLibrary.Delete Request
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${switch}/flow-node-inventory:group=1
+ RequestsLibrary.DELETE On Session
... session
- ... ${RFC8040_NODES_API}/node=openflow%3A${switch}/flow-node-inventory:group=1000
+ ... url=${RFC8040_NODES_API}/node=openflow%3A${switch}/flow-node-inventory:group=1000
END
Check Flows In Operational DS After Mininet Reconnects
[Documentation] Delete all sessions.
${command} BuiltIn.Set Variable sudo iptables -v -F
Utils.Run Command On Controller cmd=${command}
- BuiltIn.Run Keyword And Ignore Error RequestsLibrary.Delete Request session ${RFC8040_NODES_API}
+ BuiltIn.Run Keyword And Ignore Error RequestsLibrary.DELETE On Session session url=${RFC8040_NODES_API}
RequestsLibrary.Delete All Sessions
Disconnect Controller Mininet