+
+Log Config And Operational Topology
+ [Documentation] For debugging purposes, this will log both config and operational topo data stores
+ ${resp} RequestsLibrary.Get Request session ${CONFIG_TOPO_API}
+ OVSDB.Log Request ${resp.content}
+ ${resp} = RequestsLibrary.Get Request session ${OPERATIONAL_TOPO_API}
+ OVSDB.Log Request ${resp.content}
+
+Config and Operational Topology Should Be Empty
+ [Documentation] This will check that only the expected output is there for both operational and config
+ ... topology data stores. Empty probably means that only ovsdb:1 is there.
+ ${config_resp} RequestsLibrary.Get Request session ${CONFIG_TOPO_API}
+ ${operational_resp} RequestsLibrary.Get Request session ${OPERATIONAL_TOPO_API}
+ BuiltIn.Should Contain ${config_resp.content} {"topology-id":"ovsdb:1"}
+ BuiltIn.Should Contain ${operational_resp.content} {"topology-id":"ovsdb:1"}
+
+Modify Multi Port Body
+ [Arguments] ${ovs_1_port_name} ${ovs_2_port_name} ${bridge}
+ [Documentation] Updates two port names for the given ${bridge} in config store
+ ${body} = OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/bug_7414/create_multiple_ports.json
+ ${ovs_1_ovsdb_uuid} = Get OVSDB UUID ${TOOLS_SYSTEM_IP}
+ ${ovs_2_ovsdb_uuid} = Get OVSDB UUID ${TOOLS_SYSTEM_2_IP}
+ ${body} = Replace String ${body} OVS_1_UUID ${ovs_1_ovsdb_uuid}
+ ${body} = Replace String ${body} OVS_2_UUID ${ovs_2_ovsdb_uuid}
+ ${body} = Replace String ${body} OVS_1_BRIDGE_NAME ${bridge}
+ ${body} = Replace String ${body} OVS_2_BRIDGE_NAME ${bridge}
+ ${body} = Replace String ${body} OVS_1_IP ${TOOLS_SYSTEM_IP}
+ ${body} = Replace String ${body} OVS_2_IP ${TOOLS_SYSTEM_2_IP}
+ ${body} = Replace String ${body} OVS_1_PORT_NAME ${ovs_1_port_name}
+ ${body} = Replace String ${body} OVS_2_PORT_NAME ${ovs_2_port_name}
+ ${uri} = Builtin.Set Variable ${CONFIG_TOPO_API}
+ BuiltIn.Log URI is ${uri}
+ BuiltIn.Log data: ${body}
+ ${resp} = RequestsLibrary.Put Request session ${uri} data=${body}
+ OVSDB.Log Request ${resp.content}
+ BuiltIn.Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
+ [Return] ${body}
+
+Create Qos
+ [Arguments] ${qos}
+ ${body} = OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/create_qos.json
+ ${uri} = BuiltIn.Set Variable ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:qos-entries/${qos}/
+ ${body} = Replace String ${body} QOS-1 ${qos}
+ BuiltIn.Log URI is ${uri}
+ BuiltIn.Log data: ${body}
+ ${resp} = RequestsLibrary.Put Request session ${uri} data=${body}
+ OVSDB.Log Request ${resp.content}
+ BuiltIn.Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
+
+Create Queue
+ [Arguments] ${queue}
+ ${body} = OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/create_qoslinkedqueue.json
+ ${body} = Replace String ${body} QUEUE-1 ${queue}
+ ${uri} = BuiltIn.Set Variable ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:queues/${queue}/
+ BuiltIn.Log URI is ${uri}
+ BuiltIn.Log data: ${body}
+ ${resp} = RequestsLibrary.Put Request session ${uri} data=${body}
+ OVSDB.Log Request ${resp.content}
+ BuiltIn.Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
+
+Update Qos
+ [Arguments] ${qos}
+ ${body} = OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/update_existingqos.json
+ ${uri} = BuiltIn.Set Variable ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:qos-entries/${QOS}/
+ BuiltIn.Log URL is ${uri}
+ BuiltIn.Log data: ${body}
+ ${resp} = RequestsLibrary.Put Request session ${uri} data=${body}
+ OVSDB.Log Request ${resp.content}
+ BuiltIn.Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
+
+Create Qos Linked Queue
+ ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/bug_7160/create_qoslinkedqueue.json
+ ${resp} RequestsLibrary.Put Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1 data=${body}
+ OVSDB.Log Request ${resp.content}
+ BuiltIn.Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
+
+Add OVS Logging
+ [Arguments] ${conn_id}
+ [Documentation] Add higher levels of OVS logging
+ SSHLibrary.Switch Connection ${conn_id}
+ @{modules} = BuiltIn.Create List bridge:file:dbg connmgr:file:dbg inband:file:dbg ofp_actions:file:dbg ofp_errors:file:dbg
+ ... ofp_msgs:file:dbg ovsdb_error:file:dbg rconn:file:dbg tunnel:file:dbg vconn:file:dbg
+ : FOR ${module} IN @{modules}
+ \ Utils.Write Commands Until Expected Prompt sudo ovs-appctl --target ovs-vswitchd vlog/set ${module} ${DEFAULT_LINUX_PROMPT_STRICT}
+ Utils.Write Commands Until Expected Prompt sudo ovs-appctl --target ovs-vswitchd vlog/list ${DEFAULT_LINUX_PROMPT_STRICT}
+
+Reset OVS Logging
+ [Arguments] ${conn_id}
+ [Documentation] Reset the OVS logging
+ SSHLibrary.Switch Connection ${conn_id}
+ ${output} = Utils.Write Commands Until Expected Prompt sudo ovs-appctl --target ovs-vswitchd vlog/set :file:info ${DEFAULT_LINUX_PROMPT_STRICT}
+
+Suite Setup
+ SetupUtils.Setup_Utils_For_Setup_And_Teardown
+ KarafKeywords.Open Controller Karaf Console On Background
+ RequestsLibrary.Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
+ OVSDB.Log Config And Operational Topology
+
+Suite Teardown
+ [Arguments] ${uris}=@{EMPTY}
+ [Documentation] Cleans up test environment, close existing sessions.
+ OVSDB.Clean OVSDB Test Environment ${TOOLS_SYSTEM_IP}
+ : FOR ${uri} IN @{uris}
+ \ RequestsLibrary.Delete Request session ${uri}
+ ${resp} = RequestsLibrary.Get Request session ${CONFIG_TOPO_API}
+ OVSDB.Log Config And Operational Topology
+ RequestsLibrary.Delete All Sessions