+Check No Switches In Inventory
+ [Arguments] ${switches}
+ [Documentation] Check no switch is in inventory
+ ${resp} RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_NODES_API}
+ Log ${resp.text}
+ FOR ${switch} IN RANGE 1 ${switches+1}
+ Should Not Contain ${resp.text} "openflow:${switch}"
+ END
+
+Check No Switches In Topology
+ [Arguments] ${switches}
+ [Documentation] Check no switch is in topology
+ ${resp} RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_TOPO_API}
+ 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
+
+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 ${RFC8040_NODES_API}/node=openflow%3A${switch}
+ 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
+ [Arguments] ${switches}
+ [Documentation] Check switches are in the topology.
+ ${resp}= RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_TOPO_API}
+ 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
+ [Arguments] ${links}
+ [Documentation] Check number of links in the topolgy.
+ ${resp}= RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_TOPO_API}
+ 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
+ [Arguments] ${switches}
+ [Documentation] Check Linear topology.
+ ${resp} RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_TOPO_API}
+ 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"
+ Should Contain ${resp.text} "tp-id":"openflow:${switch}:2"
+ 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"
+ END
+
+Check Flows Operational Datastore
+ [Arguments] ${flow_count} ${controller_ip}=${ODL_SYSTEM_IP}
+ [Documentation] Check if number of Operational Flows on member of given index is equal to ${flow_count}.
+ ${sw} ${reported_flow} ${found_flow}= ScaleClient.Flow Stats Collected controller=${controller_ip}
+ Should_Be_Equal_As_Numbers ${flow_count} ${found_flow}
+
+Check Number Of Flows
+ [Arguments] ${flows}
+ [Documentation] Check number of flows in the inventory.
+ ${resp}= RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_NODES_API}
+ 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
+ [Arguments] ${groups}
+ [Documentation] Check number of groups in the inventory.
+ ${resp}= RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_NODES_API}
+ 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
+ [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}/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}
+
+Check Number Of Hosts
+ [Arguments] ${hosts}
+ [Documentation] Check number of hosts in topology
+ ${resp}= RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_TOPO_API}
+ 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
+ Should Not Contain ${resp.text} "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 ${RFC8040_NODES_API}/node=openflow%3A${switch}/flow-node-inventory: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 ${RFC8040_NODES_API}/node=openflow%3A${switch}/flow-node-inventory:table=0/flow=default session
+ END
+