*** Settings ***
-Documentation Test suite for Connection Manager
-Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
-Suite Teardown Delete All Sessions
-Library OperatingSystem
-Library String
-Library Collections
-Library SSHLibrary
-Library RequestsLibrary
-Library ../../../libraries/Common.py
-Variables ../../../variables/Variables.py
-Resource ../../../libraries/Utils.robot
-Resource ../../../libraries/OVSDB.robot
+Documentation Test suite for Connection Manager
+
+Library RequestsLibrary
+Resource ../../../libraries/MininetKeywords.robot
+Resource ../../../libraries/OVSDB.robot
+Resource ../../../libraries/SetupUtils.robot
+Resource ../../../libraries/Utils.robot
+Resource ../../../variables/Variables.robot
+Resource ../../../variables/ovsdb/Variables.robot
+
+Suite Setup OVSDB.Suite Setup
+Suite Teardown Suite Teardown
+Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+
+Force Tags southbound
+
*** Variables ***
-${OVSDB_PORT} 6634
-${OVSDB_CONFIG_DIR} ${CURDIR}/../../../variables/ovsdb
-@{node_list1} ovsdb://${MININET1}:${OVSDB_PORT} ${MININET1} ${OVSDB_PORT} ovsdb://${MININET}:${OVSDB_PORT} ${MININET} ${OVSDB_PORT} br-int
-${start1} sudo mn --controller=remote,ip=${CONTROLLER} --switch=ovsk,protocols=OpenFlow13 --custom ovsdb.py --topo host,1
-${start2} sudo mn --controller=remote,ip=${CONTROLLER} --switch=ovsk,protocols=OpenFlow13 --custom ovsdb.py --topo host,2
+@{NODE_LIST}
+... ${OVSDB_NODE_PORT}
+... ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}
+... ${TOOLS_SYSTEM_IP}
+... ${OVSDB_NODE_PORT}
+... ovsdb://${TOOLS_SYSTEM_2_IP}:${OVSDB_NODE_PORT}
+... ${TOOLS_SYSTEM_2_IP}
+${MN_OPTS_S1} --custom ovsdb.py --topo host,1
+${MN_OPTS_S2} --custom ovsdb.py --topo host,2
+
*** Test Cases ***
Make the OVS instance to listen for connection
- [Tags] Southbound
- Run Command On Remote System ${MININET1} sudo ovs-vsctl del-manager
- Run Command On Remote System ${MININET1} sudo ovs-vsctl set-manager ptcp:6634
- Run Command On Remote System ${MININET} sudo ovs-vsctl del-manager
- Run Command On Remote System ${MININET} sudo ovs-vsctl set-manager ptcp:6634
+ Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
+ Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager ptcp:${OVSDB_NODE_PORT}
+ Utils.Run Command On Mininet ${TOOLS_SYSTEM_2_IP} sudo ovs-vsctl del-manager
+ Utils.Run Command On Mininet ${TOOLS_SYSTEM_2_IP} sudo ovs-vsctl set-manager ptcp:${OVSDB_NODE_PORT}
Connect controller to OVSDB Node1
[Documentation] Initiate the connection to OVSDB node from controller
- [Tags] Southbound
- Connect To Ovsdb Node ${MININET1}
+ OVSDB.Connect To Ovsdb Node ${TOOLS_SYSTEM_IP}
Connect controller to OVSDB Node2
[Documentation] Initiate the connection to OVSDB node from controller
- [Tags] Southbound
- Connect To Ovsdb Node ${MININET}
+ OVSDB.Connect To Ovsdb Node ${TOOLS_SYSTEM_2_IP}
Get Operational Topology from OVSDB Node1 and OVSDB Node2
[Documentation] This request will fetch the operational topology from the connected OVSDB nodes
- [Tags] Southbound
- Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API} ${node_list1}
-
-Delete the integration Bridge from OVSDB node 1 and 2 and Verify it
- [Documentation] This request will delete the integation bridge node from the OVSDB as we don't need it and verify the operation.
- [Tags] Southbound
- Delete Bridge From Ovsdb Node ${MININET} br-int
- Delete Bridge From Ovsdb Node ${MININET1} br-int
- @{list} Create List br-int
- Wait Until Keyword Succeeds 8s 2s Check For Elements Not At URI ${OPERATIONAL_TOPO_API} ${list}
+ BuiltIn.Wait Until Keyword Succeeds
+ ... 8s
+ ... 2s
+ ... Utils.Check For Elements At URI
+ ... ${RFC8040_OPERATIONAL_TOPO_API}
+ ... ${NODE_LIST}
+ ... pretty_print_json=True
Start the Mininet and create custom topology
[Documentation] This will start mininet with custom topology on both the Virtual Machines
- [Tags] Southbound
- ${conn_id1} Start Mininet ${MININET1} ${start1} ${OVSDB_CONFIG_DIR}/ovsdb.py
- Set Global Variable ${conn_id1}
- ${conn_id2} Start Mininet ${MININET} ${start2} ${OVSDB_CONFIG_DIR}/ovsdb.py
- Set Global Variable ${conn_id2}
+ ${conn_id1} = MininetKeywords.Start Mininet Single Controller
+ ... ${TOOLS_SYSTEM_IP}
+ ... ${ODL_SYSTEM_IP}
+ ... ${MN_OPTS_S1}
+ ... ${OVSDB_CONFIG_DIR}/ovsdb.py
+ ${conn_id2} = MininetKeywords.Start Mininet Single Controller
+ ... ${TOOLS_SYSTEM_2_IP}
+ ... ${ODL_SYSTEM_IP}
+ ... ${MN_OPTS_S2}
+ ... ${OVSDB_CONFIG_DIR}/ovsdb.py
Get Operational Topology with custom topology
[Documentation] This request will fetch the operational topology from the connected OVSDB nodes to make sure the mininet created custom topology
- [Tags] Southbound
- @{list} Create List s1 s2
- Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API} ${list}
+ @{list} = BuiltIn.Create List s1 s2
+ BuiltIn.Wait Until Keyword Succeeds
+ ... 8s
+ ... 2s
+ ... Utils.Check For Elements At URI
+ ... ${RFC8040_OPERATIONAL_TOPO_API}
+ ... ${list}
+ ... pretty_print_json=True
Add the bridge s1 in the config datastore of OVSDB Node1
[Documentation] This request will add already operational bridge to the config data store of the OVSDB node.
- [Tags] Southbound
- Add Bridge To Ovsdb Node ${MININET1} s1 0000000000000001
+ OVSDB.Add Bridge To Ovsdb Node
+ ... ${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}
+ ... ${TOOLS_SYSTEM_IP}
+ ... s1
+ ... 0000000000000051
Add the bridge s2 in the config datastore of OVSDB Node2
[Documentation] This request will add already operational bridge to the config data store of the OVSDB node.
- [Tags] Southbound
- Add Bridge To Ovsdb Node ${MININET} s2 0000000000000002
+ OVSDB.Add Bridge To Ovsdb Node
+ ... ${TOOLS_SYSTEM2_IP}:${OVSDB_NODE_PORT}
+ ... ${TOOLS_SYSTEM_2_IP}
+ ... s2
+ ... 0000000000000052
Get Config Topology with s1 and s2 Bridges
[Documentation] This will fetch the configuration topology from configuration data store to verify the bridge is added to the config data store
- [Tags] Southbound
- @{list} Create List s1 s2
- Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${CONFIG_TOPO_API} ${list}
+ @{list} = BuiltIn.Create List s1 s2
+ BuiltIn.Wait Until Keyword Succeeds
+ ... 8s
+ ... 2s
+ ... Utils.Check For Elements At URI
+ ... ${RFC8040_CONFIG_TOPO_API}
+ ... ${list}
+ ... pretty_print_json=True
Create Vxlan Port and attach to s1 Bridge
[Documentation] This request will create vxlan port/interface for vxlan tunnel and attach it to the specific bridge s1 of OVSDB node 1
- [Tags] Southbound
- Add Vxlan To Bridge ${MININET} s2 vxlanport ${MININET1}
+ OVSDB.Add Vxlan To Bridge ${TOOLS_SYSTEM_IP} s1 s1-s2 ${TOOLS_SYSTEM_2_IP}
Create Vxlan Port and attach to s2 Bridge
[Documentation] This request will create vxlan port/interface for vxlan tunnel and attach it to the specific bridge s2 of OVSDB node 2
- [Tags] Southbound
- Add Vxlan To Bridge ${MININET1} s1 vxlanport ${MININET}
+ OVSDB.Add Vxlan To Bridge ${TOOLS_SYSTEM_2_IP} s2 s2-s1 ${TOOLS_SYSTEM_IP}
Get Operational Topology with vxlan tunnel
[Documentation] This request will fetch the operational topology from the connected OVSDB nodes to verify that the vxlan tunnel is created
- [Tags] Southbound
- @{list} Create List vxlanport ${MININET1} ${MININET}
- Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API} ${list}
-
-Add Flow1 Rule for s1 and verify
- [Documentation] This request will add flow to the switch and after that verify through the config datastore flow
- [Tags] Southbound
- ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/add_flow_rule1.xml
- Set Suite Variable ${body}
- Log URL is ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/1
- ${resp} RequestsLibrary.Put session ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/1 headers=${HEADERS_XML} data=${body}
- Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} 200
- ${resp} RequestsLibrary.Get session ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/1 headers=${ACCEPT_XML}
- Should Be Equal As Strings ${resp.status_code} 200
- compare xml ${body} ${resp.content}
-
-Add Flow2 Rule for s1 and verify
- [Documentation] This request will add flow to the switch and after that verify through the config datastore flow
- [Tags] Southbound
- ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/add_flow_rule2.xml
- Log URL is ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/2
- ${resp} RequestsLibrary.Put session ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/2 headers=${HEADERS_XML} data=${body}
- Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} 200
- ${resp} RequestsLibrary.Get session ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/2 headers=${ACCEPT_XML}
- Should Be Equal As Strings ${resp.status_code} 200
- compare xml ${body} ${resp.content}
-
-Get Operational Topology to verify the flows successfully installed in the bridge s1
- [Documentation] This request will fetch the operational topology and verify that the flows has been installed in the switch
- [Tags] Southbound
- @{list} Create List openflow:1
- Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API} ${list}
-
-Add Flow1 Rule for s2 and verify
- [Documentation] This request will add flow to the switch and after that verify through the config datastore flow
- [Tags] Southbound
- ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/add_flow_rule1.xml
- Log URL is ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/1
- ${resp} RequestsLibrary.Put session ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/1 headers=${HEADERS_XML} data=${body}
- Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} 200
- ${resp} RequestsLibrary.Get session ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/1 headers=${ACCEPT_XML}
- Should Be Equal As Strings ${resp.status_code} 200
- compare xml ${body} ${resp.content}
-
-Add Flow2 Rule for s2 and verify
- [Documentation] This request will add flow to the switch and after that verify through the config datastore flow
- [Tags] Southbound
- ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/add_flow_rule2.xml
- Log URL is ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/2
- ${resp} RequestsLibrary.Put session ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/2 headers=${HEADERS_XML} data=${body}
- Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} 200
- ${resp} RequestsLibrary.Get session ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/2 headers=${ACCEPT_XML}
- Should Be Equal As Strings ${resp.status_code} 200
- compare xml ${body} ${resp.content}
-
-Get Operational Topology to verify the flows successfully installed in the bridge s2
- [Documentation] This request will fetch the operational topology and verify that the flows has been installed in the switch
- [Tags] Southbound
- @{list} Create List openflow:2
- Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API} ${list}
-
-Ping host2 to IP of host1
- [Documentation] This step will verify the functionality of the vxlan tunnel between two OVSDB nodes. Ping h2(10.0.0.2)---> 10.0.0.1 , verify no packet loss
- Switch Connection ${conn_id2}
- SSHLibrary.Write h2 ping -w 1 10.0.0.1
- ${result} Read Until mininet>
- Should Contain ${result} 1 received, 0% packet loss
-
-Cleanup work after test completed
- [Documentation] Cleanup/Shutdown work that should be done at the completion of all tests
- Stop Mininet ${conn_id2}
- Stop Mininet ${conn_id1}
+ @{list} = BuiltIn.Create List s1-s2 s2-s1 ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP}
+ BuiltIn.Wait Until Keyword Succeeds
+ ... 8s
+ ... 2s
+ ... Utils.Check For Elements At URI
+ ... ${RFC8040_OPERATIONAL_TOPO_API}
+ ... ${list}
+ ... pretty_print_json=True
+
+Delete Bridges from config datastore
+ [Documentation] This request will delete the bridges from config data store.
+ [Tags] southbound
+ OVSDB.Delete Bridge From Ovsdb Node ${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT} s1
+ OVSDB.Delete Bridge From Ovsdb Node ${TOOLS_SYSTEM_2_IP}:${OVSDB_NODE_PORT} s2
Disconnect controller connection from the connected OVSDBs nodes
[Documentation] This request will disconnect the controller from the connected OVSDB node for clean startup for next suite.
- [Tags] Southbound
- Disconnect From Ovsdb Node ${MININET}
- Disconnect From Ovsdb Node ${MININET1}
+ [Tags] southbound
+ OVSDB.Disconnect From Ovsdb Node ${TOOLS_SYSTEM_IP}
+ OVSDB.Disconnect From Ovsdb Node ${TOOLS_SYSTEM_2_IP}
Verify that the operational topology is clean
[Documentation] This request will verify the operational toplogy after the mininet is cleaned.
- [Tags] Southbound
- @{list} Create List ${MININET} ${MININET1} s1 s2
- Wait Until Keyword Succeeds 8s 2s Check For Elements Not At URI ${OPERATIONAL_TOPO_API} ${list}
+ [Tags] southbound
+ @{list} = BuiltIn.Create List ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP} s1 s2
+ BuiltIn.Wait Until Keyword Succeeds
+ ... 8s
+ ... 2s
+ ... Utils.Check For Elements Not At URI
+ ... ${RFC8040_OPERATIONAL_TOPO_API}
+ ... ${list}
+ ... pretty_print_json=True
+
+Check For Bug 4756
+ [Documentation] bug 4756 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
+ ... case executed.
+ Utils.Check Karaf Log File Does Not Have Messages
+ ... ${ODL_SYSTEM_IP}
+ ... SimpleShardDataTreeCohort.*Unexpected failure in validation phase
+ [Teardown] Utils.Report_Failure_Due_To_Bug 4756
+
+Check For Bug 4794
+ [Documentation] bug 4794 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
+ ... case executed.
+ Utils.Check Karaf Log File Does Not Have Messages
+ ... ${ODL_SYSTEM_IP}
+ ... Shard.*shard-topology-operational An exception occurred while preCommitting transaction
+ [Teardown] Utils.Report_Failure_Due_To_Bug 4794
+
+
+*** Keywords ***
+Suite Teardown
+ [Documentation] Cleans up test environment, close existing sessions.
+ OVSDB.Clean OVSDB Test Environment ${TOOLS_SYSTEM_IP}
+ OVSDB.Clean OVSDB Test Environment ${TOOLS_SYSTEM_2_IP}
+ ${resp} = RequestsLibrary.Get Request session ${RFC8040_CONFIG_TOPO_API}
+ OVSDB.Log Config And Operational Topology
+ RequestsLibrary.Delete All Sessions