X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FFlowLib.robot;h=143b06f46d3235a8040b2cb8a19e4f655c1eb44e;hb=94651ca9711d8eb316721775561e815830bc6c7e;hp=73b91d04ba7552c8d337e854adc78395092d7428;hpb=f1261006656179a8276fa6dd3878b1fe326e22e0;p=integration%2Ftest.git diff --git a/csit/libraries/FlowLib.robot b/csit/libraries/FlowLib.robot index 73b91d04ba..143b06f46d 100644 --- a/csit/libraries/FlowLib.robot +++ b/csit/libraries/FlowLib.robot @@ -18,9 +18,9 @@ Check No Switches In Inventory [Documentation] Check no switch is in inventory ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_NODES_API} Log ${resp.content} - Should Be Equal As Strings ${resp.status_code} 200 - : FOR ${switch} IN RANGE 1 ${switches+1} - \ Should Not Contain ${resp.content} "openflow:${switch}" + FOR ${switch} IN RANGE 1 ${switches+1} + Should Not Contain ${resp.content} "openflow:${switch}" + END Check No Switches In Topology [Arguments] ${switches} @@ -28,17 +28,20 @@ Check No Switches In Topology ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_TOPO_API} Log ${resp.content} Should Be Equal As Strings ${resp.status_code} 200 - : FOR ${switch} IN RANGE 1 ${switches+1} - \ Should Not Contain ${resp.content} openflow:${switch} + FOR ${switch} IN RANGE 1 ${switches+1} + Should Not Contain ${resp.content} openflow:${switch} + END Check Switches In Inventory [Arguments] ${switches} [Documentation] Check all switches and stats in operational inventory - : FOR ${switch} IN RANGE 1 ${switches+1} - \ ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_NODES_API}/node/openflow:${switch} - \ Should Be Equal As Strings ${resp.status_code} 200 - \ Should Contain ${resp.content} flow-capable-node-connector-statistics - \ Should Contain ${resp.content} flow-table-statistics + FOR ${switch} IN RANGE 1 ${switches+1} + ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_NODES_API}/node/openflow:${switch} + Log ${resp.content} + Should Be Equal As Strings ${resp.status_code} 200 + Should Contain ${resp.content} flow-capable-node-connector-statistics + Should Contain ${resp.content} flow-table-statistics + END Check Switches In Topology [Arguments] ${switches} @@ -64,16 +67,17 @@ Check Linear Topology ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_TOPO_API} Log ${resp.content} Should Be Equal As Strings ${resp.status_code} 200 - : FOR ${switch} IN RANGE 1 ${switches+1} - \ Should Contain ${resp.content} "node-id":"openflow:${switch}" - \ Should Contain ${resp.content} "tp-id":"openflow:${switch}:1" - \ Should Contain ${resp.content} "tp-id":"openflow:${switch}:2" - \ Should Contain ${resp.content} "source-tp":"openflow:${switch}:2" - \ Should Contain ${resp.content} "dest-tp":"openflow:${switch}:2" - \ ${edge} Evaluate ${switch}==1 or ${switch}==${switches} - \ Run Keyword Unless ${edge} Should Contain ${resp.content} "tp-id":"openflow:${switch}:3" - \ Run Keyword Unless ${edge} Should Contain ${resp.content} "source-tp":"openflow:${switch}:3" - \ Run Keyword Unless ${edge} Should Contain ${resp.content} "dest-tp":"openflow:${switch}:3" + FOR ${switch} IN RANGE 1 ${switches+1} + Should Contain ${resp.content} "node-id":"openflow:${switch}" + Should Contain ${resp.content} "tp-id":"openflow:${switch}:1" + Should Contain ${resp.content} "tp-id":"openflow:${switch}:2" + Should Contain ${resp.content} "source-tp":"openflow:${switch}:2" + Should Contain ${resp.content} "dest-tp":"openflow:${switch}:2" + ${edge} Evaluate ${switch}==1 or ${switch}==${switches} + Run Keyword Unless ${edge} Should Contain ${resp.content} "tp-id":"openflow:${switch}:3" + Run Keyword Unless ${edge} Should Contain ${resp.content} "source-tp":"openflow:${switch}:3" + Run Keyword Unless ${edge} Should Contain ${resp.content} "dest-tp":"openflow:${switch}:3" + END Check Flows Operational Datastore [Arguments] ${flow_count} ${controller_ip}=${ODL_SYSTEM_IP} @@ -97,8 +101,7 @@ Check Number Of Groups Log ${resp.content} Should Be Equal As Strings ${resp.status_code} 200 ${group_count}= Get Count ${resp.content} "group-type" - ${count}= CompareStream.Set_Variable_If_At Least_Boron ${group_count} ${group_count/2} - Should Be Equal As Integers ${count} ${groups} + Should Be Equal As Integers ${group_count} ${groups} Check Flow Stats Are Available [Arguments] ${node_id} ${flows} @@ -123,6 +126,23 @@ Check No Hosts Should Be Equal As Strings ${resp.status_code} 200 Should Not Contain ${resp.content} "node-id":"host: +Add Table Miss Flows + [Arguments] ${switches} + [Documentation] Add table miss flows to switches. + ${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 ${CONFIG_NODES_API}/node/openflow:${switch}/table/0/flow/default ${data} session + END + +Check Table Miss Flows + [Arguments] ${switches} + [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 ${OPERATIONAL_NODES_API}/node/openflow:${switch}/table/0/flow/default session + END + Create Inventory Flow [Documentation] Calls FlowLib.Make_Inventory_Flow function and initializes and sanitizes ... the basic flow elements that can be given to flow:inventory @@ -279,8 +299,9 @@ Verify Flow On Mininet Switch Sleep 1 Write dpctl dump-flows -O OpenFlow13 ${switchoutput} Read Until > - : FOR ${flowElement} IN @{flow_elements} - \ Should Contain ${switchoutput} ${flowElement} + FOR ${flowElement} IN @{flow_elements} + Should Contain ${switchoutput} ${flowElement} + END Remove Group From Controller And Verify [Arguments] ${node_id} ${group_id} @@ -310,8 +331,9 @@ Verify Flow Does Not Exist On Mininet Switch Sleep 1 Write dpctl dump-flows -O OpenFlow13 ${switchoutput} Read Until > - : FOR ${flowElement} IN @{flow_elements} - \ Should Not Contain ${switchoutput} ${flowElement} + FOR ${flowElement} IN @{flow_elements} + Should Not Contain ${switchoutput} ${flowElement} + END Remove Default Flows [Arguments] ${node_id} @@ -499,3 +521,11 @@ Delete Flow Via Restconf Log ${resp.content} ${msg}= Set Variable Delete flow for ${CONFIG_NODES_API}/node/openflow:${node_id}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received. Should Be Equal As Strings ${resp.status_code} 200 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 ${CONFIG_NODES_API}/node/openflow:${dpnid}/table/${table_id} + BuiltIn.Log ${resp.content} + @{flow_id} = String.Get Regexp Matches ${resp.content} id\":\"(\\d+${flow_element}) 1 + [Return] @{flow_id}[0]