2 Documentation Test suite for Connection Manager
3 Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
4 Suite Teardown Delete All Sessions
5 Library OperatingSystem
9 Library RequestsLibrary
10 Library ../../../libraries/Common.py
11 Variables ../../../variables/Variables.py
12 Resource ../../../libraries/Utils.txt
13 Resource ../../../libraries/OVSDB.robot
17 ${OVSDB_CONFIG_DIR} ${CURDIR}/../../../variables/ovsdb
18 @{node_list1} ovsdb://${MININET1}:${OVSDB_PORT} ${MININET1} ${OVSDB_PORT} ovsdb://${MININET}:${OVSDB_PORT} ${MININET} ${OVSDB_PORT} br-int
19 ${start1} sudo mn --controller=remote,ip=${CONTROLLER} --switch=ovsk,protocols=OpenFlow13 --custom ovsdb.py --topo host,1
20 ${start2} sudo mn --controller=remote,ip=${CONTROLLER} --switch=ovsk,protocols=OpenFlow13 --custom ovsdb.py --topo host,2
23 Make the OVS instance to listen for connection
25 Run Command On Remote System ${MININET1} sudo ovs-vsctl del-manager
26 Run Command On Remote System ${MININET1} sudo ovs-vsctl set-manager ptcp:6634
27 Run Command On Remote System ${MININET} sudo ovs-vsctl del-manager
28 Run Command On Remote System ${MININET} sudo ovs-vsctl set-manager ptcp:6634
30 Connect controller to OVSDB Node1 and OVSDB Node2
31 [Documentation] Initiate the connection to OVSDB node from controller
33 Connect To Ovsdb Node ${MININET1}
34 Connect To Ovsdb Node ${MININET}
36 Get Operational Topology from OVSDB Node1 and OVSDB Node2
37 [Documentation] This request will fetch the operational topology from the connected OVSDB nodes
39 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API} ${node_list1}
41 Delete the integration Bridge from OVSDB node 1 and 2 and Verify it
42 [Documentation] This request will delete the integation bridge node from the OVSDB as we don't need it and verify the operation.
44 Delete Bridge From Ovsdb Node ${MININET} br-int
45 Delete Bridge From Ovsdb Node ${MININET1} br-int
46 @{list} Create List br-int
47 Wait Until Keyword Succeeds 8s 2s Check For Elements Not At URI ${OPERATIONAL_TOPO_API} ${list}
49 Start the Mininet and create custom topology
50 [Documentation] This will start mininet with custom topology on both the Virtual Machines
52 ${conn_id1} Start Mininet ${MININET1} ${start1} ${OVSDB_CONFIG_DIR}/ovsdb.py
53 Set Global Variable ${conn_id1}
54 ${conn_id2} Start Mininet ${MININET} ${start2} ${OVSDB_CONFIG_DIR}/ovsdb.py
55 Set Global Variable ${conn_id2}
57 Get Operational Topology with custom topology
58 [Documentation] This request will fetch the operational topology from the connected OVSDB nodes to make sure the mininet created custom topology
60 @{list} Create List s1 s2
61 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API} ${list}
63 Add the bridge s1 in the config datastore of OVSDB Node1
64 [Documentation] This request will add already operational bridge to the config data store of the OVSDB node.
66 Add Bridge To Ovsdb Node ${MININET1} s1 0000000000000001
68 Add the bridge s2 in the config datastore of OVSDB Node2
69 [Documentation] This request will add already operational bridge to the config data store of the OVSDB node.
71 Add Bridge To Ovsdb Node ${MININET} s2 0000000000000002
73 Get Config Topology with s1 and s2 Bridges
74 [Documentation] This will fetch the configuration topology from configuration data store to verify the bridge is added to the config data store
76 @{list} Create List s1 s2
77 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${CONFIG_TOPO_API} ${list}
79 Create Vxlan Port and attach to s1 Bridge
80 [Documentation] This request will create vxlan port/interface for vxlan tunnel and attach it to the specific bridge s1 of OVSDB node 1
82 Add Vxlan To Bridge ${MININET} s2 vxlanport ${MININET1} create_port_key.json
84 Create Vxlan Port and attach to s2 Bridge
85 [Documentation] This request will create vxlan port/interface for vxlan tunnel and attach it to the specific bridge s2 of OVSDB node 2
87 Add Vxlan To Bridge ${MININET1} s1 vxlanport ${MININET} create_port_key.json
89 Get Operational Topology with vxlan tunnel
90 [Documentation] This request will fetch the operational topology from the connected OVSDB nodes to verify that the vxlan tunnel is created
92 @{list} Create List vxlanport ${MININET1} ${MININET}
93 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API} ${list}
95 Add Flow1 Rule for s1 and verify
96 [Documentation] This request will add flow to the switch and after that verify through the config datastore flow
98 ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/add_flow_rule3.xml
99 Set Suite Variable ${body}
100 Log URL is ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/1
101 ${resp} RequestsLibrary.Put session ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/1 headers=${HEADERS_XML} data=${body}
103 Should Be Equal As Strings ${resp.status_code} 200
104 ${resp} RequestsLibrary.Get session ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/1 headers=${ACCEPT_XML}
105 Should Be Equal As Strings ${resp.status_code} 200
106 compare xml ${body} ${resp.content}
108 Add Flow2 Rule for s1 and verify
109 [Documentation] This request will add flow to the switch and after that verify through the config datastore flow
111 ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/add_flow_rule4.xml
112 Log URL is ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/2
113 ${resp} RequestsLibrary.Put session ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/2 headers=${HEADERS_XML} data=${body}
115 Should Be Equal As Strings ${resp.status_code} 200
116 ${resp} RequestsLibrary.Get session ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/2 headers=${ACCEPT_XML}
117 Should Be Equal As Strings ${resp.status_code} 200
118 compare xml ${body} ${resp.content}
120 Get Operational Topology to verify the flows successfully installed in the bridge s1
121 [Documentation] This request will fetch the operational topology and verify that the flows has been installed in the switch
123 @{list} Create List openflow:1
124 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API} ${list}
126 Add Flow1 Rule for s2 and verify
127 [Documentation] This request will add flow to the switch and after that verify through the config datastore flow
129 ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/add_flow_rule3.xml
130 Log URL is ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/1
131 ${resp} RequestsLibrary.Put session ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/1 headers=${HEADERS_XML} data=${body}
133 Should Be Equal As Strings ${resp.status_code} 200
134 ${resp} RequestsLibrary.Get session ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/1 headers=${ACCEPT_XML}
135 Should Be Equal As Strings ${resp.status_code} 200
136 compare xml ${body} ${resp.content}
138 Add Flow2 Rule for s2 and verify
139 [Documentation] This request will add flow to the switch and after that verify through the config datastore flow
141 ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/add_flow_rule4.xml
142 Log URL is ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/2
143 ${resp} RequestsLibrary.Put session ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/2 headers=${HEADERS_XML} data=${body}
145 Should Be Equal As Strings ${resp.status_code} 200
146 ${resp} RequestsLibrary.Get session ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/2 headers=${ACCEPT_XML}
147 Should Be Equal As Strings ${resp.status_code} 200
148 compare xml ${body} ${resp.content}
150 Get Operational Topology to verify the flows successfully installed in the bridge s2
151 [Documentation] This request will fetch the operational topology and verify that the flows has been installed in the switch
153 @{list} Create List openflow:2
154 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API} ${list}
156 Ping host2 to IP of host1
157 [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
158 Switch Connection ${conn_id2}
159 SSHLibrary.Write h2 ping -w 1 10.0.0.1
160 ${result} Read Until mininet>
161 Should Contain ${result} 1 received, 0% packet loss
163 Cleanup work after test completed
164 [Documentation] Cleanup/Shutdown work that should be done at the completion of all tests
165 Stop Mininet ${conn_id2}
166 Stop Mininet ${conn_id1}
168 Disconnect controller connection from the connected OVSDBs nodes
169 [Documentation] This request will disconnect the controller from the connected OVSDB node for clean startup for next suite.
171 Disconnect From Ovsdb Node ${MININET}
172 Disconnect From Ovsdb Node ${MININET1}
174 Verify that the operational topology is clean
175 [Documentation] This request will verify the operational toplogy after the mininet is cleaned.
177 @{list} Create List ${MININET} ${MININET1} s1 s2
178 Wait Until Keyword Succeeds 8s 2s Check For Elements Not At URI ${OPERATIONAL_TOPO_API} ${list}